From 472db8ba6a5d156f7dcccb828ab4293b902670bc Mon Sep 17 00:00:00 2001 From: alves Date: Tue, 16 Dec 2025 10:55:59 +0800 Subject: [PATCH 1/8] feature add bury point for soft --- src/CMakeLists.txt | 6 ++-- src/Snapmaker_Orca.cpp | 5 ++- src/Snapmaker_Orca_app_msvc.cpp | 8 +++++ src/bury_cfg/bury_point.cpp | 18 +++++++++++ src/bury_cfg/bury_point.hpp | 39 +++++++++++++++++++++++ src/sentry_wrapper/SentryWrapper.hpp | 1 + src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 3 ++ src/slic3r/GUI/PrintHostDialogs.cpp | 3 ++ src/slic3r/GUI/WebSMUserLoginDialog.cpp | 9 ++++-- src/slic3r/Utils/MoonRaker.cpp | 3 ++ 10 files changed, 89 insertions(+), 6 deletions(-) create mode 100644 src/bury_cfg/bury_point.cpp create mode 100644 src/bury_cfg/bury_point.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee5c2e7cf4..4d0ea05baa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -115,9 +115,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/Snapmaker_Orca configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/Snapmaker_Orca.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.manifest @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY) if (WIN32) - add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp) + add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp) else () - add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp) + add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp) endif () if (MINGW) @@ -181,7 +181,7 @@ if (WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode") endif() - add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc) + add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc) # Generate debug symbols even in release mode. if(MSVC) target_link_options(Snapmaker_Orca_app_gui PUBLIC "$<$:/DEBUG>") diff --git a/src/Snapmaker_Orca.cpp b/src/Snapmaker_Orca.cpp index 5f50d8aca3..b7e72214f0 100644 --- a/src/Snapmaker_Orca.cpp +++ b/src/Snapmaker_Orca.cpp @@ -6296,9 +6296,12 @@ extern "C" { int main(int argc, char **argv) { initSentry(); - + std::string softStartTime = BP_SOFT_START_TIME+ ":" + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softStartTime, BP_START_SOFT); auto res = CLI().run(argc, argv); + std::string softEndTime = BP_SOFT_END_TIME + ":" + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return res; diff --git a/src/Snapmaker_Orca_app_msvc.cpp b/src/Snapmaker_Orca_app_msvc.cpp index fe77bf37ea..99660b8e94 100644 --- a/src/Snapmaker_Orca_app_msvc.cpp +++ b/src/Snapmaker_Orca_app_msvc.cpp @@ -227,6 +227,8 @@ int wmain(int argc, wchar_t** argv) _set_error_mode(_OUT_TO_MSGBOX); initSentry(); + std::string softStartTime = BP_SOFT_START_TIME + std::string(":") + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softStartTime, BP_START_SOFT); std::vector argv_extended; argv_extended.emplace_back(argv[0]); @@ -292,6 +294,8 @@ int wmain(int argc, wchar_t** argv) HINSTANCE hInstance_Slic3r = LoadLibraryExW(path_to_slic3r, nullptr, 0); if (hInstance_Slic3r == nullptr) { printf("Snapmaker_Orca.dll was not loaded, error=%d\n", GetLastError()); + std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return -1; } @@ -308,12 +312,16 @@ int wmain(int argc, wchar_t** argv) ); if (Snapmaker_Orca_main == nullptr) { printf("could not locate the function Snapmaker_Orca_main in Snapmaker_Orca.dll\n"); + std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return -1; } // argc minus the trailing nullptr of the argv auto res = Snapmaker_Orca_main((int) argv_extended.size() - 1, argv_extended.data()); + std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return res; } diff --git a/src/bury_cfg/bury_point.cpp b/src/bury_cfg/bury_point.cpp new file mode 100644 index 0000000000..549ff77bc1 --- /dev/null +++ b/src/bury_cfg/bury_point.cpp @@ -0,0 +1,18 @@ +#include "bury_point.hpp" +#include +#include +#include +#include + +std::string get_timestamp_seconds() +{ + auto now = std::chrono::system_clock::now(); + + auto timestamp = std::chrono::duration_cast(now.time_since_epoch()).count(); + + std::ostringstream oss; + oss << timestamp; + auto strTime = oss.str(); + + return strTime; +} \ No newline at end of file diff --git a/src/bury_cfg/bury_point.hpp b/src/bury_cfg/bury_point.hpp new file mode 100644 index 0000000000..e0aaef18a8 --- /dev/null +++ b/src/bury_cfg/bury_point.hpp @@ -0,0 +1,39 @@ +#ifndef _BURY_POINT_hpp_ +#define _BURY_POINT_hpp_ +#include +#include + +#define BP_START_SOFT "bury_point_start_soft" +#define BP_SOFT_START_TIME "soft_start_time" +#define BP_SOFT_END_TIME "soft_end_time" + +#define BP_DEIVCE_CONNECT "bury_point_device_connect" +#define BP_CONNECT_DEVICE_ID "device_id" +#define BP_CONNECT_NET_TYPE "net_type" + +#define BP_LOGIN "bury_point_login" +#define BP_LOGIN_USER_ID "user_id" +#define BP_LOGIN_HTTP_CODE "http_code" + +#define BP_VIDEO_START "bury_point_video_start" +#define BP_VIDEO_STATUS "video_status" + +#define BP_DEVICE_ERROR "bury_point_device_error" +#define BP_DEVICE_ERROR_STATUS "error_status" + +#define BP_UPLOAD "bury_point_upload" + +#define BP_UPLOAD_AND_PRINT "bury_point_upload_and_print" + +#define BP_COLOR_PAINTING "bury_point_color_painting" + +#define BP_VIDEO_ABNORMAL "bury_point_video_abnormal" +//webview bury point + + + + static bool isAgreeSlice = false; + extern std::string get_timestamp_seconds(); + + +#endif \ No newline at end of file diff --git a/src/sentry_wrapper/SentryWrapper.hpp b/src/sentry_wrapper/SentryWrapper.hpp index 29de368b0e..c3302dbc90 100644 --- a/src/sentry_wrapper/SentryWrapper.hpp +++ b/src/sentry_wrapper/SentryWrapper.hpp @@ -2,6 +2,7 @@ #define slic3r_SentryWrapper_hpp_ #include +#include "bury_cfg/bury_point.hpp" namespace Slic3r { diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 762b371778..29b58b5457 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -34,6 +34,7 @@ #include +#include "sentry_wrapper/SentryWrapper.hpp" namespace Slic3r { namespace GUI { //BBS: GUI refactor: to support top layout @@ -350,6 +351,8 @@ bool GLGizmosManager::open_gizmo(EType type) #ifdef __WXOSX__ m_parent.post_event(SimpleEvent(wxEVT_PAINT)); #endif + if (EType::MmSegmentation == type) + sentryReportLog(SENTRY_LOG_TRACE, "", BP_COLOR_PAINTING); return true; } return false; diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp index deeb64cae0..b1761b90dd 100644 --- a/src/slic3r/GUI/PrintHostDialogs.cpp +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -3,6 +3,7 @@ #include #include +#include "sentry_wrapper/SentryWrapper.hpp" #include #include #include @@ -152,6 +153,7 @@ void PrintHostSendDialog::init() auto* btn_ok = add_button(wxID_OK, true, _L("Upload")); btn_ok->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { + sentryReportLog(SENTRY_LOG_TRACE, "", BP_UPLOAD); if (validate_path(txt_filename->GetValue())) { post_upload_action = PrintHostPostUploadAction::None; EndDialog(wxID_OK); @@ -172,6 +174,7 @@ void PrintHostSendDialog::init() if (post_actions.has(PrintHostPostUploadAction::StartPrint)) { auto* btn_print = add_button(wxID_YES, false, _L("Upload and Print")); btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { + sentryReportLog(SENTRY_LOG_TRACE, "", BP_UPLOAD_AND_PRINT); if (validate_path(txt_filename->GetValue())) { post_upload_action = PrintHostPostUploadAction::StartPrint; EndDialog(wxID_OK); diff --git a/src/slic3r/GUI/WebSMUserLoginDialog.cpp b/src/slic3r/GUI/WebSMUserLoginDialog.cpp index 1df1e1efd0..2092f0d812 100644 --- a/src/slic3r/GUI/WebSMUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebSMUserLoginDialog.cpp @@ -25,6 +25,7 @@ #include #include +#include "sentry_wrapper/SentryWrapper.hpp" using namespace std; using namespace nlohmann; @@ -198,11 +199,13 @@ void SMUserLogin::OnNavigationRequest(wxWebViewEvent &evt) http.header("Authorization",token); http.on_complete([&](std::string body, unsigned status) { if (status == 200) { + std::string user_id = ""; json response = json::parse(body); if (response.count("data")) { json data = response["data"]; if (data.count("id")) { wxGetApp().sm_get_userinfo()->set_user_id(std::to_string(data["id"].get())); + user_id = std::to_string(data["id"].get()); } if (data.count("nickname")) { wxGetApp().sm_get_userinfo()->set_user_name(data["nickname"].get()); @@ -214,13 +217,15 @@ void SMUserLogin::OnNavigationRequest(wxWebViewEvent &evt) wxGetApp().sm_get_userinfo()->set_user_account(data["account"].get()); } } - + string userInfo = BP_LOGIN_USER_ID + std::string(":") + user_id; + sentryReportLog(SENTRY_LOG_TRACE, userInfo, BP_LOGIN); wxGetApp().sm_get_userinfo()->set_user_token(token); wxGetApp().sm_get_userinfo()->set_user_login(true); } }) .on_error([&](std::string body, std::string error, unsigned status) { - + std::string http_code = BP_LOGIN_HTTP_CODE + string(":") + std::to_string(status); + sentryReportLog(SENTRY_LOG_TRACE, http_code, BP_LOGIN); }) .perform_sync(); }); diff --git a/src/slic3r/Utils/MoonRaker.cpp b/src/slic3r/Utils/MoonRaker.cpp index bc6fef75df..b8d4ade264 100644 --- a/src/slic3r/Utils/MoonRaker.cpp +++ b/src/slic3r/Utils/MoonRaker.cpp @@ -28,6 +28,7 @@ #include "slic3r/GUI/WebPreprintDialog.hpp" #include "slic3r/GUI/SSWCP.hpp" +#include "sentry_wrapper/SentryWrapper.hpp" #ifdef _WIN32 #include #include @@ -2287,6 +2288,7 @@ void Moonraker_Mqtt::async_camera_start(const std::string& domain, int interval, callback) { BOOST_LOG_TRIVIAL(error) << "[Moonraker_Mqtt] 发送启动摄像头监控请求失败"; wcp_loger.add_log("发送启动摄像头监控请求失败", false, "", "Moonraker_Mqtt", "error"); + sentryReportLog(SENTRY_LOG_TRACE, "open video cmd error", BP_VIDEO_ABNORMAL); callback(json::value_t::null); } } @@ -2336,6 +2338,7 @@ void Moonraker_Mqtt::async_canmera_stop(const std::string& domain, std::function callback) { BOOST_LOG_TRIVIAL(error) << "[Moonraker_Mqtt] 发送停止摄像头监控请求失败"; wcp_loger.add_log("发送停止摄像头监控请求失败", false, "", "Moonraker_Mqtt", "error"); + sentryReportLog(SENTRY_LOG_TRACE, "stop video cmd error", BP_VIDEO_ABNORMAL); callback(json::value_t::null); } } From 005e45bd0a53e9ea2261560426a8de0c7121ce1c Mon Sep 17 00:00:00 2001 From: alves Date: Tue, 16 Dec 2025 15:39:38 +0800 Subject: [PATCH 2/8] feature add bury point for slice model and use soft, login soft. --- src/Snapmaker_Orca.cpp | 6 ++-- src/Snapmaker_Orca_app_msvc.cpp | 13 ++++--- src/bury_cfg/bury_point.cpp | 29 ++++++++++++++++ src/bury_cfg/bury_point.hpp | 12 +++++-- src/sentry_wrapper/SentryWrapper.cpp | 9 +++-- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 41 +++++++++++++++++++++++ src/slic3r/GUI/PrintHostDialogs.cpp | 4 +-- 8 files changed, 99 insertions(+), 17 deletions(-) diff --git a/src/Snapmaker_Orca.cpp b/src/Snapmaker_Orca.cpp index b7e72214f0..f340215897 100644 --- a/src/Snapmaker_Orca.cpp +++ b/src/Snapmaker_Orca.cpp @@ -6296,11 +6296,11 @@ extern "C" { int main(int argc, char **argv) { initSentry(); - std::string softStartTime = BP_SOFT_START_TIME+ ":" + get_timestamp_seconds(); - sentryReportLog(SENTRY_LOG_TRACE, softStartTime, BP_START_SOFT); + auto soft_start_time = get_time_timestamp(); auto res = CLI().run(argc, argv); + auto soft_end_time = get_time_timestamp(); - std::string softEndTime = BP_SOFT_END_TIME + ":" + get_timestamp_seconds(); + std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time); sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); diff --git a/src/Snapmaker_Orca_app_msvc.cpp b/src/Snapmaker_Orca_app_msvc.cpp index 99660b8e94..2d47aefb15 100644 --- a/src/Snapmaker_Orca_app_msvc.cpp +++ b/src/Snapmaker_Orca_app_msvc.cpp @@ -227,8 +227,7 @@ int wmain(int argc, wchar_t** argv) _set_error_mode(_OUT_TO_MSGBOX); initSentry(); - std::string softStartTime = BP_SOFT_START_TIME + std::string(":") + get_timestamp_seconds(); - sentryReportLog(SENTRY_LOG_TRACE, softStartTime, BP_START_SOFT); + auto soft_start_time = get_time_timestamp(); std::vector argv_extended; argv_extended.emplace_back(argv[0]); @@ -294,7 +293,9 @@ int wmain(int argc, wchar_t** argv) HINSTANCE hInstance_Slic3r = LoadLibraryExW(path_to_slic3r, nullptr, 0); if (hInstance_Slic3r == nullptr) { printf("Snapmaker_Orca.dll was not loaded, error=%d\n", GetLastError()); - std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds(); + + auto soft_end_time = get_time_timestamp(); + std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time); sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return -1; @@ -312,7 +313,8 @@ int wmain(int argc, wchar_t** argv) ); if (Snapmaker_Orca_main == nullptr) { printf("could not locate the function Snapmaker_Orca_main in Snapmaker_Orca.dll\n"); - std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds(); + auto soft_end_time = get_time_timestamp(); + std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time); sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return -1; @@ -320,7 +322,8 @@ int wmain(int argc, wchar_t** argv) // argc minus the trailing nullptr of the argv auto res = Snapmaker_Orca_main((int) argv_extended.size() - 1, argv_extended.data()); - std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds(); + auto soft_end_time = get_time_timestamp(); + std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time); sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return res; diff --git a/src/bury_cfg/bury_point.cpp b/src/bury_cfg/bury_point.cpp index 549ff77bc1..a4f78fce14 100644 --- a/src/bury_cfg/bury_point.cpp +++ b/src/bury_cfg/bury_point.cpp @@ -15,4 +15,33 @@ std::string get_timestamp_seconds() auto strTime = oss.str(); return strTime; +} + +long long get_time_timestamp() +{ + auto now = std::chrono::system_clock::now(); + + auto timestamp = std::chrono::duration_cast(now.time_since_epoch()).count(); + + return timestamp; +} + +std::string get_works_time(const uint64_t& timestamp) +{ + uint64_t hours = timestamp / 3600000; + uint64_t remaining_ms = timestamp % 3600000; + + uint64_t minutes = remaining_ms / 60000; + remaining_ms = remaining_ms % 60000; + + uint64_t seconds = remaining_ms / 1000; + uint64_t ms = remaining_ms % 1000; + + char buffer[32] = {0}; + std::snprintf(buffer, sizeof(buffer), "%02llu:%02llu:%02llu.%03llu", hours, minutes, seconds, ms); + + + std::string works_time = std::string(buffer); + + return works_time; } \ No newline at end of file diff --git a/src/bury_cfg/bury_point.hpp b/src/bury_cfg/bury_point.hpp index e0aaef18a8..132ef3446f 100644 --- a/src/bury_cfg/bury_point.hpp +++ b/src/bury_cfg/bury_point.hpp @@ -3,9 +3,10 @@ #include #include +#define BURY_POINT "bury_point" + #define BP_START_SOFT "bury_point_start_soft" -#define BP_SOFT_START_TIME "soft_start_time" -#define BP_SOFT_END_TIME "soft_end_time" +#define BP_SOFT_WORKS_TIME "soft_works_time" #define BP_DEIVCE_CONNECT "bury_point_device_connect" #define BP_CONNECT_DEVICE_ID "device_id" @@ -28,12 +29,17 @@ #define BP_COLOR_PAINTING "bury_point_color_painting" #define BP_VIDEO_ABNORMAL "bury_point_video_abnormal" + +#define BP_SLICE_DURATION "bury_point_slice_duration" +#define BP_SLICE_DURATION_TIME "slice_duration_time" + //webview bury point static bool isAgreeSlice = false; extern std::string get_timestamp_seconds(); - + extern long long get_time_timestamp(); + extern std::string get_works_time(const uint64_t& timestamp); #endif \ No newline at end of file diff --git a/src/sentry_wrapper/SentryWrapper.cpp b/src/sentry_wrapper/SentryWrapper.cpp index 0b2224adb5..3ed5d38982 100644 --- a/src/sentry_wrapper/SentryWrapper.cpp +++ b/src/sentry_wrapper/SentryWrapper.cpp @@ -57,14 +57,15 @@ static sentry_value_t on_crash_callback(const sentry_ucontext_t* uctx, sentry_va 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 logger_val = sentry_value_get_by_key(event, "logger"); - std::string logger = sentry_value_as_string(logger_val); + sentry_value_t moduleValue = sentry_value_get_by_key(event, "logger"); + std::string moduleName = sentry_value_as_string(moduleValue); - if (MACHINE_MODULE == logger) + if (MACHINE_MODULE == moduleName) { srand((unsigned int) time(0)); int random_num = rand() % 100; @@ -255,6 +256,8 @@ void sentryReportLogEx(SENTRY_LOG_LEVEL logLevel, sentry_value_set_by_key(tags, "snapmaker_trace_id", sentry_value_new_string(logTraceId.c_str())); } + if (SENTRY_LEVEL_TRACE == sentry_msg_level) + sentry_set_tag(BURY_POINT, "snapmaker_bury_point"); if (!logTagKey.empty()) sentry_set_tag(logTagKey.c_str(), logTagValue.c_str()); diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 29b58b5457..1b2bb4bad7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -352,7 +352,7 @@ bool GLGizmosManager::open_gizmo(EType type) m_parent.post_event(SimpleEvent(wxEVT_PAINT)); #endif if (EType::MmSegmentation == type) - sentryReportLog(SENTRY_LOG_TRACE, "", BP_COLOR_PAINTING); + sentryReportLog(SENTRY_LOG_TRACE, BP_COLOR_PAINTING, BP_COLOR_PAINTING); return true; } return false; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 664f3dcd58..69bcb84a26 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -156,6 +156,9 @@ #include "CloneDialog.hpp" #include "WebPreprintDialog.hpp" +#include "sentry_wrapper/sentryWrapper.hpp" +#include + using boost::optional; namespace fs = boost::filesystem; using Slic3r::_3DScene; @@ -3089,6 +3092,9 @@ struct Plater::priv bool show_wireframe{ false }; bool wireframe_enabled{ true }; + std::chrono::steady_clock::time_point m_slice_start_time; + bool m_slice_timing_active = false; + static const std::regex pattern_bundle; static const std::regex pattern_3mf; static const std::regex pattern_zip_amf; @@ -7649,6 +7655,9 @@ void Plater::priv::on_export_finished(wxCommandEvent& evt) void Plater::priv::on_slicing_began() { + if(!m_slice_timing_active) + m_slice_start_time = std::chrono::steady_clock::now(); + m_slice_timing_active = true; clear_warnings(); notification_manager->close_notification_of_type(NotificationType::SignDetected); notification_manager->close_notification_of_type(NotificationType::ExportFinished); @@ -7733,6 +7742,31 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt) //BBS: add project slice logic bool is_finished = !m_slice_all || (m_cur_slice_plate == (partplate_list.get_plate_count() - 1)); + { + if (m_slice_timing_active) { + auto end_time = std::chrono::steady_clock::now(); + auto duration_ms = std::chrono::duration_cast(end_time - m_slice_start_time).count(); + uint64_t timess = duration_ms; + if (evt.cancelled()) { + BOOST_LOG_TRIVIAL(info) << "Slicing cancelled after " << duration_ms << " ms"; + m_slice_start_time = {}; + m_slice_timing_active = false; + } else if (evt.error()) + { + m_slice_start_time = {}; + m_slice_timing_active = false; + } + else if (is_finished && evt.finished()) + { + auto strTime = get_works_time(duration_ms); + auto slice_time = BP_SLICE_DURATION_TIME + std::string(":") + strTime; + sentryReportLog(SENTRY_LOG_TRACE, slice_time, BP_SLICE_DURATION); + + m_slice_start_time = {}; + m_slice_timing_active = false; + } + } + } //BBS: slice .gcode.3mf file related logic, assign is_finished again bool only_has_gcode_need_preview = false; auto plate_list = this->partplate_list.get_plate_list(); @@ -7751,6 +7785,13 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt) // At this point of time the thread should be either finished or canceled, // so the following call just confirms, that the produced data were consumed. this->background_process.stop(); + if (m_slice_timing_active && !this->background_process.running()) + { + if (evt.cancelled() || evt.error()) { + m_slice_start_time = {}; + m_slice_timing_active = false; + } + } notification_manager->set_slicing_progress_export_possible(); // Reset the "export G-code path" name, so that the automatic background processing will be enabled again. diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp index b1761b90dd..e728d2b075 100644 --- a/src/slic3r/GUI/PrintHostDialogs.cpp +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -153,7 +153,7 @@ void PrintHostSendDialog::init() auto* btn_ok = add_button(wxID_OK, true, _L("Upload")); btn_ok->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { - sentryReportLog(SENTRY_LOG_TRACE, "", BP_UPLOAD); + sentryReportLog(SENTRY_LOG_TRACE, BP_UPLOAD, BP_UPLOAD); if (validate_path(txt_filename->GetValue())) { post_upload_action = PrintHostPostUploadAction::None; EndDialog(wxID_OK); @@ -174,7 +174,7 @@ void PrintHostSendDialog::init() if (post_actions.has(PrintHostPostUploadAction::StartPrint)) { auto* btn_print = add_button(wxID_YES, false, _L("Upload and Print")); btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { - sentryReportLog(SENTRY_LOG_TRACE, "", BP_UPLOAD_AND_PRINT); + sentryReportLog(SENTRY_LOG_TRACE, BP_UPLOAD_AND_PRINT, BP_UPLOAD_AND_PRINT); if (validate_path(txt_filename->GetValue())) { post_upload_action = PrintHostPostUploadAction::StartPrint; EndDialog(wxID_OK); From 6688f3c0ed4515559b85bec7f4a0d794ae7238b1 Mon Sep 17 00:00:00 2001 From: alves Date: Tue, 16 Dec 2025 17:24:13 +0800 Subject: [PATCH 3/8] feature add web version on bury point --- src/bury_cfg/bury_point.cpp | 2 +- src/sentry_wrapper/SentryWrapper.cpp | 8 +++++++ src/sentry_wrapper/SentryWrapper.hpp | 2 ++ src/slic3r/GUI/MainFrame.cpp | 36 +++++++++++++++++++++++++++- src/slic3r/GUI/MainFrame.hpp | 1 + 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/bury_cfg/bury_point.cpp b/src/bury_cfg/bury_point.cpp index a4f78fce14..cf3e1dc9ce 100644 --- a/src/bury_cfg/bury_point.cpp +++ b/src/bury_cfg/bury_point.cpp @@ -21,7 +21,7 @@ long long get_time_timestamp() { auto now = std::chrono::system_clock::now(); - auto timestamp = std::chrono::duration_cast(now.time_since_epoch()).count(); + auto timestamp = std::chrono::duration_cast(now.time_since_epoch()).count(); return timestamp; } diff --git a/src/sentry_wrapper/SentryWrapper.cpp b/src/sentry_wrapper/SentryWrapper.cpp index 3ed5d38982..25982b9d46 100644 --- a/src/sentry_wrapper/SentryWrapper.cpp +++ b/src/sentry_wrapper/SentryWrapper.cpp @@ -296,5 +296,13 @@ void sentryReportLog(SENTRY_LOG_LEVEL logLevel, #endif } +void set_sentry_tags(const std::string& tag_key, const std::string& tag_value) +{ +#ifdef SLIC3R_SENTRY + if (!tag_key.empty()) + sentry_set_tag(tag_key.c_str(), tag_value.c_str()); +#endif +} + } // namespace Slic3r diff --git a/src/sentry_wrapper/SentryWrapper.hpp b/src/sentry_wrapper/SentryWrapper.hpp index c3302dbc90..2a902b583c 100644 --- a/src/sentry_wrapper/SentryWrapper.hpp +++ b/src/sentry_wrapper/SentryWrapper.hpp @@ -25,6 +25,8 @@ namespace Slic3r { const std::string& logTagKey = "", const std::string& logTagValue = "", const std::string& logTraceId = ""); + + void set_sentry_tags(const std::string& tag_key,const std::string& tag_value); } // namespace Slic3r #endif // slic3r_SentryWrapper_hpp_ diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 8a42c4747e..4369152b35 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1008,6 +1008,39 @@ void MainFrame::show_option(bool show) } } } +void MainFrame::get_local_webview_version() +{ + std::string versionFilePath = ""; + +#ifdef _WIN32 + wchar_t appDataPath[MAX_PATH] = {0}; + auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath); + char* path = new char[MAX_PATH]; + size_t pathLength; + wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH); + std::string filePath = path; + versionFilePath = filePath + "\\" + std::string("Snapmaker_Orca\\web\\flutter_web\\version.json"); +#elif __APPLE__ + const char* home_env = getenv("HOME"); + versionFilePath = home_env; + versionFilePath = versionFilePath + "/Library/Application Support/Snapmaker_Orca/web/flutter_web/version.json"; +#else + +#endif + + std::ifstream json_file(versionFilePath); + if (!json_file.is_open()) { + return; + } + nlohmann::json json_data; + json_file >> json_data; + std::string str_version = json_data["version"]; + std::string str_build_number = json_data["build_number"]; + + std::string tag = std::string("flutter_version: ") + str_version + std::string(" ") + std::string("build_number: ") + str_build_number; + set_sentry_tags("flutter_version", tag); + +} void MainFrame::init_tabpanel() { // wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on @@ -1089,8 +1122,9 @@ void MainFrame::init_tabpanel() { }); m_tabpanel->AddPage(m_webview, "", "tab_home_active", "tab_home_active", false); m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL); + } - + get_local_webview_version(); m_plater = new Plater(this, this); m_plater->SetBackgroundColour(*wxWHITE); m_plater->Hide(); diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index 1bf719f73f..a3889ad91a 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -264,6 +264,7 @@ public: void update_title_colour_after_set_title(); void show_option(bool show); void init_tabpanel(); + void get_local_webview_version(); void create_preset_tabs(); //BBS: GUI refactor void add_created_tab(Tab* panel, const std::string& bmp_name = ""); From 399fbc7a331e2b14fee53478d10434dbaa220c58 Mon Sep 17 00:00:00 2001 From: alves Date: Tue, 16 Dec 2025 18:08:20 +0800 Subject: [PATCH 4/8] feature add get pc name function --- src/slic3r/GUI/MainFrame.cpp | 2 ++ src/slic3r/GUI/SSWCP.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 4369152b35..7120e6ef86 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1030,6 +1030,8 @@ void MainFrame::get_local_webview_version() std::ifstream json_file(versionFilePath); if (!json_file.is_open()) { + std::ifstream json_file(versionFilePath); + BOOST_LOG_TRIVIAL(error) << "check flutter version error with file path:" << versionFilePath; return; } nlohmann::json json_data; diff --git a/src/slic3r/GUI/SSWCP.cpp b/src/slic3r/GUI/SSWCP.cpp index 513016744e..c89aeeb758 100644 --- a/src/slic3r/GUI/SSWCP.cpp +++ b/src/slic3r/GUI/SSWCP.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include @@ -90,6 +91,8 @@ bool WCP_Logger::set_level(wxString& level) } } +std::string WCP_Logger::get_pc_name() { return boost::asio::ip::host_name(); } + // Add a log message to the queue void WCP_Logger::add_log(const wxString& content, bool is_web = false, wxString time = "", wxString module = "Default", wxString level = "debug") { From 5ed729e27c2b320b9581c2ebdc9ee2a1a16018a2 Mon Sep 17 00:00:00 2001 From: alves Date: Wed, 17 Dec 2025 11:42:07 +0800 Subject: [PATCH 5/8] feature add common function for soft --- deps_src/nlohmann/CMakeLists.txt | 2 +- src/CMakeLists.txt | 10 ++--- src/common_func/common_func.cpp | 59 +++++++++++++++++++++++++ src/common_func/common_func.hpp | 27 +++++++++++ src/libslic3r/PresetBundle.cpp | 2 +- src/libslic3r/libslic3r.h | 2 +- src/libslic3r/pchheader.hpp | 2 +- src/sentry_wrapper/SentryWrapper.cpp | 8 ++++ src/slic3r/GUI/CreatePresetsDialog.cpp | 2 +- src/slic3r/GUI/GUI_App.cpp | 2 +- src/slic3r/GUI/MainFrame.cpp | 38 +--------------- src/slic3r/GUI/MainFrame.hpp | 1 - src/slic3r/GUI/Plater.cpp | 2 +- src/slic3r/GUI/PrinterWebView.cpp | 2 +- src/slic3r/GUI/SSWCP.cpp | 1 - src/slic3r/GUI/WebDownPluginDlg.cpp | 2 +- src/slic3r/GUI/WebGuideDialog.cpp | 2 +- src/slic3r/GUI/WebPresetDialog.cpp | 2 +- src/slic3r/GUI/WebSMUserLoginDialog.cpp | 2 +- src/slic3r/GUI/WebUserLoginDialog.cpp | 2 +- src/slic3r/GUI/WebViewDialog.cpp | 2 +- src/slic3r/Utils/Http.hpp | 2 +- src/slic3r/Utils/PresetUpdater.cpp | 2 +- 23 files changed, 116 insertions(+), 60 deletions(-) create mode 100644 src/common_func/common_func.cpp create mode 100644 src/common_func/common_func.hpp diff --git a/deps_src/nlohmann/CMakeLists.txt b/deps_src/nlohmann/CMakeLists.txt index 5fb42165a3..c30ac1e4ca 100644 --- a/deps_src/nlohmann/CMakeLists.txt +++ b/deps_src/nlohmann/CMakeLists.txt @@ -6,7 +6,7 @@ add_library(nlohmann_json INTERFACE) target_include_directories(nlohmann_json SYSTEM INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. ) target_sources(nlohmann_json INTERFACE diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4d0ea05baa..ac01610264 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -115,9 +115,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/Snapmaker_Orca configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/Snapmaker_Orca.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.manifest @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY) if (WIN32) - add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp) + add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp common_func/common_func.hpp common_func/common_func.cpp) else () - add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp) + add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp common_func/common_func.hpp common_func/common_func.cpp) endif () if (MINGW) @@ -181,7 +181,7 @@ if (WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode") endif() - add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc) + add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.cpp common_func/common_func.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc) # Generate debug symbols even in release mode. if(MSVC) target_link_options(Snapmaker_Orca_app_gui PUBLIC "$<$:/DEBUG>") @@ -190,9 +190,9 @@ if (WIN32) add_dependencies(Snapmaker_Orca_app_gui Snapmaker_Orca) set_target_properties(Snapmaker_Orca_app_gui PROPERTIES OUTPUT_NAME "snapmaker-orca") if (SLIC3R_SENTRY) - target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry) + target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry nlohmann_json) else() - target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly) + target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly nlohmann_json) endif() if (SLIC3R_SENTRY) target_compile_definitions(Snapmaker_Orca_app_gui PRIVATE SLIC3R_SENTRY) diff --git a/src/common_func/common_func.cpp b/src/common_func/common_func.cpp new file mode 100644 index 0000000000..c2c7060fb4 --- /dev/null +++ b/src/common_func/common_func.cpp @@ -0,0 +1,59 @@ +#include "common_func.hpp" +#include + +#ifdef _WIN32 +#include +#include + +#elif __APPLE__ +#include +#endif + +#include +#include + +namespace common +{ + std::string get_pc_name() + { + return boost::asio::ip::host_name(); + } + + std::string get_flutter_version() + { + + std::string versionFilePath = ""; + +#ifdef _WIN32 + wchar_t appDataPath[MAX_PATH] = {0}; + auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath); + char* path = new char[MAX_PATH]; + size_t pathLength; + wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH); + std::string filePath = path; + versionFilePath = filePath + "\\" + std::string("Snapmaker_Orca\\web\\flutter_web\\version.json"); +#elif __APPLE__ + const char* home_env = getenv("HOME"); + versionFilePath = home_env; + versionFilePath = versionFilePath + "/Library/Application Support/Snapmaker_Orca/web/flutter_web/version.json"; +#else + +#endif + + std::ifstream json_file(versionFilePath); + if (!json_file.is_open()) { + std::ifstream json_file(versionFilePath); + return ""; + } + nlohmann::json json_data; + json_file >> json_data; + std::string str_version = json_data["version"]; + std::string str_build_number = json_data["build_number"]; + + std::string flutter_version = std::string("flutter_version: ") + str_version + std::string(" ") + std::string("build_number: ") + + str_build_number; + + return flutter_version; + } + +} \ No newline at end of file diff --git a/src/common_func/common_func.hpp b/src/common_func/common_func.hpp new file mode 100644 index 0000000000..919e234fee --- /dev/null +++ b/src/common_func/common_func.hpp @@ -0,0 +1,27 @@ +#ifndef _common_func_hppp_ +#define _common_func_hppp_ +#include + + +#define SLIC3R_APP_NAME "Snapmaker Orca" +#define SLIC3R_APP_KEY "Snapmaker_Orca" +#define SLIC3R_VERSION "01.10.01.50" +#define Snapmaker_VERSION "2.2.0" +#define MIN_FIRM_VER "0.8.4" +#ifndef GIT_COMMIT_HASH +#define GIT_COMMIT_HASH "0000000" // 0000000 means uninitialized +#endif +#define SLIC3R_BUILD_ID "" +// #define SLIC3R_RC_VERSION "01.10.01.50" +#define BBL_RELEASE_TO_PUBLIC 1 +#define BBL_INTERNAL_TESTING 0 +#define ORCA_CHECK_GCODE_PLACEHOLDERS 0 + +namespace common +{ + std::string get_pc_name(); + + std::string get_flutter_version(); +} // namespace common + +#endif \ No newline at end of file diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 79071cc061..407b6bf740 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -6,7 +6,7 @@ #include "Utils.hpp" #include "Model.hpp" #include "format.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include #include diff --git a/src/libslic3r/libslic3r.h b/src/libslic3r/libslic3r.h index 0364ac340e..8d0f779129 100644 --- a/src/libslic3r/libslic3r.h +++ b/src/libslic3r/libslic3r.h @@ -1,7 +1,7 @@ #ifndef _libslic3r_h_ #define _libslic3r_h_ -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #define SLIC3R_APP_FULL_NAME "Snapmaker Orca" #define GCODEVIEWER_APP_NAME "Snapmaker_Orca G-code Viewer" #define GCODEVIEWER_APP_KEY "Snapmaker_OrcaGcodeViewer" diff --git a/src/libslic3r/pchheader.hpp b/src/libslic3r/pchheader.hpp index 1bedfb482a..cc93b3b220 100644 --- a/src/libslic3r/pchheader.hpp +++ b/src/libslic3r/pchheader.hpp @@ -125,7 +125,7 @@ #include "SVG.hpp" #include "libslic3r.h" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include diff --git a/src/sentry_wrapper/SentryWrapper.cpp b/src/sentry_wrapper/SentryWrapper.cpp index 25982b9d46..6f72348634 100644 --- a/src/sentry_wrapper/SentryWrapper.cpp +++ b/src/sentry_wrapper/SentryWrapper.cpp @@ -27,6 +27,7 @@ #include #include #include +#include "common_func/common_func.hpp" namespace Slic3r { @@ -193,6 +194,7 @@ void initSentryEx() #endif sentry_options_set_environment(options, "develop"); + //sentry_options_set_environment(options, "Release"); sentry_options_set_auto_session_tracking(options, 0); sentry_options_set_symbolize_stacktraces(options, 1); @@ -202,6 +204,12 @@ void initSentryEx() sentry_options_set_sample_rate(options, 1.0); sentry_options_set_traces_sample_rate(options, 1.0); + sentry_set_tag("version", Snapmaker_VERSION); + + std::string flutterVersion = common::get_flutter_version(); + if (!flutterVersion.empty()) + set_sentry_tags("flutter_version", flutterVersion); + sentry_init(options); sentry_start_session(); diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 36d572e1b9..78e14f1bed 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -16,7 +16,7 @@ #include "FileHelp.hpp" #include "Tab.hpp" #include "MainFrame.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #define NAME_OPTION_COMBOBOX_SIZE wxSize(FromDIP(200), FromDIP(24)) #define FILAMENT_PRESET_COMBOBOX_SIZE wxSize(FromDIP(300), FromDIP(24)) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 06f24b848f..a7fe3e4a8d 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -6,7 +6,7 @@ #include "slic3r/GUI/UserManager.hpp" #include "slic3r/GUI/TaskManager.hpp" #include "format.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include "Downloader.hpp" #include "slic3r/GUI/WebUrlDialog.hpp" diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 7120e6ef86..f6e67d1c0a 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -72,9 +72,9 @@ #include #include #include -#include "sentry_wrapper/SentryWrapper.hpp" #endif // _WIN32 #include +#include "sentry_wrapper/SentryWrapper.hpp" namespace Slic3r { @@ -1008,41 +1008,6 @@ void MainFrame::show_option(bool show) } } } -void MainFrame::get_local_webview_version() -{ - std::string versionFilePath = ""; - -#ifdef _WIN32 - wchar_t appDataPath[MAX_PATH] = {0}; - auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath); - char* path = new char[MAX_PATH]; - size_t pathLength; - wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH); - std::string filePath = path; - versionFilePath = filePath + "\\" + std::string("Snapmaker_Orca\\web\\flutter_web\\version.json"); -#elif __APPLE__ - const char* home_env = getenv("HOME"); - versionFilePath = home_env; - versionFilePath = versionFilePath + "/Library/Application Support/Snapmaker_Orca/web/flutter_web/version.json"; -#else - -#endif - - std::ifstream json_file(versionFilePath); - if (!json_file.is_open()) { - std::ifstream json_file(versionFilePath); - BOOST_LOG_TRIVIAL(error) << "check flutter version error with file path:" << versionFilePath; - return; - } - nlohmann::json json_data; - json_file >> json_data; - std::string str_version = json_data["version"]; - std::string str_build_number = json_data["build_number"]; - - std::string tag = std::string("flutter_version: ") + str_version + std::string(" ") + std::string("build_number: ") + str_build_number; - set_sentry_tags("flutter_version", tag); - -} void MainFrame::init_tabpanel() { // wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on @@ -1126,7 +1091,6 @@ void MainFrame::init_tabpanel() { m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL); } - get_local_webview_version(); m_plater = new Plater(this, this); m_plater->SetBackgroundColour(*wxWHITE); m_plater->Hide(); diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index a3889ad91a..1bf719f73f 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -264,7 +264,6 @@ public: void update_title_colour_after_set_title(); void show_option(bool show); void init_tabpanel(); - void get_local_webview_version(); void create_preset_tabs(); //BBS: GUI refactor void add_created_tab(Tab* panel, const std::string& bmp_name = ""); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 69bcb84a26..edfeabd849 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1,6 +1,6 @@ #include "Plater.hpp" #include "libslic3r/Config.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include #include diff --git a/src/slic3r/GUI/PrinterWebView.cpp b/src/slic3r/GUI/PrinterWebView.cpp index 322eb642a6..4a8c42edc6 100644 --- a/src/slic3r/GUI/PrinterWebView.cpp +++ b/src/slic3r/GUI/PrinterWebView.cpp @@ -5,7 +5,7 @@ #include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/MainFrame.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include #include diff --git a/src/slic3r/GUI/SSWCP.cpp b/src/slic3r/GUI/SSWCP.cpp index c89aeeb758..6555fd53c8 100644 --- a/src/slic3r/GUI/SSWCP.cpp +++ b/src/slic3r/GUI/SSWCP.cpp @@ -91,7 +91,6 @@ bool WCP_Logger::set_level(wxString& level) } } -std::string WCP_Logger::get_pc_name() { return boost::asio::ip::host_name(); } // Add a log message to the queue void WCP_Logger::add_log(const wxString& content, bool is_web = false, wxString time = "", wxString module = "Default", wxString level = "debug") diff --git a/src/slic3r/GUI/WebDownPluginDlg.cpp b/src/slic3r/GUI/WebDownPluginDlg.cpp index 93a1a5959c..a1141ab48c 100644 --- a/src/slic3r/GUI/WebDownPluginDlg.cpp +++ b/src/slic3r/GUI/WebDownPluginDlg.cpp @@ -6,7 +6,7 @@ #include "libslic3r/AppConfig.hpp" #include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/GUI_App.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include #include diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 97fae75977..e30c1a6506 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -10,7 +10,7 @@ #include "libslic3r/PresetBundle.hpp" #include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/GUI_App.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include #include diff --git a/src/slic3r/GUI/WebPresetDialog.cpp b/src/slic3r/GUI/WebPresetDialog.cpp index bbd45a1745..0f7771699a 100644 --- a/src/slic3r/GUI/WebPresetDialog.cpp +++ b/src/slic3r/GUI/WebPresetDialog.cpp @@ -6,7 +6,7 @@ #include "libslic3r/AppConfig.hpp" #include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/GUI_App.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include #include diff --git a/src/slic3r/GUI/WebSMUserLoginDialog.cpp b/src/slic3r/GUI/WebSMUserLoginDialog.cpp index 2092f0d812..99773e3eb1 100644 --- a/src/slic3r/GUI/WebSMUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebSMUserLoginDialog.cpp @@ -5,7 +5,7 @@ #include "libslic3r/AppConfig.hpp" #include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/GUI_App.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include #include diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index 8bffe3e08b..5afc43568a 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -5,7 +5,7 @@ #include "libslic3r/AppConfig.hpp" #include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/GUI_App.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include #include diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index a7f9b4801f..98aa42af2a 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -4,7 +4,7 @@ #include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/MainFrame.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include "../Utils/Http.hpp" #include "SSWCP.hpp" diff --git a/src/slic3r/Utils/Http.hpp b/src/slic3r/Utils/Http.hpp index ef31a1127e..7b2c05b908 100644 --- a/src/slic3r/Utils/Http.hpp +++ b/src/slic3r/Utils/Http.hpp @@ -9,7 +9,7 @@ #include #include "libslic3r/Exception.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #define MAX_SIZE_TO_FILE 3*1024 diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index c9f2de7517..b1321a2689 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -25,7 +25,7 @@ #include "libslic3r/format.hpp" #include "libslic3r/Utils.hpp" #include "libslic3r/PresetBundle.hpp" -#include "libslic3r_version.h" +#include "common_func/common_func.hpp" #include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/I18N.hpp" From 941c92432969d7878ff11eba74b8a390c24fa442 Mon Sep 17 00:00:00 2001 From: alves Date: Wed, 17 Dec 2025 18:24:23 +0800 Subject: [PATCH 6/8] feature add privacy policy for guide --- resources/web/guide/11/11.js | 3 +- resources/web/guide/21/index.html | 2 +- resources/web/guide/3/3.css | 22 +++++ resources/web/guide/3/3.js | 118 +++++++++++++++------------ resources/web/guide/3/index.html | 15 ++-- resources/web/guide/31/index.html | 2 +- src/bury_cfg/bury_point.cpp | 21 +++-- src/bury_cfg/bury_point.hpp | 8 +- src/sentry_wrapper/SentryWrapper.cpp | 6 ++ src/slic3r/GUI/GUI_App.cpp | 8 +- src/slic3r/GUI/Plater.cpp | 2 +- src/slic3r/GUI/WebGuideDialog.cpp | 11 ++- src/slic3r/GUI/WebPresetDialog.cpp | 8 ++ 13 files changed, 150 insertions(+), 76 deletions(-) diff --git a/resources/web/guide/11/11.js b/resources/web/guide/11/11.js index 5cbc330192..74a201f338 100644 --- a/resources/web/guide/11/11.js +++ b/resources/web/guide/11/11.js @@ -62,7 +62,8 @@ function GotoPolicyPage() SendWXMessage( JSON.stringify(tSend) ); - window.location.href="../21/index.html"; + + window.location.href="../3/index.html"; } diff --git a/resources/web/guide/21/index.html b/resources/web/guide/21/index.html index 5122ccec49..c0694faffc 100644 --- a/resources/web/guide/21/index.html +++ b/resources/web/guide/21/index.html @@ -104,7 +104,7 @@
-
Back
+
Back
Next
diff --git a/resources/web/guide/3/3.css b/resources/web/guide/3/3.css index bd7d413337..f3044a5792 100644 --- a/resources/web/guide/3/3.css +++ b/resources/web/guide/3/3.css @@ -1,3 +1,25 @@ + +#Title { + height: auto; + min-height: 60px; + padding: 12px 25px; + box-sizing: border-box; +} + +#Title div { + font-size: 16px; + line-height: 24px; + word-wrap: break-word; + white-space: normal; + text-align: center; +} + + +#Content { + flex: 1; + height: auto; +} + .PolicyArea { background-color: #4A4A51; diff --git a/resources/web/guide/3/3.js b/resources/web/guide/3/3.js index 1418d50dda..379cd39441 100644 --- a/resources/web/guide/3/3.js +++ b/resources/web/guide/3/3.js @@ -1,31 +1,12 @@ +var m_Region = ''; + function OnInit() { TranslatePage(); - SendPrivacySelect(); -} - - -function SendPrivacySelect() -{ - let nVal="refuse"; - if( $('#ChoosePrivacy').is(':checked') ) - nVal="agree"; - var tSend={}; - tSend['sequence_id']=Math.round(new Date() / 1000); - tSend['command']="user_private_choice"; - tSend['data']={}; - tSend['data']['action']=nVal; - - SendWXMessage( JSON.stringify(tSend) ); -} - - -function GotoNextPage() -{ - RequestProfile(); + RequestProfile(); } function RequestProfile() @@ -40,41 +21,72 @@ function RequestProfile() function HandleStudio( pVal ) { let strCmd=pVal['command']; - //alert(strCmd); if(strCmd=='response_userguide_profile') { - HandleModelInfo(pVal['response']); + + if(pVal['response'] && pVal['response']['region']) { + m_Region = pVal['response']['region']; + } } } -function HandleModelInfo( pVal ) -{ - let Modellist=pVal["model"]; - let nModel=Modellist.length; - - if(nModel==1) - { -// let pModel=Modellist[0]; -// -// var tSend={}; -// tSend['sequence_id']=Math.round(new Date() / 1000); -// tSend['command']="save_userguide_models"; -// tSend['data']={}; -// -// let ModelName=pModel['model']; -// -// tSend['data'][ModelName]={}; -// tSend['data'][ModelName]['model']=pModel['model']; -// tSend['data'][ModelName]['nozzle_diameter']=pModel['nozzle_diameter']; -// tSend['data'][ModelName]['vendor']=pModel['vendor']; -// -// SendWXMessage( JSON.stringify(tSend) ); - - window.location.href="../22/index.html"; - - return; - } - window.location.href="../21/index.html"; -} \ No newline at end of file +function GotoBackPage() +{ + window.location.href="../11/index.html"; +} + + +function GotoNextPage() +{ + + SendPrivacyChoice("agree"); + + + window.location.href="../21/index.html"; +} + + +function GotoSkipPage() +{ + + SendPrivacyChoice("refuse"); + + + window.location.href="../21/index.html"; +} + + +function SendPrivacyChoice(action) +{ + var tSend={}; + tSend['sequence_id']=Math.round(new Date() / 1000); + tSend['command']="user_private_choice"; + tSend['data']={}; + tSend['data']['action']=action; // "agree" 或 "refuse" + + SendWXMessage( JSON.stringify(tSend) ); +} + + +function OpenPrivacyPolicy() +{ + var privacyUrl = ""; + + + if(m_Region === "China") { + privacyUrl = "https://www.snapmaker.cn/privacy-policy.html"; + } else { + privacyUrl = "https://www.snapmaker.com/privacy-policy"; + } + + + var tSend={}; + tSend['sequence_id']=Math.round(new Date() / 1000); + tSend['command']="common_openurl"; + tSend['url']=privacyUrl; + tSend['local']=m_Region + + SendWXMessage( JSON.stringify(tSend) ); +} diff --git a/resources/web/guide/3/index.html b/resources/web/guide/3/index.html index 836811bf84..daef8b263b 100644 --- a/resources/web/guide/3/index.html +++ b/resources/web/guide/3/index.html @@ -16,24 +16,21 @@
-
We kindly request your help to improve
everyone's printing
+
We kindly request your help to improve everyone's printing.
Come and Join our Customer Experience Improvement Program
-
Back
-
Next
+
Back
+
Skip
+
Join the Program
diff --git a/resources/web/guide/31/index.html b/resources/web/guide/31/index.html index 65b81fd420..3a68b05338 100644 --- a/resources/web/guide/31/index.html +++ b/resources/web/guide/31/index.html @@ -19,7 +19,7 @@
diff --git a/src/bury_cfg/bury_point.cpp b/src/bury_cfg/bury_point.cpp index cf3e1dc9ce..282474f30e 100644 --- a/src/bury_cfg/bury_point.cpp +++ b/src/bury_cfg/bury_point.cpp @@ -4,6 +4,15 @@ #include #include +bool get_privacy_policy() +{ + return isAgreeSlice; +} + +void set_privacy_policy(bool isAgree) { + isAgreeSlice = isAgree; +} + std::string get_timestamp_seconds() { auto now = std::chrono::system_clock::now(); @@ -26,16 +35,16 @@ long long get_time_timestamp() return timestamp; } -std::string get_works_time(const uint64_t& timestamp) +std::string get_works_time(const long long& timestamp) { - uint64_t hours = timestamp / 3600000; - uint64_t remaining_ms = timestamp % 3600000; + long long hours = timestamp / 3600000; + long long remaining_ms = timestamp % 3600000; - uint64_t minutes = remaining_ms / 60000; + long long minutes = remaining_ms / 60000; remaining_ms = remaining_ms % 60000; - uint64_t seconds = remaining_ms / 1000; - uint64_t ms = remaining_ms % 1000; + long long seconds = remaining_ms / 1000; + long long ms = remaining_ms % 1000; char buffer[32] = {0}; std::snprintf(buffer, sizeof(buffer), "%02llu:%02llu:%02llu.%03llu", hours, minutes, seconds, ms); diff --git a/src/bury_cfg/bury_point.hpp b/src/bury_cfg/bury_point.hpp index 132ef3446f..647c4d968f 100644 --- a/src/bury_cfg/bury_point.hpp +++ b/src/bury_cfg/bury_point.hpp @@ -2,6 +2,7 @@ #define _BURY_POINT_hpp_ #include #include +#include #define BURY_POINT "bury_point" @@ -37,9 +38,12 @@ - static bool isAgreeSlice = false; + static std::atomic isAgreeSlice = true; + + bool get_privacy_policy(); + void set_privacy_policy(bool isAgree); extern std::string get_timestamp_seconds(); extern long long get_time_timestamp(); - extern std::string get_works_time(const uint64_t& timestamp); + extern std::string get_works_time(const long long& timestamp); #endif \ No newline at end of file diff --git a/src/sentry_wrapper/SentryWrapper.cpp b/src/sentry_wrapper/SentryWrapper.cpp index 6f72348634..4774bff7a7 100644 --- a/src/sentry_wrapper/SentryWrapper.cpp +++ b/src/sentry_wrapper/SentryWrapper.cpp @@ -57,6 +57,12 @@ static sentry_value_t on_crash_callback(const sentry_ucontext_t* uctx, sentry_va static sentry_value_t before_send(sentry_value_t event, void* hint, void* data) { + if (!get_privacy_policy()) + { + sentry_value_decref(event); + return sentry_value_new_null(); + } + sentry_value_t level_val = sentry_value_get_by_key(event, SENTRY_KEY_LEVEL); std::string levelName = sentry_value_as_string(level_val); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index a7fe3e4a8d..d889b01510 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -120,7 +120,7 @@ #include "PrivacyUpdateDialog.hpp" #include "ModelMall.hpp" #include "HintNotification.hpp" - +#include "bury_cfg/bury_point.hpp" //#ifdef WIN32 //#include "BaseException.h" //#endif @@ -3754,6 +3754,9 @@ if (res) { } catch (std::exception &) { // wxMessageBox(e.what(), "", MB_OK); } + auto isAgree = wxGetApp().app_config->get("snapmaker_privacy_policy", "isagree"); + + set_privacy_policy(isAgree == "true"); } void GUI_App::ShowDownNetPluginDlg() { @@ -7059,6 +7062,9 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage mainframe->refresh_plugin_tips(); // BBS: remove SLA related message } + auto isAgree = wxGetApp().app_config->get("snapmaker_privacy_policy", "isagree"); + + set_privacy_policy(isAgree == "true"); return res; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index edfeabd849..1cbd8e013e 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -7746,7 +7746,7 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt) if (m_slice_timing_active) { auto end_time = std::chrono::steady_clock::now(); auto duration_ms = std::chrono::duration_cast(end_time - m_slice_start_time).count(); - uint64_t timess = duration_ms; + auto timess = duration_ms; if (evt.cancelled()) { BOOST_LOG_TRIVIAL(info) << "Slicing cancelled after " << duration_ms << " ms"; m_slice_start_time = {}; diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index e30c1a6506..483508bdef 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -492,6 +492,15 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt) this->Close(); } else if (strCmd == "save_region") { m_Region = j["region"]; + m_ProfileJson["region"] = m_Region; + } + else if (strCmd == "common_openurl") { + + std::string url = j["url"]; + std::string local = j["local"]; + if (!url.empty()) { + wxLaunchDefaultBrowser(url); + } } else if (strCmd == "network_plugin_install") { std::string sAction = j["data"]["action"]; @@ -617,7 +626,7 @@ int GuideFrame::SaveProfile() // m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "1"); // } else // m_MainPtr->app_config->set(std::string(m_SectionName.mb_str()), "privacyuse", "0"); - + m_MainPtr->app_config->set("snapmaker_privacy_policy", "isagree", PrivacyUse); m_MainPtr->app_config->set("region", m_Region); m_MainPtr->app_config->set_bool("stealth_mode", StealthMode); diff --git a/src/slic3r/GUI/WebPresetDialog.cpp b/src/slic3r/GUI/WebPresetDialog.cpp index 0f7771699a..aee23c9e1d 100644 --- a/src/slic3r/GUI/WebPresetDialog.cpp +++ b/src/slic3r/GUI/WebPresetDialog.cpp @@ -588,6 +588,14 @@ void WebPresetDialog::OnScriptMessage(wxWebViewEvent& evt) this->Close(); } else if (strCmd == "save_region") { m_Region = j["region"]; + m_ProfileJson["region"] = m_Region; + } + else if (strCmd == "common_openurl") { + + std::string url = j["url"]; + if (!url.empty()) { + wxLaunchDefaultBrowser(url); + } } else if (strCmd == "network_plugin_install") { std::string sAction = j["data"]["action"]; From 4578e840bb9e12352d88da7173532c71a9f87f2c Mon Sep 17 00:00:00 2001 From: alves Date: Thu, 18 Dec 2025 09:34:49 +0800 Subject: [PATCH 7/8] fix privacy policy flags not work bug --- src/CMakeLists.txt | 9 ++++++--- src/bury_cfg/bury_point.cpp | 1 + src/bury_cfg/bury_point.hpp | 24 +++++++++++++++--------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ac01610264..c060c480c7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -116,6 +116,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/Snapmaker_Orca configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY) if (WIN32) add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp common_func/common_func.hpp common_func/common_func.cpp) + target_compile_definitions(Snapmaker_Orca PRIVATE BURY_EXPORTS) else () add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp common_func/common_func.hpp common_func/common_func.cpp) endif () @@ -181,7 +182,8 @@ if (WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode") endif() - add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.cpp common_func/common_func.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc) + + add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp common_func/common_func.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc) # Generate debug symbols even in release mode. if(MSVC) target_link_options(Snapmaker_Orca_app_gui PUBLIC "$<$:/DEBUG>") @@ -189,10 +191,11 @@ if (WIN32) target_compile_definitions(Snapmaker_Orca_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE) add_dependencies(Snapmaker_Orca_app_gui Snapmaker_Orca) set_target_properties(Snapmaker_Orca_app_gui PROPERTIES OUTPUT_NAME "snapmaker-orca") + if (SLIC3R_SENTRY) - target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry nlohmann_json) + target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry nlohmann_json Snapmaker_Orca) else() - target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly nlohmann_json) + target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly nlohmann_json Snapmaker_Orca) endif() if (SLIC3R_SENTRY) target_compile_definitions(Snapmaker_Orca_app_gui PRIVATE SLIC3R_SENTRY) diff --git a/src/bury_cfg/bury_point.cpp b/src/bury_cfg/bury_point.cpp index 282474f30e..8c16dc5a0b 100644 --- a/src/bury_cfg/bury_point.cpp +++ b/src/bury_cfg/bury_point.cpp @@ -4,6 +4,7 @@ #include #include +static std::atomic isAgreeSlice(true); bool get_privacy_policy() { return isAgreeSlice; diff --git a/src/bury_cfg/bury_point.hpp b/src/bury_cfg/bury_point.hpp index 647c4d968f..9fb3f2bc20 100644 --- a/src/bury_cfg/bury_point.hpp +++ b/src/bury_cfg/bury_point.hpp @@ -4,6 +4,16 @@ #include #include +#ifdef _WIN32 + #ifdef BURY_EXPORTS + #define BURY_API __declspec(dllexport) + #else + #define BURY_API __declspec(dllimport) + #endif +#else + #define BURY_API extern +#endif + #define BURY_POINT "bury_point" #define BP_START_SOFT "bury_point_start_soft" @@ -36,14 +46,10 @@ //webview bury point - - - static std::atomic isAgreeSlice = true; - - bool get_privacy_policy(); - void set_privacy_policy(bool isAgree); - extern std::string get_timestamp_seconds(); - extern long long get_time_timestamp(); - extern std::string get_works_time(const long long& timestamp); + BURY_API bool get_privacy_policy(); + BURY_API void set_privacy_policy(bool isAgree); + BURY_API std::string get_timestamp_seconds(); + BURY_API long long get_time_timestamp(); + BURY_API std::string get_works_time(const long long& timestamp); #endif \ No newline at end of file From 43892819f57917a4daa49f56dfd00222004eb81a Mon Sep 17 00:00:00 2001 From: alves Date: Thu, 18 Dec 2025 09:45:55 +0800 Subject: [PATCH 8/8] fix linux build fail bug --- src/slic3r/CMakeLists.txt | 2 +- src/slic3r/GUI/Plater.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index 44ae2d49a1..28596e3fb9 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -653,7 +653,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GeneratedConfig.hpp.in @ONLY) add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES}) -target_include_directories(libslic3r_gui PRIVATE Utils ${CMAKE_CURRENT_BINARY_DIR}) +target_include_directories(libslic3r_gui PRIVATE Utils ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..) target_link_libraries(libslic3r_gui paho-mqttpp3-static) target_include_directories(libslic3r_gui PRIVATE ${PAHO_MQTT_CPP_PATH}/include) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 1cbd8e013e..c9b4b06e5e 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -156,7 +156,7 @@ #include "CloneDialog.hpp" #include "WebPreprintDialog.hpp" -#include "sentry_wrapper/sentryWrapper.hpp" +#include "sentry_wrapper/SentryWrapper.hpp" #include using boost::optional;