mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-11 22:43:04 +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>
|
||||
#endif
|
||||
|
||||
#define UPDATE_BY_USER 1
|
||||
|
||||
using namespace std::literals;
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
@@ -2580,9 +2582,15 @@ bool GUI_App::on_init_inner()
|
||||
});
|
||||
|
||||
Bind(EVT_NO_PRESET_UPDATE, [this](const wxCommandEvent& evt) {
|
||||
wxString msg = _L("This is the newest version.");
|
||||
InfoDialog dlg(nullptr, _L("Info"), msg);
|
||||
dlg.ShowModal();
|
||||
wxString msg = _L("The configuration is up to date.");
|
||||
InfoDialog dlg(nullptr, _L("Info"), msg);
|
||||
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 {
|
||||
@@ -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);
|
||||
|
||||
if (current_version >= server_version) {
|
||||
if (current_version >= server_version && by_user) {
|
||||
this->no_new_version();
|
||||
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);
|
||||
evt->SetString(version_info.url);
|
||||
if (by_user)
|
||||
evt->SetInt(UPDATE_BY_USER);
|
||||
GUI::wxGetApp().QueueEvent(evt);
|
||||
} catch (...) {}
|
||||
})
|
||||
@@ -6912,8 +6922,7 @@ void GUI_App::check_updates(const bool verbose)
|
||||
m_app_conf_exists = true;
|
||||
}
|
||||
else if (verbose && updater_result == PresetUpdater::R_NOOP) {
|
||||
MsgNoUpdates dlg;
|
||||
dlg.ShowModal();
|
||||
|
||||
}
|
||||
}
|
||||
catch (const std::exception & ex) {
|
||||
|
||||
@@ -782,7 +782,7 @@ private:
|
||||
bool check_networking_version();
|
||||
void cancel_networking_install();
|
||||
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:
|
||||
int updating_bambu_networking();
|
||||
|
||||
@@ -735,9 +735,10 @@ void PresetUpdater::priv::sync_update_flutter_resource(bool isAuto_check)
|
||||
if (errCode != 200)
|
||||
return;
|
||||
|
||||
auto buildNumber = jsonData["data"]["build_number"];
|
||||
auto supportPcVersion = jsonData["data"]["support_snapmaker_version"];
|
||||
auto buildNumber = jsonData["data"]["build_number"];
|
||||
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 fileSize = jsonData["data"]["file_size"];
|
||||
auto fileMd5 = jsonData["data"]["file_md5"];
|
||||
@@ -810,6 +811,8 @@ void PresetUpdater::priv::sync_config(bool isAuto_check)
|
||||
return;
|
||||
|
||||
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 fileSize = jsonData["data"]["file_size"];
|
||||
auto fileMd5 = jsonData["data"]["file_md5"];
|
||||
@@ -826,17 +829,20 @@ void PresetUpdater::priv::sync_config(bool isAuto_check)
|
||||
std::string localOtaPresetVersion = "";
|
||||
if (fs::exists(localProfilesjson)) {
|
||||
Semver localOtaVersion = get_version_from_json(localProfilesjson.string());
|
||||
|
||||
if (localOtaVersion >= remoteVersion) {
|
||||
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.");
|
||||
}
|
||||
//don't allow jump version. first upgrade localOta
|
||||
if (localOtaVersion >= currentPresetVersion)
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPresetVersion < remoteVersion)
|
||||
@@ -1661,7 +1667,7 @@ void PresetUpdater::sync_config_async()
|
||||
|
||||
GUI::wxGetApp().CallAfter([] {
|
||||
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