mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-31 05:47:02 +00:00
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.
This commit is contained in:
@@ -5077,21 +5077,28 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
|
|||||||
if (plater != nullptr && wxGetApp().imgui()->display_initialized()) {
|
if (plater != nullptr && wxGetApp().imgui()->display_initialized()) {
|
||||||
std::string text;
|
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) {
|
switch (conflict_code) {
|
||||||
case -1:
|
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.");
|
"Pull downloads the cloud copy. Force push overwrites it with your local preset.");
|
||||||
break;
|
break;
|
||||||
case -2:
|
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.");
|
"Pull downloads the cloud copy. Force push overwrites it with your local preset.");
|
||||||
break;
|
break;
|
||||||
case -3:
|
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.");
|
"Delete will delete your local preset. Force push overwrites it with your local preset.");
|
||||||
break;
|
break;
|
||||||
default:
|
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.");
|
"Pull downloads the cloud copy. Force push overwrites it with your local preset.");
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
@@ -5110,10 +5117,12 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
|
|||||||
[this, conflict_setting_id, conflict_preset_name, conflict_user_id](wxEvtHandler*) {
|
[this, conflict_setting_id, conflict_preset_name, conflict_user_id](wxEvtHandler*) {
|
||||||
if (mainframe == nullptr)
|
if (mainframe == nullptr)
|
||||||
return false;
|
return false;
|
||||||
MessageDialog
|
const wxString confirm_msg = conflict_preset_name.empty()
|
||||||
dlg(mainframe,
|
? _L("Force push will overwrite the cloud copy with your local preset changes.\nDo you want to continue?")
|
||||||
_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?"),
|
||||||
_L("Resolve cloud sync conflict"), wxCENTER | wxYES_NO | wxNO_DEFAULT | wxICON_WARNING);
|
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)
|
if (dlg.ShowModal() != wxID_YES)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -6549,14 +6558,14 @@ void GUI_App::sync_preset(Preset* preset, bool force)
|
|||||||
result = 0; // Set to 0 so the sync_info gets saved below
|
result = 0; // Set to 0 so the sync_info gets saved below
|
||||||
|
|
||||||
// Show user notification
|
// Show user notification
|
||||||
CallAfter([this] {
|
CallAfter([this, name = preset->name] {
|
||||||
static bool size_limit_dialog_notified = false;
|
static bool size_limit_dialog_notified = false;
|
||||||
if (size_limit_dialog_notified)
|
if (size_limit_dialog_notified)
|
||||||
return;
|
return;
|
||||||
size_limit_dialog_notified = true;
|
size_limit_dialog_notified = true;
|
||||||
if (mainframe == nullptr)
|
if (mainframe == nullptr)
|
||||||
return;
|
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();
|
MessageDialog(mainframe, msg, _L("Sync user presets"), wxICON_WARNING | wxOK).ShowModal();
|
||||||
});
|
});
|
||||||
// NOTE: Don't return here - let execution continue to save the sync_info
|
// NOTE: Don't return here - let execution continue to save the sync_info
|
||||||
|
|||||||
Reference in New Issue
Block a user