mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-29 22:02:10 +00:00
feature update web recourse on sync.
This commit is contained in:
@@ -963,7 +963,7 @@ void GUI_App::post_init()
|
|||||||
std::string language = GUI::into_u8(current_language_code());
|
std::string language = GUI::into_u8(current_language_code());
|
||||||
std::string network_ver = Slic3r::NetworkAgent::get_version();
|
std::string network_ver = Slic3r::NetworkAgent::get_version();
|
||||||
bool sys_preset = app_config->get("sync_system_preset") == "true";
|
bool sys_preset = app_config->get("sync_system_preset") == "true";
|
||||||
this->preset_updater->sync(http_url, language, network_ver, sys_preset ? preset_bundle : nullptr);
|
//this->preset_updater->sync(http_url, language, network_ver, sys_preset ? preset_bundle : nullptr);
|
||||||
this->preset_updater->sync_web_async(true);
|
this->preset_updater->sync_web_async(true);
|
||||||
this->check_new_version_sf(false, false);
|
this->check_new_version_sf(false, false);
|
||||||
|
|
||||||
@@ -4881,7 +4881,7 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
|
|||||||
GUI::wxGetApp().QueueEvent(evt);
|
GUI::wxGetApp().QueueEvent(evt);
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
})
|
})
|
||||||
.perform();
|
.perform_sync();
|
||||||
}
|
}
|
||||||
void GUI_App::process_network_msg(std::string dev_id, std::string msg)
|
void GUI_App::process_network_msg(std::string dev_id, std::string msg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ struct PresetUpdater::priv
|
|||||||
bool cancel;
|
bool cancel;
|
||||||
std::thread thread;
|
std::thread thread;
|
||||||
|
|
||||||
|
bool m_web_thread_cancel;
|
||||||
|
std::thread m_web_resource_thread;
|
||||||
bool has_waiting_updates { false };
|
bool has_waiting_updates { false };
|
||||||
Updates waiting_updates;
|
Updates waiting_updates;
|
||||||
bool has_waiting_printer_updates { false };
|
bool has_waiting_printer_updates { false };
|
||||||
@@ -1536,6 +1538,12 @@ PresetUpdater::~PresetUpdater()
|
|||||||
p->cancel = true;
|
p->cancel = true;
|
||||||
p->thread.join();
|
p->thread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p && p->m_web_resource_thread.joinable())
|
||||||
|
{
|
||||||
|
p->m_web_thread_cancel = true;
|
||||||
|
p->m_web_resource_thread.join();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//BBS: change directories by design
|
//BBS: change directories by design
|
||||||
@@ -1697,13 +1705,13 @@ bool PresetUpdater::install_bundles_rsrc(std::vector<std::string> bundles, bool
|
|||||||
|
|
||||||
void PresetUpdater::sync_web_async(bool isAutoUpdata)
|
void PresetUpdater::sync_web_async(bool isAutoUpdata)
|
||||||
{
|
{
|
||||||
if (p->thread.joinable()) {
|
if (p->m_web_resource_thread.joinable()) {
|
||||||
p->cancel = true;
|
p->m_web_thread_cancel = true;
|
||||||
p->thread.join();
|
p->m_web_resource_thread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
p->cancel = false;
|
p->m_web_thread_cancel = false;
|
||||||
p->thread = std::thread([this, isAutoUpdata]() {
|
p->m_web_resource_thread = std::thread([this, isAutoUpdata]() {
|
||||||
BOOST_LOG_TRIVIAL(debug) << "[Orca Updater] sync_web_async started";
|
BOOST_LOG_TRIVIAL(debug) << "[Orca Updater] sync_web_async started";
|
||||||
this->p->sync_update_flutter_resource(isAutoUpdata);
|
this->p->sync_update_flutter_resource(isAutoUpdata);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user