From 4fe80bcbc5f76417d30db19fae1afe724e650940 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Fri, 3 Nov 2023 00:12:33 +0800 Subject: [PATCH] remove staff_pick_switch --- src/libslic3r/AppConfig.cpp | 6 ++-- src/slic3r/GUI/GUI_App.cpp | 46 +++++++++++++-------------- src/slic3r/GUI/Preferences.cpp | 36 ++++++++++----------- src/slic3r/GUI/WebViewDialog.cpp | 54 ++++++++++++++++---------------- 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index cec5d8bab8..94f1735ce9 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -312,9 +312,9 @@ void AppConfig::set_defaults() set("max_recent_count", "18"); } - if (get("staff_pick_switch").empty()) { - set_bool("staff_pick_switch", true); - } + // if (get("staff_pick_switch").empty()) { + // set_bool("staff_pick_switch", false); + // } if (get("sync_system_preset").empty()) { set_bool("sync_system_preset", true); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 068b38a956..dcbf17321a 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1736,9 +1736,9 @@ void GUI_App::restart_networking() if (app_config->get("sync_user_preset") == "true") { start_sync_user_preset(); } - if (mainframe && this->app_config->get("staff_pick_switch") == "true") { - if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(has_model_mall()); } - } + // if (mainframe && this->app_config->get("staff_pick_switch") == "true") { + // if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(has_model_mall()); } + // } } BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(" exit, m_agent=%1%")%m_agent; } @@ -2989,10 +2989,10 @@ void GUI_App::update_label_colours_from_appconfig() void GUI_App::update_publish_status() { - mainframe->show_publish_button(has_model_mall()); - if (app_config->get("staff_pick_switch") == "true") { - mainframe->m_webview->SendDesignStaffpick(has_model_mall()); - } + // mainframe->show_publish_button(has_model_mall()); + // if (app_config->get("staff_pick_switch") == "true") { + // mainframe->m_webview->SendDesignStaffpick(has_model_mall()); + // } } bool GUI_App::has_model_mall() @@ -3818,22 +3818,22 @@ std::string GUI_App::handle_web_request(std::string cmd) } } } - else if (command_str.compare("modelmall_model_advise_get") == 0) { - if (mainframe && this->app_config->get("staff_pick_switch") == "true") { - if (mainframe->m_webview) { - mainframe->m_webview->SendDesignStaffpick(has_model_mall()); - } - } - } - else if (command_str.compare("modelmall_model_open") == 0) { - if (root.get_child_optional("data") != boost::none) { - pt::ptree data_node = root.get_child("data"); - boost::optional id = data_node.get_optional("id"); - if (id.has_value() && mainframe->m_webview) { - mainframe->m_webview->OpenModelDetail(id.value(), m_agent); - } - } - } + // else if (command_str.compare("modelmall_model_advise_get") == 0) { + // if (mainframe && this->app_config->get("staff_pick_switch") == "true") { + // if (mainframe->m_webview) { + // mainframe->m_webview->SendDesignStaffpick(has_model_mall()); + // } + // } + // } + // else if (command_str.compare("modelmall_model_open") == 0) { + // if (root.get_child_optional("data") != boost::none) { + // pt::ptree data_node = root.get_child("data"); + // boost::optional id = data_node.get_optional("id"); + // if (id.has_value() && mainframe->m_webview) { + // mainframe->m_webview->OpenModelDetail(id.value(), m_agent); + // } + // } + // } else if (command_str.compare("homepage_open_recentfile") == 0) { if (root.get_child_optional("data") != boost::none) { pt::ptree data_node = root.get_child("data"); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 8e009323fe..6704a03550 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -630,10 +630,10 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa app_config->set_bool(param, checkbox->GetValue()); app_config->save(); - if (param == "staff_pick_switch") { - bool pbool = app_config->get("staff_pick_switch") == "true"; - wxGetApp().switch_staff_pick(pbool); - } + // if (param == "staff_pick_switch") { + // bool pbool = app_config->get("staff_pick_switch") == "true"; + // wxGetApp().switch_staff_pick(pbool); + // } // backup if (param == "backup_switch") { @@ -1008,9 +1008,9 @@ wxWindow* PreferencesDialog::create_general_page() _L("If enabled, sets OrcaSlicer as default application to open .step files"), 50, "associate_step"); #endif // _WIN32 - auto title_modelmall = create_item_title(_L("Online Models"), page, _L("Online Models")); + // auto title_modelmall = create_item_title(_L("Online Models"), page, _L("Online Models")); // 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_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 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) { @@ -1060,18 +1060,18 @@ 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) { - bool has_model_mall = wxGetApp().has_model_mall(); - item_title_modelmall->Show(has_model_mall); - item_item_modelmall->Show(has_model_mall); - Layout(); - Fit(); - }; - wxCommandEvent eee(wxEVT_COMBOBOX); - update_modelmall(eee); - item_region->GetItem(size_t(2))->GetWindow()->Bind(wxEVT_COMBOBOX, update_modelmall); + // 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) { + // bool has_model_mall = wxGetApp().has_model_mall(); + // item_title_modelmall->Show(has_model_mall); + // item_item_modelmall->Show(has_model_mall); + // Layout(); + // Fit(); + // }; + // wxCommandEvent eee(wxEVT_COMBOBOX); + // update_modelmall(eee); + // item_region->GetItem(size_t(2))->GetWindow()->Bind(wxEVT_COMBOBOX, update_modelmall); sizer_page->Add(title_project, 0, wxTOP| wxEXPAND, FromDIP(20)); sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_save_choise, 0, wxTOP, FromDIP(3)); diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index 2b01dd1e8c..2319187bc2 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -430,23 +430,23 @@ void WebViewPanel::SendRecentList(int images) void WebViewPanel::SendDesignStaffpick(bool on) { - if (on) { - get_design_staffpick(0, 60, [this](std::string body) { - if (body.empty() || body.front() != '{') { - BOOST_LOG_TRIVIAL(warning) << "get_design_staffpick failed " + body; - return; - } - CallAfter([this, body] { - auto body2 = from_u8(body); - body2.insert(1, "\"command\": \"modelmall_model_advise_get\", "); - RunScript(wxString::Format("window.postMessage(%s)", body2)); - }); - }); - } else { - std::string body2 = "{\"total\":0, \"hits\":[]}"; - body2.insert(1, "\"command\": \"modelmall_model_advise_get\", "); - RunScript(wxString::Format("window.postMessage(%s)", body2)); - } + // if (on) { + // get_design_staffpick(0, 60, [this](std::string body) { + // if (body.empty() || body.front() != '{') { + // BOOST_LOG_TRIVIAL(warning) << "get_design_staffpick failed " + body; + // return; + // } + // CallAfter([this, body] { + // auto body2 = from_u8(body); + // body2.insert(1, "\"command\": \"modelmall_model_advise_get\", "); + // RunScript(wxString::Format("window.postMessage(%s)", body2)); + // }); + // }); + // } else { + // std::string body2 = "{\"total\":0, \"hits\":[]}"; + // body2.insert(1, "\"command\": \"modelmall_model_advise_get\", "); + // RunScript(wxString::Format("window.postMessage(%s)", body2)); + // } } void WebViewPanel::OpenModelDetail(std::string id, NetworkAgent *agent) @@ -488,17 +488,17 @@ void WebViewPanel::ShowNetpluginTip() void WebViewPanel::get_design_staffpick(int offset, int limit, std::function callback) { - auto host = wxGetApp().get_http_url(wxGetApp().app_config->get_country_code(), "v1/design-service/design/staffpick"); - std::string url = (boost::format("%1%/?offset=%2%&limit=%3%") % host % offset % limit).str(); + // auto host = wxGetApp().get_http_url(wxGetApp().app_config->get_country_code(), "v1/design-service/design/staffpick"); + // std::string url = (boost::format("%1%/?offset=%2%&limit=%3%") % host % offset % limit).str(); - Http http = Http::get(url); - http.header("accept", "application/json") - .header("Content-Type", "application/json") - .on_complete([this, callback](std::string body, unsigned status) { callback(body); }) - .on_error([this, callback](std::string body, std::string error, unsigned status) { - callback(body); - }) - .perform(); + // Http http = Http::get(url); + // http.header("accept", "application/json") + // .header("Content-Type", "application/json") + // .on_complete([this, callback](std::string body, unsigned status) { callback(body); }) + // .on_error([this, callback](std::string body, std::string error, unsigned status) { + // callback(body); + // }) + // .perform(); } int WebViewPanel::get_model_mall_detail_url(std::string *url, std::string id)