Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/slic3r/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ set(SLIC3R_GUI_SOURCES
GUI/SMPhysicalPrinterDialog.cpp
GUI/SSWCP.cpp
GUI/SSWCP.hpp
GUI/WebSocketDebugServer.cpp
GUI/WebSocketDebugServer.hpp
GUI/DownloadManager.cpp
GUI/DownloadManager.hpp
GUI/GenericDownloadDialog.cpp
Expand Down
74 changes: 42 additions & 32 deletions src/slic3r/GUI/GUI_App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ class SplashScreen : public wxSplashScreen

// use a memory DC to draw directly onto the bitmap
wxMemoryDC memDc(bmp);

int width = bmp.GetWidth();
int height = bmp.GetHeight();

Expand Down Expand Up @@ -973,7 +973,7 @@ void GUI_App::post_init()
}
}

// Start preset sync after project opened, otherwise we could have preset change during project opening which could cause crash
// Start preset sync after project opened, otherwise we could have preset change during project opening which could cause crash
if (app_config->get("sync_user_preset") == "true") {
// BBS loading user preset
// Always async, not such startup step
Expand Down Expand Up @@ -1004,7 +1004,7 @@ void GUI_App::post_init()
this->preset_updater->sync(http_url, language, network_ver, sys_preset ? preset_bundle : nullptr);
this->preset_updater->sync_web_async(true);
this->check_new_version_sf(false, false);

});
}

Expand Down Expand Up @@ -1823,7 +1823,7 @@ void GUI_App::init_networking_callbacks()
else {
obj->parse_json(msg, true);
}


if (!this->is_enable_multi_machine()) {
if ((sel == obj || sel == nullptr) && obj->is_ams_need_update) {
Expand Down Expand Up @@ -2371,7 +2371,7 @@ bool GUI_App::on_init_inner()
#endif

BOOST_LOG_TRIVIAL(info) << boost::format("gui mode, Current Snapmaker_Orca Version %1%")%Snapmaker_VERSION;

#if defined(__WINDOWS__)
HMODULE hKernel32 = GetModuleHandleW(L"kernel32.dll");
m_is_arm64 = false;
Expand Down Expand Up @@ -2560,7 +2560,7 @@ bool GUI_App::on_init_inner()
skip_this_version = false;
}
}
if (!skip_this_version || evt.GetInt() != 0) {
if (!skip_this_version || evt.GetInt() != 0) {
wxString extmsg = wxString::FromUTF8(version_info.description);
if(!m_updateDialog)
return;
Expand All @@ -2570,8 +2570,8 @@ bool GUI_App::on_init_inner()
}
m_updateDialog->Raise();
m_updateDialog->Show();
m_updateDialog->setUrl(version_info.url);
m_updateDialog->setUrl(version_info.url);

}
}
});
Expand All @@ -2587,7 +2587,7 @@ bool GUI_App::on_init_inner()
false,
wxCENTER | wxICON_INFORMATION);
dialog.SetExtendedMessage(description_text);

int result = dialog.ShowModal();
switch (result)
{
Expand All @@ -2599,7 +2599,7 @@ bool GUI_App::on_init_inner()
wxGetApp().mainframe->Close(true);
break;
case wxID_CANCEL:
wxGetApp().mainframe->Close(true);
wxGetApp().mainframe->Close(true);
break;
default:
wxGetApp().mainframe->Close(true);
Expand Down Expand Up @@ -2831,6 +2831,16 @@ bool GUI_App::on_init_inner()
"configuration file.\nPlease note, application settings will be lost, but printer profiles will not be affected."));
}

// WebSocket debug server: only when Preferences → "Web Debug Mode" (websocket_debug) is on.
// When off, explicitly stop the debug server so port 8766 is not left listening.
const bool websocket_debug_pref = app_config->get_bool("websocket_debug");
if (websocket_debug_pref) {
BOOST_LOG_TRIVIAL(info) << "Web Debug Mode enabled in preferences, starting WebSocket debug server (port 8766)";
Slic3r::GUI::SSWCP::enable_debug_mode(true, 8766);
} else {
Slic3r::GUI::SSWCP::enable_debug_mode(false, 8766);
}

return true;
}

Expand Down Expand Up @@ -2878,7 +2888,7 @@ void GUI_App::machine_find()
// wcp订阅
json data = this->app_config->get_devices();
wxGetApp().device_card_notify(data);

});
}
}
Expand Down Expand Up @@ -3644,7 +3654,7 @@ void GUI_App::recreate_GUI(const wxString &msg_name)
std::string printer_model = printer_model_opt->value;
is_snapmaker_u1 = boost::icontains(printer_model, "Snapmaker") && boost::icontains(printer_model, "U1");
}

if (!preset_bundle->is_bbl_vendor()) {
if (is_snapmaker_u1) {
wxString url = wxString::FromUTF8(LOCALHOST_URL + std::to_string(get_page_http_port()) + "/web/flutter_web/index.html?path=2");
Expand All @@ -3658,7 +3668,7 @@ void GUI_App::recreate_GUI(const wxString &msg_name)
}

wxGetApp().device_card_notify(devices);

BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "recreate_GUI exit";
}

Expand Down Expand Up @@ -4320,17 +4330,17 @@ std::string GUI_App::handle_web_request(std::string cmd)
if (path.has_value()) {
wxLaunchDefaultBrowser(path.value());
}
}
}
else if (command_str.compare("homepage_makerlab_get") == 0) {
//if (mainframe->m_webview) { mainframe->m_webview->SendMakerlabList(); }
}
else if (command_str.compare("makerworld_model_open") == 0)
else if (command_str.compare("makerworld_model_open") == 0)
{
if (root.get_child_optional("model") != boost::none) {
pt::ptree data_node = root.get_child("model");
boost::optional<std::string> path = data_node.get_optional<std::string>("url");
if (path.has_value())
{
if (path.has_value())
{
wxString realurl = from_u8(url_decode(path.value()));
wxGetApp().request_model_download(realurl);
}
Expand Down Expand Up @@ -4387,7 +4397,7 @@ void GUI_App::request_open_project(std::string project_id)
CallAfter([this, project_id] { mainframe->open_recent_project(-1, wxString::FromUTF8(project_id)); });
}

void GUI_App::sm_request_remove_project(std::string project_id)
void GUI_App::sm_request_remove_project(std::string project_id)
{
mainframe->sm_remove_recent_project(wxString::FromUTF8(project_id));
}
Expand Down Expand Up @@ -4781,7 +4791,7 @@ void GUI_App::check_web_version()
}

void GUI_App::check_preset_version()
{
{
if (preset_updater != nullptr)
preset_updater->sync_config_async();
}
Expand Down Expand Up @@ -4849,11 +4859,11 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
if (platformType == "win") {
fileSize = defaultObj.value("file_size", 0);
fileMd5 = defaultObj.value("file_md5", "");
fileSha256 = defaultObj.value("file_sha256", "");
version_info.url = defaultObj.value("file_url", "");
fileSha256 = defaultObj.value("file_sha256", "");
version_info.url = defaultObj.value("file_url", "");

reservedData = defaultObj.value("reserved_1", "");
reservedData2 = defaultObj.value("reserved_2", "");
reservedData2 = defaultObj.value("reserved_2", "");
}
else if (platformType == "mac")
{
Expand Down Expand Up @@ -4882,8 +4892,8 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
version_info.url = platformObj.value("file_url", "");

reservedData = platformObj.value("reserved_1", "");
reservedData2 = platformObj.value("reserved_2", "");
reservedData2 = platformObj.value("reserved_2", "");

}
else
{
Expand Down Expand Up @@ -4920,7 +4930,7 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
GUI::wxGetApp().QueueEvent(evt);
} catch (const std::exception& ex) {
std::string errorMsg = ex.what();
BOOST_LOG_TRIVIAL(fatal) << "request server soft update data error:" << errorMsg;
BOOST_LOG_TRIVIAL(fatal) << "request server soft update data error:" << errorMsg;
}
})
.perform();
Expand Down Expand Up @@ -5353,7 +5363,7 @@ void GUI_App::stop_sync_user_preset()
// m_http_server.stop();
//}

void GUI_App::start_page_http_server()
void GUI_App::start_page_http_server()
{
if (!m_page_http_server.is_started())
m_page_http_server.start();
Expand Down Expand Up @@ -6629,7 +6639,7 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
}
auto isAgree = wxGetApp().app_config->get("app", PRIVACY_POLICY_FLAGS);

user_update_privacy_notify(isAgree == "true");
user_update_privacy_notify(isAgree == "true");
BOOST_LOG_TRIVIAL(warning) << "run_wizard changed the privacy policy with: " << (isAgree);
return res;
}
Expand Down Expand Up @@ -6841,7 +6851,7 @@ void GUI_App::user_update_privacy_notify(const bool& res)
json data;

data[PRIVACY_POLICY_FLAGS] = res;

for (const auto& instance : m_user_update_privacy_subscribers) {
auto ptr = instance.second.lock();
if (ptr) {
Expand All @@ -6866,17 +6876,17 @@ void GUI_App::user_login_notify(const json& res)
bool GUI_App::config_wizard_startup()
{
auto isAgree = wxGetApp().app_config->get("app", PRIVACY_POLICY_FLAGS);
user_update_privacy_notify(isAgree == "true");
user_update_privacy_notify(isAgree == "true");
BOOST_LOG_TRIVIAL(warning) << "config_wizard_startup changed the privacy policy with: " << (isAgree);
if (!m_app_conf_exists || preset_bundle->printers.only_default_printers()) {
BOOST_LOG_TRIVIAL(info) << "run wizard...";
run_wizard(ConfigWizard::RR_DATA_EMPTY);
BOOST_LOG_TRIVIAL(info) << "finished run wizard";

return true;
}
}

if (isAgree.empty())
if (isAgree.empty())
{
run_wizard(ConfigWizard::RR_DATA_EMPTY); // Compatible with older versions
return true;
Expand Down Expand Up @@ -7164,7 +7174,7 @@ bool GUI_App::sm_disconnect_current_machine(bool need_reload_printerview)
// wxGetApp().load_current_presets();

});

}

return true;
Expand Down
2 changes: 2 additions & 0 deletions src/slic3r/GUI/GUI_App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ class GUI_App : public wxApp
bool is_user_login();

wxString get_international_url(const wxString& origin_url);
wxString flutter_web_base_url(const wxString& path);
wxString build_flutter_web_url(const wxString& path);

// SM
struct SMUserInfo
Expand Down
Loading
Loading