mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 15:37:30 -06:00
reduce AppConfig::Save() calls
This commit is contained in:
parent
cccc857f6f
commit
6aa3e400d1
7 changed files with 9 additions and 23 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -27,3 +27,4 @@ src/OrcaSlicer-doc/
|
||||||
.idea/
|
.idea/
|
||||||
bbl/i18n/es/OrcaSlicer_es.mo
|
bbl/i18n/es/OrcaSlicer_es.mo
|
||||||
bbl/i18n/es/OrcaSlicer.mo
|
bbl/i18n/es/OrcaSlicer.mo
|
||||||
|
/.cache/
|
|
@ -39,7 +39,6 @@ void Camera::set_type(EType type)
|
||||||
m_type = type;
|
m_type = type;
|
||||||
if (m_update_config_on_type_change_enabled) {
|
if (m_update_config_on_type_change_enabled) {
|
||||||
wxGetApp().app_config->set_bool("use_perspective_camera", m_type == EType::Perspective);
|
wxGetApp().app_config->set_bool("use_perspective_camera", m_type == EType::Perspective);
|
||||||
wxGetApp().app_config->save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2322,8 +2322,9 @@ bool GUI_App::on_init_inner()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(app_config->get("version") != SLIC3R_VERSION) {
|
||||||
app_config->set("version", SLIC3R_VERSION);
|
app_config->set("version", SLIC3R_VERSION);
|
||||||
app_config->save();
|
}
|
||||||
|
|
||||||
BBLSplashScreen * scrn = nullptr;
|
BBLSplashScreen * scrn = nullptr;
|
||||||
const bool show_splash_screen = true;
|
const bool show_splash_screen = true;
|
||||||
|
@ -2623,9 +2624,6 @@ bool GUI_App::on_init_inner()
|
||||||
if (! plater_)
|
if (! plater_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (app_config->dirty())
|
|
||||||
app_config->save();
|
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
//this->obj_manipul()->update_if_dirty();
|
//this->obj_manipul()->update_if_dirty();
|
||||||
|
|
||||||
|
@ -2650,6 +2648,9 @@ bool GUI_App::on_init_inner()
|
||||||
m_download_file_url = "";
|
m_download_file_url = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_post_initialized && app_config->dirty())
|
||||||
|
app_config->save();
|
||||||
});
|
});
|
||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
|
@ -4220,12 +4221,10 @@ void GUI_App::show_check_privacy_dlg(wxCommandEvent& evt)
|
||||||
privacy_dlg.Bind(EVT_PRIVACY_UPDATE_CONFIRM, [this, online_login](wxCommandEvent &e) {
|
privacy_dlg.Bind(EVT_PRIVACY_UPDATE_CONFIRM, [this, online_login](wxCommandEvent &e) {
|
||||||
app_config->set("privacy_version", privacy_version_info.version_str);
|
app_config->set("privacy_version", privacy_version_info.version_str);
|
||||||
app_config->set_bool("privacy_update_checked", true);
|
app_config->set_bool("privacy_update_checked", true);
|
||||||
app_config->save();
|
|
||||||
request_user_handle(online_login);
|
request_user_handle(online_login);
|
||||||
});
|
});
|
||||||
privacy_dlg.Bind(EVT_PRIVACY_UPDATE_CANCEL, [this](wxCommandEvent &e) {
|
privacy_dlg.Bind(EVT_PRIVACY_UPDATE_CANCEL, [this](wxCommandEvent &e) {
|
||||||
app_config->set_bool("privacy_update_checked", false);
|
app_config->set_bool("privacy_update_checked", false);
|
||||||
app_config->save();
|
|
||||||
if (m_agent) {
|
if (m_agent) {
|
||||||
m_agent->user_logout();
|
m_agent->user_logout();
|
||||||
}
|
}
|
||||||
|
@ -4777,7 +4776,6 @@ bool GUI_App::select_language()
|
||||||
// m_wxLocale->GetCanonicalName()
|
// m_wxLocale->GetCanonicalName()
|
||||||
// 3) new_language_info->CanonicalName is a safe bet. It points to a valid dictionary name.
|
// 3) new_language_info->CanonicalName is a safe bet. It points to a valid dictionary name.
|
||||||
app_config->set("language", new_language_info->CanonicalName.ToUTF8().data());
|
app_config->set("language", new_language_info->CanonicalName.ToUTF8().data());
|
||||||
app_config->save();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5019,7 +5017,6 @@ void GUI_App::save_mode(const /*ConfigOptionMode*/int mode)
|
||||||
mode == comSimple ? "simple" :
|
mode == comSimple ? "simple" :
|
||||||
mode == comDevelop ? "develop" : "simple";
|
mode == comDevelop ? "develop" : "simple";
|
||||||
app_config->set("user_mode", mode_str);
|
app_config->set("user_mode", mode_str);
|
||||||
app_config->save();
|
|
||||||
update_mode();
|
update_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,6 @@ void update_dark_config()
|
||||||
{
|
{
|
||||||
wxSystemAppearance app = wxSystemSettings::GetAppearance();
|
wxSystemAppearance app = wxSystemSettings::GetAppearance();
|
||||||
GUI::wxGetApp().app_config->set("dark_color_mode", app.IsDark() ? "1" : "0");
|
GUI::wxGetApp().app_config->set("dark_color_mode", app.IsDark() ? "1" : "0");
|
||||||
GUI::wxGetApp().app_config->save();
|
|
||||||
wxGetApp().Update_dark_mode_flag();
|
wxGetApp().Update_dark_mode_flag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -837,6 +837,7 @@ void MainFrame::shutdown()
|
||||||
//wxGetApp().other_instance_message_handler()->shutdown(this);
|
//wxGetApp().other_instance_message_handler()->shutdown(this);
|
||||||
// Save the slic3r.ini.Usually the ini file is saved from "on idle" callback,
|
// Save the slic3r.ini.Usually the ini file is saved from "on idle" callback,
|
||||||
// but in rare cases it may not have been called yet.
|
// but in rare cases it may not have been called yet.
|
||||||
|
if(wxGetApp().app_config->dirty())
|
||||||
wxGetApp().app_config->save();
|
wxGetApp().app_config->save();
|
||||||
// if (m_plater)
|
// if (m_plater)
|
||||||
// m_plater->print = undef;
|
// m_plater->print = undef;
|
||||||
|
@ -2799,7 +2800,6 @@ void MainFrame::set_max_recent_count(int max)
|
||||||
recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
|
recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
|
||||||
}
|
}
|
||||||
wxGetApp().app_config->set_recent_projects(recent_projects);
|
wxGetApp().app_config->set_recent_projects(recent_projects);
|
||||||
wxGetApp().app_config->save();
|
|
||||||
m_webview->SendRecentList("");
|
m_webview->SendRecentList("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3266,7 +3266,6 @@ void MainFrame::add_to_recent_projects(const wxString& filename)
|
||||||
recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
|
recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
|
||||||
}
|
}
|
||||||
wxGetApp().app_config->set_recent_projects(recent_projects);
|
wxGetApp().app_config->set_recent_projects(recent_projects);
|
||||||
wxGetApp().app_config->save();
|
|
||||||
m_webview->SendRecentList("");
|
m_webview->SendRecentList("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3366,7 +3365,6 @@ void MainFrame::open_recent_project(size_t file_id, wxString const & filename)
|
||||||
recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
|
recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
|
||||||
}
|
}
|
||||||
wxGetApp().app_config->set_recent_projects(recent_projects);
|
wxGetApp().app_config->set_recent_projects(recent_projects);
|
||||||
wxGetApp().app_config->save();
|
|
||||||
m_webview->SendRecentList("");
|
m_webview->SendRecentList("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3390,7 +3388,6 @@ void MainFrame::remove_recent_project(size_t file_id, wxString const &filename)
|
||||||
recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
|
recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
|
||||||
}
|
}
|
||||||
wxGetApp().app_config->set_recent_projects(recent_projects);
|
wxGetApp().app_config->set_recent_projects(recent_projects);
|
||||||
wxGetApp().app_config->save();
|
|
||||||
m_webview->SendRecentList("");
|
m_webview->SendRecentList("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6375,7 +6375,6 @@ void Plater::priv::update_plugin_when_launch(wxCommandEvent &event)
|
||||||
else if (result == wxID_NO) {
|
else if (result == wxID_NO) {
|
||||||
app_config->set("update_network_plugin", "false");
|
app_config->set("update_network_plugin", "false");
|
||||||
}
|
}
|
||||||
app_config->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::show_install_plugin_hint(wxCommandEvent &event)
|
void Plater::priv::show_install_plugin_hint(wxCommandEvent &event)
|
||||||
|
|
|
@ -81,7 +81,6 @@ wxBoxSizer *PreferencesDialog::create_item_combobox(wxString title, wxWindow *pa
|
||||||
//// save config
|
//// save config
|
||||||
combobox->GetDropDown().Bind(wxEVT_COMBOBOX, [this, param](wxCommandEvent &e) {
|
combobox->GetDropDown().Bind(wxEVT_COMBOBOX, [this, param](wxCommandEvent &e) {
|
||||||
app_config->set(param, std::to_string(e.GetSelection()));
|
app_config->set(param, std::to_string(e.GetSelection()));
|
||||||
app_config->save();
|
|
||||||
e.Skip();
|
e.Skip();
|
||||||
});
|
});
|
||||||
return m_sizer_combox;
|
return m_sizer_combox;
|
||||||
|
@ -199,7 +198,6 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox(
|
||||||
m_current_language_selected = combobox->GetSelection();
|
m_current_language_selected = combobox->GetSelection();
|
||||||
if (m_current_language_selected >= 0 && m_current_language_selected < vlist.size()) {
|
if (m_current_language_selected >= 0 && m_current_language_selected < vlist.size()) {
|
||||||
app_config->set(param, vlist[m_current_language_selected]->CanonicalName.ToUTF8().data());
|
app_config->set(param, vlist[m_current_language_selected]->CanonicalName.ToUTF8().data());
|
||||||
app_config->save();
|
|
||||||
|
|
||||||
wxGetApp().load_language(vlist[m_current_language_selected]->CanonicalName, false);
|
wxGetApp().load_language(vlist[m_current_language_selected]->CanonicalName, false);
|
||||||
Close();
|
Close();
|
||||||
|
@ -324,7 +322,6 @@ wxBoxSizer *PreferencesDialog::create_item_loglevel_combobox(wxString title, wxW
|
||||||
auto level = Slic3r::get_string_logging_level(e.GetSelection());
|
auto level = Slic3r::get_string_logging_level(e.GetSelection());
|
||||||
Slic3r::set_logging_level(Slic3r::level_string_to_boost(level));
|
Slic3r::set_logging_level(Slic3r::level_string_to_boost(level));
|
||||||
app_config->set("severity_level",level);
|
app_config->set("severity_level",level);
|
||||||
app_config->save();
|
|
||||||
e.Skip();
|
e.Skip();
|
||||||
});
|
});
|
||||||
return m_sizer_combox;
|
return m_sizer_combox;
|
||||||
|
@ -376,14 +373,12 @@ wxBoxSizer *PreferencesDialog::create_item_multiple_combobox(
|
||||||
combobox_left->GetDropDown().Bind(wxEVT_COMBOBOX, [this, param, combobox_right](wxCommandEvent &e) {
|
combobox_left->GetDropDown().Bind(wxEVT_COMBOBOX, [this, param, combobox_right](wxCommandEvent &e) {
|
||||||
auto config = e.GetString() + wxString("/") + combobox_right->GetValue();
|
auto config = e.GetString() + wxString("/") + combobox_right->GetValue();
|
||||||
app_config->set(param, std::string(config.mb_str()));
|
app_config->set(param, std::string(config.mb_str()));
|
||||||
app_config->save();
|
|
||||||
e.Skip();
|
e.Skip();
|
||||||
});
|
});
|
||||||
|
|
||||||
combobox_right->GetDropDown().Bind(wxEVT_COMBOBOX, [this, param, combobox_left](wxCommandEvent &e) {
|
combobox_right->GetDropDown().Bind(wxEVT_COMBOBOX, [this, param, combobox_left](wxCommandEvent &e) {
|
||||||
auto config = combobox_left->GetValue() + wxString("/") + e.GetString();
|
auto config = combobox_left->GetValue() + wxString("/") + e.GetString();
|
||||||
app_config->set(param, std::string(config.mb_str()));
|
app_config->set(param, std::string(config.mb_str()));
|
||||||
app_config->save();
|
|
||||||
e.Skip();
|
e.Skip();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -427,7 +422,6 @@ wxBoxSizer *PreferencesDialog::create_item_input(wxString title, wxString title2
|
||||||
input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, param, input, onchange](wxFocusEvent &e) {
|
input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, param, input, onchange](wxFocusEvent &e) {
|
||||||
auto value = input->GetTextCtrl()->GetValue();
|
auto value = input->GetTextCtrl()->GetValue();
|
||||||
app_config->set(param, std::string(value.mb_str()));
|
app_config->set(param, std::string(value.mb_str()));
|
||||||
app_config->save();
|
|
||||||
onchange(value);
|
onchange(value);
|
||||||
e.Skip();
|
e.Skip();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue