From 8f0a6fa996bb4b3e218e740a098148562d091332 Mon Sep 17 00:00:00 2001 From: tao wang Date: Wed, 16 Oct 2024 17:19:32 +0800 Subject: [PATCH] NEW:support show print history Change-Id: I28acf421ec0a21d14e89a498012029ee7a32f00b --- src/slic3r/GUI/Preferences.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 908024695..17f78148b 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -806,6 +806,15 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa } } + if (param == "show_print_history") { + auto show_history = app_config->get("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(this), _L("The current project has unsaved changes, save it before continuing?"), @@ -1171,6 +1180,8 @@ 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; @@ -1234,10 +1245,13 @@ wxWindow* PreferencesDialog::create_general_page() #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_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(); };