mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-11 11:07:40 +00:00
fix: tombstone resolution for 409 status code with error code -3
This commit is contained in:
@@ -4953,16 +4953,25 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
|
|||||||
auto* plater = wxGetApp().plater();
|
auto* plater = wxGetApp().plater();
|
||||||
if (plater != nullptr && wxGetApp().imgui()->display_initialized()) {
|
if (plater != nullptr && wxGetApp().imgui()->display_initialized()) {
|
||||||
std::string text;
|
std::string text;
|
||||||
if (conflict_code == -1) {
|
|
||||||
|
switch (conflict_code) {
|
||||||
|
case -1:
|
||||||
text = _u8L("Cloud sync conflict: this preset has a newer version in OrcaCloud.\n"
|
text = _u8L("Cloud sync conflict: 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.");
|
||||||
} else {
|
break;
|
||||||
|
case -2:
|
||||||
text = _u8L("Cloud sync conflict: a preset with this name already exists in OrcaCloud.\n"
|
text = _u8L("Cloud sync conflict: 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;
|
||||||
|
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?");
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
plater->get_notification_manager()->push_orca_sync_conflict_notification(
|
plater->get_notification_manager()->push_orca_sync_conflict_notification(
|
||||||
text,
|
text,
|
||||||
[this](wxEvtHandler*) {
|
conflict_code == -3 ? nullptr : std::function<bool(wxEvtHandler*)>{[this](wxEvtHandler*) {
|
||||||
// Runs on the GUI thread (on_http_error is a queued wx event); restart_sync_user_preset()
|
// 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.
|
// already joins the old sync thread off the UI thread, so no extra thread is needed here.
|
||||||
if (is_closing() || !m_agent || !preset_bundle)
|
if (is_closing() || !m_agent || !preset_bundle)
|
||||||
@@ -4970,7 +4979,7 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
|
|||||||
BOOST_LOG_TRIVIAL(info) << "Pulling Orca Cloud settings to resolve sync conflict.";
|
BOOST_LOG_TRIVIAL(info) << "Pulling Orca Cloud settings to resolve sync conflict.";
|
||||||
restart_sync_user_preset();
|
restart_sync_user_preset();
|
||||||
return true;
|
return true;
|
||||||
},
|
}},
|
||||||
[this, conflict_setting_id](wxEvtHandler*) {
|
[this, conflict_setting_id](wxEvtHandler*) {
|
||||||
if (mainframe == nullptr)
|
if (mainframe == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2416,12 +2416,18 @@ void NotificationManager::OrcaSyncConflictNotification::render_text(ImGuiWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
const float action_y = starting_y + m_endlines.size() * shift_y;
|
const float action_y = starting_y + m_endlines.size() * shift_y;
|
||||||
const std::string pull_text = _u8L("Pull");
|
std::string pull_text = "";
|
||||||
render_hyperlink_action(imgui, x_offset, action_y, pull_text, "##orca_sync_pull",
|
float padding = 0.f;
|
||||||
[this] { if (m_pull_callback && m_pull_callback(m_evt_handler)) close(); });
|
|
||||||
|
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(); });
|
||||||
|
}
|
||||||
if (m_force_push_callback) {
|
if (m_force_push_callback) {
|
||||||
const std::string force_push_text = _u8L("Force push");
|
const std::string force_push_text = _u8L("Force push");
|
||||||
const float force_x = x_offset + ImGui::CalcTextSize((pull_text + " ").c_str()).x;
|
const float force_x = x_offset + padding;
|
||||||
render_hyperlink_action(imgui, force_x, action_y, force_push_text, "##orca_sync_force_push",
|
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(); });
|
[this] { if (m_force_push_callback && m_force_push_callback(m_evt_handler)) close(); });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user