revert changes in Preset.cpp

This commit is contained in:
SoftFever
2026-07-01 15:25:54 +08:00
parent e39be23d6d
commit 9af07685fd

View File

@@ -800,14 +800,10 @@ bool is_compatible_with_parent_printer(const PresetWithVendorProfile& preset, co
{
auto *compatible_printers = dynamic_cast<const ConfigOptionStrings*>(preset.preset.config.option("compatible_printers"));
bool has_compatible_printers = compatible_printers != nullptr && ! compatible_printers->values.empty();
auto contains_printer_name = [compatible_printers](const std::string &printer_name) {
return std::find(compatible_printers->values.begin(), compatible_printers->values.end(), printer_name) !=
compatible_printers->values.end();
};
//BBS: FIXME only check the parent now, but should check grand-parent as well.
return has_compatible_printers &&
(contains_printer_name(active_printer.preset.inherits()) ||
std::any_of(active_printer.preset.renamed_from.begin(), active_printer.preset.renamed_from.end(), contains_printer_name));
std::find(compatible_printers->values.begin(), compatible_printers->values.end(), active_printer.preset.inherits()) !=
compatible_printers->values.end();
}
bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_printer, const DynamicPrintConfig *extra_config)
@@ -838,13 +834,9 @@ bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const Pre
return true;
}
}
auto contains_printer_name = [compatible_printers](const std::string &printer_name) {
return std::find(compatible_printers->values.begin(), compatible_printers->values.end(), printer_name) !=
compatible_printers->values.end();
};
return preset.preset.is_default || active_printer.preset.name.empty() || !has_compatible_printers ||
contains_printer_name(active_printer.preset.name) ||
std::any_of(active_printer.preset.renamed_from.begin(), active_printer.preset.renamed_from.end(), contains_printer_name) ||
std::find(compatible_printers->values.begin(), compatible_printers->values.end(), active_printer.preset.name) !=
compatible_printers->values.end() ||
(!active_printer.preset.is_system && is_compatible_with_parent_printer(preset, active_printer));
}