mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 15:07:31 -06:00
remove staff_pick_switch
This commit is contained in:
parent
70c5178e50
commit
4fe80bcbc5
4 changed files with 71 additions and 71 deletions
|
@ -312,9 +312,9 @@ void AppConfig::set_defaults()
|
||||||
set("max_recent_count", "18");
|
set("max_recent_count", "18");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get("staff_pick_switch").empty()) {
|
// if (get("staff_pick_switch").empty()) {
|
||||||
set_bool("staff_pick_switch", true);
|
// set_bool("staff_pick_switch", false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (get("sync_system_preset").empty()) {
|
if (get("sync_system_preset").empty()) {
|
||||||
set_bool("sync_system_preset", true);
|
set_bool("sync_system_preset", true);
|
||||||
|
|
|
@ -1736,9 +1736,9 @@ void GUI_App::restart_networking()
|
||||||
if (app_config->get("sync_user_preset") == "true") {
|
if (app_config->get("sync_user_preset") == "true") {
|
||||||
start_sync_user_preset();
|
start_sync_user_preset();
|
||||||
}
|
}
|
||||||
if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
|
// if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
|
||||||
if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(has_model_mall()); }
|
// if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(has_model_mall()); }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(" exit, m_agent=%1%")%m_agent;
|
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()
|
void GUI_App::update_publish_status()
|
||||||
{
|
{
|
||||||
mainframe->show_publish_button(has_model_mall());
|
// mainframe->show_publish_button(has_model_mall());
|
||||||
if (app_config->get("staff_pick_switch") == "true") {
|
// if (app_config->get("staff_pick_switch") == "true") {
|
||||||
mainframe->m_webview->SendDesignStaffpick(has_model_mall());
|
// mainframe->m_webview->SendDesignStaffpick(has_model_mall());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GUI_App::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) {
|
// else if (command_str.compare("modelmall_model_advise_get") == 0) {
|
||||||
if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
|
// if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
|
||||||
if (mainframe->m_webview) {
|
// if (mainframe->m_webview) {
|
||||||
mainframe->m_webview->SendDesignStaffpick(has_model_mall());
|
// mainframe->m_webview->SendDesignStaffpick(has_model_mall());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (command_str.compare("modelmall_model_open") == 0) {
|
// else if (command_str.compare("modelmall_model_open") == 0) {
|
||||||
if (root.get_child_optional("data") != boost::none) {
|
// if (root.get_child_optional("data") != boost::none) {
|
||||||
pt::ptree data_node = root.get_child("data");
|
// pt::ptree data_node = root.get_child("data");
|
||||||
boost::optional<std::string> id = data_node.get_optional<std::string>("id");
|
// boost::optional<std::string> id = data_node.get_optional<std::string>("id");
|
||||||
if (id.has_value() && mainframe->m_webview) {
|
// if (id.has_value() && mainframe->m_webview) {
|
||||||
mainframe->m_webview->OpenModelDetail(id.value(), m_agent);
|
// mainframe->m_webview->OpenModelDetail(id.value(), m_agent);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (command_str.compare("homepage_open_recentfile") == 0) {
|
else if (command_str.compare("homepage_open_recentfile") == 0) {
|
||||||
if (root.get_child_optional("data") != boost::none) {
|
if (root.get_child_optional("data") != boost::none) {
|
||||||
pt::ptree data_node = root.get_child("data");
|
pt::ptree data_node = root.get_child("data");
|
||||||
|
|
|
@ -630,10 +630,10 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
||||||
app_config->set_bool(param, checkbox->GetValue());
|
app_config->set_bool(param, checkbox->GetValue());
|
||||||
app_config->save();
|
app_config->save();
|
||||||
|
|
||||||
if (param == "staff_pick_switch") {
|
// if (param == "staff_pick_switch") {
|
||||||
bool pbool = app_config->get("staff_pick_switch") == "true";
|
// bool pbool = app_config->get("staff_pick_switch") == "true";
|
||||||
wxGetApp().switch_staff_pick(pbool);
|
// wxGetApp().switch_staff_pick(pbool);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// backup
|
// backup
|
||||||
if (param == "backup_switch") {
|
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");
|
_L("If enabled, sets OrcaSlicer as default application to open .step files"), 50, "associate_step");
|
||||||
#endif // _WIN32
|
#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_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 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) {
|
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_stl, 0, wxTOP, FromDIP(3));
|
||||||
sizer_page->Add(item_associate_step, 0, wxTOP, FromDIP(3));
|
sizer_page->Add(item_associate_step, 0, wxTOP, FromDIP(3));
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
auto item_title_modelmall = sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20));
|
// 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_modelmall = sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3));
|
||||||
auto update_modelmall = [this, item_title_modelmall, item_item_modelmall] (wxEvent & e) {
|
// auto update_modelmall = [this, item_title_modelmall, item_item_modelmall] (wxEvent & e) {
|
||||||
bool has_model_mall = wxGetApp().has_model_mall();
|
// bool has_model_mall = wxGetApp().has_model_mall();
|
||||||
item_title_modelmall->Show(has_model_mall);
|
// item_title_modelmall->Show(has_model_mall);
|
||||||
item_item_modelmall->Show(has_model_mall);
|
// item_item_modelmall->Show(has_model_mall);
|
||||||
Layout();
|
// Layout();
|
||||||
Fit();
|
// Fit();
|
||||||
};
|
// };
|
||||||
wxCommandEvent eee(wxEVT_COMBOBOX);
|
// wxCommandEvent eee(wxEVT_COMBOBOX);
|
||||||
update_modelmall(eee);
|
// update_modelmall(eee);
|
||||||
item_region->GetItem(size_t(2))->GetWindow()->Bind(wxEVT_COMBOBOX, update_modelmall);
|
// 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(title_project, 0, wxTOP| wxEXPAND, FromDIP(20));
|
||||||
sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3));
|
sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3));
|
||||||
sizer_page->Add(item_save_choise, 0, wxTOP, FromDIP(3));
|
sizer_page->Add(item_save_choise, 0, wxTOP, FromDIP(3));
|
||||||
|
|
|
@ -430,23 +430,23 @@ void WebViewPanel::SendRecentList(int images)
|
||||||
|
|
||||||
void WebViewPanel::SendDesignStaffpick(bool on)
|
void WebViewPanel::SendDesignStaffpick(bool on)
|
||||||
{
|
{
|
||||||
if (on) {
|
// if (on) {
|
||||||
get_design_staffpick(0, 60, [this](std::string body) {
|
// get_design_staffpick(0, 60, [this](std::string body) {
|
||||||
if (body.empty() || body.front() != '{') {
|
// if (body.empty() || body.front() != '{') {
|
||||||
BOOST_LOG_TRIVIAL(warning) << "get_design_staffpick failed " + body;
|
// BOOST_LOG_TRIVIAL(warning) << "get_design_staffpick failed " + body;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
CallAfter([this, body] {
|
// CallAfter([this, body] {
|
||||||
auto body2 = from_u8(body);
|
// auto body2 = from_u8(body);
|
||||||
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
// body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
||||||
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
// RunScript(wxString::Format("window.postMessage(%s)", body2));
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
std::string body2 = "{\"total\":0, \"hits\":[]}";
|
// std::string body2 = "{\"total\":0, \"hits\":[]}";
|
||||||
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
// body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
||||||
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
// RunScript(wxString::Format("window.postMessage(%s)", body2));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewPanel::OpenModelDetail(std::string id, NetworkAgent *agent)
|
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<void(std::string)> callback)
|
void WebViewPanel::get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback)
|
||||||
{
|
{
|
||||||
auto host = wxGetApp().get_http_url(wxGetApp().app_config->get_country_code(), "v1/design-service/design/staffpick");
|
// 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();
|
// std::string url = (boost::format("%1%/?offset=%2%&limit=%3%") % host % offset % limit).str();
|
||||||
|
|
||||||
Http http = Http::get(url);
|
// Http http = Http::get(url);
|
||||||
http.header("accept", "application/json")
|
// http.header("accept", "application/json")
|
||||||
.header("Content-Type", "application/json")
|
// .header("Content-Type", "application/json")
|
||||||
.on_complete([this, callback](std::string body, unsigned status) { callback(body); })
|
// .on_complete([this, callback](std::string body, unsigned status) { callback(body); })
|
||||||
.on_error([this, callback](std::string body, std::string error, unsigned status) {
|
// .on_error([this, callback](std::string body, std::string error, unsigned status) {
|
||||||
callback(body);
|
// callback(body);
|
||||||
})
|
// })
|
||||||
.perform();
|
// .perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
int WebViewPanel::get_model_mall_detail_url(std::string *url, std::string id)
|
int WebViewPanel::get_model_mall_detail_url(std::string *url, std::string id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue