ENH: select first order variant for newly enabled printer_model

Change-Id: I841a15f908cb74e6bfa594e017349a967ab4cf0a
Jira: STUDIO-10791
This commit is contained in:
chunmao.guo 2025-03-17 10:17:18 +08:00 committed by lane.wei
parent f0656ee986
commit f1365df997
1 changed files with 8 additions and 0 deletions

View File

@ -862,11 +862,19 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
if (config == enabled_vendors.end())
return std::string();
const VendorProfile & printer_profile = preset_bundle->vendors[bundle_name];
const std::map<std::string, std::set<std::string>>& model_maps = config->second;
//for (const auto& vendor_profile : preset_bundle->vendors) {
for (const auto model_it: model_maps) {
if (model_it.second.size() > 0) {
variant = *model_it.second.begin();
if (model_it.second.size() > 1) {
const VendorProfile::PrinterModel &printer_model = *std::find_if(printer_profile.models.begin(), printer_profile.models.end(),
[id = model_it.first](auto &m) { return m.id == id; });
for (auto &vt : printer_model.variants) {
if (std::find(model_it.second.begin(), model_it.second.end(), vt.name) != model_it.second.end()) { variant = vt.name; break; }
}
}
const auto config_old = old_enabled_vendors.find(bundle_name);
if (config_old == old_enabled_vendors.end())
return model_it.first;