From 6bd30977c5cbe38564e82038979383cec7c3310a Mon Sep 17 00:00:00 2001 From: Ian Chua Date: Tue, 9 Jun 2026 18:12:32 +0800 Subject: [PATCH] fix: add resolution for undefined conflicts --- src/slic3r/GUI/GUI_App.cpp | 12 ++++++++---- src/slic3r/GUI/NotificationManager.cpp | 17 ++++++----------- src/slic3r/GUI/NotificationManager.hpp | 6 +++++- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index f990d2e29e..7323029e78 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -4965,13 +4965,17 @@ void GUI_App::on_http_error(wxCommandEvent &evt) break; case -3: text = _u8L("Cloud sync conflict: a preset with the same name was previously deleted from the cloud.\n" - "Do you want to push this new copy to the cloud?"); + "Delete will delete your local preset. Force push overwrites it with your local preset."); + break; + default: + text = _u8L("Cloud sync conflict: there was an unexpected or unidentified preset conflict.\n" + "Pull downloads the cloud copy. Force push overwrites it with your local preset."); break; }; plater->get_notification_manager()->push_orca_sync_conflict_notification( - text, - conflict_code == -3 ? nullptr : std::function{[this](wxEvtHandler*) { + text, conflict_code, + [this](wxEvtHandler*) { // Runs on the GUI thread (on_http_error is a queued wx event); restart_sync_user_preset() // already joins the old sync thread off the UI thread, so no extra thread is needed here. if (is_closing() || !m_agent || !preset_bundle) @@ -4979,7 +4983,7 @@ void GUI_App::on_http_error(wxCommandEvent &evt) BOOST_LOG_TRIVIAL(info) << "Pulling Orca Cloud settings to resolve sync conflict."; restart_sync_user_preset(); return true; - }}, + }, [this, conflict_setting_id](wxEvtHandler*) { if (mainframe == nullptr) return false; diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 835ae29522..2e8d22ebee 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -2416,18 +2416,12 @@ void NotificationManager::OrcaSyncConflictNotification::render_text(ImGuiWrapper } const float action_y = starting_y + m_endlines.size() * shift_y; - std::string pull_text = ""; - float padding = 0.f; - - if (m_pull_callback) { - pull_text = _u8L("Pull"); - padding = ImGui::CalcTextSize((pull_text + " ").c_str()).x; - render_hyperlink_action(imgui, x_offset, action_y, pull_text, "##orca_sync_pull", - [this] { if (m_pull_callback && m_pull_callback(m_evt_handler)) close(); }); - } + const std::string pull_text = conflict_code == -3 ? _u8L("Delete") : _u8L("Pull"); + render_hyperlink_action(imgui, x_offset, action_y, pull_text, "##orca_sync_pull", + [this] { if (m_pull_callback && m_pull_callback(m_evt_handler)) close(); }); if (m_force_push_callback) { const std::string force_push_text = _u8L("Force push"); - const float force_x = x_offset + padding; + const float force_x = x_offset + ImGui::CalcTextSize((pull_text + " ").c_str()).x; render_hyperlink_action(imgui, force_x, action_y, force_push_text, "##orca_sync_force_push", [this] { if (m_force_push_callback && m_force_push_callback(m_evt_handler)) close(); }); } @@ -2443,13 +2437,14 @@ void NotificationManager::push_shared_profiles_notification(const std::string& e } void NotificationManager::push_orca_sync_conflict_notification(const std::string& text, + int conflict_code, std::function pull_callback, std::function force_push_callback) { close_notification_of_type(NotificationType::OrcaSyncConflict); NotificationData data{ NotificationType::OrcaSyncConflict, NotificationLevel::WarningNotificationLevel, 0, text }; push_notification_data(std::make_unique( - data, m_id_provider, m_evt_handler, std::move(pull_callback), std::move(force_push_callback)), 0); + data, m_id_provider, m_evt_handler, std::move(pull_callback), std::move(force_push_callback), conflict_code), 0); } void NotificationManager::push_download_URL_progress_notification(size_t id, const std::string& text, std::function user_action_callback) diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 006de5cff6..dd17f19e42 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -279,6 +279,7 @@ public: // Shared profiles available for selected printer void push_shared_profiles_notification(const std::string& explore_url); void push_orca_sync_conflict_notification(const std::string& text, + int conflict_code, std::function pull_callback, std::function force_push_callback); @@ -905,10 +906,12 @@ private: public: OrcaSyncConflictNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler, std::function pull_callback, - std::function force_push_callback) + std::function force_push_callback, + int conflict_code) : PopNotification(n, id_provider, evt_handler) , m_pull_callback(std::move(pull_callback)) , m_force_push_callback(std::move(force_push_callback)) + , conflict_code(conflict_code) { m_multiline = true; } @@ -920,6 +923,7 @@ private: std::function m_pull_callback; std::function m_force_push_callback; + int conflict_code; }; class SlicingProgressNotification;