Make sure codes uses same structure/naming/position as BambuStudio

for easier code comparasion & porting in the future
This commit is contained in:
Noisyfox
2026-07-07 16:34:35 +08:00
parent 0e20f60712
commit f713c7ae49
9 changed files with 111 additions and 78 deletions

View File

@@ -3781,6 +3781,26 @@ void PresetCollection::set_custom_preset_alias(Preset &preset)
set_printer_hold_alias(preset.alias, preset);
}
std::string PresetCollection::get_preset_alias(Preset &preset, bool force)
{
if (!preset.alias.empty())
return preset.alias;
else
set_custom_preset_alias(preset);
if (!preset.alias.empty() || !force)
return preset.alias;
std::string alias_name;
std::string preset_name = preset.name;
size_t end_pos = preset_name.find_first_of("@");
if (end_pos != std::string::npos) {
alias_name = preset_name.substr(0, end_pos);
boost::trim_right(alias_name);
}
return alias_name;
}
void PresetCollection::set_printer_hold_alias(const std::string &alias, Preset &preset, bool remove)
{
auto compatible_printers = dynamic_cast<ConfigOptionStrings *>(preset.config.option("compatible_printers"));