From ee1f4ef1d62a299c425cc893a3f23d6d0c1fc6e6 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sun, 5 Jul 2026 17:05:41 +0800 Subject: [PATCH] Show preset name in cloud sync conflict and error messages (#14592) The 409 conflict notification, the force-push confirmation dialog, and the payload-too-large (413) dialog now name the affected preset. The name was already parsed from the conflict body but never surfaced. The account-level preset-limit message stays generic since it isn't about one specific preset. --- src/slic3r/GUI/GUI_App.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index fb9aeb339e..1fb4d24f84 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -5099,21 +5099,28 @@ void GUI_App::on_http_error(wxCommandEvent &evt) if (plater != nullptr && wxGetApp().imgui()->display_initialized()) { std::string text; + // Name the specific preset in the header so the user knows which one conflicts. + // The agent injects the local preset name into every 409 conflict body, so this is + // normally populated; fall back to a generic header if it is somehow missing. + const std::string header = conflict_preset_name.empty() + ? _u8L("Cloud sync conflict:") + : format(_u8L("Cloud sync conflict for preset \"%s\":"), conflict_preset_name); + switch (conflict_code) { case -1: - text = _u8L("Cloud sync conflict: this preset has a newer version in OrcaCloud.\n" + text = header + " " + _u8L("This preset has a newer version in OrcaCloud.\n" "Pull downloads the cloud copy. Force push overwrites it with your local preset."); break; case -2: - text = _u8L("Cloud sync conflict: a preset with this name already exists in OrcaCloud.\n" + text = header + " " + _u8L("A preset with this name already exists in OrcaCloud.\n" "Pull downloads the cloud copy. Force push overwrites it with your local preset."); break; case -3: - text = _u8L("Cloud sync conflict: a preset with the same name was previously deleted from the cloud.\n" + text = header + " " + _u8L("A preset with the same name was previously deleted from the cloud.\n" "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" + text = header + " " + _u8L("There was an unexpected or unidentified preset conflict.\n" "Pull downloads the cloud copy. Force push overwrites it with your local preset."); break; }; @@ -5132,10 +5139,12 @@ void GUI_App::on_http_error(wxCommandEvent &evt) [this, conflict_setting_id, conflict_preset_name, conflict_user_id](wxEvtHandler*) { if (mainframe == nullptr) return false; - MessageDialog - dlg(mainframe, - _L("Force push will overwrite the cloud copy with your local preset changes.\nDo you want to continue?"), - _L("Resolve cloud sync conflict"), wxCENTER | wxYES_NO | wxNO_DEFAULT | wxICON_WARNING); + const wxString confirm_msg = conflict_preset_name.empty() + ? _L("Force push will overwrite the cloud copy with your local preset changes.\nDo you want to continue?") + : format_wxstr(_L("Force push will overwrite the cloud copy of preset \"%s\" with your local changes.\nDo you want to continue?"), + conflict_preset_name); + MessageDialog dlg(mainframe, confirm_msg, _L("Resolve cloud sync conflict"), + wxCENTER | wxYES_NO | wxNO_DEFAULT | wxICON_WARNING); if (dlg.ShowModal() != wxID_YES) return false; @@ -6571,14 +6580,14 @@ void GUI_App::sync_preset(Preset* preset, bool force) result = 0; // Set to 0 so the sync_info gets saved below // Show user notification - CallAfter([this] { + CallAfter([this, name = preset->name] { static bool size_limit_dialog_notified = false; if (size_limit_dialog_notified) return; size_limit_dialog_notified = true; if (mainframe == nullptr) return; - auto msg = _L("The preset content is too large to sync to the cloud (exceeds 1MB). Please reduce the preset size by removing custom configurations or use it locally only."); + auto msg = format_wxstr(_L("The preset \"%s\" is too large to sync to the cloud (exceeds 1MB). Please reduce the preset size by removing custom configurations or use it locally only."), name); MessageDialog(mainframe, msg, _L("Sync user presets"), wxICON_WARNING | wxOK).ShowModal(); }); // NOTE: Don't return here - let execution continue to save the sync_info