mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-31 05:47:02 +00:00
feature update preset logic for get the server latest version
This commit is contained in:
@@ -164,6 +164,8 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS2)(
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define UPDATE_BY_USER 1
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
namespace pt = boost::property_tree;
|
namespace pt = boost::property_tree;
|
||||||
|
|
||||||
@@ -2580,9 +2582,15 @@ bool GUI_App::on_init_inner()
|
|||||||
});
|
});
|
||||||
|
|
||||||
Bind(EVT_NO_PRESET_UPDATE, [this](const wxCommandEvent& evt) {
|
Bind(EVT_NO_PRESET_UPDATE, [this](const wxCommandEvent& evt) {
|
||||||
wxString msg = _L("This is the newest version.");
|
wxString msg = _L("The configuration is up to date.");
|
||||||
InfoDialog dlg(nullptr, _L("Info"), msg);
|
InfoDialog dlg(nullptr, _L("Info"), msg);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
|
});
|
||||||
|
|
||||||
|
Bind(EVT_NO_WEB_RESOURCE_UPDATE, [this](const wxCommandEvent& evt) {
|
||||||
|
wxString msg = _L("This is the newest version.");
|
||||||
|
InfoDialog dlg(nullptr, _L("Info"), msg);
|
||||||
|
dlg.ShowModal();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -4791,7 +4799,7 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
|
|||||||
|
|
||||||
Semver server_version = get_version(version_info.version_str, matcher);
|
Semver server_version = get_version(version_info.version_str, matcher);
|
||||||
|
|
||||||
if (current_version >= server_version) {
|
if (current_version >= server_version && by_user) {
|
||||||
this->no_new_version();
|
this->no_new_version();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4809,6 +4817,8 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
|
|||||||
|
|
||||||
wxCommandEvent* evt = new wxCommandEvent(EVT_SLIC3R_VERSION_ONLINE);
|
wxCommandEvent* evt = new wxCommandEvent(EVT_SLIC3R_VERSION_ONLINE);
|
||||||
evt->SetString(version_info.url);
|
evt->SetString(version_info.url);
|
||||||
|
if (by_user)
|
||||||
|
evt->SetInt(UPDATE_BY_USER);
|
||||||
GUI::wxGetApp().QueueEvent(evt);
|
GUI::wxGetApp().QueueEvent(evt);
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
})
|
})
|
||||||
@@ -6912,8 +6922,7 @@ void GUI_App::check_updates(const bool verbose)
|
|||||||
m_app_conf_exists = true;
|
m_app_conf_exists = true;
|
||||||
}
|
}
|
||||||
else if (verbose && updater_result == PresetUpdater::R_NOOP) {
|
else if (verbose && updater_result == PresetUpdater::R_NOOP) {
|
||||||
MsgNoUpdates dlg;
|
|
||||||
dlg.ShowModal();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception & ex) {
|
catch (const std::exception & ex) {
|
||||||
|
|||||||
@@ -782,7 +782,7 @@ private:
|
|||||||
bool check_networking_version();
|
bool check_networking_version();
|
||||||
void cancel_networking_install();
|
void cancel_networking_install();
|
||||||
void restart_networking();
|
void restart_networking();
|
||||||
void check_config_updates_from_updater() { check_updates(false); }
|
void check_config_updates_from_updater(bool updateByuser = false) { check_updates(updateByuser); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int updating_bambu_networking();
|
int updating_bambu_networking();
|
||||||
|
|||||||
@@ -736,8 +736,9 @@ void PresetUpdater::priv::sync_update_flutter_resource(bool isAuto_check)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto buildNumber = jsonData["data"]["build_number"];
|
auto buildNumber = jsonData["data"]["build_number"];
|
||||||
auto supportPcVersion = jsonData["data"]["support_snapmaker_version"];
|
|
||||||
auto isForceUpgrade = jsonData["data"]["is_force_upgrade"];
|
auto isForceUpgrade = jsonData["data"]["is_force_upgrade"];
|
||||||
|
auto minSupportPcVersion = jsonData["data"]["min_support_pc_version"];
|
||||||
|
auto maxSupportPcVersion = jsonData["data"]["max_support_pc_version"];
|
||||||
auto fileVersion = jsonData["data"]["file_version"];
|
auto fileVersion = jsonData["data"]["file_version"];
|
||||||
auto fileSize = jsonData["data"]["file_size"];
|
auto fileSize = jsonData["data"]["file_size"];
|
||||||
auto fileMd5 = jsonData["data"]["file_md5"];
|
auto fileMd5 = jsonData["data"]["file_md5"];
|
||||||
@@ -810,6 +811,8 @@ void PresetUpdater::priv::sync_config(bool isAuto_check)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto isForceUpgrade = jsonData["data"]["is_force_upgrade"];
|
auto isForceUpgrade = jsonData["data"]["is_force_upgrade"];
|
||||||
|
auto minSupportPcVersion = jsonData["data"]["min_support_pc_version"];
|
||||||
|
auto maxSupportPcVersion = jsonData["data"]["max_support_pc_version"];
|
||||||
auto fileVersion = jsonData["data"]["file_version"];
|
auto fileVersion = jsonData["data"]["file_version"];
|
||||||
auto fileSize = jsonData["data"]["file_size"];
|
auto fileSize = jsonData["data"]["file_size"];
|
||||||
auto fileMd5 = jsonData["data"]["file_md5"];
|
auto fileMd5 = jsonData["data"]["file_md5"];
|
||||||
@@ -826,16 +829,19 @@ void PresetUpdater::priv::sync_config(bool isAuto_check)
|
|||||||
std::string localOtaPresetVersion = "";
|
std::string localOtaPresetVersion = "";
|
||||||
if (fs::exists(localProfilesjson)) {
|
if (fs::exists(localProfilesjson)) {
|
||||||
Semver localOtaVersion = get_version_from_json(localProfilesjson.string());
|
Semver localOtaVersion = get_version_from_json(localProfilesjson.string());
|
||||||
|
//don't allow jump version. first upgrade localOta
|
||||||
if (localOtaVersion >= remoteVersion) {
|
if (localOtaVersion >= currentPresetVersion)
|
||||||
if (!isAuto_check)
|
|
||||||
{
|
|
||||||
wxCommandEvent* evt = new wxCommandEvent(EVT_NO_PRESET_UPDATE);
|
|
||||||
GUI::wxGetApp().QueueEvent(evt);
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << format("use check the preset update.");
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (currentPresetVersion >= remoteVersion) {
|
||||||
|
if (!isAuto_check) {//show tipsdlg by user check upgrade
|
||||||
|
wxCommandEvent* evt = new wxCommandEvent(EVT_NO_PRESET_UPDATE);
|
||||||
|
GUI::wxGetApp().QueueEvent(evt);
|
||||||
|
BOOST_LOG_TRIVIAL(info) << format("use check the preset update.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1661,7 +1667,7 @@ void PresetUpdater::sync_config_async()
|
|||||||
|
|
||||||
GUI::wxGetApp().CallAfter([] {
|
GUI::wxGetApp().CallAfter([] {
|
||||||
BOOST_LOG_TRIVIAL(debug) << "[Orca Updater] sync_config_async completed, checking updates...";
|
BOOST_LOG_TRIVIAL(debug) << "[Orca Updater] sync_config_async completed, checking updates...";
|
||||||
GUI::wxGetApp().check_config_updates_from_updater();
|
GUI::wxGetApp().check_config_updates_from_updater(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user