ENH: preset: refine logic to judge Preset::is_bbl_vendor_preset
JIRA: no jira Change-Id: I64dedd76c10624ca51104a2c61b11d4c0f523646
This commit is contained in:
parent
b9898d1cf5
commit
c1f891b646
|
@ -730,26 +730,31 @@ bool Preset::is_custom_defined()
|
|||
// I extened to support call on all presets
|
||||
bool Preset::is_bbl_vendor_preset(PresetBundle *preset_bundle)
|
||||
{
|
||||
bool is_bbl_vendor_preset = true;
|
||||
bool is_bbl_vendor_preset = false;
|
||||
if (preset_bundle) {
|
||||
auto config = &this->config;
|
||||
auto printers = config->opt<ConfigOptionStrings>("compatible_printers");
|
||||
if (printers && !printers->values.empty()) {
|
||||
auto printer = preset_bundle->printers.find_preset(printers->values.front());
|
||||
if (printer)
|
||||
config = &printer->config;
|
||||
if (type != TYPE_PRINTER) {
|
||||
auto printers = config->opt<ConfigOptionStrings>("compatible_printers");
|
||||
if (printers && !printers->values.empty()) {
|
||||
auto printer = preset_bundle->printers.find_preset(printers->values.front());
|
||||
if (printer)
|
||||
config = &printer->config;
|
||||
}
|
||||
}
|
||||
std::string vendor_name;
|
||||
for (auto vendor_profile : preset_bundle->vendors) {
|
||||
for (auto vendor_model : vendor_profile.second.models)
|
||||
if (vendor_model.name == config->opt_string("printer_model"))
|
||||
{
|
||||
vendor_name = vendor_profile.first;
|
||||
break;
|
||||
}
|
||||
auto printer_model_opt = config->opt<ConfigOptionString>("printer_model");
|
||||
if (printer_model_opt) {
|
||||
std::string vendor_name;
|
||||
for (auto vendor_profile : preset_bundle->vendors) {
|
||||
for (auto vendor_model : vendor_profile.second.models)
|
||||
if (vendor_model.name == printer_model_opt->value)
|
||||
{
|
||||
vendor_name = vendor_profile.first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!vendor_name.empty())
|
||||
is_bbl_vendor_preset = (vendor_name.compare("BBL") == 0);
|
||||
}
|
||||
if (!vendor_name.empty())
|
||||
is_bbl_vendor_preset = vendor_name.compare("BBL") == 0 ? true : false;
|
||||
}
|
||||
return is_bbl_vendor_preset;
|
||||
}
|
||||
|
@ -1487,7 +1492,7 @@ int PresetCollection::get_user_presets(PresetBundle *preset_bundle, std::vector<
|
|||
if (!preset.is_user()) continue;
|
||||
if (get_preset_base(preset) != &preset && preset.base_id.empty()) continue;
|
||||
if (!preset.setting_id.empty() && preset.sync_info.empty()) continue;
|
||||
if (!preset.is_bbl_vendor_preset(preset_bundle)) continue;
|
||||
//if (!preset.is_bbl_vendor_preset(preset_bundle)) continue;
|
||||
|
||||
result_presets.push_back(preset);
|
||||
count++;
|
||||
|
|
Loading…
Reference in New Issue