lensfun: properly group lenses by maker in the UI
This commit is contained in:
parent
03ec1abca8
commit
0f197bf1a4
@ -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
|
Glib::ustring LFLens::getLens() const
|
||||||
{
|
{
|
||||||
if (data_) {
|
if (data_) {
|
||||||
|
@ -73,6 +73,7 @@ class LFLens {
|
|||||||
public:
|
public:
|
||||||
LFLens();
|
LFLens();
|
||||||
bool ok() const;
|
bool ok() const;
|
||||||
|
Glib::ustring getMake() const;
|
||||||
Glib::ustring getLens() const;
|
Glib::ustring getLens() const;
|
||||||
Glib::ustring getDisplayString() const { return getLens(); }
|
Glib::ustring getDisplayString() const { return getLens(); }
|
||||||
private:
|
private:
|
||||||
|
@ -360,12 +360,8 @@ void LensProfilePanel::fillLensfunLenses()
|
|||||||
std::map<Glib::ustring, std::set<Glib::ustring>> lenses;
|
std::map<Glib::ustring, std::set<Glib::ustring>> lenses;
|
||||||
auto lenslist = LFDatabase::getInstance()->getLenses();
|
auto lenslist = LFDatabase::getInstance()->getLenses();
|
||||||
for (auto &l : lenslist) {
|
for (auto &l : lenslist) {
|
||||||
auto name = l.getDisplayString();
|
auto name = l.getLens();
|
||||||
auto pos = name.find_first_of(' ');
|
auto make = l.getMake();
|
||||||
Glib::ustring make = "(Unknown)";
|
|
||||||
if (pos != Glib::ustring::npos) {
|
|
||||||
make = name.substr(0, pos);
|
|
||||||
}
|
|
||||||
lenses[make].insert(name);
|
lenses[make].insert(name);
|
||||||
}
|
}
|
||||||
for (auto &p : lenses) {
|
for (auto &p : lenses) {
|
||||||
@ -415,15 +411,8 @@ bool LensProfilePanel::setLensfunLens(const Glib::ustring &lens)
|
|||||||
return true;
|
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()) {
|
for (auto row : lensfunLensModel->children()) {
|
||||||
if (row[lensfunModelLens.lens] == make) {
|
if (lens.find(row[lensfunModelLens.lens]) == 0) {
|
||||||
auto &c = row.children();
|
auto &c = row.children();
|
||||||
for (auto it = c.begin(), end = c.end(); it != end; ++it) {
|
for (auto it = c.begin(), end = c.end(); it != end; ++it) {
|
||||||
auto &childrow = *it;
|
auto &childrow = *it;
|
||||||
@ -502,6 +491,16 @@ void LensProfilePanel::onCorrModeChanged()
|
|||||||
ckbUseVign->set_sensitive(true);
|
ckbUseVign->set_sensitive(true);
|
||||||
ckbUseCA->set_sensitive(false);
|
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");
|
mode = M("LENSPROFILE_CORRECTION_AUTOMATCH");
|
||||||
} else if (corrLensfunManual->get_active()) {
|
} else if (corrLensfunManual->get_active()) {
|
||||||
useLensfunChanged = true;
|
useLensfunChanged = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user