mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
ENH: config: add default_nozzle_volume_type in printer
1. also remove original nozzle_volume_type from printer and move into project config 2. support save nozzle_volume_type into appconfig and load from it at beginning or printer switch jira: no-jira Change-Id: I01fc82d142fc633fc59a238796a71b9f8d180efb (cherry picked from commit fe8b904e7551cde83b1ead75922e9b60278b50ad)
This commit is contained in:
@@ -1360,6 +1360,32 @@ std::vector<std::string> AppConfig::get_custom_color_from_config()
|
||||
return colors;
|
||||
}
|
||||
|
||||
void AppConfig::save_nozzle_volume_types_to_config(const std::string& printer_name, const std::string& nozzle_volume_types)
|
||||
{
|
||||
if (!has_section("nozzle_volume_types")) {
|
||||
std::map<std::string, std::string> data;
|
||||
data[printer_name] = nozzle_volume_types;
|
||||
set_section("nozzle_volume_types", data);
|
||||
} else {
|
||||
auto data = get_section("nozzle_volume_types");
|
||||
auto data_modify = const_cast<std::map<std::string, std::string>&>(data);
|
||||
data_modify[printer_name] = nozzle_volume_types;
|
||||
set_section("nozzle_volume_types", data_modify);
|
||||
}
|
||||
}
|
||||
|
||||
std::string AppConfig::get_nozzle_volume_types_from_config(const std::string& printer_name)
|
||||
{
|
||||
std::string nozzle_volume_types;
|
||||
if (has_section("nozzle_volume_types")) {
|
||||
auto data = get_section("nozzle_volume_types");
|
||||
if (data.find(printer_name) != data.end())
|
||||
nozzle_volume_types = data[printer_name];
|
||||
}
|
||||
|
||||
return nozzle_volume_types;
|
||||
}
|
||||
|
||||
void AppConfig::reset_selections()
|
||||
{
|
||||
auto it = m_storage.find("presets");
|
||||
|
||||
Reference in New Issue
Block a user