Fixed bug in updating the GUI value of the lensfun lens when maker name consists of multiple words

It might happen in the lensfun DB that there are multiple makers sharing a
similar name (at present, this only happens for "Leica" and "Leica Camera AG").
The logic for finding the lens in the combo box was not considering this...
This commit is contained in:
Alberto Griggio 2017-10-19 16:20:31 +02:00
parent 6f3d5688d8
commit e2433214a3

View File

@ -420,7 +420,8 @@ bool LensProfilePanel::setLensfunLens(const Glib::ustring &lens)
if (it && (*it)[lf->lensfunModelLens.lens] == lens) {
return true;
}
bool first_maker_found = false;
for (auto row : lf->lensfunLensModel->children()) {
if (lens.find(row[lf->lensfunModelLens.lens]) == 0) {
auto &c = row.children();
@ -431,6 +432,11 @@ bool LensProfilePanel::setLensfunLens(const Glib::ustring &lens)
return true;
}
}
// we do not break immediately here, because there might be multiple makers
// sharing the same prefix (e.g. "Leica" and "Leica Camera AG").
// therefore, we break below when the lens doesn't match any of them
first_maker_found = true;
} else if (first_maker_found) {
break;
}
}