Merge pull request #133 from Snapmaker/dev_upgrade_alves

Dev upgrade alves
This commit is contained in:
Alves
2026-01-28 15:35:29 +08:00
committed by GitHub
28 changed files with 335 additions and 223 deletions
@@ -15297,6 +15297,15 @@ msgstr "OrcaSlicer 基于来自 Bambu Lab 的 Bambu Studio 开发而来。"
msgid "Printing by object with caution. This function may cause the print head to collide with printed parts during switching." msgid "Printing by object with caution. This function may cause the print head to collide with printed parts during switching."
msgstr "谨慎使用逐件打印,该功能可能会导致打印头切换时与打印件碰撞" msgstr "谨慎使用逐件打印,该功能可能会导致打印头切换时与打印件碰撞"
msgid "Check for Process Preset Updates"
msgstr "检查工艺预设新版本"
msgid "Check for Web Resource Updates"
msgstr "检查Web资源新版本"
msgid "Export Logs"
msgstr "日志导出"
#~ msgid "Improve shell precision by adjusting outer wall spacing. This also improves layer consistency." #~ msgid "Improve shell precision by adjusting outer wall spacing. This also improves layer consistency."
#~ msgstr "优化外墙刀路以提高外墙精度。这个优化同时减少层纹" #~ msgstr "优化外墙刀路以提高外墙精度。这个优化同时减少层纹"
+108 -77
View File
@@ -30,7 +30,9 @@
#include <cstdlib> #include <cstdlib>
#include <atomic> #include <atomic>
#include <random> #include <random>
#include <mutex>
#include "common_func/common_func.hpp" #include "common_func/common_func.hpp"
#include <iostream>
namespace Slic3r { namespace Slic3r {
@@ -63,67 +65,6 @@ static sentry_value_t on_crash_callback(const sentry_ucontext_t* uctx, sentry_va
return log; return log;
} }
static sentry_value_t before_send(sentry_value_t event, void* hint, void* data)
{
sentry_value_t level_val = sentry_value_get_by_key(event, SENTRY_KEY_LEVEL);
std::string levelName = sentry_value_as_string(level_val);
std::string eventLevel = sentry_value_as_string(sentry_value_get_by_key(event, SENTRY_KEY_LEVEL));
//module name
sentry_value_t moduleValue = sentry_value_get_by_key(event, "logger");
std::string moduleName = sentry_value_as_string(moduleValue);
if (MACHINE_MODULE == moduleName)
{
srand((unsigned int) time(0));
int random_num = rand() % 100;
int randNumber = rand() % 100 + 1;
if (randNumber < 85)
{
sentry_value_decref(event);
return sentry_value_new_null();
}
else
{
return event;
}
}
if (!get_privacy_policy() && levelName == SENTRY_EVENT_TRACE) {
sentry_value_decref(event);
return sentry_value_new_null();
}
if (SENTRY_EVENT_FATAL == eventLevel ||
SENTRY_EVENT_ERROR == eventLevel ||
SENTRY_EVENT_TRACE == eventLevel)
{
return event;
}
else if (SENTRY_EVENT_WARNING == eventLevel)
{
srand((unsigned int) time(0));
int random_num = rand() % 100;
int randNumber = rand() % 100 + 1;
if (randNumber > 5)
{
sentry_value_decref(event);
return sentry_value_new_null();
}
else
{
return event;
}
}
//info trace debug not report
sentry_value_decref(event);
return sentry_value_new_null();
}
void initSentryEx() void initSentryEx()
{ {
sentry_options_t* options = sentry_options_new(); sentry_options_t* options = sentry_options_new();
@@ -154,43 +95,134 @@ void initSentryEx()
dataBaseDir = home_env; dataBaseDir = home_env;
dataBaseDir = dataBaseDir + "/Library/Application Support/Snapmaker_Orca/SentryData"; dataBaseDir = dataBaseDir + "/Library/Application Support/Snapmaker_Orca/SentryData";
#elif _WIN32 #elif _WIN32
wchar_t exeDir[MAX_PATH]; // Use extended path length support for Windows (up to 32767 characters)
::GetModuleFileNameW(nullptr, exeDir, MAX_PATH); const DWORD MAX_PATH_EXTENDED = 32767;
std::wstring wsExeDir(exeDir); wchar_t exeDir[MAX_PATH_EXTENDED];
int nPos = wsExeDir.find_last_of('\\'); DWORD pathLen = ::GetModuleFileNameW(nullptr, exeDir, MAX_PATH_EXTENDED);
// GetModuleFileNameW returns 0 on error, or the number of characters written (excluding null terminator)
// If return value equals buffer size, the path was truncated
if (pathLen == 0) {
// Failed to get module path, use fallback
DWORD lastError = GetLastError();
std::cout<< "Failed to get module file name, error: " << lastError;
handlerDir = "";
dataBaseDir = "";
} else if (pathLen >= MAX_PATH_EXTENDED) {
// Path was truncated, which shouldn't happen with MAX_PATH_EXTENDED
std::cout<< "Module file path too long or truncated, length: " << pathLen;
handlerDir = "";
dataBaseDir = "";
} else {
// Ensure null termination (GetModuleFileNameW should do this, but be safe)
exeDir[pathLen] = L'\0';
std::wstring wsExeDir(exeDir, pathLen);
size_t nPos = wsExeDir.find_last_of(L'\\');
if (nPos == std::wstring::npos) {
// No backslash found, use current directory as fallback
std::cout<< "No backslash found in executable path, using current directory";
nPos = 0;
}
// Ensure nPos + 1 doesn't exceed string length
if (nPos + 1 > wsExeDir.length()) {
std::cout<< "Invalid path position, using full path";
nPos = wsExeDir.length();
}
std::wstring wsDmpDir = wsExeDir.substr(0, nPos + 1); std::wstring wsDmpDir = wsExeDir.substr(0, nPos + 1);
std::wstring desDir = wsDmpDir + L"crashpad_handler.exe"; std::wstring desDir = wsDmpDir + L"crashpad_handler.exe";
wsDmpDir += L"dump"; wsDmpDir += L"dump";
auto wstringTostring = [](std::wstring wTmpStr) -> std::string { auto wstringTostring = [](const std::wstring& wTmpStr) -> std::string {
std::string resStr = std::string(); if (wTmpStr.empty())
int len = WideCharToMultiByte(CP_UTF8, 0, wTmpStr.c_str(), -1, nullptr, 0, nullptr, nullptr);
if (len <= 0)
return std::string(); return std::string();
std::string desStr(len, 0); int len = WideCharToMultiByte(CP_UTF8, 0, wTmpStr.c_str(), -1, nullptr, 0, nullptr, nullptr);
WideCharToMultiByte(CP_UTF8, 0, wTmpStr.c_str(), -1, &desStr[0], len, nullptr, nullptr); if (len <= 0) {
resStr = desStr; std::cout<< "WideCharToMultiByte failed, error: " << GetLastError();
return std::string();
}
return resStr; // Allocate buffer with size len (includes null terminator)
std::string desStr;
desStr.resize(len - 1); // Reserve space excluding null terminator
int result = WideCharToMultiByte(CP_UTF8, 0, wTmpStr.c_str(), -1, &desStr[0], len, nullptr, nullptr);
if (result == 0 || result != len) {
std::cout<< "WideCharToMultiByte conversion failed, error: " << GetLastError();
return std::string();
}
// Remove null terminator if present (safely check before accessing)
if (!desStr.empty() && desStr.back() == '\0')
desStr.pop_back();
return desStr;
}; };
handlerDir = wstringTostring(desDir); handlerDir = wstringTostring(desDir);
}
// Get LocalAppData folder path
PWSTR pszPath = nullptr; PWSTR pszPath = nullptr;
char* path = new char[MAX_PATH](); char* path = nullptr;
size_t pathLength = 0; size_t pathLength = 0;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pszPath); HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pszPath);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr) && pszPath != nullptr) {
wcstombs_s(&pathLength, path, MAX_PATH, pszPath, MAX_PATH); // Calculate required buffer size first
size_t wcsLen = wcslen(pszPath);
if (wcsLen > 0 && wcsLen < SIZE_MAX / 3) { // Check for overflow
// Allocate buffer with extra space for safety
size_t requiredSize = wcsLen * 3 + 1; // UTF-8 can be up to 3 bytes per wchar
path = new (std::nothrow) char[requiredSize]();
if (path != nullptr) {
errno_t err = wcstombs_s(&pathLength, path, requiredSize, pszPath, _TRUNCATE);
if (err != 0) {
std::cout<< "wcstombs_s failed, error: " << err;
delete[] path;
path = nullptr;
}
} else {
std::cout<< "Failed to allocate memory for path conversion";
}
} else if (wcsLen == 0) {
std::cout<< "SHGetKnownFolderPath returned empty path";
} else {
std::cout<< "Path length overflow detected: " << wcsLen;
}
// Always free the path returned by SHGetKnownFolderPath
CoTaskMemFree(pszPath); CoTaskMemFree(pszPath);
pszPath = nullptr;
} else {
std::cout<< "SHGetKnownFolderPath failed, hr: " << std::hex << hr;
// Ensure pszPath is freed even on failure (though it should be nullptr)
if (pszPath != nullptr) {
CoTaskMemFree(pszPath);
pszPath = nullptr;
}
} }
if (path != nullptr) {
std::string filePath = path; std::string filePath = path;
std::string appName = "\\" + std::string("Snapmaker_Orca\\"); std::string appName = "\\" + std::string("Snapmaker_Orca\\");
dataBaseDir = filePath + appName; dataBaseDir = filePath + appName;
delete[] path; delete[] path;
path = nullptr;
} else {
// Fallback: use temp directory
char tempPath[MAX_PATH];
if (GetTempPathA(MAX_PATH, tempPath) != 0) {
dataBaseDir = std::string(tempPath) + "Snapmaker_Orca\\";
std::cout<< "Using temp directory as fallback for Sentry data: " << dataBaseDir;
} else {
dataBaseDir = "";
std::cout<< "Failed to get temp path, Sentry data directory will be empty";
}
}
#endif #endif
if (!handlerDir.empty()) if (!handlerDir.empty())
@@ -211,7 +243,6 @@ void initSentryEx()
sentry_options_set_auto_session_tracking(options, 0); sentry_options_set_auto_session_tracking(options, 0);
sentry_options_set_symbolize_stacktraces(options, 1); sentry_options_set_symbolize_stacktraces(options, 1);
sentry_options_set_on_crash(options, on_crash_callback, NULL); sentry_options_set_on_crash(options, on_crash_callback, NULL);
sentry_options_set_before_send(options, before_send, NULL);
sentry_options_set_sample_rate(options, 1.0); sentry_options_set_sample_rate(options, 1.0);
sentry_options_set_traces_sample_rate(options, 1.0); sentry_options_set_traces_sample_rate(options, 1.0);
+1 -1
View File
@@ -846,7 +846,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
apply(config, &new_conf); apply(config, &new_conf);
} }
toggle_line("overhang_reverse_threshold", has_detect_overhang_wall && allow_overhang_reverse && has_overhang_reverse && !has_overhang_reverse_internal_only); toggle_line("overhang_reverse_threshold", has_detect_overhang_wall && allow_overhang_reverse && has_overhang_reverse && !has_overhang_reverse_internal_only);
toggle_line("timelapse_type", true); toggle_line("timelapse_type", is_BBL_Printer);
bool have_small_area_infill_flow_compensation = config->opt_bool("small_area_infill_flow_compensation"); bool have_small_area_infill_flow_compensation = config->opt_bool("small_area_infill_flow_compensation");
+25 -36
View File
@@ -2516,24 +2516,16 @@ bool GUI_App::on_init_inner()
skip_this_version = false; skip_this_version = false;
} }
} }
if (!skip_this_version if (!skip_this_version || evt.GetInt() != 0) {
|| evt.GetInt() != 0) {
UpdateVersionDialog dialog(this->mainframe);
wxString extmsg = wxString::FromUTF8(version_info.description); wxString extmsg = wxString::FromUTF8(version_info.description);
dialog.update_version_info(extmsg, version_info.version_str); m_updateDialog->update_version_info(extmsg, version_info.version_str);
if (evt.GetInt() != 0) { if (evt.GetInt() != 0) {
dialog.m_button_skip_version->Hide(); m_updateDialog->m_button_skip_version->Hide();
}
switch (dialog.ShowModal())
{
case wxID_YES:
wxLaunchDefaultBrowser(version_info.url);
break;
case wxID_NO:
break;
default:
;
} }
m_updateDialog->Raise();
m_updateDialog->Show();
m_updateDialog->setUrl(version_info.url);
} }
} }
}); });
@@ -2669,6 +2661,13 @@ bool GUI_App::on_init_inner()
BOOST_LOG_TRIVIAL(info) << "create the main window"; BOOST_LOG_TRIVIAL(info) << "create the main window";
mainframe = new MainFrame(); mainframe = new MainFrame();
m_updateDialog = new UpdateVersionDialog(mainframe);
m_updateDialog->Hide();
m_updateDialog->Bind(EVT_DOWN_URL_PACK, [this](wxCommandEvent& event) {
auto downloadUlr = m_updateDialog->getUrl();
wxLaunchDefaultBrowser(downloadUlr);
});
// hide settings tabs after first Layout // hide settings tabs after first Layout
if (is_editor()) { if (is_editor()) {
mainframe->select_tab(size_t(0)); mainframe->select_tab(size_t(0));
@@ -4045,18 +4044,14 @@ wxString GUI_App::get_international_url(const wxString& origin_url) {
string dark_mode = wxGetApp().app_config->get("dark_color_mode"); string dark_mode = wxGetApp().app_config->get("dark_color_mode");
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree");
std::string useAgree = (isAgree == "true" ? "1" : "0");
if (baseUrl.find("?") != std::string::npos) { if (baseUrl.find("?") != std::string::npos) {
return baseUrl + wxString::FromUTF8("&locale=") + lang + wxString::FromUTF8("-") + region + return baseUrl + wxString::FromUTF8("&locale=") + lang + wxString::FromUTF8("-") + region +
wxString::FromUTF8("&dark_mode=" + dark_mode) + wxString::FromUTF8("&privacy_policy_isagree=" + useAgree); wxString::FromUTF8("&dark_mode=" + dark_mode);
} else { } else {
return baseUrl + wxString::FromUTF8("?locale=") + lang + wxString::FromUTF8("-") + region + return baseUrl + wxString::FromUTF8("?locale=") + lang + wxString::FromUTF8("-") + region +
wxString::FromUTF8("&dark_mode=" + dark_mode) + wxString::FromUTF8("&privacy_policy_isagree=" + useAgree); wxString::FromUTF8("&dark_mode=" + dark_mode);
} }
} }
bool GUI_App::is_user_login() bool GUI_App::is_user_login()
@@ -4857,12 +4852,12 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
Semver server_version = get_version(version_info.version_str, matcher); Semver server_version = get_version(version_info.version_str, matcher);
if (current_version >= server_version && by_user) { if (current_version >= server_version) {
if(by_user)
this->no_new_version(); this->no_new_version();
return; return;
} }
//if (true)
if (isForceUpgrade) if (isForceUpgrade)
{ {
wxGetApp().app_config->set_bool("force_upgrade", version_info.force_upgrade); wxGetApp().app_config->set_bool("force_upgrade", version_info.force_upgrade);
@@ -4879,7 +4874,10 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
if (by_user) if (by_user)
evt->SetInt(UPDATE_BY_USER); evt->SetInt(UPDATE_BY_USER);
GUI::wxGetApp().QueueEvent(evt); GUI::wxGetApp().QueueEvent(evt);
} catch (...) {} } catch (const std::exception& ex) {
std::string errorMsg = ex.what();
BOOST_LOG_TRIVIAL(fatal) << "request server soft update data error:" << errorMsg;
}
}) })
.perform_sync(); .perform_sync();
} }
@@ -6690,15 +6688,6 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
{ {
wxCHECK_MSG(mainframe != nullptr, false, "Internal error: Main frame not created / null"); wxCHECK_MSG(mainframe != nullptr, false, "Internal error: Main frame not created / null");
//if (reason == ConfigWizard::RR_USER) {
// //TODO: turn off it currently, maybe need to turn on in the future
// if (preset_updater->config_update(app_config->orig_version(), PresetUpdater::UpdateParams::FORCED_BEFORE_WIZARD) == PresetUpdater::R_ALL_CANCELED)
// return false;
//}
//auto wizard_t = new ConfigWizard(mainframe);
//const bool res = wizard_t->run(reason, start_page);
std::string strFinish = wxGetApp().app_config->get("firstguide", "finish"); std::string strFinish = wxGetApp().app_config->get("firstguide", "finish");
long pStyle = wxCAPTION | wxCLOSE_BOX | wxSYSTEM_MENU; long pStyle = wxCAPTION | wxCLOSE_BOX | wxSYSTEM_MENU;
if (strFinish == "false" || strFinish.empty()) if (strFinish == "false" || strFinish.empty())
@@ -6719,7 +6708,7 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
mainframe->refresh_plugin_tips(); mainframe->refresh_plugin_tips();
// BBS: remove SLA related message // BBS: remove SLA related message
} }
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree"); 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); BOOST_LOG_TRIVIAL(warning) << "run_wizard changed the privacy policy with: " << (isAgree);
@@ -6932,7 +6921,7 @@ void GUI_App::user_update_privacy_notify(const bool& res)
json data; json data;
data["privacy_policy_isagree"] = res; data[PRIVACY_POLICY_FLAGS] = res;
for (const auto& instance : m_user_update_privacy_subscribers) { for (const auto& instance : m_user_update_privacy_subscribers) {
auto ptr = instance.second.lock(); auto ptr = instance.second.lock();
@@ -6957,7 +6946,7 @@ void GUI_App::user_login_notify(const json& res)
bool GUI_App::config_wizard_startup() bool GUI_App::config_wizard_startup()
{ {
auto isAgree = wxGetApp().app_config->get("app", "privacy_policy_isagree"); 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); BOOST_LOG_TRIVIAL(warning) << "config_wizard_startup changed the privacy policy with: " << (isAgree);
if (!m_app_conf_exists || preset_bundle->printers.only_default_printers()) { if (!m_app_conf_exists || preset_bundle->printers.only_default_printers()) {
+9
View File
@@ -46,6 +46,8 @@
#define _MSW_DARK_MODE 1 #define _MSW_DARK_MODE 1
#endif // _MSW_DARK_MODE #endif // _MSW_DARK_MODE
#define PRIVACY_POLICY_FLAGS "privacy_policy_isagree"
class wxMenuItem; class wxMenuItem;
class wxMenuBar; class wxMenuBar;
class wxTopLevelWindow; class wxTopLevelWindow;
@@ -55,7 +57,13 @@ class wxBookCtrlBase;
class Notebook; class Notebook;
struct wxLanguageInfo; struct wxLanguageInfo;
namespace Slic3r {
namespace GUI {
class UpdateVersionDialog;
};
};
// namespace Slice3rnamespace GUI::Slice3rnamespace GUI
namespace Slic3r { namespace Slic3r {
class AppConfig; class AppConfig;
@@ -717,6 +725,7 @@ private:
PresetUpdater* preset_updater{ nullptr }; PresetUpdater* preset_updater{ nullptr };
MainFrame* mainframe{ nullptr }; MainFrame* mainframe{ nullptr };
Plater* plater_{ nullptr }; Plater* plater_{ nullptr };
UpdateVersionDialog* m_updateDialog{nullptr};
PresetUpdater* get_preset_updater() { return preset_updater; } PresetUpdater* get_preset_updater() { return preset_updater; }
+4 -3
View File
@@ -1747,8 +1747,9 @@ wxBoxSizer* MainFrame::create_side_tools()
{ {
SidePopup* p = new SidePopup(this); SidePopup* p = new SidePopup(this);
// if (wxGetApp().preset_bundle && !wxGetApp().preset_bundle->is_bbl_vendor()) if (wxGetApp().preset_bundle && !wxGetApp().preset_bundle->is_bbl_vendor())
if (0) { //if (0)
{
// ThirdParty Buttons // ThirdParty Buttons
SideButton* export_gcode_btn = new SideButton(p, _L("Export G-code file"), ""); SideButton* export_gcode_btn = new SideButton(p, _L("Export G-code file"), "");
export_gcode_btn->SetCornerRadius(0); export_gcode_btn->SetCornerRadius(0);
@@ -2264,7 +2265,7 @@ static wxMenu* generate_help_menu()
"", nullptr, []() { return true; }); "", nullptr, []() { return true; });
append_menu_item( append_menu_item(
helpMenu, wxID_ANY, _L("Check for Web ResourceUpdates"), _L("Check for Web ResourceUpdates"), helpMenu, wxID_ANY, _L("Check for Web Resource Updates"), _L("Check for Web Resource Updates"),
[](wxCommandEvent&) { [](wxCommandEvent&) {
wxGetApp().check_web_version(); wxGetApp().check_web_version();
}, },
-1
View File
@@ -281,7 +281,6 @@ void MarkdownTip::OnError(wxWebViewEvent& event)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":MarkdownTip error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":MarkdownTip error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init MarkdownTip webview fail", BP_WEB_VIEW);
} }
void MarkdownTip::OnTimer(wxTimerEvent& event) void MarkdownTip::OnTimer(wxTimerEvent& event)
+1 -1
View File
@@ -172,7 +172,7 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con
btn->SetFocus(); btn->SetFocus();
btn_sizer->Add(btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceButtonGap())); btn_sizer->Add(btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceButtonGap()));
btn->Bind(wxEVT_BUTTON, [this, btn_id](wxCommandEvent&) { EndModal(btn_id); }); btn->Bind(wxEVT_BUTTON, [this, btn_id](wxCommandEvent&) { EndModal(btn_id); });
btn->SetCursor(wxCURSOR_HAND);
MsgButton *mb = new MsgButton; MsgButton *mb = new MsgButton;
ButtonData *bd = new ButtonData; ButtonData *bd = new ButtonData;
-10
View File
@@ -13818,16 +13818,6 @@ void Plater::send_gcode_legacy(int plate_idx, Export3mfProgressFn proFn, bool us
upload_job = PrintHostJob(physical_printer_config); upload_job = PrintHostJob(physical_printer_config);
} }
//if (wxGetApp().app_config->get("use_new_connect") == "true") {
// /*std::shared_ptr<PrintHost> temp;
// wxGetApp().get_connect_host(temp);
// upload_job.printhost = std::unique_ptr<PrintHost>(temp.get());*/
// upload_job = PrintHostJob(wxGetApp().get_host_config());
//} else {
// upload_job = PrintHostJob(physical_printer_config); //
//}
if (upload_job.empty()) if (upload_job.empty())
return; return;
+3 -3
View File
@@ -748,9 +748,9 @@ 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 == "privacy_policy_isagree") if (param == PRIVACY_POLICY_FLAGS)
{ {
app_config->set("app", "privacy_policy_isagree", checkbox->GetValue()); app_config->set("app", PRIVACY_POLICY_FLAGS, checkbox->GetValue());
BOOST_LOG_TRIVIAL(warning) <<"create_item_checkbox changed the privacy policy with: "<<(checkbox->GetValue()?"true" : "false"); BOOST_LOG_TRIVIAL(warning) <<"create_item_checkbox changed the privacy policy with: "<<(checkbox->GetValue()?"true" : "false");
wxGetApp().user_update_privacy_notify(checkbox->GetValue()); wxGetApp().user_update_privacy_notify(checkbox->GetValue());
} }
@@ -1300,7 +1300,7 @@ wxWindow* PreferencesDialog::create_general_page()
std::string region = app_config->get("language"); std::string region = app_config->get("language");
auto title_user_experience = create_item_title(_L("User Experience"), page, _L("User Experience")); auto title_user_experience = create_item_title(_L("User Experience"), page, _L("User Experience"));
auto item_priv_policy = create_item_checkbox(_L("Join Customer Experience Improvement Program."), page, _L(""), 50, "privacy_policy_isagree"); auto item_priv_policy = create_item_checkbox(_L("Join Customer Experience Improvement Program."), page, _L(""), 50,PRIVACY_POLICY_FLAGS);
wxHyperlinkCtrl* hyperlink = nullptr; wxHyperlinkCtrl* hyperlink = nullptr;
if (region.empty() || region != "zh_CN") if (region.empty() || region != "zh_CN")
hyperlink = new wxHyperlinkCtrl(page, wxID_ANY, _L("What data would be collected?"), enUrl); hyperlink = new wxHyperlinkCtrl(page, wxID_ANY, _L("What data would be collected?"), enUrl);
-1
View File
@@ -185,7 +185,6 @@ void PrinterWebView::OnError(wxWebViewEvent &evt)
break; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":PrinterWebView error loading page %1% %2% %3% %4%") %evt.GetURL() %evt.GetTarget() %e %evt.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":PrinterWebView error loading page %1% %2% %3% %4%") %evt.GetURL() %evt.GetTarget() %e %evt.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init PrinterWebView webview fail", BP_WEB_VIEW);
} }
void PrinterWebView::OnLoaded(wxWebViewEvent &evt) void PrinterWebView::OnLoaded(wxWebViewEvent &evt)
+15 -14
View File
@@ -44,6 +44,7 @@ wxDEFINE_EVENT(EVT_UPDATE_NOZZLE, wxCommandEvent);
wxDEFINE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent); wxDEFINE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent);
wxDEFINE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent); wxDEFINE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent);
wxDEFINE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent); wxDEFINE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent);
wxDEFINE_EVENT(EVT_DOWN_URL_PACK, wxCommandEvent);
ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/) ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/)
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Release Note"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) : DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Release Note"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
@@ -333,7 +334,13 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
m_button_download->SetCursor(wxCURSOR_HAND); m_button_download->SetCursor(wxCURSOR_HAND);
m_button_download->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { m_button_download->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
EndModal(wxID_YES); wxCommandEvent event(EVT_DOWN_URL_PACK);
wxPostEvent(this, event);
if (isModal)
EndModal(wxID_NO);
else
Close();
}); });
m_button_skip_version = new Button(this, _L("Skip this Version")); m_button_skip_version = new Button(this, _L("Skip this Version"));
@@ -347,7 +354,10 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
m_button_skip_version->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { m_button_skip_version->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
wxGetApp().set_skip_version(true); wxGetApp().set_skip_version(true);
if (isModal)
EndModal(wxID_NO); EndModal(wxID_NO);
else
Close();
}); });
m_cb_stable_only = new CheckBox(this); m_cb_stable_only = new CheckBox(this);
@@ -377,7 +387,11 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
m_button_cancel->SetCursor(wxCURSOR_HAND); m_button_cancel->SetCursor(wxCURSOR_HAND);
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
if (isModal)
EndModal(wxID_NO); EndModal(wxID_NO);
else
Close();
}); });
m_sizer_main->Add(m_line_top, 0, wxEXPAND | wxBOTTOM, 0); m_sizer_main->Add(m_line_top, 0, wxEXPAND | wxBOTTOM, 0);
@@ -446,7 +460,6 @@ void UpdateVersionDialog::OnError(wxWebViewEvent& event)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":UpdateVersionDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e %event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":UpdateVersionDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e %event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init UpdateVersionDialog webview fail", BP_WEB_VIEW);
event.Skip(); event.Skip();
} }
@@ -514,18 +527,6 @@ void UpdateVersionDialog::update_version_info(wxString release_note, wxString ve
//bbs check whether the web display is used //bbs check whether the web display is used
bool use_web_link = false; bool use_web_link = false;
url_line = ""; url_line = "";
// Orca: not used in Orca Slicer
// auto split_array = splitWithStl(release_note.ToStdString(), "###");
// if (split_array.size() >= 3) {
// for (auto i = 0; i < split_array.size(); i++) {
// std::string url = split_array[i];
// if (std::strstr(url.c_str(), "http://") != NULL || std::strstr(url.c_str(), "https://") != NULL) {
// use_web_link = true;
// url_line = url;
// break;
// }
// }
// }
if (use_web_link) { if (use_web_link) {
m_brand->Hide(); m_brand->Hide();
+6
View File
@@ -51,6 +51,7 @@ wxDECLARE_EVENT(EVT_LOAD_VAMS_TRAY, wxCommandEvent);
wxDECLARE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent); wxDECLARE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent);
wxDECLARE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent); wxDECLARE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent);
wxDECLARE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent); wxDECLARE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent);
wxDECLARE_EVENT(EVT_DOWN_URL_PACK, wxCommandEvent);
class ReleaseNoteDialog : public DPIDialog class ReleaseNoteDialog : public DPIDialog
{ {
@@ -95,6 +96,10 @@ public:
void update_version_info(wxString release_note, wxString version); void update_version_info(wxString release_note, wxString version);
std::vector<std::string> splitWithStl(std::string str, std::string pattern); std::vector<std::string> splitWithStl(std::string str, std::string pattern);
void setDialogMode(bool mode) { isModal = mode; }
std::string getUrl() { return m_url; }
void setUrl(const std::string downloadUrl) { m_url = downloadUrl; }
std::string m_url{""};
wxStaticBitmap* m_brand{nullptr}; wxStaticBitmap* m_brand{nullptr};
Label * m_text_up_info{nullptr}; Label * m_text_up_info{nullptr};
wxWebView* m_vebview_release_note{nullptr}; wxWebView* m_vebview_release_note{nullptr};
@@ -108,6 +113,7 @@ public:
Button* m_button_download; Button* m_button_download;
Button* m_button_cancel; Button* m_button_cancel;
std::string url_line; std::string url_line;
bool isModal = true;
}; };
class SecondaryCheckDialog : public DPIFrame class SecondaryCheckDialog : public DPIFrame
+72 -17
View File
@@ -1421,7 +1421,10 @@ void SSWCP_Instance::sw_Unsubscribe_Filter() {
} }
} }
} }
else
{
BOOST_LOG_TRIVIAL(warning) << "no this cmd for:" << cmd;
}
send_to_js(); send_to_js();
finish_job(); finish_job();
} }
@@ -2075,17 +2078,15 @@ void SSWCP_MachineOption_Instance::process()
sw_UploadCameraTimelapse(); sw_UploadCameraTimelapse();
} else if (m_cmd == "sw_DeleteCameraTimelapse") { } else if (m_cmd == "sw_DeleteCameraTimelapse") {
sw_DeleteCameraTimelapse(); sw_DeleteCameraTimelapse();
} else if (m_cmd == "sw_GetTimelapseInstance") { } else if (m_cmd == "sw_GetCameraTimelapseInstance") {
sw_GetTimelapseInstance(); sw_GetCameraTimelapseInstance();
} else if (m_cmd == "sw_ServerClientManagerSetUserinfo") { } else if (m_cmd == "sw_ServerClientManagerSetUserinfo") {
sw_ServerClientManagerSetUserinfo(); sw_ServerClientManagerSetUserinfo();
} else if (m_cmd == "sw_DefectDetactionConfig"){ } else if (m_cmd == "sw_DefectDetactionConfig"){
sw_DefectDetactionConfig(); sw_DefectDetactionConfig();
} else if (m_cmd == GETCAMERA_TIMELAPSE_INSTANCE) {
CmdForwarding();
} }
else if (m_cmd == GET_DEVICEDATA_STORAGESPACE) { else if (m_cmd == GET_DEVICEDATA_STORAGESPACE) {
CmdForwarding(); sw_GetDeviceDataStorageSpace();
} }
else { else {
handle_general_fail(); handle_general_fail();
@@ -3671,8 +3672,30 @@ void SSWCP_MachineOption_Instance::sw_UploadCameraTimelapse()
handle_general_fail(); handle_general_fail();
} }
} }
void SSWCP_MachineOption_Instance::CmdForwarding()
{
try {
std::shared_ptr<PrintHost> host = nullptr;
wxGetApp().get_connect_host(host);
void SSWCP_MachineOption_Instance::sw_GetTimelapseInstance() if (!host) {
handle_general_fail(-1, "Connection lost!");
return;
}
auto weak_self = std::weak_ptr<SSWCP_Instance>(shared_from_this());
host->test_async_wcp_mqtt_moonraker(m_param_data, [weak_self](const json& response) {
auto self = weak_self.lock();
if (self) {
SSWCP_Instance::on_mqtt_msg_arrived(self, response);
}
});
} catch (std::exception& e) {
handle_general_fail();
}
}
void SSWCP_MachineOption_Instance::sw_GetCameraTimelapseInstance()
{ {
try { try {
std::shared_ptr<PrintHost> host = nullptr; std::shared_ptr<PrintHost> host = nullptr;
@@ -3695,7 +3718,9 @@ void SSWCP_MachineOption_Instance::sw_GetTimelapseInstance()
handle_general_fail(); handle_general_fail();
} }
} }
void SSWCP_MachineOption_Instance::CmdForwarding() { void SSWCP_MachineOption_Instance::sw_GetDeviceDataStorageSpace()
{
try { try {
std::shared_ptr<PrintHost> host = nullptr; std::shared_ptr<PrintHost> host = nullptr;
wxGetApp().get_connect_host(host); wxGetApp().get_connect_host(host);
@@ -3706,7 +3731,7 @@ void SSWCP_MachineOption_Instance::CmdForwarding() {
} }
auto weak_self = std::weak_ptr<SSWCP_Instance>(shared_from_this()); auto weak_self = std::weak_ptr<SSWCP_Instance>(shared_from_this());
host->async_delete_camera_timelapse(m_param_data, [weak_self](const json& response) { host->async_get_userdata_space(m_param_data, [weak_self](const json& response) {
auto self = weak_self.lock(); auto self = weak_self.lock();
if (self) { if (self) {
SSWCP_Instance::on_mqtt_msg_arrived(self, response); SSWCP_Instance::on_mqtt_msg_arrived(self, response);
@@ -3717,7 +3742,6 @@ void SSWCP_MachineOption_Instance::CmdForwarding() {
} }
} }
void SSWCP_MachineOption_Instance::sw_DeleteCameraTimelapse() void SSWCP_MachineOption_Instance::sw_DeleteCameraTimelapse()
{ {
try { try {
@@ -3886,6 +3910,7 @@ void SSWCP_MachineConnect_Instance::sw_get_pin_code()
self->send_to_js(); self->send_to_js();
self->finish_job(); self->finish_job();
std::string dc_msg = "success"; std::string dc_msg = "success";
bool flag = mqtt_client->Disconnect(dc_msg); bool flag = mqtt_client->Disconnect(dc_msg);
wxGetApp().CallAfter([mqtt_client]() { delete mqtt_client; }); wxGetApp().CallAfter([mqtt_client]() { delete mqtt_client; });
@@ -4267,7 +4292,13 @@ void SSWCP_UserLogin_Instance::process()
sw_GetUserLoginState(); sw_GetUserLoginState();
} else if (m_cmd == "sw_SubscribeUserLoginState") { } else if (m_cmd == "sw_SubscribeUserLoginState") {
sw_SubscribeUserLoginState(); sw_SubscribeUserLoginState();
} else { }
else if (m_cmd == UPDATE_PRIVACY_STATUS) {
sw_SubUserUpdatePrivacy();
} else if (m_cmd == GET_PRIVACY_STATUS) {
sw_GetUserUpdatePrivacy();
}
else {
handle_general_fail(); handle_general_fail();
} }
} }
@@ -4331,6 +4362,33 @@ void SSWCP_UserLogin_Instance::sw_GetUserLoginState()
handle_general_fail(); handle_general_fail();
} }
} }
void SSWCP_UserLogin_Instance::sw_GetUserUpdatePrivacy()
{
json data;
auto isAgree = wxGetApp().app_config->get("app", PRIVACY_POLICY_FLAGS);
bool isUserAgree = false;
if (isAgree == "true")
isUserAgree = true;
data[PRIVACY_POLICY_FLAGS] = isUserAgree;
m_res_data = data;
send_to_js();
finish_job();
}
void SSWCP_UserLogin_Instance::sw_SubUserUpdatePrivacy()
{
try {
std::weak_ptr<SSWCP_Instance> weak_ptr = shared_from_this();
wxGetApp().m_user_update_privacy_subscribers[m_webview] = weak_ptr;
} catch (std::exception& e) {
handle_general_fail();
}
}
void SSWCP_UserLogin_Instance::sw_SubscribeUserLoginState() void SSWCP_UserLogin_Instance::sw_SubscribeUserLoginState()
{ {
@@ -5803,10 +5861,9 @@ std::unordered_set<std::string> SSWCP::m_machine_option_cmd_list = {
"sw_UpdateMachineFilamentInfo", "sw_UpdateMachineFilamentInfo",
"sw_UploadCameraTimelapse", "sw_UploadCameraTimelapse",
"sw_DeleteCameraTimelapse", "sw_DeleteCameraTimelapse",
"sw_GetTimelapseInstance", "sw_GetCameraTimelapseInstance",
"sw_ServerClientManagerSetUserinfo", "sw_ServerClientManagerSetUserinfo",
"sw_DefectDetactionConfig", "sw_DefectDetactionConfig",
GETCAMERA_TIMELAPSE_INSTANCE,
GET_DEVICEDATA_STORAGESPACE GET_DEVICEDATA_STORAGESPACE
}; };
@@ -5823,9 +5880,8 @@ std::unordered_set<std::string> SSWCP::m_project_cmd_list = {
"sw_NewProject", "sw_OpenProject", "sw_GetRecentProjects", "sw_OpenRecentFile", "sw_DeleteRecentFiles", "sw_SubscribeRecentFiles", "sw_NewProject", "sw_OpenProject", "sw_GetRecentProjects", "sw_OpenRecentFile", "sw_DeleteRecentFiles", "sw_SubscribeRecentFiles",
}; };
std::unordered_set<std::string> SSWCP::m_login_cmd_list = { std::unordered_set<std::string> SSWCP::m_login_cmd_list = {"sw_UserLogin", "sw_UserLogout", "sw_GetUserLoginState", "sw_SubscribeUserLoginState",
"sw_UserLogin", "sw_UserLogout", "sw_GetUserLoginState", "sw_SubscribeUserLoginState" UPDATE_PRIVACY_STATUS, GET_PRIVACY_STATUS};
};
std::unordered_set<std::string> SSWCP::m_machine_manage_cmd_list = { std::unordered_set<std::string> SSWCP::m_machine_manage_cmd_list = {
"sw_GetLocalDevices", "sw_AddDevice", "sw_SubscribeLocalDevices", "sw_RenameDevice", "sw_SwitchModel", "sw_DeleteDevices" "sw_GetLocalDevices", "sw_AddDevice", "sw_SubscribeLocalDevices", "sw_RenameDevice", "sw_SwitchModel", "sw_DeleteDevices"
@@ -5899,7 +5955,6 @@ void SSWCP::handle_web_message(std::string message, wxWebView* webview) {
if (payload.count("event_id") && !payload["event_id"].is_null()) { if (payload.count("event_id") && !payload["event_id"].is_null()) {
event_id = payload["event_id"].get<std::string>(); event_id = payload["event_id"].get<std::string>();
} }
std::shared_ptr<SSWCP_Instance> instance = create_sswcp_instance(cmd, header, params, event_id, webview); std::shared_ptr<SSWCP_Instance> instance = create_sswcp_instance(cmd, header, params, event_id, webview);
if (instance) { if (instance) {
if (event_id != "") { if (event_id != "") {
+6 -6
View File
@@ -26,9 +26,9 @@ using tcp = asio::ip::tcp;
//WCP Interface definition //WCP Interface definition
#define UPDATE_PRIVACY_STATUS "sw_SubUserUpdatePrivacy" #define UPDATE_PRIVACY_STATUS "sw_SubUserUpdatePrivacy"
#define GET_PRIVACY_STATUS "sw_GetUserUpdatePrivacy"
#define UPLOAD_CAMERA_TIMELAPSE "sw_UploadCameraTimelapse" #define UPLOAD_CAMERA_TIMELAPSE "sw_UploadCameraTimelapse"
#define DELETE_CAMERA_TIMELAPSE "sw_DeleteCameraTimelapse" #define DELETE_CAMERA_TIMELAPSE "sw_DeleteCameraTimelapse"
#define GETCAMERA_TIMELAPSE_INSTANCE "sw_GetCameraTimelapseInstance"
#define GET_DEVICEDATA_STORAGESPACE "sw_GetDeviceDataStorageSpace" #define GET_DEVICEDATA_STORAGESPACE "sw_GetDeviceDataStorageSpace"
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
@@ -310,9 +310,6 @@ private:
void sw_mqtt_publish(); void sw_mqtt_publish();
void sw_mqtt_set_engine(); void sw_mqtt_set_engine();
private: private:
void clean_current_engine(); void clean_current_engine();
@@ -424,10 +421,12 @@ private:
void sw_GetFileListPage(); void sw_GetFileListPage();
void sw_UploadCameraTimelapse(); void sw_UploadCameraTimelapse();
void sw_DeleteCameraTimelapse(); void sw_DeleteCameraTimelapse();
void sw_GetTimelapseInstance(); void sw_GetCameraTimelapseInstance();
void sw_DefectDetactionConfig(); void sw_DefectDetactionConfig();
void sw_GetDeviceDataStorageSpace();
void CmdForwarding(); void CmdForwarding();
// Download machine file // Download machine file
@@ -534,8 +533,9 @@ private:
void sw_SubscribeUserLoginState(); void sw_SubscribeUserLoginState();
void sw_SubUserUpdatePrivacy(); void sw_GetUserUpdatePrivacy();
void sw_SubUserUpdatePrivacy();
}; };
// Instance class for homepage business // Instance class for homepage business
+1 -1
View File
@@ -118,7 +118,7 @@ void WebDeviceDialog::OnError(wxWebViewEvent &evt)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebDeviceDialog error loading page %1% %2% %3% %4%") % evt.GetURL() % evt.GetTarget() % e %evt.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebDeviceDialog error loading page %1% %2% %3% %4%") % evt.GetURL() % evt.GetTarget() % e %evt.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebDeviceDialog webview fail", BP_WEB_VIEW);
} }
void WebDeviceDialog::OnScriptMessage(wxWebViewEvent &evt) void WebDeviceDialog::OnScriptMessage(wxWebViewEvent &evt)
+2 -2
View File
@@ -611,7 +611,7 @@ void GuideFrame::OnError(wxWebViewEvent& event)
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":GuideFrame error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":GuideFrame error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init GuideFrame webview fail", BP_WEB_VIEW);
} }
void GuideFrame::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt)) void GuideFrame::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt))
@@ -639,7 +639,7 @@ int GuideFrame::SaveProfile()
// m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "1"); // m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "1");
// } else // } else
// m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "0"); // m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "0");
m_MainPtr->app_config->set("app", "privacy_policy_isagree", PrivacyUse); m_MainPtr->app_config->set("app", PRIVACY_POLICY_FLAGS, PrivacyUse);
BOOST_LOG_TRIVIAL(warning) << "SaveProfile changed the privacy policy with: " << (PrivacyUse ? "true" : "false"); BOOST_LOG_TRIVIAL(warning) << "SaveProfile changed the privacy policy with: " << (PrivacyUse ? "true" : "false");
wxGetApp().user_update_privacy_notify(PrivacyUse); wxGetApp().user_update_privacy_notify(PrivacyUse);
m_MainPtr->app_config->set("region", m_Region); m_MainPtr->app_config->set("region", m_Region);
+1 -1
View File
@@ -167,7 +167,7 @@ void WebPreprintDialog::OnError(wxWebViewEvent &event)
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPreprintDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPreprintDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebPreprintDialog webview fail", BP_WEB_VIEW);
} }
void WebPreprintDialog::OnScriptMessage(wxWebViewEvent &evt) void WebPreprintDialog::OnScriptMessage(wxWebViewEvent &evt)
+1 -1
View File
@@ -707,7 +707,7 @@ void WebPresetDialog::OnError(wxWebViewEvent& event)
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPresetDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPresetDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebPresetDialog webview fail", BP_WEB_VIEW);
} }
void WebPresetDialog::OnScriptResponseMessage(wxCommandEvent& WXUNUSED(evt)) void WebPresetDialog::OnScriptResponseMessage(wxCommandEvent& WXUNUSED(evt))
+1 -1
View File
@@ -400,7 +400,7 @@ void SMUserLogin::OnError(wxWebViewEvent &event)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":SMUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":SMUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init SMUserLogin webview fail", BP_WEB_VIEW);
} }
void SMUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt)) void SMUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt))
+1 -1
View File
@@ -130,7 +130,7 @@ void WebUrlDialog::OnError(wxWebViewEvent &event)
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebUrlDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebUrlDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebUrlDialog webview fail", BP_WEB_VIEW);
} }
void WebUrlDialog::OnScriptMessage(wxWebViewEvent &evt) void WebUrlDialog::OnScriptMessage(wxWebViewEvent &evt)
+1 -1
View File
@@ -374,7 +374,7 @@ void ZUserLogin::OnError(wxWebViewEvent &event)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":ZUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":ZUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init ZUserLogin webview fail", BP_WEB_VIEW);
} }
void ZUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt)) void ZUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt))
+1 -1
View File
@@ -908,7 +908,7 @@ void WebViewPanel::OnError(wxWebViewEvent& event)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":PrinterWebView error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":PrinterWebView error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebViewPanel webview fail", BP_WEB_VIEW);
} }
+24
View File
@@ -2399,6 +2399,30 @@ void Moonraker_Mqtt::async_get_timelapse_instance(const nlohmann::json& targets,
} }
} }
//get the mechine local storage space
void Moonraker_Mqtt::async_get_userdata_space(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)> callback)
{
auto& wcp_loger = GUI::WCP_Logger::getInstance();
std::string method = "server.files.get_userdata_space";
json params = json::object();
params = targets;
if (!send_to_request(method, params, true, callback,
[callback, &wcp_loger]() {
BOOST_LOG_TRIVIAL(warning) << "[Moonraker_Mqtt] get uoser storage space";
wcp_loger.add_log("get uoser storage space timeout", false, "", "Moonraker_Mqtt", "warning");
json res;
res["error"] = "timeout";
callback(res);
}) &&callback) {
BOOST_LOG_TRIVIAL(error) << "[Moonraker_Mqtt]send the cmd to get uoser storage space fail";
wcp_loger.add_log("send the cmd to get uoser storage space fail", false, "", "Moonraker_Mqtt", "error");
callback(json::value_t::null);
}
}
// 请求删除延时摄影文件 // 请求删除延时摄影文件
void Moonraker_Mqtt::async_delete_camera_timelapse(const nlohmann::json& targets, void Moonraker_Mqtt::async_delete_camera_timelapse(const nlohmann::json& targets,
std::function<void(const nlohmann::json& response)> callback) std::function<void(const nlohmann::json& response)> callback)
+3
View File
@@ -140,6 +140,7 @@ public:
virtual void async_defect_detaction_config(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {} virtual void async_defect_detaction_config(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
virtual void async_get_userdata_space(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
protected: protected:
// Internal upload implementations // Internal upload implementations
@@ -272,6 +273,8 @@ public:
virtual void async_get_timelapse_instance(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) override; virtual void async_get_timelapse_instance(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) override;
virtual void async_get_userdata_space(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) override;
virtual void async_defect_detaction_config(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) override; virtual void async_defect_detaction_config(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) override;
void set_connection_lost(std::function<void()> callback) override; void set_connection_lost(std::function<void()> callback) override;
+21 -27
View File
@@ -795,7 +795,7 @@ void PresetUpdater::priv::sync_update_flutter_resource(bool isAuto_check)
if (currentSoftVersion > maxSpVersion || currentSoftVersion < minSpVersion) { if (currentSoftVersion > maxSpVersion || currentSoftVersion < minSpVersion) {
if (!isAuto_check) { if (!isAuto_check) {
wxCommandEvent* evt = new wxCommandEvent(EVT_NO_PRESET_UPDATE); wxCommandEvent* evt = new wxCommandEvent(EVT_NO_WEB_RESOURCE_UPDATE);
GUI::wxGetApp().QueueEvent(evt); GUI::wxGetApp().QueueEvent(evt);
BOOST_LOG_TRIVIAL(info) << format("use check the web update."); BOOST_LOG_TRIVIAL(info) << format("use check the web update.");
@@ -814,7 +814,10 @@ void PresetUpdater::priv::sync_update_flutter_resource(bool isAuto_check)
} }
} }
} catch (...) {} } catch (const std::exception& ex) {
std::string errorMsg = ex.what();
BOOST_LOG_TRIVIAL(fatal) << "request server flutter update data error:" << errorMsg;
}
}) })
.perform_sync(); .perform_sync();
} }
@@ -920,7 +923,10 @@ void PresetUpdater::priv::sync_config(bool isAuto_check)
} }
} }
} catch (...) {} } catch (const std::exception& ex) {
std::string errorMsg = ex.what();
BOOST_LOG_TRIVIAL(fatal) << "request server preset update data error:" << errorMsg;
}
}) })
.perform_sync(); .perform_sync();
} }
@@ -1422,8 +1428,7 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
} }
} }
bool version_match = ((vendor_ver.maj() == cache_ver.maj()) && (vendor_ver.min() == cache_ver.min())); if (vendor_ver < cache_ver) {
if (version_match && (vendor_ver < cache_ver)) {
Semver min_ver = get_min_version_from_json(file_path); Semver min_ver = get_min_version_from_json(file_path);
Semver soft_ver = Semver(std::string(Snapmaker_VERSION)); Semver soft_ver = Semver(std::string(Snapmaker_VERSION));
@@ -1718,7 +1723,7 @@ void PresetUpdater::sync_web_async(bool isAutoUpdata)
GUI::wxGetApp().CallAfter([this] { GUI::wxGetApp().CallAfter([this] {
std::string zipfilepath = this->p->cache_path.string() + "/flutter_web.zip"; std::string zipfilepath = this->p->cache_path.string() + "/flutter_web.zip";
BOOST_LOG_TRIVIAL(debug) << "[Orca Updater] sync_web_async completed, checking updates..."; BOOST_LOG_TRIVIAL(debug) << "[Orca Updater] sync_web_async completed, checking updates...";
load_lutter_web(zipfilepath, true); load_flutter_web(zipfilepath, true);
}); });
}); });
} }
@@ -1802,7 +1807,7 @@ bool PresetUpdater::version_check_enabled() const
} }
void PresetUpdater::load_lutter_web(const std::string& zip_file, bool serverUpdate) void PresetUpdater::load_flutter_web(const std::string& zip_file, bool serverUpdate)
{ {
boost::filesystem::path temp_path = boost::filesystem::temp_directory_path() / "orca_temp_flutter_import"; boost::filesystem::path temp_path = boost::filesystem::temp_directory_path() / "orca_temp_flutter_import";
try { try {
@@ -1845,7 +1850,7 @@ void PresetUpdater::load_lutter_web(const std::string& zip_file, bool serverUpda
Semver online_version = version_str; Semver online_version = version_str;
Semver current_version = ori_version_str; Semver current_version = ori_version_str;
if (/* current_version < online_version && */ ori_build_number_str < build_number_str) { if (current_version < online_version) {
auto source_folder_path = fs::path(dir_entry.path().parent_path()); auto source_folder_path = fs::path(dir_entry.path().parent_path());
auto target_folder_path = (boost::filesystem::path(data_dir()) / "web" / "flutter_web"); auto target_folder_path = (boost::filesystem::path(data_dir()) / "web" / "flutter_web");
@@ -1940,6 +1945,7 @@ void PresetUpdater::load_lutter_web(const std::string& zip_file, bool serverUpda
app->recreate_GUI(_L("Update web resources")); app->recreate_GUI(_L("Update web resources"));
} }
} catch (std::exception& e) { } catch (std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "Failed to importweb resources: " << e.what(); BOOST_LOG_TRIVIAL(error) << "Failed to importweb resources: " << e.what();
GUI::MessageDialog(nullptr, _L("Import Failed")).ShowModal(); GUI::MessageDialog(nullptr, _L("Import Failed")).ShowModal();
@@ -1959,7 +1965,7 @@ void PresetUpdater::import_flutter_web()
std::string zip_file = dialog.GetPath().ToUTF8().data(); std::string zip_file = dialog.GetPath().ToUTF8().data();
load_lutter_web(zip_file); load_flutter_web(zip_file);
} }
void PresetUpdater::import_system_profile() void PresetUpdater::import_system_profile()
@@ -2090,7 +2096,6 @@ void PresetUpdater::import_system_profile()
} }
// 5. 执行更新并提示结果 // 5. 执行更新并提示结果
bool need_restart = false;
if (!updates.updates.empty()) { if (!updates.updates.empty()) {
std::vector<GUI::MsgUpdateConfig::Update> updates_msg; std::vector<GUI::MsgUpdateConfig::Update> updates_msg;
for (const auto& update : updates.updates) { for (const auto& update : updates.updates) {
@@ -2098,9 +2103,6 @@ void PresetUpdater::import_system_profile()
if (update.is_directory) if (update.is_directory)
continue; continue;
if (update.can_install) {
need_restart = true;
}
std::string changelog = update.change_log; std::string changelog = update.change_log;
updates_msg.emplace_back(update.vendor, update.version.config_version, update.descriptions, std::move(changelog)); updates_msg.emplace_back(update.vendor, update.version.config_version, update.descriptions, std::move(changelog));
} }
@@ -2111,12 +2113,16 @@ void PresetUpdater::import_system_profile()
if (res == wxID_OK) { if (res == wxID_OK) {
p->perform_updates(std::move(updates)); p->perform_updates(std::move(updates));
// Use hot reload instead of restart
if (!reload_configs_update_gui()) {
BOOST_LOG_TRIVIAL(warning) << "[Orca Updater]:reload_configs_update_gui failed for system profiles";
} else {
BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:System profiles updated successfully via hot reload";
}
} else { } else {
boost::filesystem::remove_all(temp_path); boost::filesystem::remove_all(temp_path);
return; return;
} }
} }
wxString message; wxString message;
@@ -2128,18 +2134,6 @@ void PresetUpdater::import_system_profile()
GUI::MessageDialog(nullptr, message).ShowModal(); GUI::MessageDialog(nullptr, message).ShowModal();
} }
if (need_restart) {
GUI::MessageDialog msg_wingow(nullptr,
_L("Updating the system resources requires application restart.") + "\n" +
_L("Do you want to continue?"),
L("System resource update"), wxICON_QUESTION | wxOK | wxCANCEL);
if (msg_wingow.ShowModal() == wxID_CANCEL) {
return;
}
app->recreate_GUI(_L("Update system profiles"));
}
} catch (std::exception& e) { } catch (std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "Failed to import presets: " << e.what(); BOOST_LOG_TRIVIAL(error) << "Failed to import presets: " << e.what();
GUI::MessageDialog(nullptr, _L("Import Failed")).ShowModal(); GUI::MessageDialog(nullptr, _L("Import Failed")).ShowModal();
+1 -1
View File
@@ -65,7 +65,7 @@ public:
void import_flutter_web(); void import_flutter_web();
void load_lutter_web(const std::string& zip_file,bool serverUpdate = false); void load_flutter_web(const std::string& zip_file,bool serverUpdate = false);
void sync_config_async(); void sync_config_async();
+2
View File
@@ -171,6 +171,8 @@ public:
virtual void async_get_timelapse_instance(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {} virtual void async_get_timelapse_instance(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
virtual void async_get_userdata_space(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
virtual void async_defect_detaction_config(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {} virtual void async_defect_detaction_config(const nlohmann::json& targets, std::function<void(const nlohmann::json& response)>) {}
//Support for cloud webui login //Support for cloud webui login