NEW:support show print history

jira:[histroy]

Change-Id: Ibf3df10b0620aeab3731e248569f7d8381011c56
This commit is contained in:
tao wang 2024-10-29 15:51:48 +08:00 committed by Lane.Wei
parent 3317e4be69
commit 05877729ff
2 changed files with 20 additions and 3 deletions

View File

@ -263,6 +263,10 @@ void AppConfig::set_defaults()
set_bool("show_home_page", true);
}
if (get("show_print_history").empty()) {
set_bool("show_print_history", true);
}
if (get("show_printable_box").empty()) {
set_bool("show_printable_box", true);
}

View File

@ -806,6 +806,15 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
}
}
if (param == "show_print_history") {
auto show_history = app_config->get_bool("show_print_history");
if (show_history == true) {
if (wxGetApp().mainframe && wxGetApp().mainframe->m_webview) { wxGetApp().mainframe->m_webview->ShowUserPrintTask(true); }
} else {
if (wxGetApp().mainframe && wxGetApp().mainframe->m_webview) { wxGetApp().mainframe->m_webview->ShowUserPrintTask(false); }
}
}
if (param == "enable_lod") {
if (wxGetApp().plater()->is_project_dirty()) {
auto result = MessageDialog(static_cast<wxWindow *>(this), _L("The current project has unsaved changes, save it before continuing?"),
@ -1171,6 +1180,7 @@ wxWindow* PreferencesDialog::create_general_page()
// auto item_backup = create_item_switch(_L("Backup switch"), page, _L("Backup switch"), "units");
auto item_modelmall = create_item_checkbox(_L("Show online staff-picked models on the home page"), page, _L("Show online staff-picked models on the home page"), 50, "staff_pick_switch");
auto item_show_history = create_item_checkbox(_L("Show history on the home page"), page, _L("Show history on the home page"), 50, "show_print_history");
auto title_project = create_item_title(_L("Project"), page, "");
auto item_max_recent_count = create_item_input(_L("Maximum recent projects"), "", page, _L("Maximum count of recent projects"), "max_recent_count", [](wxString value) {
long max = 0;
@ -1232,12 +1242,15 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(item_associate_stl, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_associate_step, 0, wxTOP, FromDIP(3));
#endif // _WIN32
auto item_title_modelmall = sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20));
auto item_item_modelmall = sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3));
auto update_modelmall = [this, item_title_modelmall, item_item_modelmall] (wxEvent & e) {
auto item_title_modelmall = sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20));
auto item_item_modelmall = sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3));
auto item_item_show_history = sizer_page->Add(item_show_history, 0, wxTOP, FromDIP(3));
auto update_modelmall = [this, item_title_modelmall, item_item_modelmall, item_item_show_history](wxEvent &e) {
bool has_model_mall = wxGetApp().has_model_mall();
item_title_modelmall->Show(has_model_mall);
item_item_modelmall->Show(has_model_mall);
item_item_show_history->Show(has_model_mall);
Layout();
Fit();
};