diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index c90de08d9..9b35d038f 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -184,6 +184,16 @@ bool LFLens::ok() const } +Glib::ustring LFLens::getMake() const +{ + if (data_) { + return data_->Maker; + } else { + return ""; + } +} + + Glib::ustring LFLens::getLens() const { if (data_) { diff --git a/rtengine/rtlensfun.h b/rtengine/rtlensfun.h index cb8748eb3..640b6a18c 100644 --- a/rtengine/rtlensfun.h +++ b/rtengine/rtlensfun.h @@ -73,6 +73,7 @@ class LFLens { public: LFLens(); bool ok() const; + Glib::ustring getMake() const; Glib::ustring getLens() const; Glib::ustring getDisplayString() const { return getLens(); } private: diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index b6af0d8d0..1280a3524 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -360,12 +360,8 @@ void LensProfilePanel::fillLensfunLenses() std::map> lenses; auto lenslist = LFDatabase::getInstance()->getLenses(); for (auto &l : lenslist) { - auto name = l.getDisplayString(); - auto pos = name.find_first_of(' '); - Glib::ustring make = "(Unknown)"; - if (pos != Glib::ustring::npos) { - make = name.substr(0, pos); - } + auto name = l.getLens(); + auto make = l.getMake(); lenses[make].insert(name); } for (auto &p : lenses) { @@ -415,15 +411,8 @@ bool LensProfilePanel::setLensfunLens(const Glib::ustring &lens) return true; } - // search for the active row - auto pos = lens.find_first_of(' '); - Glib::ustring make = "(Unknown)"; - if (pos != Glib::ustring::npos) { - make = lens.substr(0, pos); - } - for (auto row : lensfunLensModel->children()) { - if (row[lensfunModelLens.lens] == make) { + if (lens.find(row[lensfunModelLens.lens]) == 0) { auto &c = row.children(); for (auto it = c.begin(), end = c.end(); it != end; ++it) { auto &childrow = *it; @@ -502,6 +491,16 @@ void LensProfilePanel::onCorrModeChanged() ckbUseVign->set_sensitive(true); ckbUseCA->set_sensitive(false); + if (metadata) { + disableListener(); + const LFDatabase *db = LFDatabase::getInstance(); + LFCamera c = db->findCamera(metadata->getMake(), metadata->getModel()); + LFLens l = db->findLens(c, metadata->getLens()); + setLensfunCamera(c.getMake(), c.getModel()); + setLensfunLens(l.getLens()); + enableListener(); + } + mode = M("LENSPROFILE_CORRECTION_AUTOMATCH"); } else if (corrLensfunManual->get_active()) { useLensfunChanged = true;