NEW: Revert "[STUDIO-2476] design_staffpick"

This reverts commit 0063720bbaaa6a680f2d9f395d60cf193d126e11.

Change-Id: Ieb19daf19b38f5e25b78967ee225042988d98c7d
This commit is contained in:
chunmao.guo 2023-04-11 10:30:07 +08:00 committed by Lane.Wei
parent de3bb7eb4f
commit a344ebcf81
18 changed files with 556 additions and 363 deletions

View file

@ -3702,24 +3702,6 @@ 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(m_agent);
}
}
}
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<std::string> id = data_node.get_optional<std::string>("id");
if (id.has_value() && m_agent) {
std::string url;
if (m_agent->get_model_mall_detail_url(&url, id.value()) == 0)
wxLaunchDefaultBrowser(url);
}
}
}
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");
@ -3808,12 +3790,6 @@ std::string GUI_App::handle_web_request(std::string cmd)
}
}
}
else if (command_str.compare("common_openurl") == 0) {
boost::optional<std::string> path = root.get_optional<std::string>("url");
if (path.has_value()) {
wxLaunchDefaultBrowser(path.value());
}
}
}
}
catch (...) {
@ -4578,11 +4554,6 @@ void GUI_App::stop_http_server()
m_http_server.stop();
}
void GUI_App::switch_staff_pick(bool on)
{
mainframe->m_webview->SendDesignStaffpick(on ? m_agent : nullptr);
}
bool GUI_App::switch_language()
{
if (select_language()) {

View file

@ -439,7 +439,6 @@ public:
void stop_sync_user_preset();
void start_http_server();
void stop_http_server();
void switch_staff_pick(bool on);
void on_show_check_privacy_dlg(int online_login = 0);
void show_check_privacy_dlg(wxCommandEvent& evt);

View file

@ -604,11 +604,6 @@ 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);
}
// backup
if (param == "backup_switch") {
bool pbool = app_config->get("backup_switch") == "true" ? true : false;
@ -941,11 +936,6 @@ wxWindow* PreferencesDialog::create_general_page()
_L("If enabled, sets BambuStudio 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 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 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;
@ -986,9 +976,6 @@ 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
sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20));
sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3));
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));

View file

@ -427,23 +427,6 @@ void WebViewPanel::SendRecentList(wxString const &sequence_id)
RunScript(wxString::Format("window.postMessage(%s)", oss.str()));
}
void WebViewPanel::SendDesignStaffpick(NetworkAgent *agent)
{
if (agent) {
agent->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 = body;
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
RunScript(wxString::Format("window.postMessage(%s)", body2));
});
});
}
}
void WebViewPanel::SendLoginInfo()
{
if (wxGetApp().getAgent()) {

View file

@ -27,9 +27,6 @@
namespace Slic3r {
class NetworkAgent;
namespace GUI {
@ -94,7 +91,6 @@ public:
public:
void SendRecentList(wxString const &sequence_id);
void SendDesignStaffpick(NetworkAgent *agent);
void SendLoginInfo();
void ShowNetpluginTip();