Re: exif data in full screen
Carles Pina i Estany <[email protected]>
| Newsgroups | gmane.comp.kde.gwenview |
|---|---|
| Message-ID | <[email protected]> |
Hello, On Jun/23/2007, Angelo Naselli wrote: > > > I have worked on it, I have an implementation of aperture. I think that > > > ISO and shutter speed will not be difficult. > > > > That's really great news! (and another reason to release a 1.4.2 :-) ) > Great news! let me know when you've planned to. I'd like to have a look > at http://qa.mandriva.com/show_bug.cgi?id=31395, maybe i can try to fix > it for 1.4.2 as well... I planned for next days... but I could finish today, at least this version. I send the patch attached on this mail. The patch is against last svn version. Possible things to improve: -I see that, in each photo, getexifinformation is called ¿4? times. It seems that exiv2 is very fast and I don't see any problem on it. In the future maybe we should call only one time per photo, or if this is too difficult don't call to exiv2 if the photo is the same than before, just return some cache value. Tell me, I can take a look (don't know if tomorrow, else during the week, but as I said, I don't have any "slowdown") -names of methods, etc. maybe could be better. Feel free to change. -add even more information (exif data is cool :-) i wanted to add only what is more common (aperture, shutter speed, iso and focal length) -I have seen some code from some other program that, if, Exif.Photo.FNumber fails tries to get Aperture data. I have not had problems using only FNumber, but who knows... -If data is not available, i am returning "n/a". Maybe empty string is better? Any comments are welcome. Ah! i have followed the "comments" exif data information flow to get the new exif data. Maybe there was other method, but I have not looked in all classes, etc. if you want that I do any big change tell me too. Thanks for your attention, -- Carles Pina i Estany GPG id: 0x8CBDAE64 http://pinux.info Manresa - Barcelona ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Gwenview-general mailing list Gwenview-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/gwenview-general
gwenview.osdexif.patch
(text/x-diff, 8.5 KB)
Index: app/configfullscreenpage.ui
===================================================================
--- app/configfullscreenpage.ui (revision 679406)
+++ app/configfullscreenpage.ui (working copy)
@@ -113,6 +113,10 @@
<li>%r: resolution</li>
<li>%n: current image position</li>
<li>%N: image count</li>
+<li>%a: aperture</li>
+<li>%t: exposure time</li>
+<li>%i: iso</li>
+<li>%l: focal length</li>
</ul>
</qt></string>
</property>
Index: app/configdialog.cpp
===================================================================
--- app/configdialog.cpp (revision 679406)
+++ app/configdialog.cpp (working copy)
@@ -261,6 +261,10 @@
formatter.mImageSize=QSize(1600, 1200);
formatter.mPosition=4;
formatter.mCount=12;
+ formatter.mAperture="2.8";
+ formatter.mExposureTime="1/60 s";
+ formatter.mIso="100";
+ formatter.mFocalLength="8.88";
QString txt=formatter.format( d->mFullScreenPage->kcfg_osdFormat->text() );
d->mFullScreenPage->mOSDPreviewLabel->setText(txt);
Index: app/mainwindow.cpp
===================================================================
--- app/mainwindow.cpp (revision 679406)
+++ app/mainwindow.cpp (working copy)
@@ -297,6 +297,10 @@
formatter.mImageSize=mDocument->image().size();
formatter.mPosition=mFileViewController->shownFilePosition()+1;
formatter.mCount=mFileViewController->fileCount();
+ formatter.mAperture=mDocument->aperture();
+ formatter.mExposureTime=mDocument->exposuretime();
+ formatter.mIso=mDocument->iso();
+ formatter.mFocalLength=mDocument->focallength();
QString txt=formatter.format( FullScreenConfig::osdFormat() );
mFullScreenLabelAction->label()->setText(txt);
Index: gvcore/documentimpl.cpp
===================================================================
--- gvcore/documentimpl.cpp (revision 679406)
+++ gvcore/documentimpl.cpp (working copy)
@@ -57,6 +57,22 @@
mDocument->setFileSize(size);
}
+QString DocumentImpl::aperture() const {
+ return QString::null;
+}
+
+QString DocumentImpl::exposuretime() const {
+ return QString::null;
+}
+
+QString DocumentImpl::iso() const {
+ return QString::null;
+}
+
+QString DocumentImpl::focallength() const {
+ return QString::null;
+}
+
QString DocumentImpl::comment() const {
return QString::null;
}
Index: gvcore/documentjpegloadedimpl.h
===================================================================
--- gvcore/documentjpegloadedimpl.h (revision 679406)
+++ gvcore/documentjpegloadedimpl.h (working copy)
@@ -42,7 +42,12 @@
QString comment() const;
void setComment(const QString&);
Document::CommentState commentState() const;
-
+
+ QString aperture() const;
+ QString exposuretime() const;
+ QString iso() const;
+ QString focallength() const;
+
void transform(ImageUtils::Orientation);
protected:
Index: gvcore/captionformatter.h
===================================================================
--- gvcore/captionformatter.h (revision 679406)
+++ gvcore/captionformatter.h (working copy)
@@ -41,6 +41,11 @@
QString mPath;
QString mFileName;
QString mComment;
+ QString mAperture;
+ QString mFocalLength;
+ QString mExposureTime;
+ QString mIso;
+
QSize mImageSize;
int mPosition;
int mCount;
Index: gvcore/documentimpl.h
===================================================================
--- gvcore/documentimpl.h (revision 679406)
+++ gvcore/documentimpl.h (working copy)
@@ -52,7 +52,12 @@
* Convenience method to emit rectUpdated with the whole image rect
*/
void emitImageRectUpdated();
-
+
+ virtual QString aperture() const;
+ virtual QString exposuretime() const;
+ virtual QString iso() const;
+ virtual QString focallength() const;
+
virtual QString comment() const;
virtual Document::CommentState commentState() const;
virtual void setComment(const QString&);
Index: gvcore/document.cpp
===================================================================
--- gvcore/document.cpp (revision 679406)
+++ gvcore/document.cpp (working copy)
@@ -283,6 +283,22 @@
return d->mImpl->comment();
}
+QString Document::aperture() const {
+ return d->mImpl->aperture();
+}
+
+QString Document::exposuretime() const {
+ return d->mImpl->exposuretime();
+}
+
+QString Document::iso() const {
+ return d->mImpl->iso();
+}
+
+QString Document::focallength() const {
+ return d->mImpl->focallength();
+}
+
void Document::setComment(const QString& comment) {
d->mImpl->setComment(comment);
d->mModified=true;
Index: gvcore/documentjpegloadedimpl.cpp
===================================================================
--- gvcore/documentjpegloadedimpl.cpp (revision 679406)
+++ gvcore/documentjpegloadedimpl.cpp (working copy)
@@ -119,6 +119,22 @@
d->mJPEGContent.setComment(comment);
}
+QString DocumentJPEGLoadedImpl::aperture() const {
+ return d->mJPEGContent.aperture();
+}
+
+QString DocumentJPEGLoadedImpl::exposuretime() const {
+ return d->mJPEGContent.exposuretime();
+}
+
+QString DocumentJPEGLoadedImpl::iso() const {
+ return d->mJPEGContent.iso();
+}
+
+QString DocumentJPEGLoadedImpl::focallength() const {
+ return d->mJPEGContent.focallength();
+}
+
Document::CommentState DocumentJPEGLoadedImpl::commentState() const {
return Document::WRITABLE;
}
Index: gvcore/captionformatter.cpp
===================================================================
--- gvcore/captionformatter.cpp (revision 679406)
+++ gvcore/captionformatter.cpp (working copy)
@@ -45,6 +45,11 @@
str.replace("%r", resolution);
str.replace("%n", QString::number(mPosition));
str.replace("%N", QString::number(mCount));
+ str.replace("%a", mAperture);
+ str.replace("%t", mExposureTime);
+ str.replace("%i", mIso);
+ str.replace("%l", mFocalLength);
+
return str;
}
Index: gvcore/document.h
===================================================================
--- gvcore/document.h (revision 679406)
+++ gvcore/document.h (working copy)
@@ -84,6 +84,10 @@
Document::CommentState commentState() const;
QString comment() const;
void setComment(const QString&);
+ QString aperture() const;
+ QString exposuretime() const;
+ QString iso() const;
+ QString focallength() const;
int duration() const;
Index: imageutils/jpegcontent.cpp
===================================================================
--- imageutils/jpegcontent.cpp (revision 679406)
+++ imageutils/jpegcontent.cpp (working copy)
@@ -143,6 +143,11 @@
QByteArray mRawData;
QSize mSize;
QString mComment;
+ QString mAperture;
+ QString mExposureTime;
+ QString mFocalLength;
+ QString mIso;
+
bool mPendingTransformation;
QWMatrix mTransformMatrix;
Exiv2::ExifData mExifData;
@@ -264,6 +269,11 @@
d->mExifData = image->exifData();
d->mComment = QString::fromUtf8( image->comment().c_str() );
+ d->mAperture=aperture();
+ d->mExposureTime=exposuretime();
+ d->mIso=iso();
+ d->mFocalLength=iso();
+
// Adjust the size according to the orientation
switch (orientation()) {
case TRANSPOSE:
@@ -351,12 +361,47 @@
return d->mComment;
}
+QString JPEGContent::getexifinformation(const QString exifkey) const {
+ QString ret;
+
+ Exiv2::ExifKey key(exifkey.latin1());
+ Exiv2::ExifData::iterator it = d->mExifData.findKey(key);
+ if (it != d->mExifData.end()) {
+ std::ostringstream outputString;
+ outputString << *it;
+ ret=QString(outputString.str().c_str());
+ }
+ else {
+ ret="n/a";
+ }
+ return ret;
+}
+
+QString JPEGContent::aperture() const {
+ d->mAperture=getexifinformation("Exif.Photo.FNumber");
+ return d->mAperture;
+}
+
+QString JPEGContent::exposuretime() const {
+ d->mExposureTime=getexifinformation("Exif.Photo.ExposureTime");
+ return d->mExposureTime;
+}
+
+QString JPEGContent::iso() const {
+ d->mIso=getexifinformation("Exif.Photo.ISOSpeedRatings");
+ return d->mIso;
+}
+
+QString JPEGContent::focallength() const {
+ d->mFocalLength=getexifinformation("Exif.Photo.FocalLength");
+ return d->mFocalLength;
+}
+
void JPEGContent::setComment(const QString& comment) {
d->mComment = comment;
}
-
static QWMatrix createRotMatrix(int angle) {
QWMatrix matrix;
matrix.rotate(angle);
Index: imageutils/jpegcontent.h
===================================================================
--- imageutils/jpegcontent.h (revision 679406)
+++ imageutils/jpegcontent.h (working copy)
@@ -51,7 +51,14 @@
QString comment() const;
void setComment(const QString&);
-
+
+ QString aperture() const;
+ QString exposuretime() const;
+ QString iso() const;
+ QString focallength() const;
+
+ QString getexifinformation(const QString exifkey) const;
+
void transform(Orientation);
QImage thumbnail() const;