mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-14 03:11:19 +00:00
Ask Before Migrating User Filament Presets to Their Legacy Printers
Instead of giving user presets their parent's 2.4.2 printers in memory, detect the user presets that inherit their parent's compatible_printers and are missing printers from the legacy map, and offer to migrate them at startup or from Help > Migrate Filament Presets. Migrating first backs up the user folder to filament_preset_migration_<datetime>_backup.zip in the configuration folder, and migrates nothing if that fails. It then writes the printers into each preset's compatible_printers, patching only that key so the preset keeps the parent name it was saved with and older releases can still resolve it. Cloud-synced presets are marked for upload. No asks again at the next launch; "Don't remind me again" stops the startup prompt.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "DeviceManager.hpp"
|
||||
#include "HMS.hpp"
|
||||
#include "PresetBundleDialog.hpp"
|
||||
#include "LegacyPrinterMigrationDialog.hpp"
|
||||
#include "WebUserLoginDialog.hpp"
|
||||
#include "WebViewDialog.hpp"
|
||||
#include "slic3r/Utils/BBLCloudServiceAgent.hpp"
|
||||
@@ -1109,6 +1110,8 @@ void GUI_App::post_init()
|
||||
}
|
||||
|
||||
this->check_new_version_sf();
|
||||
if (!cw_showed)
|
||||
this->check_legacy_printer_migration(false);
|
||||
const auto cloud_provider = get_printer_cloud_provider();
|
||||
if (is_user_login(cloud_provider) && !app_config->get_stealth_mode()) {
|
||||
// this->check_privacy_version(0);
|
||||
@@ -6822,6 +6825,50 @@ void GUI_App::reload_settings()
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_App::check_legacy_printer_migration(bool by_user)
|
||||
{
|
||||
const std::vector<LegacyPrinterMigration> migrations = preset_bundle->legacy_printer_migrations();
|
||||
if (migrations.empty()) {
|
||||
if (by_user)
|
||||
MessageDialog(mainframe, _L("All your filament presets are available on the printers they were made for."),
|
||||
_L("Migrate Filament Presets"), wxOK | wxICON_INFORMATION).ShowModal();
|
||||
return;
|
||||
}
|
||||
if (!by_user && app_config->get_bool("legacy_printer_migration_dont_remind"))
|
||||
return;
|
||||
|
||||
LegacyPrinterMigrationDialog dlg(mainframe, migrations, !by_user);
|
||||
const bool migrate = dlg.ShowModal() == wxID_YES;
|
||||
if (dlg.dont_remind())
|
||||
app_config->set_bool("legacy_printer_migration_dont_remind", true);
|
||||
if (!migrate)
|
||||
return;
|
||||
|
||||
std::vector<std::string> failed;
|
||||
const std::string backup = preset_bundle->migrate_legacy_printers(migrations, failed);
|
||||
if (backup.empty()) {
|
||||
show_error(mainframe, _L("Your presets could not be backed up, so they were not migrated."));
|
||||
return;
|
||||
}
|
||||
preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
|
||||
mainframe->update_side_preset_ui();
|
||||
for (auto tab : tabs_list) {
|
||||
tab->reload_config();
|
||||
tab->update_changed_ui();
|
||||
}
|
||||
if (plater_)
|
||||
plater_->sidebar().update_all_preset_comboboxes();
|
||||
|
||||
wxString message = format_wxstr(_L("Your filament presets were migrated. Select them again in the filament list where you used them.\n\n"
|
||||
"A backup of your presets was saved to:\n%1%"), backup);
|
||||
if (!failed.empty()) {
|
||||
message += "\n\n" + _L("These presets could not be migrated:");
|
||||
for (const std::string &name : failed)
|
||||
message += "\n" + from_u8(name);
|
||||
}
|
||||
MessageDialog(mainframe, message, _L("Migrate Filament Presets"), wxOK | (failed.empty() ? wxICON_INFORMATION : wxICON_WARNING)).ShowModal();
|
||||
}
|
||||
|
||||
//BBS reload when logout
|
||||
void GUI_App::remove_user_presets()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user