ENH: select first order variant for newly enabled printer_model
Change-Id: I841a15f908cb74e6bfa594e017349a967ab4cf0a Jira: STUDIO-10791
This commit is contained in:
parent
f0656ee986
commit
f1365df997
|
@ -862,11 +862,19 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
|
||||||
if (config == enabled_vendors.end())
|
if (config == enabled_vendors.end())
|
||||||
return std::string();
|
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;
|
const std::map<std::string, std::set<std::string>>& model_maps = config->second;
|
||||||
//for (const auto& vendor_profile : preset_bundle->vendors) {
|
//for (const auto& vendor_profile : preset_bundle->vendors) {
|
||||||
for (const auto model_it: model_maps) {
|
for (const auto model_it: model_maps) {
|
||||||
if (model_it.second.size() > 0) {
|
if (model_it.second.size() > 0) {
|
||||||
variant = *model_it.second.begin();
|
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);
|
const auto config_old = old_enabled_vendors.find(bundle_name);
|
||||||
if (config_old == old_enabled_vendors.end())
|
if (config_old == old_enabled_vendors.end())
|
||||||
return model_it.first;
|
return model_it.first;
|
||||||
|
|
Loading…
Reference in New Issue