mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-11 02:57:39 +00:00
feature update download file and open it function for web.
This commit is contained in:
@@ -4297,6 +4297,8 @@ void SSWCP_UserLogin_Instance::process()
|
|||||||
sw_GetUserUpdatePrivacy();
|
sw_GetUserUpdatePrivacy();
|
||||||
} else if (m_cmd == DOWNLOAD_FILE) {
|
} else if (m_cmd == DOWNLOAD_FILE) {
|
||||||
sw_DownloadFile();
|
sw_DownloadFile();
|
||||||
|
} else if (m_cmd == DOWNLOAD_FILE_AND_OPEN) {
|
||||||
|
sw_DownloadFileAndOpen();
|
||||||
} else if (m_cmd == CANCEL_DOWNLOAD) {
|
} else if (m_cmd == CANCEL_DOWNLOAD) {
|
||||||
sw_CancelDownload();
|
sw_CancelDownload();
|
||||||
} else if (m_cmd == FILE_VIEW) {
|
} else if (m_cmd == FILE_VIEW) {
|
||||||
@@ -4383,6 +4385,36 @@ void SSWCP_UserLogin_Instance::sw_GetUserUpdatePrivacy()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SSWCP_UserLogin_Instance::sw_DownloadFileAndOpen()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
std::string fileName = m_param_data.count("file_name") ? m_param_data["file_name"].get<std::string>() : "";
|
||||||
|
std::string fileUrl = m_param_data.count("file_url") ? m_param_data["file_url"].get<std::string>() : "";
|
||||||
|
|
||||||
|
if (fileUrl.empty() || fileName.empty()) {
|
||||||
|
handle_general_fail(-1, "file_url and file_name are required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use Download Manager
|
||||||
|
DownloadManager* download_mgr = wxGetApp().download_manager();
|
||||||
|
if (!download_mgr) {
|
||||||
|
handle_general_fail(-1, "Download Manager not available");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGetApp().mainframe->downloadOpenProject(fileUrl, fileName, "");
|
||||||
|
|
||||||
|
m_status = 0;
|
||||||
|
m_msg = "success";
|
||||||
|
send_to_js();
|
||||||
|
finish_job();
|
||||||
|
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
handle_general_fail(-1, e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SSWCP_UserLogin_Instance::sw_DownloadFile()
|
void SSWCP_UserLogin_Instance::sw_DownloadFile()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -4401,7 +4433,8 @@ void SSWCP_UserLogin_Instance::sw_DownloadFile()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGetApp().mainframe->downloadOpenProject(fileUrl, fileName, "");
|
//only download file and don't do anything.
|
||||||
|
//wxGetApp().mainframe->downloadOpenProject(fileUrl, fileName, "");
|
||||||
|
|
||||||
m_status = 0;
|
m_status = 0;
|
||||||
m_msg = "success";
|
m_msg = "success";
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ using tcp = asio::ip::tcp;
|
|||||||
#define DELETE_CAMERA_TIMELAPSE "sw_DeleteCameraTimelapse"
|
#define DELETE_CAMERA_TIMELAPSE "sw_DeleteCameraTimelapse"
|
||||||
#define GET_DEVICEDATA_STORAGESPACE "sw_GetDeviceDataStorageSpace"
|
#define GET_DEVICEDATA_STORAGESPACE "sw_GetDeviceDataStorageSpace"
|
||||||
#define DOWNLOAD_FILE "sw_DownloadFile"
|
#define DOWNLOAD_FILE "sw_DownloadFile"
|
||||||
|
#define DOWNLOAD_FILE_AND_OPEN "sw_DownloadFileAndOpen"
|
||||||
#define CANCEL_DOWNLOAD "sw_CancelDownload"
|
#define CANCEL_DOWNLOAD "sw_CancelDownload"
|
||||||
#define FILE_VIEW "sw_FileView"
|
#define FILE_VIEW "sw_FileView"
|
||||||
|
|
||||||
@@ -542,6 +543,8 @@ private:
|
|||||||
|
|
||||||
void sw_DownloadFile();
|
void sw_DownloadFile();
|
||||||
|
|
||||||
|
void sw_DownloadFileAndOpen();
|
||||||
|
|
||||||
void sw_DownloadFileEx();
|
void sw_DownloadFileEx();
|
||||||
|
|
||||||
void sw_CancelDownload();
|
void sw_CancelDownload();
|
||||||
|
|||||||
Reference in New Issue
Block a user