Snapshots extended to capture and restore sla_print, sla_material,

physical_printers.
Updated the snapshots dialog to display sla_print and sla_material.
Updated the snapshots dialog to display physical_printer instead of
printer if the physical_printer key is nonempty.
The "physical_printer" key was moved from [extras] to [presets] section
of PrusaSlicer.ini
This commit is contained in:
Vojtech Bubnik 2020-10-27 12:48:20 +01:00
parent 15a75ec6b0
commit 06c16b085d
6 changed files with 74 additions and 26 deletions

View file

@ -205,6 +205,20 @@ std::string AppConfig::load()
m_legacy_datadir = ini_ver < Semver(1, 40, 0);
}
// Legacy conversion
if (m_mode == EAppMode::Editor) {
// Convert [extras] "physical_printer" to [presets] "physical_printer",
// remove the [extras] section if it becomes empty.
if (auto it_section = m_storage.find("extras"); it_section != m_storage.end()) {
if (auto it_physical_printer = it_section->second.find("physical_printer"); it_physical_printer != it_section->second.end()) {
m_storage["presets"]["physical_printer"] = it_physical_printer->second;
it_section->second.erase(it_physical_printer);
}
if (it_section->second.empty())
m_storage.erase(it_section);
}
}
// Override missing or keys with their defaults.
this->set_defaults();
m_dirty = false;
@ -428,6 +442,7 @@ void AppConfig::reset_selections()
it->second.erase("sla_print");
it->second.erase("sla_material");
it->second.erase("printer");
it->second.erase("physical_printer");
m_dirty = true;
}
}