mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 11:17:51 -06:00
FIX: [STUDIO-2844] use user presets only if login
Change-Id: Iec2dc9a77be8354ff1d5e0e4a60f79006ee682d3
This commit is contained in:
parent
ddabc14676
commit
1b0b14c0f2
4 changed files with 27 additions and 32 deletions
|
@ -1759,7 +1759,16 @@ void GUI_App::restart_networking()
|
||||||
if (plater_)
|
if (plater_)
|
||||||
plater_->get_notification_manager()->bbl_close_plugin_install_notification();
|
plater_->get_notification_manager()->bbl_close_plugin_install_notification();
|
||||||
|
|
||||||
if (app_config->get("sync_user_preset") == "true") { start_sync_user_preset(); }
|
if (m_agent->is_user_login()) {
|
||||||
|
remove_user_presets();
|
||||||
|
enable_user_preset_folder(true);
|
||||||
|
preset_bundle->load_user_presets(m_agent->get_user_id(), ForwardCompatibilitySubstitutionRule::Enable);
|
||||||
|
mainframe->update_side_preset_ui();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (app_config->get("sync_user_preset") == "true") {
|
||||||
|
start_sync_user_preset();
|
||||||
|
}
|
||||||
if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
|
if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
|
||||||
if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(m_agent); }
|
if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(m_agent); }
|
||||||
}
|
}
|
||||||
|
@ -2557,7 +2566,7 @@ bool GUI_App::on_init_inner()
|
||||||
copy_network_if_available();
|
copy_network_if_available();
|
||||||
on_init_network();
|
on_init_network();
|
||||||
|
|
||||||
if (app_config->get("sync_user_preset") == "true" && m_agent && m_agent->is_user_login()) {
|
if (m_agent && m_agent->is_user_login()) {
|
||||||
enable_user_preset_folder(true);
|
enable_user_preset_folder(true);
|
||||||
} else {
|
} else {
|
||||||
enable_user_preset_folder(false);
|
enable_user_preset_folder(false);
|
||||||
|
@ -3674,6 +3683,11 @@ void GUI_App::request_user_logout()
|
||||||
/* delete old user settings */
|
/* delete old user settings */
|
||||||
m_device_manager->clean_user_info();
|
m_device_manager->clean_user_info();
|
||||||
GUI::wxGetApp().sidebar().load_ams_list({}, {});
|
GUI::wxGetApp().sidebar().load_ams_list({}, {});
|
||||||
|
remove_user_presets();
|
||||||
|
enable_user_preset_folder(false);
|
||||||
|
preset_bundle->load_user_presets(DEFAULT_USER_FOLDER_NAME, ForwardCompatibilitySubstitutionRule::Enable);
|
||||||
|
mainframe->update_side_preset_ui();
|
||||||
|
|
||||||
GUI::wxGetApp().stop_sync_user_preset();
|
GUI::wxGetApp().stop_sync_user_preset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4034,14 +4048,13 @@ void GUI_App::on_user_login_handle(wxCommandEvent &evt)
|
||||||
wxQueueEvent(this, evt);
|
wxQueueEvent(this, evt);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (online_login) {
|
||||||
|
remove_user_presets();
|
||||||
if (online_login)
|
|
||||||
GUI::wxGetApp().mainframe->show_sync_dialog();
|
|
||||||
else if (app_config->get("sync_user_preset") == "true") {
|
|
||||||
enable_user_preset_folder(true);
|
enable_user_preset_folder(true);
|
||||||
} else {
|
preset_bundle->load_user_presets(m_agent->get_user_id(), ForwardCompatibilitySubstitutionRule::Enable);
|
||||||
enable_user_preset_folder(false);
|
mainframe->update_side_preset_ui();
|
||||||
|
|
||||||
|
GUI::wxGetApp().mainframe->show_sync_dialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4472,23 +4485,12 @@ void GUI_App::sync_preset(Preset* preset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::start_sync_user_preset(bool load_immediately, bool with_progress_dlg)
|
void GUI_App::start_sync_user_preset(bool with_progress_dlg)
|
||||||
{
|
{
|
||||||
if (!m_agent || !m_agent->is_user_login()) return;
|
if (!m_agent || !m_agent->is_user_login()) return;
|
||||||
|
|
||||||
if (load_immediately)
|
|
||||||
remove_user_presets();
|
|
||||||
|
|
||||||
enable_user_preset_folder(true);
|
|
||||||
|
|
||||||
// has already start sync
|
// has already start sync
|
||||||
if (enable_sync)
|
if (enable_sync) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (load_immediately) {
|
|
||||||
preset_bundle->load_user_presets(m_agent->get_user_id(), ForwardCompatibilitySubstitutionRule::Enable);
|
|
||||||
mainframe->update_side_preset_ui();
|
|
||||||
}
|
|
||||||
|
|
||||||
ProgressFn progressFn;
|
ProgressFn progressFn;
|
||||||
WasCancelledFn cancelFn;
|
WasCancelledFn cancelFn;
|
||||||
|
@ -4591,13 +4593,6 @@ void GUI_App::start_sync_user_preset(bool load_immediately, bool with_progress_d
|
||||||
|
|
||||||
void GUI_App::stop_sync_user_preset()
|
void GUI_App::stop_sync_user_preset()
|
||||||
{
|
{
|
||||||
if (!wxGetApp().m_is_closing)
|
|
||||||
remove_user_presets();
|
|
||||||
enable_user_preset_folder(false);
|
|
||||||
|
|
||||||
preset_bundle->load_user_presets(DEFAULT_USER_FOLDER_NAME, ForwardCompatibilitySubstitutionRule::Enable);
|
|
||||||
mainframe->update_side_preset_ui();
|
|
||||||
|
|
||||||
if (!enable_sync)
|
if (!enable_sync)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -437,7 +437,7 @@ public:
|
||||||
void reload_settings();
|
void reload_settings();
|
||||||
void remove_user_presets();
|
void remove_user_presets();
|
||||||
void sync_preset(Preset* preset);
|
void sync_preset(Preset* preset);
|
||||||
void start_sync_user_preset(bool load_immediately = false, bool with_progress_dlg = false);
|
void start_sync_user_preset(bool with_progress_dlg = false);
|
||||||
void stop_sync_user_preset();
|
void stop_sync_user_preset();
|
||||||
void start_http_server();
|
void start_http_server();
|
||||||
void stop_http_server();
|
void stop_http_server();
|
||||||
|
|
|
@ -3291,7 +3291,7 @@ void MainFrame::on_select_default_preset(SimpleEvent& evt)
|
||||||
{
|
{
|
||||||
case wxID_YES: {
|
case wxID_YES: {
|
||||||
wxGetApp().app_config->set_bool("sync_user_preset", true);
|
wxGetApp().app_config->set_bool("sync_user_preset", true);
|
||||||
wxGetApp().start_sync_user_preset(true, true);
|
wxGetApp().start_sync_user_preset(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case wxID_NO:
|
case wxID_NO:
|
||||||
|
|
|
@ -622,7 +622,7 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
||||||
if (param == "sync_user_preset") {
|
if (param == "sync_user_preset") {
|
||||||
bool sync = app_config->get("sync_user_preset") == "true" ? true : false;
|
bool sync = app_config->get("sync_user_preset") == "true" ? true : false;
|
||||||
if (sync) {
|
if (sync) {
|
||||||
wxGetApp().start_sync_user_preset(true);
|
wxGetApp().start_sync_user_preset();
|
||||||
} else {
|
} else {
|
||||||
wxGetApp().stop_sync_user_preset();
|
wxGetApp().stop_sync_user_preset();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue