[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/graphics/digikam/libs/dimg/filters/lens
From: Gilles Caulier <caulier.gilles () gmail ! com>
Date: 2010-09-18 8:46:11
Message-ID: 20100918084611.4E76FAC888 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1176678 by cgilles:
now, lensfun settings widget use partially digiKam lensfun iface to handle \
camera/lens/shot information from metadata. It still some work to do to set this \
widget fully undependant of lensfun library. The goal of course is to port this tool \
to BQM easily.
CCBUGS: 216353
M +21 -106 lensfuncameraselector.cpp
M +4 -0 lensfunfilter.h
--- trunk/extragear/graphics/digikam/libs/dimg/filters/lens/lensfuncameraselector.cpp \
#1176677:1176678 @@ -193,30 +193,19 @@
d->exifUsage->setEnabled(true);
}
-/* TODO
LensFunContainer settings;
d->iface->findFromMetadata(d->metadata, settings);
-*/
- PhotoInfoContainer photoInfo = d->metadata.getPhotographInformation();
- QString make = photoInfo.make;
- QString model = photoInfo.model;
- QString lens = photoInfo.lens;
// ------------------------------------------------------------------------------------------------
- int makerIdx = d->make->combo()->findText(make);
+ QString makeLF;
+ int makerIdx = -1;
- if (makerIdx < 0)
+ if (settings.cameraPrt)
{
- const lfCamera** makes = d->iface->m_lfDb->FindCameras( make.toAscii(), \
model.toAscii() );
- QString makeLF = "";
-
- if (makes && *makes)
- {
- makeLF = (*makes)->Maker;
+ makeLF = settings.cameraPrt->Maker;
makerIdx = d->make->combo()->findText(makeLF);
}
- }
if (makerIdx >= 0)
{
@@ -226,25 +215,16 @@
slotUpdateCombos();
- int modelIdx = d->model->combo()->findText(model);
+ // ------------------------------------------------------------------------------------------------
- if (modelIdx < 0)
- {
- const lfCamera** makes = d->iface->m_lfDb->FindCameras( make.toAscii(), \
model.toAscii() );
- QString modelLF = "";
- int count = 0;
+ QString modelLF;
+ int modelIdx = -1;
- while (makes && *makes)
+ if (settings.cameraPrt)
{
- modelLF = (*makes)->Model;
- ++makes;
- ++count;
- }
- if (count == 1)
- {
+ modelLF = settings.cameraPrt->Model;
modelIdx = d->model->combo()->findText(modelLF);
}
- }
if (modelIdx >= 0)
{
@@ -253,44 +233,16 @@
slotUpdateLensCombo();
}
- // The LensFun DB has the Maker before the Lens model name.
- // We use here the Camera Maker, because the Lens Maker seems not to be
- // part of the Exif data. This is of course bad for 3rd party lenses, but
- // they seem anyway not to have Exif entries usually :/
- int lensIdx = d->lens->combo()->findText(lens);
+ // ------------------------------------------------------------------------------------------------
- if (lensIdx < 0)
- lensIdx = d->lens->combo()->findText(make + ' ' + lens);
+ QString lensLF;
+ int lensIdx = -1;
- if (lensIdx < 0)
+ if (settings.lensPtr)
{
- QString lensCutted = lens;
-
- if (lensCutted.contains("Nikon"))
- {
- // adapt exiv2 strings to lensfun strings
- lensCutted.replace("Nikon ", "");
- lensCutted.replace("Zoom-", "");
- lensCutted.replace("IF-ID", "ED-IF");
- }
-
- QVariant v = d->model->combo()->itemData( \
d->model->currentIndex() );
- LensFunContainer::DevicePtr dev = v.value<LensFunContainer::DevicePtr>();
- const lfLens** lenses = d->iface->m_lfDb->FindLenses( dev, NULL, \
lensCutted.toAscii().data() );
- QString lensLF = "";
- int count = 0;
-
- while (lenses && *lenses)
- {
- lensLF = (*lenses)->Model;
- ++lenses;
- ++count;
- }
- if (count == 1)
- {
+ lensLF = settings.lensPtr->Model;
lensIdx = d->lens->combo()->findText(lensLF);
}
- }
if (lensIdx >= 0)
{
@@ -305,60 +257,23 @@
d->lens->setEnabled(true);
}
- kDebug() << "Search for Lens: " << make << " :: " << lens
- << "< and found: >" << d->lens->combo()->itemText(0) + " <";
+ // ------------------------------------------------------------------------------------------------
- QString temp = photoInfo.focalLength;
- if (!temp.isEmpty())
+ if (settings.focal != -1.0)
{
- double focal = temp.mid(0, temp.length() -3).toDouble(); // HACK: strip the \
" mm" at the end ...
- kDebug() << "Focal Length: " << focal;
- d->focal->setValue(focal);
+ d->focal->setValue(settings.focal);
d->focal->setEnabled(false);
}
- temp = photoInfo.aperture;
- if (!temp.isEmpty())
+ if (settings.aperture != -1.0)
{
- double aperture = temp.mid(1).toDouble();
- kDebug() << "Aperture: " << aperture;
- d->aperture->setValue(aperture);
+ d->aperture->setValue(settings.aperture);
d->aperture->setEnabled(false);
}
- // ------------------------------------------------------------------------------------------------
- // Try to get subject distance value.
-
- // From standard Exif.
- temp = d->metadata.getExifTagString("Exif.Photo.SubjectDistance");
- if (temp.isEmpty())
+ if (settings.distance != -1.0)
{
- // From standard XMP.
- temp = d->metadata.getXmpTagString("Xmp.exif.SubjectDistance");
- }
- if (temp.isEmpty())
- {
- // From Canon Makernote.
- temp = d->metadata.getExifTagString("Exif.CanonSi.SubjectDistance");
- }
- if (temp.isEmpty())
- {
- // From Nikon Makernote.
- temp = d->metadata.getExifTagString("Exif.NikonLd2.FocusDistance");
- }
- if (temp.isEmpty())
- {
- // From Nikon Makernote.
- temp = d->metadata.getExifTagString("Exif.NikonLd3.FocusDistance");
- }
- // TODO: Add here others Makernotes tags.
-
- if (!temp.isEmpty())
- {
- temp = temp.replace(" m", "");
- double distance = temp.toDouble();
- kDebug() << "Subject Distance: " << distance;
- d->distance->setValue(distance);
+ d->distance->setValue(settings.distance);
d->distance->setEnabled(false);
}
}
--- trunk/extragear/graphics/digikam/libs/dimg/filters/lens/lensfunfilter.h \
#1176677:1176678 @@ -58,6 +58,10 @@
filterGeom = true;
cameraPrt = 0;
lensPtr = 0;
+ focal = -1.0;
+ aperture = -1.0;
+ distance = -1.0;
+ cropFactor = -1.0;
};
~LensFunContainer(){};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic