Summary: | wish: *add* (not edit) EXIF headers like date, comment etc | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Jens <jens-bugs.kde.org> |
Component: | Metadata-Date | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 0.7.2 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.0 | |
Sentry Crash Report: |
Description
Jens
2005-04-05 01:39:54 UTC
*** This bug has been confirmed by popular vote. *** SVN commit 515268 by cgilles: digikam from trunk : Metadata support using Exiv2 : - New image properties sidebar tab named "Metadata" instead old "Exif". This area include : * Standard Exif tags viewer. * MarkerNote Exif tags viewer. * IPTC records viewer. - New capability to copy metadata in clipboard like text. - New capability to print metadata. - Tags name use the "user Friendly" conversion from Exiv2 instead the internal name provided by old Exif viewer based on libkexif. - Capability to read metadata from CRW files (Canon RAW files) - New class DMetadata to load/save metadata without loading image data. Actually JPEG, CRW, and PNG files are supported. About PNG (Exif and IPTC raw profiles generated by ImageMagick are supported. To support new file formats (like NEF, MRW, TIFF, DNG, etc), new image file parsers must be added to Exiv2 library. IMPORTANT: - Exiv2 do not support yet gettext for i18n rules. All informations in metadata viewers aren't yet i18n (tags name, tags values, and tags descriptions) - Any tag names use internal Exiv2 name, not the user friendly text transformations. This point must be fixed in Exiv2 libs. To 0.9.0, these tools are just metadata readers. Writting capabilities (metadata editors) will added later 0.9.0. The files in B.K.O directly or indirectly relevant of this commits are listed below : *Pending: 103255 106103 115764 111560 *Partially fixed: 91812 96459 109253 110598 118501 * To check before closing: 122264 * Fixed (can be closed): 103489 121371 105670 109319 CCMAIL: digikam-devel@kde.org, Andreas Huggel <ahuggel@gmx.net> CCBUGS: 103255, 106103, 115764, 111560, 91812, 96459, 109253, 110598, 118501, 122264, 103489, 121371, 105670, 109319 M +2 -1 libs/Makefile.am M +5 -4 libs/dimg/Makefile.am M +1 -1 libs/dimg/dimg.cpp M +1 -1 libs/dimg/dimg.h M +19 -1 libs/dimg/dimgloader.cpp M +4 -2 libs/dimg/dimgloader.h M +4 -61 libs/dimg/loaders/jpegloader.cpp M +5 -29 libs/dimg/loaders/pngloader.cpp M +2 -1 libs/dimg/loaders/rawloader.cpp A libs/dmetadata (directory) A libs/dmetadata/Makefile.am A libs/dmetadata/dmetadata.cpp [License: GPL] A libs/dmetadata/dmetadata.h [License: GPL] A libs/dmetadata/loaders (directory) A libs/dmetadata/loaders/Makefile.am A libs/dmetadata/loaders/dmetaloader.cpp [License: GPL] A libs/dmetadata/loaders/dmetaloader.h [License: GPL] A libs/dmetadata/loaders/jpegmetaloader.cpp [License: GPL] A libs/dmetadata/loaders/jpegmetaloader.h [License: GPL] A libs/dmetadata/loaders/pngmetaloader.cpp [License: GPL] A libs/dmetadata/loaders/pngmetaloader.h [License: GPL] A libs/dmetadata/loaders/rawmetaloader.cpp [License: GPL] A libs/dmetadata/loaders/rawmetaloader.h [License: GPL] A libs/dmetadata/loaders/tiffmetaloader.cpp [License: GPL] A libs/dmetadata/loaders/tiffmetaloader.h [License: GPL] M +3 -2 libs/imageproperties/Makefile.am M +82 -323 libs/imageproperties/imagepropertiesexiftab.cpp M +12 -25 libs/imageproperties/imagepropertiesexiftab.h M +19 -18 libs/imageproperties/imagepropertiessidebar.cpp M +10 -9 libs/imageproperties/imagepropertiessidebar.h M +27 -26 libs/imageproperties/imagepropertiessidebarcamgui.cpp M +2 -1 libs/imageproperties/imagepropertiessidebarcamgui.h M +16 -15 libs/imageproperties/imagepropertiessidebardb.cpp M +3 -1 libs/widgets/Makefile.am A libs/widgets/metadata (directory) A libs/widgets/metadata/Makefile.am A libs/widgets/metadata/exifwidget.cpp [License: GPL] A libs/widgets/metadata/exifwidget.h [License: GPL] A libs/widgets/metadata/iptcwidget.cpp [License: GPL] A libs/widgets/metadata/iptcwidget.h [License: GPL] A libs/widgets/metadata/makernotewidget.cpp [License: GPL] A libs/widgets/metadata/makernotewidget.h [License: GPL] A libs/widgets/metadata/mdkeylistviewitem.cpp [License: GPL] A libs/widgets/metadata/mdkeylistviewitem.h [License: GPL] A libs/widgets/metadata/metadatalistview.cpp [License: GPL] A libs/widgets/metadata/metadatalistview.h [License: GPL] A libs/widgets/metadata/metadatalistviewitem.cpp [License: GPL] A libs/widgets/metadata/metadatalistviewitem.h [License: GPL] A libs/widgets/metadata/metadatawidget.cpp [License: GPL] A libs/widgets/metadata/metadatawidget.h [License: GPL] M +24 -1 utilities/cameragui/cameraui.cpp SVN commit 525972 by cgilles: digikam from trunk : Camera GUI : - new option to set Date&Time Exif Tags on the fly during download if camera don't set it when pictures are taken. - new options to set IPTC photographers identity on the fly using digiKam metadata setup. CCMAIL: digikam-devel@kde.org CCBUGS: 103255, 121306, 115764 M +4 -2 TODO M +55 -24 utilities/cameragui/cameracontroller.cpp M +7 -3 utilities/cameragui/cameracontroller.h M +78 -27 utilities/cameragui/cameraui.cpp From current implementation (0.9.0-svn), CameraGUi do some new on the fly operations during download : - Fixed or Added time stamp into Exif and IPTC. - Add default Copyrights in IPTC. - Add default License into IPTC. - Add default Photographer Id into IPTC. I close this file now. Gilles Caulier *** Bug has been marked as fixed ***. Jens, you won't talking about camera gui but an improvement of import folder/images in album collection. Right ? Sorry about my confusion. I have closed this file by error. A new tool to import files with "on fly operations" options need to be done in the future. Please give me a feedback about news "On Fly" options available in Camera gui if this sounds is good for you. Gilles Caulier Hi Gilles, thank you for all the new features in Digikam! :-) Since I scan my old images on a Mac (because the driver for my negative scanner as well as color correction profiles, and the software, only exists for Mac and Windows) I don't mind doing this in the main Digikam window. I do see this (the ability to set EXIF/IPTC fields as defaults during download) as a valuable option though. One thing I would absolutely love to have though, would be a way to automatically synchronize the file date (you know, ctime/mtime) with the EXIF date when the picture was taken, since I also organize my pictures outside Digikam. But that is a different bug. Thank you, again! If there's a way to help you (documentation, testing?) please tell me. I can also compile Digikam on OS X if you want me to test portability :-) Jens #1 : you scan your images from another computer. This is want meant that you import your images later using Album->Import menu entries. Right ? You never use Camera gui for that. Right ? (you talking about "Download" pictures (:=)))) #2 : file time stamp synchronized with Exif datetime: have you tested Kipi Date & Time Adjust plugin for that ? #3 : All help is welcome ! 0.9.0 is a major release. Actually, i'm trying to cleanup all bugs from B.K.O before 0.9.0-beta1. The digiKam handbook need to be updated, and there are a lots of changes to do. If you want more information about this release, i recommend you to check this url : - NEWS file from svn (uncomplete) : http://websvn.kde.org/trunk/extragear/graphics/digikam/NEWS?rev=528458&view=auto - Developpers Blogs : http://www.digikam.org/?q=blog - Fresh screenshots : http://www.digikam.org/?q=image We have planed a 0.9.0-beta1 release during may. If you is interresed to update digiKam handbook, let's me hear. I will make a TODO file for that in svn. The current handbook can be seen here : http://docs.kde.org/development/en/extragear-graphics/digikam/index.html or here in PDF : http://docs.kde.org/development/en/extragear-graphics/digikam/digikam.pdf Like you can see, digiKam handbook try to be a real book (:=))) And YES, a feedback from OS-X is welcome, especially if you use a PowerPC processor. If you have any problems to compile, or bugs relevant, please make new files in B.K.O. Thanks in advance for your help (:=))) Gilles #1: I either use Album -> Import, or I just copy them into the digikam folder when digikam is not running. #2: Yes, I've even tried to modify it a bit, but unsuccessfully. So far it's a bit cumbersome to use really. If you like, I'll provide some thoughts for this in a seperate bug report (or here?). #3: I will try to compile it for OS X and try it out (I just moved and currently my Mac Mini is the only computer I have running ;) ). Hi, just a small status report: I'm having trouble compiling KDE libraries under OS-X (KDE 3.5.1 using Fink). I will get back to you when I succeeded compiling KDE and digikam-current under OS-X. Jens SVN commit 594899 by cgilles: kipiplugins from trunk : new plugin to edit EXIF photograph tags and IPTC tags of pictures This tool can be used on single or batch mode. Note: this plugin is under developement. It's not yet suitable. CCMAIL: digikam-devel@kde.org, kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 A metadataedit (directory) A metadataedit/Makefile.am A metadataedit/iptccaption.cpp [License: GPL] A metadataedit/iptccaption.h [License: GPL] A metadataedit/iptccredits.cpp [License: GPL] A metadataedit/iptccredits.h [License: GPL] A metadataedit/iptceditdialog.cpp [License: GPL] A metadataedit/iptceditdialog.h [License: GPL] A metadataedit/kipiplugin_metadataedit.desktop A metadataedit/metadataeditdialog.cpp [License: GPL] A metadataedit/metadataeditdialog.h [License: GPL] A metadataedit/metadataitem.cpp [License: GPL] A metadataedit/metadataitem.h [License: GPL] A metadataedit/plugin_metadataedit.cpp [License: GPL] A metadataedit/plugin_metadataedit.h [License: GPL] SVN commit 595026 by cgilles: kipiplugins from trunk : MetadataEdit plugin: "Et Voila"... The IPTC metadata can be changed/set from pictures. The IPTC data set to edit is not yet complete, but a more complete edit dialog coming soon... CCMAIL: digikam-devel@kde.org, kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 M +17 -4 iptccaption.cpp M +18 -2 iptccredits.cpp M +1 -1 iptceditdialog.cpp M +5 -5 metadataeditdialog.cpp M +16 -7 metadataitem.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/iptccaption.cpp #595025:595026 @@ -36,6 +36,7 @@ // Local includes. +#include "exiv2iface.h" #include "iptccaption.h" #include "iptccaption.moc" @@ -127,8 +128,7 @@ vlay->addStretch(); // -------------------------------------------------------- - - + readMetadata(iptcData); } @@ -137,12 +137,25 @@ delete d; } -void IPTCCaption::applyMetadata(QByteArray& iptcData) +void IPTCCaption::readMetadata(QByteArray& iptcData) { + KIPIPlugins::Exiv2Iface exiv2Iface; + exiv2Iface.setIptc(iptcData); + d->captionEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Caption", false)); + d->writerEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Writer", false)); + d->headlineEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Headline", false)); + d->specialInstructionEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.SpecialInstructions", false)); } -void IPTCCaption::readMetadata(QByteArray& iptcData) +void IPTCCaption::applyMetadata(QByteArray& iptcData) { + KIPIPlugins::Exiv2Iface exiv2Iface; + exiv2Iface.setIptc(iptcData); + exiv2Iface.setIptcTagString("Iptc.Application2.Caption", d->captionEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.Writer", d->writerEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.Headline", d->headlineEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.SpecialInstructions", d->specialInstructionEdit->text()); + iptcData = exiv2Iface.getIptc(); } } // namespace KIPIMetadataEditPlugin --- trunk/extragear/libs/kipi-plugins/metadataedit/iptccredits.cpp #595025:595026 @@ -35,6 +35,7 @@ // Local includes. +#include "exiv2iface.h" #include "iptccredits.h" #include "iptccredits.moc" @@ -148,12 +149,27 @@ delete d; } -void IPTCCredits::applyMetadata(QByteArray& iptcData) +void IPTCCredits::readMetadata(QByteArray& iptcData) { + KIPIPlugins::Exiv2Iface exiv2Iface; + exiv2Iface.setIptc(iptcData); + d->copyrightEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Copyright", false)); + d->bylineEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Byline", false)); + d->bylineTitleEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.BylineTitle", false)); + d->creditEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Credit", false)); + d->sourceEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Source", false)); } -void IPTCCredits::readMetadata(QByteArray& iptcData) +void IPTCCredits::applyMetadata(QByteArray& iptcData) { + KIPIPlugins::Exiv2Iface exiv2Iface; + exiv2Iface.setIptc(iptcData); + exiv2Iface.setIptcTagString("Iptc.Application2.Copyright", d->copyrightEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.Byline", d->bylineEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.BylineTitle", d->bylineTitleEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.Credit", d->creditEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.Source", d->sourceEdit->text()); + iptcData = exiv2Iface.getIptc(); } } // namespace KIPIMetadataEditPlugin --- trunk/extragear/libs/kipi-plugins/metadataedit/iptceditdialog.cpp #595025:595026 @@ -128,7 +128,7 @@ QByteArray IPTCEditDialog::getIPTCInfo() { - return QByteArray(); + return d->iptcData; } void IPTCEditDialog::slotOk() --- trunk/extragear/libs/kipi-plugins/metadataedit/metadataeditdialog.cpp #595025:595026 @@ -382,24 +382,24 @@ void MetadataEditDialog::slotApply() { -/* KURL::List images; + KURL::List images; QListViewItemIterator it( d->listView ); while ( it.current() ) { - GPSListViewItem *item = (GPSListViewItem*) it.current(); + MetadataItem *item = (MetadataItem*)it.current(); d->listView->setSelected(item, true); d->listView->ensureItemVisible(item); - item->writeGPSInfoToFile(); + item->writeMetadataToFile(); images.append(item->getUrl()); - // TODO : new libkipi method to store GPS info in host database. + // TODO : add libkipi method call to please the host to re-read metadata from pictures. ++it; kapp->processEvents(); } - d->interface->refreshImages(images);*/ + d->interface->refreshImages(images); } } // NameSpace KIPIMetadataEditPlugin --- trunk/extragear/libs/kipi-plugins/metadataedit/metadataitem.cpp #595025:595026 @@ -173,25 +173,34 @@ { if (isEnabled() && isDirty()) { -/* setPixmap(1, SmallIcon("run")); + setPixmap(1, SmallIcon("run")); KIPIPlugins::Exiv2Iface exiv2Iface; bool ret = exiv2Iface.load(d->url.path()); - if (d->erase) - ret &= exiv2Iface.removeGPSInfo(); + if (d->eraseExif) + { + // ret &= exiv2Iface.removeExif(); + } else { - ret &= exiv2Iface.setGPSInfo(d->gpsData.altitude(), - d->gpsData.latitude(), - d->gpsData.longitude()); + ret &= exiv2Iface.setExif(d->exifData); } + if (d->eraseIptc) + { + // ret &= exiv2Iface.removeIptc(); + } + else + { + ret &= exiv2Iface.setIptc(d->iptcData); + } + ret &= exiv2Iface.save(d->url.path()); if (ret) setPixmap(1, SmallIcon("ok")); else - setPixmap(1, SmallIcon("cancel"));*/ + setPixmap(1, SmallIcon("cancel")); d->dirty = false; } SVN commit 595071 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Added IPTC Status informations in IPTC Edit dialog CCMAIL: kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 M +1 -1 Makefile.am M +1 -1 iptccredits.cpp M +10 -1 iptceditdialog.cpp A iptcstatus.cpp [License: GPL] A iptcstatus.h [License: GPL] --- trunk/extragear/libs/kipi-plugins/metadataedit/Makefile.am #595070:595071 @@ -11,7 +11,7 @@ # Srcs for the plugin kipiplugin_metadataedit_la_SOURCES = plugin_metadataedit.cpp metadataeditdialog.cpp \ metadataitem.cpp iptceditdialog.cpp iptccaption.cpp \ - iptccredits.cpp + iptccredits.cpp iptcstatus.cpp # Libs needed by the plugin kipiplugin_metadataedit_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \ --- trunk/extragear/libs/kipi-plugins/metadataedit/iptccredits.cpp #595070:595071 @@ -126,7 +126,7 @@ d->sourceEdit = new KLineEdit(parent); d->sourceEdit->setValidator(asciiValidator); d->sourceEdit->setMaxLength(32); - label4->setBuddy(d->sourceEdit); + label5->setBuddy(d->sourceEdit); vlay->addWidget(label5); vlay->addWidget(d->sourceEdit); QWhatsThis::add(d->sourceEdit, i18n("<p>Set here the original owner of content. " --- trunk/extragear/libs/kipi-plugins/metadataedit/iptceditdialog.cpp #595070:595071 @@ -40,6 +40,7 @@ #include "iptccaption.h" #include "iptccredits.h" +#include "iptcstatus.h" #include "iptceditdialog.h" #include "iptceditdialog.moc" @@ -55,19 +56,22 @@ { page_caption = 0; page_credits = 0; + page_status = 0; captionPage = 0; creditsPage = 0; + statusPage = 0; } QByteArray iptcData; QFrame *page_caption; QFrame *page_credits; + QFrame *page_status; IPTCCaption *captionPage; IPTCCredits *creditsPage; - + IPTCStatus *statusPage; }; IPTCEditDialog::IPTCEditDialog(QWidget* parent, QByteArray iptcData, const QString& fileName) @@ -87,6 +91,10 @@ BarIcon("identity", KIcon::SizeMedium)); d->creditsPage = new IPTCCredits(d->page_credits, d->iptcData); + d->page_status = addPage(i18n("Status"), i18n("IPTC Status Informations"), + BarIcon("messagebox_info", KIcon::SizeMedium)); + d->statusPage = new IPTCStatus(d->page_status, d->iptcData); + readSettings(); show(); } @@ -135,6 +143,7 @@ { d->captionPage->applyMetadata(d->iptcData); d->creditsPage->applyMetadata(d->iptcData); + d->statusPage->applyMetadata(d->iptcData); saveSettings(); accept(); SVN commit 595152 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Added IPTC Origin informations in IPTC Edit dialog CCMAIL: kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 M +1 -1 Makefile.am M +11 -2 iptceditdialog.cpp M +0 -13 iptceditdialog.h A iptcorigin.cpp [License: GPL] A iptcorigin.h [License: GPL] --- trunk/extragear/libs/kipi-plugins/metadataedit/Makefile.am #595151:595152 @@ -11,7 +11,7 @@ # Srcs for the plugin kipiplugin_metadataedit_la_SOURCES = plugin_metadataedit.cpp metadataeditdialog.cpp \ metadataitem.cpp iptceditdialog.cpp iptccaption.cpp \ - iptccredits.cpp iptcstatus.cpp + iptccredits.cpp iptcstatus.cpp iptcorigin.cpp # Libs needed by the plugin kipiplugin_metadataedit_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \ --- trunk/extragear/libs/kipi-plugins/metadataedit/iptceditdialog.cpp #595151:595152 @@ -41,6 +41,7 @@ #include "iptccaption.h" #include "iptccredits.h" #include "iptcstatus.h" +#include "iptcorigin.h" #include "iptceditdialog.h" #include "iptceditdialog.moc" @@ -57,10 +58,12 @@ page_caption = 0; page_credits = 0; page_status = 0; + page_origin = 0; captionPage = 0; creditsPage = 0; statusPage = 0; + originPage = 0; } QByteArray iptcData; @@ -68,10 +71,12 @@ QFrame *page_caption; QFrame *page_credits; QFrame *page_status; + QFrame *page_origin; IPTCCaption *captionPage; IPTCCredits *creditsPage; IPTCStatus *statusPage; + IPTCOrigin *originPage; }; IPTCEditDialog::IPTCEditDialog(QWidget* parent, QByteArray iptcData, const QString& fileName) @@ -95,6 +100,10 @@ BarIcon("messagebox_info", KIcon::SizeMedium)); d->statusPage = new IPTCStatus(d->page_status, d->iptcData); + d->page_origin = addPage(i18n("Origin"), i18n("IPTC Origin Informations"), + BarIcon("www", KIcon::SizeMedium)); + d->originPage = new IPTCOrigin(d->page_origin, d->iptcData); + readSettings(); show(); } @@ -121,7 +130,7 @@ { KConfig config("kipirc"); config.setGroup("Metadata Edit Settings"); - showPage(config.readNumEntry("IPTC Edit Page", Caption)); + showPage(config.readNumEntry("IPTC Edit Page", 0)); resize(configDialogSize(config, QString("IPTC Edit Dialog"))); } @@ -144,7 +153,7 @@ d->captionPage->applyMetadata(d->iptcData); d->creditsPage->applyMetadata(d->iptcData); d->statusPage->applyMetadata(d->iptcData); - + d->originPage->applyMetadata(d->iptcData); saveSettings(); accept(); } --- trunk/extragear/libs/kipi-plugins/metadataedit/iptceditdialog.h #595151:595152 @@ -40,19 +40,6 @@ public: - enum Page - { - LastPageUsed = -1, - Caption = 0, - Keywords, - Categories, - Credits, - Status, - Origin - }; - -public: - IPTCEditDialog(QWidget* parent, QByteArray iptcData, const QString& fileName); ~IPTCEditDialog(); SVN commit 595192 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Added IPTC Date & Time informations in IPTC Edit dialog CCMAIL: kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 M +2 -1 Makefile.am A iptcdatetime.cpp [License: GPL] A iptcdatetime.h [License: GPL] M +38 -28 iptceditdialog.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/Makefile.am #595191:595192 @@ -11,7 +11,8 @@ # Srcs for the plugin kipiplugin_metadataedit_la_SOURCES = plugin_metadataedit.cpp metadataeditdialog.cpp \ metadataitem.cpp iptceditdialog.cpp iptccaption.cpp \ - iptccredits.cpp iptcstatus.cpp iptcorigin.cpp + iptccredits.cpp iptcstatus.cpp iptcorigin.cpp \ + iptcdatetime.cpp # Libs needed by the plugin kipiplugin_metadataedit_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \ --- trunk/extragear/libs/kipi-plugins/metadataedit/iptceditdialog.cpp #595191:595192 @@ -42,6 +42,7 @@ #include "iptccredits.h" #include "iptcstatus.h" #include "iptcorigin.h" +#include "iptcdatetime.h" #include "iptceditdialog.h" #include "iptceditdialog.moc" @@ -55,28 +56,32 @@ IPTCEditDialogDialogPrivate() { - page_caption = 0; - page_credits = 0; - page_status = 0; - page_origin = 0; + page_caption = 0; + page_credits = 0; + page_status = 0; + page_origin = 0; + page_datetime = 0; - captionPage = 0; - creditsPage = 0; - statusPage = 0; - originPage = 0; + captionPage = 0; + creditsPage = 0; + statusPage = 0; + originPage = 0; + datetimePage = 0; } QByteArray iptcData; - QFrame *page_caption; - QFrame *page_credits; - QFrame *page_status; - QFrame *page_origin; + QFrame *page_caption; + QFrame *page_credits; + QFrame *page_status; + QFrame *page_origin; + QFrame *page_datetime; - IPTCCaption *captionPage; - IPTCCredits *creditsPage; - IPTCStatus *statusPage; - IPTCOrigin *originPage; + IPTCCaption *captionPage; + IPTCCredits *creditsPage; + IPTCStatus *statusPage; + IPTCOrigin *originPage; + IPTCDateTime *datetimePage; }; IPTCEditDialog::IPTCEditDialog(QWidget* parent, QByteArray iptcData, const QString& fileName) @@ -88,22 +93,26 @@ setHelp("metadataedit", "kipi-plugins"); - d->page_caption = addPage(i18n("Caption"), i18n("IPTC Caption Informations"), - BarIcon("editclear", KIcon::SizeMedium)); - d->captionPage = new IPTCCaption(d->page_caption, d->iptcData); + d->page_caption = addPage(i18n("Caption"), i18n("IPTC Caption Informations"), + BarIcon("editclear", KIcon::SizeMedium)); + d->captionPage = new IPTCCaption(d->page_caption, d->iptcData); - d->page_credits = addPage(i18n("Credits"), i18n("IPTC Credits Informations"), - BarIcon("identity", KIcon::SizeMedium)); - d->creditsPage = new IPTCCredits(d->page_credits, d->iptcData); + d->page_credits = addPage(i18n("Credits"), i18n("IPTC Credits Informations"), + BarIcon("identity", KIcon::SizeMedium)); + d->creditsPage = new IPTCCredits(d->page_credits, d->iptcData); - d->page_status = addPage(i18n("Status"), i18n("IPTC Status Informations"), - BarIcon("messagebox_info", KIcon::SizeMedium)); - d->statusPage = new IPTCStatus(d->page_status, d->iptcData); + d->page_status = addPage(i18n("Status"), i18n("IPTC Status Informations"), + BarIcon("messagebox_info", KIcon::SizeMedium)); + d->statusPage = new IPTCStatus(d->page_status, d->iptcData); - d->page_origin = addPage(i18n("Origin"), i18n("IPTC Origin Informations"), - BarIcon("www", KIcon::SizeMedium)); - d->originPage = new IPTCOrigin(d->page_origin, d->iptcData); + d->page_origin = addPage(i18n("Origin"), i18n("IPTC Origin Informations"), + BarIcon("www", KIcon::SizeMedium)); + d->originPage = new IPTCOrigin(d->page_origin, d->iptcData); + d->page_datetime = addPage(i18n("Date & Time"), i18n("IPTC Date and Time Informations"), + BarIcon("today", KIcon::SizeMedium)); + d->datetimePage = new IPTCDateTime(d->page_datetime, d->iptcData); + readSettings(); show(); } @@ -154,6 +163,7 @@ d->creditsPage->applyMetadata(d->iptcData); d->statusPage->applyMetadata(d->iptcData); d->originPage->applyMetadata(d->iptcData); + d->datetimePage->applyMetadata(d->iptcData); saveSettings(); accept(); } SVN commit 595205 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Missing IPTC Contact and Subject tags. CCMAIL: kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 M +25 -9 iptccaption.cpp M +16 -1 iptccredits.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/iptccaption.cpp #595204:595205 @@ -50,11 +50,13 @@ IPTCCaptionPriv() { captionEdit = 0; + subjectEdit = 0; writerEdit = 0; headlineEdit = 0; specialInstructionEdit = 0; } + KLineEdit *subjectEdit; KLineEdit *writerEdit; KLineEdit *headlineEdit; @@ -86,36 +88,48 @@ // -------------------------------------------------------- - QLabel *label2 = new QLabel(i18n("Caption Writer:"), parent); + QLabel *label2 = new QLabel(i18n("Subject:"), parent); + d->subjectEdit = new KLineEdit(parent); + d->subjectEdit->setValidator(asciiValidator); + d->subjectEdit->setMaxLength(236); + label2->setBuddy(d->subjectEdit); + vlay->addWidget(label2); + vlay->addWidget(d->subjectEdit); + QWhatsThis::add(d->subjectEdit, i18n("<p>Set here the structured definition of the subject. " + "This field is limited to 236 ASCII characters.")); + + // -------------------------------------------------------- + + QLabel *label3 = new QLabel(i18n("Caption Writer:"), parent); d->writerEdit = new KLineEdit(parent); d->writerEdit->setValidator(asciiValidator); d->writerEdit->setMaxLength(32); - label2->setBuddy(d->writerEdit); - vlay->addWidget(label2); + label3->setBuddy(d->writerEdit); + vlay->addWidget(label3); vlay->addWidget(d->writerEdit); QWhatsThis::add(d->writerEdit, i18n("<p>Set here the person responsible for caption. This field is limited " "to 32 ASCII characters.")); // -------------------------------------------------------- - QLabel *label3 = new QLabel(i18n("Headline:"), parent); + QLabel *label4 = new QLabel(i18n("Headline:"), parent); d->headlineEdit = new KLineEdit(parent); d->headlineEdit->setValidator(asciiValidator); d->headlineEdit->setMaxLength(256); - label3->setBuddy(d->headlineEdit); - vlay->addWidget(label3); + label4->setBuddy(d->headlineEdit); + vlay->addWidget(label4); vlay->addWidget(d->headlineEdit); QWhatsThis::add(d->headlineEdit, i18n("<p>Set here the content synopsis. This field is limited " "to 256 ASCII characters.")); // -------------------------------------------------------- - QLabel *label4 = new QLabel(i18n("Special Instructions:"), parent); + QLabel *label5 = new QLabel(i18n("Special Instructions:"), parent); d->specialInstructionEdit = new KTextEdit(parent); /* d->specialInstructionEdit->setValidator(asciiValidator); d->specialInstructionEdit->setMaxLength(256);*/ - label4->setBuddy(d->specialInstructionEdit); - vlay->addWidget(label4); + label5->setBuddy(d->specialInstructionEdit); + vlay->addWidget(label5); vlay->addWidget(d->specialInstructionEdit); QWhatsThis::add(d->specialInstructionEdit, i18n("<p>Set here the editorial usage instructions. " "This field is limited to 256 ASCII characters.")); @@ -142,6 +156,7 @@ KIPIPlugins::Exiv2Iface exiv2Iface; exiv2Iface.setIptc(iptcData); d->captionEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Caption", false)); + d->subjectEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Subject", false)); d->writerEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Writer", false)); d->headlineEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Headline", false)); d->specialInstructionEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.SpecialInstructions", false)); @@ -152,6 +167,7 @@ KIPIPlugins::Exiv2Iface exiv2Iface; exiv2Iface.setIptc(iptcData); exiv2Iface.setIptcTagString("Iptc.Application2.Caption", d->captionEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.Subject", d->subjectEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.Writer", d->writerEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.Headline", d->headlineEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.SpecialInstructions", d->specialInstructionEdit->text()); --- trunk/extragear/libs/kipi-plugins/metadataedit/iptccredits.cpp #595204:595205 @@ -53,6 +53,7 @@ bylineTitleEdit = 0; creditEdit = 0; sourceEdit = 0; + contactEdit = 0; } KLineEdit *copyrightEdit; @@ -60,6 +61,7 @@ KLineEdit *bylineTitleEdit; KLineEdit *creditEdit; KLineEdit *sourceEdit; + KLineEdit *contactEdit; }; IPTCCredits::IPTCCredits(QWidget* parent, QByteArray& iptcData) @@ -134,6 +136,18 @@ // -------------------------------------------------------- + QLabel *label6 = new QLabel(i18n("Contact:"), parent); + d->contactEdit = new KLineEdit(parent); + d->contactEdit->setValidator(asciiValidator); + d->contactEdit->setMaxLength(128); + label6->setBuddy(d->sourceEdit); + vlay->addWidget(label6); + vlay->addWidget(d->contactEdit); + QWhatsThis::add(d->contactEdit, i18n("<p>Set here the person or organisation to contact. " + "This field is limited to 128 ASCII characters.")); + + // -------------------------------------------------------- + QLabel *iptcNote = new QLabel(i18n("<b>Note: IPTC text tags only support printable " "ASCII characters set.</b>"), parent); vlay->addWidget(iptcNote); @@ -158,6 +172,7 @@ d->bylineTitleEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.BylineTitle", false)); d->creditEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Credit", false)); d->sourceEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Source", false)); + d->contactEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.Contact", false)); } void IPTCCredits::applyMetadata(QByteArray& iptcData) @@ -168,7 +183,7 @@ exiv2Iface.setIptcTagString("Iptc.Application2.Byline", d->bylineEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.BylineTitle", d->bylineTitleEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.Credit", d->creditEdit->text()); - exiv2Iface.setIptcTagString("Iptc.Application2.Source", d->sourceEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.Source", d->sourceEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.Contact", d->contactEdit->text()); iptcData = exiv2Iface.getIptc(); } SVN commit 595212 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Missing IPTC LocationName and LocationCode tags. CCMAIL: kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 M +36 -5 iptcorigin.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/iptcorigin.cpp #595211:595212 @@ -52,6 +52,8 @@ provinceEdit = 0; countryEdit = 0; countryCodeEdit = 0; + locationEdit = 0; + locationCodeEdit = 0; originalTransEdit = 0; } @@ -61,6 +63,8 @@ KLineEdit *provinceEdit; KLineEdit *countryEdit; KLineEdit *countryCodeEdit; + KLineEdit *locationEdit; + KLineEdit *locationCodeEdit; KLineEdit *originalTransEdit; }; @@ -89,6 +93,30 @@ // -------------------------------------------------------- + QLabel *label2 = new QLabel(i18n("Location:"), parent); + d->locationEdit = new KLineEdit(parent); + d->locationEdit->setValidator(asciiValidator); + d->locationEdit->setMaxLength(64); + label2->setBuddy(d->locationEdit); + grid->addMultiCellWidget(label2, 2, 2, 0, 0); + grid->addMultiCellWidget(d->locationEdit, 2, 2, 1, 2); + QWhatsThis::add(d->locationEdit, i18n("<p>Set here the full country name referenced by the content. " + "This field is limited to 64 ASCII characters.")); + + // -------------------------------------------------------- + + QLabel *label3 = new QLabel(i18n("Location code:"), parent); + d->locationCodeEdit = new KLineEdit(parent); + d->locationCodeEdit->setValidator(asciiValidator); + d->locationCodeEdit->setMaxLength(3); + label3->setBuddy(d->locationCodeEdit); + grid->addMultiCellWidget(label3, 3, 3, 0, 0); + grid->addMultiCellWidget(d->locationCodeEdit, 3, 3, 1, 1); + QWhatsThis::add(d->locationCodeEdit, i18n("<p>Set here the ISO country code referenced by the content. " + "This field is limited to 3 ASCII characters.")); + + // -------------------------------------------------------- + QLabel *label4 = new QLabel(i18n("City:"), parent); d->cityEdit = new KLineEdit(parent); d->cityEdit->setValidator(asciiValidator); @@ -117,7 +145,7 @@ d->provinceEdit = new KLineEdit(parent); d->provinceEdit->setValidator(asciiValidator); d->provinceEdit->setMaxLength(32); - label5->setBuddy(d->provinceEdit); + label6->setBuddy(d->provinceEdit); grid->addMultiCellWidget(label6, 8, 8, 0, 0); grid->addMultiCellWidget(d->provinceEdit, 8, 8, 1, 2); QWhatsThis::add(d->provinceEdit, i18n("<p>Set here the Province or State of content origin. " @@ -129,10 +157,10 @@ d->countryEdit = new KLineEdit(parent); d->countryEdit->setValidator(asciiValidator); d->countryEdit->setMaxLength(64); - label5->setBuddy(d->countryEdit); + label7->setBuddy(d->countryEdit); grid->addMultiCellWidget(label7, 9, 9, 0, 0); grid->addMultiCellWidget(d->countryEdit, 9, 9, 1, 2); - QWhatsThis::add(d->provinceEdit, i18n("<p>Set here the full country name of content origin. " + QWhatsThis::add(d->countryEdit, i18n("<p>Set here the full country name of content origin. " "This field is limited to 64 ASCII characters.")); // -------------------------------------------------------- @@ -143,7 +171,7 @@ d->countryCodeEdit->setMaxLength(3); label5->setBuddy(d->countryCodeEdit); grid->addMultiCellWidget(label8, 10, 10, 0, 0); - grid->addMultiCellWidget(d->countryCodeEdit, 10, 10, 1, 2); + grid->addMultiCellWidget(d->countryCodeEdit, 10, 10, 1, 1); QWhatsThis::add(d->countryCodeEdit, i18n("<p>Set here the ISO country code of content origin. " "This field is limited to 3 ASCII characters.")); @@ -183,6 +211,8 @@ exiv2Iface.setIptc(iptcData); d->objectNameEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.ObjectName", false)); + d->locationEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.LocationName", false)); + d->locationCodeEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.LocationCode", false)); d->cityEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.City", false)); d->sublocationEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.SubLocation", false)); d->provinceEdit->setText(exiv2Iface.getIptcTagString("Iptc.Application2.ProvinceState", false)); @@ -197,7 +227,8 @@ exiv2Iface.setIptc(iptcData); exiv2Iface.setIptcTagString("Iptc.Application2.ObjectName", d->objectNameEdit->text()); - exiv2Iface.setIptcTagString("Iptc.Application2.City", d->cityEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.LocationName", d->locationEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.LocationCode", d->locationCodeEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.City", d->cityEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.SubLocation", d->sublocationEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.ProvinceState", d->provinceEdit->text()); exiv2Iface.setIptcTagString("Iptc.Application2.CountryName", d->countryEdit->text()); SVN commit 595780 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : IPTC Keywords editor page is now implemented. CCMAIL: digikam-devel@kde.org, kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 M +1 -1 Makefile.am M +10 -0 iptceditdialog.cpp A iptckeywords.cpp [License: GPL] A iptckeywords.h [License: GPL] --- trunk/extragear/libs/kipi-plugins/metadataedit/Makefile.am #595779:595780 @@ -12,7 +12,7 @@ kipiplugin_metadataedit_la_SOURCES = plugin_metadataedit.cpp metadataeditdialog.cpp \ metadataitem.cpp iptceditdialog.cpp iptccaption.cpp \ iptccredits.cpp iptcstatus.cpp iptcorigin.cpp \ - iptcdatetime.cpp + iptcdatetime.cpp iptckeywords.cpp # Libs needed by the plugin kipiplugin_metadataedit_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \ --- trunk/extragear/libs/kipi-plugins/metadataedit/iptceditdialog.cpp #595779:595780 @@ -43,6 +43,7 @@ #include "iptcstatus.h" #include "iptcorigin.h" #include "iptcdatetime.h" +#include "iptckeywords.h" #include "iptceditdialog.h" #include "iptceditdialog.moc" @@ -57,12 +58,14 @@ IPTCEditDialogDialogPrivate() { page_caption = 0; + page_keywords = 0; page_credits = 0; page_status = 0; page_origin = 0; page_datetime = 0; captionPage = 0; + keywordsPage = 0; creditsPage = 0; statusPage = 0; originPage = 0; @@ -72,12 +75,14 @@ QByteArray iptcData; QFrame *page_caption; + QFrame *page_keywords; QFrame *page_credits; QFrame *page_status; QFrame *page_origin; QFrame *page_datetime; IPTCCaption *captionPage; + IPTCKeywords *keywordsPage; IPTCCredits *creditsPage; IPTCStatus *statusPage; IPTCOrigin *originPage; @@ -97,6 +102,10 @@ BarIcon("editclear", KIcon::SizeMedium)); d->captionPage = new IPTCCaption(d->page_caption, d->iptcData); + d->page_keywords = addPage(i18n("Keywords"), i18n("IPTC Keywords Informations"), + BarIcon("bookmark", KIcon::SizeMedium)); + d->keywordsPage = new IPTCKeywords(d->page_keywords, d->iptcData); + d->page_credits = addPage(i18n("Credits"), i18n("IPTC Credits Informations"), BarIcon("identity", KIcon::SizeMedium)); d->creditsPage = new IPTCCredits(d->page_credits, d->iptcData); @@ -160,6 +169,7 @@ void IPTCEditDialog::slotOk() { d->captionPage->applyMetadata(d->iptcData); + d->keywordsPage->applyMetadata(d->iptcData); d->creditsPage->applyMetadata(d->iptcData); d->statusPage->applyMetadata(d->iptcData); d->originPage->applyMetadata(d->iptcData); SVN commit 595932 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : IPTC Categories editor page is now implemented. CCMAIL: digikam-devel@kde.org, kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 A iptccategories.cpp [License: GPL] A iptccategories.h [License: GPL] SVN commit 595953 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : add ObjectType IPTC tag to status editor page. CCBUGS: 91812, 133276, 103255 M +67 -12 iptcstatus.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/iptcstatus.cpp #595952:595953 @@ -50,12 +50,14 @@ { priorityCB = 0; objectCycleCB = 0; + objectTypeCB = 0; statusEdit = 0; JobIDEdit = 0; programEdit = 0; programVersionEdit = 0; priorityCheck = 0; objectCycleCheck = 0; + objectTypeCheck = 0; statusCheck = 0; JobIDCheck = 0; programCheck = 0; @@ -63,6 +65,7 @@ } QCheckBox *priorityCheck; + QCheckBox *objectTypeCheck; QCheckBox *objectCycleCheck; QCheckBox *statusCheck; QCheckBox *JobIDCheck; @@ -71,8 +74,10 @@ QComboBox *priorityCB; QComboBox *objectCycleCB; + QComboBox *objectTypeCB; KLineEdit *statusEdit; + KLineEdit *objectTypeDescEdit; KLineEdit *JobIDEdit; KLineEdit *programEdit; KLineEdit *programVersionEdit; @@ -83,7 +88,7 @@ { d = new IPTCStatusPriv; - QGridLayout* grid = new QGridLayout(parent, 11, 2, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 12, 2, KDialog::spacingHint()); // IPTC only accept printable Ascii char. QRegExp asciiRx("[\x20-\x7F]+$"); @@ -121,21 +126,38 @@ d->objectCycleCheck = new QCheckBox(i18n("Object Cycle:"), parent); d->objectCycleCB = new QComboBox(false, parent); - d->objectCycleCB->insertItem(i18n("a: Morning"), 0); - d->objectCycleCB->insertItem(i18n("b: Afternoon"), 1); - d->objectCycleCB->insertItem(i18n("c: Evening"), 2); + d->objectCycleCB->insertItem(i18n("Morning"), 0); + d->objectCycleCB->insertItem(i18n("Afternoon"), 1); + d->objectCycleCB->insertItem(i18n("Evening"), 2); grid->addMultiCellWidget(d->objectCycleCheck, 3, 3, 0, 0); grid->addMultiCellWidget(d->objectCycleCB, 3, 3, 1, 1); QWhatsThis::add(d->objectCycleCB, i18n("<p>Select here the editorial cycle of content.")); // -------------------------------------------------------- + d->objectTypeCheck = new QCheckBox(i18n("Object Type:"), parent); + d->objectTypeCB = new QComboBox(false, parent); + d->objectTypeDescEdit = new KLineEdit(parent); + d->objectTypeDescEdit->setValidator(asciiValidator); + d->objectTypeDescEdit->setMaxLength(32); + d->objectTypeCB->insertItem(i18n("News"), 0); + d->objectTypeCB->insertItem(i18n("Data"), 1); + d->objectTypeCB->insertItem(i18n("Advisory"), 2); + grid->addMultiCellWidget(d->objectTypeCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->objectTypeCB, 4, 4, 1, 1); + grid->addMultiCellWidget(d->objectTypeDescEdit, 4, 4, 2, 2); + QWhatsThis::add(d->objectTypeCB, i18n("<p>Select here the editorial type of content.")); + QWhatsThis::add(d->objectTypeDescEdit, i18n("<p>Set here the editorial description of content. " + "This field is limited to 64 ASCII characters.")); + + // -------------------------------------------------------- + d->JobIDCheck = new QCheckBox(i18n("Job ID:"), parent); d->JobIDEdit = new KLineEdit(parent); d->JobIDEdit->setValidator(asciiValidator); d->JobIDEdit->setMaxLength(32); - grid->addMultiCellWidget(d->JobIDCheck, 4, 4, 0, 2); - grid->addMultiCellWidget(d->JobIDEdit, 5, 5, 0, 2); + grid->addMultiCellWidget(d->JobIDCheck, 5, 5, 0, 2); + grid->addMultiCellWidget(d->JobIDEdit, 6, 6, 0, 2); QWhatsThis::add(d->JobIDEdit, i18n("<p>Set here the string that identifies content that recurs. " "This field is limited to 32 ASCII characters.")); @@ -145,8 +167,8 @@ d->programEdit = new KLineEdit(parent); d->programEdit->setValidator(asciiValidator); d->programEdit->setMaxLength(32); - grid->addMultiCellWidget(d->programCheck, 6, 6, 0, 2); - grid->addMultiCellWidget(d->programEdit, 7, 7, 0, 2); + grid->addMultiCellWidget(d->programCheck, 7, 7, 0, 2); + grid->addMultiCellWidget(d->programEdit, 8, 8, 0, 2); QWhatsThis::add(d->programEdit, i18n("<p>Set here the content creation program name. " "This field is limited to 32 ASCII characters.")); @@ -156,8 +178,8 @@ d->programVersionEdit = new KLineEdit(parent); d->programVersionEdit->setValidator(asciiValidator); d->programVersionEdit->setMaxLength(10); - grid->addMultiCellWidget(d->programVersionCheck, 8, 8, 0, 2); - grid->addMultiCellWidget(d->programVersionEdit, 9, 9, 0, 0); + grid->addMultiCellWidget(d->programVersionCheck, 9, 9, 0, 2); + grid->addMultiCellWidget(d->programVersionEdit, 10, 10, 0, 0); QWhatsThis::add(d->programVersionEdit, i18n("<p>Set here the content creation program version. " "This field is limited to 10 ASCII characters.")); @@ -165,9 +187,9 @@ QLabel *iptcNote = new QLabel(i18n("<b>Note: IPTC text tags only support printable " "ASCII characters set.</b>"), parent); - grid->addMultiCellWidget(iptcNote, 10, 10, 0, 2); + grid->addMultiCellWidget(iptcNote, 11, 11, 0, 2); grid->setColStretch(2, 10); - grid->setRowStretch(11, 10); + grid->setRowStretch(12, 10); // -------------------------------------------------------- @@ -177,6 +199,12 @@ connect(d->objectCycleCheck, SIGNAL(toggled(bool)), d->objectCycleCB, SLOT(setEnabled(bool))); + connect(d->objectTypeCheck, SIGNAL(toggled(bool)), + d->objectTypeCB, SLOT(setEnabled(bool))); + + connect(d->objectTypeCheck, SIGNAL(toggled(bool)), + d->objectTypeDescEdit, SLOT(setEnabled(bool))); + connect(d->statusCheck, SIGNAL(toggled(bool)), d->statusEdit, SLOT(setEnabled(bool))); @@ -213,6 +241,24 @@ } d->statusEdit->setEnabled(d->statusCheck->isChecked()); + data = exiv2Iface.getIptcTagString("Iptc.Application2.ObjectType", false); + if (!data.isNull()) + { + QString typeSec = data.section(":", 0, 0); + if (!typeSec.isEmpty()) + { + int type = typeSec.toInt(); + if (type < 3 && type >= 0) + { + d->objectTypeCB->setCurrentItem(type); + d->objectTypeDescEdit->setText(data.section(":", -1)); + d->objectTypeCheck->setChecked(true); + } + } + } + d->objectTypeCB->setEnabled(d->objectTypeCheck->isChecked()); + d->objectTypeDescEdit->setEnabled(d->objectTypeCheck->isChecked()); + data = exiv2Iface.getIptcTagString("Iptc.Application2.FixtureId", false); if (!data.isNull()) { @@ -270,6 +316,15 @@ else exiv2Iface.removeIptcTag("Iptc.Application2.EditStatus"); + if (d->objectTypeCheck->isChecked()) + { + QString objectType = QString("0%1:%2").arg(d->objectTypeCB->currentItem()) + .arg(d->objectTypeDescEdit->text()); + exiv2Iface.setIptcTagString("Iptc.Application2.ObjectType", objectType); + } + else + exiv2Iface.removeIptcTag("Iptc.Application2.ObjectType"); + if (d->JobIDCheck->isChecked()) exiv2Iface.setIptcTagString("Iptc.Application2.FixtureId", d->JobIDEdit->text()); else SVN commit 595961 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : add ObjectAttribute IPTC tag to status editor page. CCBUGS: 91812, 133276, 103255 M +90 -16 iptcstatus.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/iptcstatus.cpp #595960:595961 @@ -67,6 +67,7 @@ QCheckBox *priorityCheck; QCheckBox *objectTypeCheck; QCheckBox *objectCycleCheck; + QCheckBox *objectAttributeCheck; QCheckBox *statusCheck; QCheckBox *JobIDCheck; QCheckBox *programCheck; @@ -75,9 +76,11 @@ QComboBox *priorityCB; QComboBox *objectCycleCB; QComboBox *objectTypeCB; + QComboBox *objectAttributeCB; KLineEdit *statusEdit; KLineEdit *objectTypeDescEdit; + KLineEdit *objectAttributeDescEdit; KLineEdit *JobIDEdit; KLineEdit *programEdit; KLineEdit *programVersionEdit; @@ -88,7 +91,7 @@ { d = new IPTCStatusPriv; - QGridLayout* grid = new QGridLayout(parent, 12, 2, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 14, 2, KDialog::spacingHint()); // IPTC only accept printable Ascii char. QRegExp asciiRx("[\x20-\x7F]+$"); @@ -139,25 +142,61 @@ d->objectTypeCB = new QComboBox(false, parent); d->objectTypeDescEdit = new KLineEdit(parent); d->objectTypeDescEdit->setValidator(asciiValidator); - d->objectTypeDescEdit->setMaxLength(32); + d->objectTypeDescEdit->setMaxLength(64); d->objectTypeCB->insertItem(i18n("News"), 0); d->objectTypeCB->insertItem(i18n("Data"), 1); d->objectTypeCB->insertItem(i18n("Advisory"), 2); grid->addMultiCellWidget(d->objectTypeCheck, 4, 4, 0, 0); grid->addMultiCellWidget(d->objectTypeCB, 4, 4, 1, 1); - grid->addMultiCellWidget(d->objectTypeDescEdit, 4, 4, 2, 2); + grid->addMultiCellWidget(d->objectTypeDescEdit, 5, 5, 0, 2); QWhatsThis::add(d->objectTypeCB, i18n("<p>Select here the editorial type of content.")); - QWhatsThis::add(d->objectTypeDescEdit, i18n("<p>Set here the editorial description of content. " + QWhatsThis::add(d->objectTypeDescEdit, i18n("<p>Set here the editorial type description of content. " "This field is limited to 64 ASCII characters.")); // -------------------------------------------------------- + d->objectAttributeCheck = new QCheckBox(i18n("Object Attribute:"), parent); + d->objectAttributeCB = new QComboBox(false, parent); + d->objectAttributeDescEdit = new KLineEdit(parent); + d->objectAttributeDescEdit->setValidator(asciiValidator); + d->objectAttributeDescEdit->setMaxLength(64); + d->objectAttributeCB->insertItem(i18n("Current"), 0); + d->objectAttributeCB->insertItem(i18n("Analysis"), 1); + d->objectAttributeCB->insertItem(i18n("Archive material"), 2); + d->objectAttributeCB->insertItem(i18n("Background"), 3); + d->objectAttributeCB->insertItem(i18n("Feature"), 4); + d->objectAttributeCB->insertItem(i18n("Forecast"), 5); + d->objectAttributeCB->insertItem(i18n("History"), 6); + d->objectAttributeCB->insertItem(i18n("Obituary"), 7); + d->objectAttributeCB->insertItem(i18n("Opinion"), 8); + d->objectAttributeCB->insertItem(i18n("Polls & Surveys"), 9); + d->objectAttributeCB->insertItem(i18n("Profile"), 10); + d->objectAttributeCB->insertItem(i18n("Results Listings & Table"), 11); + d->objectAttributeCB->insertItem(i18n("Side bar & Supporting information"), 12); + d->objectAttributeCB->insertItem(i18n("Summary"), 13); + d->objectAttributeCB->insertItem(i18n("Transcript & Verbatim"), 14); + d->objectAttributeCB->insertItem(i18n("Interview"), 15); + d->objectAttributeCB->insertItem(i18n("From the Scene"), 16); + d->objectAttributeCB->insertItem(i18n("Retrospective"), 17); + d->objectAttributeCB->insertItem(i18n("Statistics"), 18); + d->objectAttributeCB->insertItem(i18n("Update"), 19); + d->objectAttributeCB->insertItem(i18n("Wrap-up"), 20); + d->objectAttributeCB->insertItem(i18n("Press Release"), 21); + grid->addMultiCellWidget(d->objectAttributeCheck, 6, 6, 0, 0); + grid->addMultiCellWidget(d->objectAttributeCB, 6, 6, 1, 2); + grid->addMultiCellWidget(d->objectAttributeDescEdit, 7, 7, 0, 2); + QWhatsThis::add(d->objectAttributeCB, i18n("<p>Select here the editorial attribute of content.")); + QWhatsThis::add(d->objectAttributeDescEdit, i18n("<p>Set here the editorial attribute description of " + "content. This field is limited to 64 ASCII characters.")); + + // -------------------------------------------------------- + d->JobIDCheck = new QCheckBox(i18n("Job ID:"), parent); d->JobIDEdit = new KLineEdit(parent); d->JobIDEdit->setValidator(asciiValidator); d->JobIDEdit->setMaxLength(32); - grid->addMultiCellWidget(d->JobIDCheck, 5, 5, 0, 2); - grid->addMultiCellWidget(d->JobIDEdit, 6, 6, 0, 2); + grid->addMultiCellWidget(d->JobIDCheck, 8, 8, 0, 2); + grid->addMultiCellWidget(d->JobIDEdit, 9, 9, 0, 2); QWhatsThis::add(d->JobIDEdit, i18n("<p>Set here the string that identifies content that recurs. " "This field is limited to 32 ASCII characters.")); @@ -167,8 +206,8 @@ d->programEdit = new KLineEdit(parent); d->programEdit->setValidator(asciiValidator); d->programEdit->setMaxLength(32); - grid->addMultiCellWidget(d->programCheck, 7, 7, 0, 2); - grid->addMultiCellWidget(d->programEdit, 8, 8, 0, 2); + grid->addMultiCellWidget(d->programCheck, 10, 10, 0, 2); + grid->addMultiCellWidget(d->programEdit, 11, 11, 0, 2); QWhatsThis::add(d->programEdit, i18n("<p>Set here the content creation program name. " "This field is limited to 32 ASCII characters.")); @@ -178,8 +217,8 @@ d->programVersionEdit = new KLineEdit(parent); d->programVersionEdit->setValidator(asciiValidator); d->programVersionEdit->setMaxLength(10); - grid->addMultiCellWidget(d->programVersionCheck, 9, 9, 0, 2); - grid->addMultiCellWidget(d->programVersionEdit, 10, 10, 0, 0); + grid->addMultiCellWidget(d->programVersionCheck, 12, 12, 0, 2); + grid->addMultiCellWidget(d->programVersionEdit, 13, 13, 0, 0); QWhatsThis::add(d->programVersionEdit, i18n("<p>Set here the content creation program version. " "This field is limited to 10 ASCII characters.")); @@ -187,9 +226,9 @@ QLabel *iptcNote = new QLabel(i18n("<b>Note: IPTC text tags only support printable " "ASCII characters set.</b>"), parent); - grid->addMultiCellWidget(iptcNote, 11, 11, 0, 2); + grid->addMultiCellWidget(iptcNote, 14, 14, 0, 2); grid->setColStretch(2, 10); - grid->setRowStretch(12, 10); + grid->setRowStretch(14, 10); // -------------------------------------------------------- @@ -205,6 +244,12 @@ connect(d->objectTypeCheck, SIGNAL(toggled(bool)), d->objectTypeDescEdit, SLOT(setEnabled(bool))); + connect(d->objectAttributeCheck, SIGNAL(toggled(bool)), + d->objectAttributeCB, SLOT(setEnabled(bool))); + + connect(d->objectAttributeCheck, SIGNAL(toggled(bool)), + d->objectAttributeDescEdit, SLOT(setEnabled(bool))); + connect(d->statusCheck, SIGNAL(toggled(bool)), d->statusEdit, SLOT(setEnabled(bool))); @@ -247,7 +292,7 @@ QString typeSec = data.section(":", 0, 0); if (!typeSec.isEmpty()) { - int type = typeSec.toInt(); + int type = typeSec.toInt()-1; if (type < 3 && type >= 0) { d->objectTypeCB->setCurrentItem(type); @@ -259,6 +304,24 @@ d->objectTypeCB->setEnabled(d->objectTypeCheck->isChecked()); d->objectTypeDescEdit->setEnabled(d->objectTypeCheck->isChecked()); + data = exiv2Iface.getIptcTagString("Iptc.Application2.ObjectAttribute", false); + if (!data.isNull()) + { + QString attSec = data.section(":", 0, 0); + if (!attSec.isEmpty()) + { + int att = attSec.toInt()-1; + if (att < 21 && att >= 0) + { + d->objectAttributeCB->setCurrentItem(att); + d->objectAttributeDescEdit->setText(data.section(":", -1)); + d->objectAttributeCheck->setChecked(true); + } + } + } + d->objectAttributeCB->setEnabled(d->objectAttributeCheck->isChecked()); + d->objectAttributeDescEdit->setEnabled(d->objectAttributeCheck->isChecked()); + data = exiv2Iface.getIptcTagString("Iptc.Application2.FixtureId", false); if (!data.isNull()) { @@ -318,13 +381,24 @@ if (d->objectTypeCheck->isChecked()) { - QString objectType = QString("0%1:%2").arg(d->objectTypeCB->currentItem()) - .arg(d->objectTypeDescEdit->text()); + QString objectType; + objectType.sprintf("%2d", d->objectTypeCB->currentItem()+1); + objectType.append(QString(":%1").arg(d->objectTypeDescEdit->text())); exiv2Iface.setIptcTagString("Iptc.Application2.ObjectType", objectType); } else - exiv2Iface.removeIptcTag("Iptc.Application2.ObjectType"); + exiv2Iface.removeIptcTag("Iptc.Application2.ObjectAttribute"); + if (d->objectAttributeCheck->isChecked()) + { + QString objectAttribute; + objectAttribute.sprintf("%3d", d->objectAttributeCB->currentItem()+1); + objectAttribute.append(QString(":%1").arg(d->objectAttributeDescEdit->text())); + exiv2Iface.setIptcTagString("Iptc.Application2.ObjectAttribute", objectAttribute); + } + else + exiv2Iface.removeIptcTag("Iptc.Application2.ObjectAttribute"); + if (d->JobIDCheck->isChecked()) exiv2Iface.setIptcTagString("Iptc.Application2.FixtureId", d->JobIDEdit->text()); else SVN commit 595975 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : polish source code : set automaticly IPTC Program/version tags CCBUGS: 91812, 133276, 103255 M +7 -66 iptcstatus.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/iptcstatus.cpp #595974:595975 @@ -35,6 +35,7 @@ // Local includes. +#include "pluginsversion.h" #include "exiv2iface.h" #include "iptcstatus.h" #include "iptcstatus.moc" @@ -53,15 +54,11 @@ objectTypeCB = 0; statusEdit = 0; JobIDEdit = 0; - programEdit = 0; - programVersionEdit = 0; priorityCheck = 0; objectCycleCheck = 0; objectTypeCheck = 0; statusCheck = 0; JobIDCheck = 0; - programCheck = 0; - programVersionCheck = 0; } QCheckBox *priorityCheck; @@ -70,8 +67,6 @@ QCheckBox *objectAttributeCheck; QCheckBox *statusCheck; QCheckBox *JobIDCheck; - QCheckBox *programCheck; - QCheckBox *programVersionCheck; QComboBox *priorityCB; QComboBox *objectCycleCB; @@ -82,8 +77,6 @@ KLineEdit *objectTypeDescEdit; KLineEdit *objectAttributeDescEdit; KLineEdit *JobIDEdit; - KLineEdit *programEdit; - KLineEdit *programVersionEdit; }; IPTCStatus::IPTCStatus(QWidget* parent, QByteArray& iptcData) @@ -91,7 +84,7 @@ { d = new IPTCStatusPriv; - QGridLayout* grid = new QGridLayout(parent, 14, 2, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 11, 2, KDialog::spacingHint()); // IPTC only accept printable Ascii char. QRegExp asciiRx("[\x20-\x7F]+$"); @@ -191,7 +184,7 @@ // -------------------------------------------------------- - d->JobIDCheck = new QCheckBox(i18n("Job ID:"), parent); + d->JobIDCheck = new QCheckBox(i18n("Job Identification:"), parent); d->JobIDEdit = new KLineEdit(parent); d->JobIDEdit->setValidator(asciiValidator); d->JobIDEdit->setMaxLength(32); @@ -202,33 +195,11 @@ // -------------------------------------------------------- - d->programCheck = new QCheckBox(i18n("Program:"), parent); - d->programEdit = new KLineEdit(parent); - d->programEdit->setValidator(asciiValidator); - d->programEdit->setMaxLength(32); - grid->addMultiCellWidget(d->programCheck, 10, 10, 0, 2); - grid->addMultiCellWidget(d->programEdit, 11, 11, 0, 2); - QWhatsThis::add(d->programEdit, i18n("<p>Set here the content creation program name. " - "This field is limited to 32 ASCII characters.")); - - // -------------------------------------------------------- - - d->programVersionCheck = new QCheckBox(i18n("Program Version:"), parent); - d->programVersionEdit = new KLineEdit(parent); - d->programVersionEdit->setValidator(asciiValidator); - d->programVersionEdit->setMaxLength(10); - grid->addMultiCellWidget(d->programVersionCheck, 12, 12, 0, 2); - grid->addMultiCellWidget(d->programVersionEdit, 13, 13, 0, 0); - QWhatsThis::add(d->programVersionEdit, i18n("<p>Set here the content creation program version. " - "This field is limited to 10 ASCII characters.")); - - // -------------------------------------------------------- - QLabel *iptcNote = new QLabel(i18n("<b>Note: IPTC text tags only support printable " "ASCII characters set.</b>"), parent); - grid->addMultiCellWidget(iptcNote, 14, 14, 0, 2); + grid->addMultiCellWidget(iptcNote, 10, 10, 0, 2); grid->setColStretch(2, 10); - grid->setRowStretch(14, 10); + grid->setRowStretch(11, 10); // -------------------------------------------------------- @@ -256,12 +227,6 @@ connect(d->JobIDCheck, SIGNAL(toggled(bool)), d->JobIDEdit, SLOT(setEnabled(bool))); - connect(d->programCheck, SIGNAL(toggled(bool)), - d->programEdit, SLOT(setEnabled(bool))); - - connect(d->programVersionCheck, SIGNAL(toggled(bool)), - d->programVersionEdit, SLOT(setEnabled(bool))); - // -------------------------------------------------------- readMetadata(iptcData); @@ -330,22 +295,6 @@ } d->JobIDEdit->setEnabled(d->JobIDCheck->isChecked()); - data = exiv2Iface.getIptcTagString("Iptc.Application2.Program", false); - if (!data.isNull()) - { - d->programEdit->setText(data); - d->programCheck->setChecked(true); - } - d->programEdit->setEnabled(d->programCheck->isChecked()); - - data = exiv2Iface.getIptcTagString("Iptc.Application2.ProgramVersion", false); - if (!data.isNull()) - { - d->programVersionEdit->setText(data); - d->programVersionCheck->setChecked(true); - } - d->programVersionEdit->setEnabled(d->programVersionCheck->isChecked()); - data = exiv2Iface.getIptcTagString("Iptc.Application2.Urgency", false); if (!data.isNull()) { @@ -404,16 +353,6 @@ else exiv2Iface.removeIptcTag("Iptc.Application2.FixtureId"); - if (d->programCheck->isChecked()) - exiv2Iface.setIptcTagString("Iptc.Application2.Program", d->programEdit->text()); - else - exiv2Iface.removeIptcTag("Iptc.Application2.Program"); - - if (d->programVersionCheck->isChecked()) - exiv2Iface.setIptcTagString("Iptc.Application2.ProgramVersion", d->programVersionEdit->text()); - else - exiv2Iface.removeIptcTag("Iptc.Application2.ProgramVersion"); - if (d->priorityCheck->isChecked()) exiv2Iface.setIptcTagString("Iptc.Application2.Urgency", QString::number(d->priorityCB->currentItem())); else @@ -439,6 +378,8 @@ else exiv2Iface.removeIptcTag("Iptc.Application2.ObjectCycle"); + exiv2Iface.setImageProgramId(QString("Kipi MetadataEdit"), QString(kipiplugins_version)); + iptcData = exiv2Iface.getIptc(); } SVN commit 596354 by cgilles: kipiplugins from trunk : MetadataEdit plugin: IPTC Origin informations editor now support all country codes define by ISO-3166 norm. CCMAIL: kde-imaging@kde.org CCBUGS: 91812, 133276, 103255 M +340 -103 iptcorigin.cpp SVN commit 596688 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Caption informations editor is fully implemented. CCMAIL: kde-imaging@kde.org CCBUGS: 103255 M +28 -21 exifcaption.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifcaption.cpp #596687:596688 @@ -209,7 +209,7 @@ void EXIFCaption::readMetadata(QByteArray& exifData) { KIPIPlugins::Exiv2Iface exiv2Iface; - exiv2Iface.setIptc(exifData); + exiv2Iface.setExif(exifData); QString data; data = exiv2Iface.getExifTagString("Exif.Image.DocumentName", false); @@ -260,15 +260,13 @@ } d->copyrightEdit->setEnabled(d->copyrightCheck->isChecked()); -/* TODO - data = exiv2Iface.getIma; + data = exiv2Iface.getExifComment(); if (!data.isNull()) { d->userCommentEdit->setText(data); d->userCommentCheck->setChecked(true); } d->userCommentEdit->setEnabled(d->userCommentCheck->isChecked()); -*/ } void EXIFCaption::applyMetadata(QByteArray& exifData) @@ -276,32 +274,41 @@ KIPIPlugins::Exiv2Iface exiv2Iface; exiv2Iface.setExif(exifData); -/* - if (d->captionCheck->isChecked()) - exiv2Iface.setIptcTagString("Iptc.Application2.Caption", d->captionEdit->text()); + if (d->documentNameCheck->isChecked()) + exiv2Iface.setExifTagString("Exif.Image.DocumentName", d->documentNameEdit->text()); else - exiv2Iface.removeIptcTag("Iptc.Application2.Caption"); + exiv2Iface.removeExifTag("Exif.Image.DocumentName"); - if (d->subjectCheck->isChecked()) - exiv2Iface.setIptcTagString("Iptc.Application2.Subject", d->subjectEdit->text()); + if (d->imageDescCheck->isChecked()) + exiv2Iface.setExifTagString("Exif.Image.ImageDescription", d->imageDescEdit->text()); else - exiv2Iface.removeIptcTag("Iptc.Application2.Subject"); + exiv2Iface.removeExifTag("Exif.Image.ImageDescription"); - if (d->writerCheck->isChecked()) - exiv2Iface.setIptcTagString("Iptc.Application2.Writer", d->writerEdit->text()); + if (d->makeCheck->isChecked()) + exiv2Iface.setExifTagString("Exif.Image.Make", d->makeEdit->text()); else - exiv2Iface.removeIptcTag("Iptc.Application2.Writer"); + exiv2Iface.removeExifTag("Exif.Image.Make"); - if (d->headlineCheck->isChecked()) - exiv2Iface.setIptcTagString("Iptc.Application2.Headline", d->headlineEdit->text()); + if (d->modelCheck->isChecked()) + exiv2Iface.setExifTagString("Exif.Image.Model", d->modelEdit->text()); else - exiv2Iface.removeIptcTag("Iptc.Application2.Headline"); + exiv2Iface.removeExifTag("Exif.Image.Model"); - if (d->specialInstructionCheck->isChecked()) - exiv2Iface.setIptcTagString("Iptc.Application2.SpecialInstructions", d->specialInstructionEdit->text()); + if (d->artistCheck->isChecked()) + exiv2Iface.setExifTagString("Exif.Image.Artist", d->artistEdit->text()); else - exiv2Iface.removeIptcTag("Iptc.Application2.SpecialInstructions"); -*/ + exiv2Iface.removeExifTag("Exif.Image.Artist"); + + if (d->copyrightCheck->isChecked()) + exiv2Iface.setExifTagString("Exif.Image.Copyright", d->copyrightEdit->text()); + else + exiv2Iface.removeExifTag("Exif.Image.Copyright"); + + if (d->userCommentCheck->isChecked()) + exiv2Iface.setExifComment(d->userCommentEdit->text()); + else + exiv2Iface.removeExifTag("Exif.Photo.UserComment"); + exifData = exiv2Iface.getExif(); } SVN commit 596693 by cgilles: kipiplugins from trunk : MetadataEdit plugin: capabaility to load EXIF metadata from a specific picture and apply it to a list of pictures CCMAIL: kde-imaging@kde.org CCBUGS: 103255 M +47 -3 metadataeditdialog.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/metadataeditdialog.cpp #596692:596693 @@ -357,7 +357,51 @@ void MetadataEditDialog::slotLoadExif() { - // TODO + if (!d->listView->currentItem()) + { + KMessageBox::information(this, i18n("Please, select at least one picture from " + "the list to apply EXIF metadata from a specific picture."), i18n("Edit Metadata")); + return; + } + + KURL loadEXIFFile = KFileDialog::getOpenURL(KGlobalSettings::documentPath(), + QString::null, this, + i18n("Select File to Load EXIF data") ); + if( loadEXIFFile.isEmpty() ) + return; + + KIPIPlugins::Exiv2Iface exiv2Iface; + if (!exiv2Iface.load(loadEXIFFile.path())) + { + KMessageBox::error(this, i18n("Cannot load metadata from \"%1\"!").arg(loadEXIFFile.fileName()), + i18n("Edit Metadata")); + return; + } + + QByteArray exifData = exiv2Iface.getExif(); + if (exifData.isEmpty()) + { + KMessageBox::error(this, i18n("\"%1\" do not have EXIF metadata!").arg(loadEXIFFile.fileName()), + i18n("Edit Metadata")); + return; + } + + EXIFEditDialog dlg(this, exifData, loadEXIFFile.fileName()); + + if (dlg.exec() == KDialogBase::Accepted) + { + QListViewItemIterator it(d->listView); + + while (it.current()) + { + if (it.current()->isSelected()) + { + MetadataItem *selItem = (MetadataItem*)it.current(); + selItem->setExif(dlg.getEXIFInfo(), true); + } + ++it; + } + } } void MetadataEditDialog::slotLoadIptc() @@ -378,7 +422,7 @@ KIPIPlugins::Exiv2Iface exiv2Iface; if (!exiv2Iface.load(loadIPTCFile.path())) { - KMessageBox::error(this, i18n("Cannot load metadata from %1!").arg(loadIPTCFile.fileName()), + KMessageBox::error(this, i18n("Cannot load metadata from \"%1\"!").arg(loadIPTCFile.fileName()), i18n("Edit Metadata")); return; } @@ -386,7 +430,7 @@ QByteArray iptcData = exiv2Iface.getIptc(); if (iptcData.isEmpty()) { - KMessageBox::error(this, i18n("%1 do not have IPTC metadata!").arg(loadIPTCFile.fileName()), + KMessageBox::error(this, i18n("\"%1\" do not have IPTC metadata!").arg(loadIPTCFile.fileName()), i18n("Edit Metadata")); return; } SVN commit 596705 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Date & Time informations editor is fully implemented. CCMAIL: kde-imaging@kde.org CCBUGS: 103255 M +1 -1 Makefile.am A exifdatetime.cpp [License: GPL] A exifdatetime.h [License: GPL] M +18 -11 exifeditdialog.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/Makefile.am #596704:596705 @@ -13,7 +13,7 @@ metadataitem.cpp iptceditdialog.cpp iptccaption.cpp \ iptccredits.cpp iptcstatus.cpp iptcorigin.cpp \ iptcdatetime.cpp iptckeywords.cpp iptccategories.cpp \ - exifeditdialog.cpp exifcaption.cpp + exifeditdialog.cpp exifcaption.cpp exifdatetime.cpp # Libs needed by the plugin kipiplugin_metadataedit_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \ --- trunk/extragear/libs/kipi-plugins/metadataedit/exifeditdialog.cpp #596704:596705 @@ -38,6 +38,7 @@ // Local includes. #include "exifcaption.h" +#include "exifdatetime.h" #include "exifeditdialog.h" #include "exifeditdialog.moc" @@ -59,30 +60,34 @@ page_datetime = 0; captionPage = 0; -/* keywordsPage = 0; + datetimePage = 0; +/* + keywordsPage = 0; creditsPage = 0; statusPage = 0; originPage = 0; - datetimePage = 0;*/ +*/ } QByteArray exifData; QFrame *page_caption; + QFrame *page_datetime; QFrame *page_keywords; QFrame *page_categories; QFrame *page_credits; QFrame *page_status; QFrame *page_origin; - QFrame *page_datetime; EXIFCaption *captionPage; -/* EXIFKeywords *keywordsPage; + EXIFDateTime *datetimePage; +/* + EXIFKeywords *keywordsPage; EXIFCategories *categoriesPage; EXIFCredits *creditsPage; EXIFStatus *statusPage; EXIFOrigin *originPage; - EXIFDateTime *datetimePage;*/ +*/ }; EXIFEditDialog::EXIFEditDialog(QWidget* parent, QByteArray exifData, const QString& fileName) @@ -98,6 +103,10 @@ BarIcon("editclear", KIcon::SizeMedium)); d->captionPage = new EXIFCaption(d->page_caption, d->exifData); + d->page_datetime = addPage(i18n("Date & Time"), i18n("EXIF Date and Time Informations"), + BarIcon("today", KIcon::SizeMedium)); + d->datetimePage = new EXIFDateTime(d->page_datetime, d->exifData); + /* d->page_keywords = addPage(i18n("Keywords"), i18n("EXIF Keywords Informations"), BarIcon("bookmark", KIcon::SizeMedium)); d->keywordsPage = new EXIFKeywords(d->page_keywords, d->exifData); @@ -117,10 +126,6 @@ d->page_origin = addPage(i18n("Origin"), i18n("EXIF Origin Informations"), BarIcon("www", KIcon::SizeMedium)); d->originPage = new EXIFOrigin(d->page_origin, d->exifData); - - d->page_datetime = addPage(i18n("Date & Time"), i18n("EXIF Date and Time Informations"), - BarIcon("today", KIcon::SizeMedium)); - d->datetimePage = new EXIFDateTime(d->page_datetime, d->exifData); */ readSettings(); @@ -170,12 +175,14 @@ void EXIFEditDialog::slotOk() { d->captionPage->applyMetadata(d->exifData); -/* d->keywordsPage->applyMetadata(d->exifData); + d->datetimePage->applyMetadata(d->exifData); +/* + d->keywordsPage->applyMetadata(d->exifData); d->categoriesPage->applyMetadata(d->exifData); d->creditsPage->applyMetadata(d->exifData); d->statusPage->applyMetadata(d->exifData); d->originPage->applyMetadata(d->exifData); - d->datetimePage->applyMetadata(d->exifData);*/ +*/ saveSettings(); accept(); } SVN commit 596732 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Date & Time informations editor support now sub-seconds time values. CCMAIL: kde-imaging@kde.org CCBUGS: 103255 M +119 -21 exifdatetime.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifdatetime.cpp #596731:596732 @@ -32,6 +32,7 @@ #include <klocale.h> #include <kdialog.h> #include <kdatetimewidget.h> +#include <knuminput.h> // Local includes. @@ -48,19 +49,32 @@ EXIFDateTimePriv() { - dateCreatedSel = 0; - dateOriginalSel = 0; - dateDigitalizedSel = 0; + dateCreatedSel = 0; + dateOriginalSel = 0; + dateDigitalizedSel = 0; + dateCreatedSubSecEdit = 0; + dateOriginalSubSecEdit = 0; + dateDigitalizedSubSecEdit = 0; - dateCreatedCheck = 0; - dateOriginalCheck = 0; - dateDigitalizedCheck = 0; + dateCreatedCheck = 0; + dateOriginalCheck = 0; + dateDigitalizedCheck = 0; + dateCreatedSubSecCheck = 0; + dateOriginalSubSecCheck = 0; + dateDigitalizedSubSecCheck = 0; } QCheckBox *dateCreatedCheck; QCheckBox *dateOriginalCheck; QCheckBox *dateDigitalizedCheck; + QCheckBox *dateCreatedSubSecCheck; + QCheckBox *dateOriginalSubSecCheck; + QCheckBox *dateDigitalizedSubSecCheck; + KIntSpinBox *dateCreatedSubSecEdit; + KIntSpinBox *dateOriginalSubSecEdit; + KIntSpinBox *dateDigitalizedSubSecEdit; + KDateTimeWidget *dateCreatedSel; KDateTimeWidget *dateOriginalSel; KDateTimeWidget *dateDigitalizedSel; @@ -75,39 +89,57 @@ // -------------------------------------------------------- - d->dateCreatedCheck = new QCheckBox(i18n("Creation date and time"), parent); - d->dateCreatedSel = new KDateTimeWidget(parent); + d->dateCreatedCheck = new QCheckBox(i18n("Creation date and time"), parent); + d->dateCreatedSubSecCheck = new QCheckBox(i18n("Creation sub-second"), parent); + d->dateCreatedSel = new KDateTimeWidget(parent); + d->dateCreatedSubSecEdit = new KIntSpinBox(0, 999, 1, 0, 10, parent); d->dateCreatedSel->setDateTime(QDateTime::currentDateTime()); - grid->addMultiCellWidget(d->dateCreatedCheck, 0, 0, 0, 1); - grid->addMultiCellWidget(d->dateCreatedSel, 1, 1, 0, 1); + grid->addMultiCellWidget(d->dateCreatedCheck, 0, 0, 0, 0); + grid->addMultiCellWidget(d->dateCreatedSubSecCheck, 0, 0, 1, 2); + grid->addMultiCellWidget(d->dateCreatedSel, 1, 1, 0, 0); + grid->addMultiCellWidget(d->dateCreatedSubSecEdit, 1, 1, 1, 1); QWhatsThis::add(d->dateCreatedSel, i18n("<p>Set here the date and time of image creation. " "In this standard it is the date and time the file was changed.")); + QWhatsThis::add(d->dateCreatedSubSecEdit, i18n("<p>Set here the fractions of seconds for the date " + "and time of image creation.")); // -------------------------------------------------------- - d->dateOriginalCheck = new QCheckBox(i18n("Original date and time"), parent); - d->dateOriginalSel = new KDateTimeWidget(parent); + d->dateOriginalCheck = new QCheckBox(i18n("Original date and time"), parent); + d->dateOriginalSubSecCheck = new QCheckBox(i18n("Original sub-second"), parent); + d->dateOriginalSel = new KDateTimeWidget(parent); + d->dateOriginalSubSecEdit = new KIntSpinBox(0, 999, 1, 0, 10, parent); d->dateOriginalSel->setDateTime(QDateTime::currentDateTime()); - grid->addMultiCellWidget(d->dateOriginalCheck, 2, 2, 0, 1); - grid->addMultiCellWidget(d->dateOriginalSel, 3, 3, 0, 1); + grid->addMultiCellWidget(d->dateOriginalCheck, 2, 2, 0, 0); + grid->addMultiCellWidget(d->dateOriginalSubSecCheck, 2, 2, 1, 2); + grid->addMultiCellWidget(d->dateOriginalSel, 3, 3, 0, 0); + grid->addMultiCellWidget(d->dateOriginalSubSecEdit, 3, 3, 1, 1); QWhatsThis::add(d->dateOriginalSel, i18n("<p>Set here the date and time when the original image " "data was generated. For a digital still camera the date and " "time the picture was taken are recorded.")); + QWhatsThis::add(d->dateOriginalSubSecEdit, i18n("<p>Set here the fractions of seconds for the date " + "and time when the original image data was generated.")); // -------------------------------------------------------- - d->dateDigitalizedCheck = new QCheckBox(i18n("Digitization date and time"), parent); - d->dateDigitalizedSel = new KDateTimeWidget(parent); + d->dateDigitalizedCheck = new QCheckBox(i18n("Digitization date and time"), parent); + d->dateDigitalizedSubSecCheck = new QCheckBox(i18n("Digitization sub-second"), parent); + d->dateDigitalizedSel = new KDateTimeWidget(parent); + d->dateDigitalizedSubSecEdit = new KIntSpinBox(0, 999, 1, 0, 10, parent); d->dateDigitalizedSel->setDateTime(QDateTime::currentDateTime()); - grid->addMultiCellWidget(d->dateDigitalizedCheck, 4, 4, 0, 1); - grid->addMultiCellWidget(d->dateDigitalizedSel, 5, 5, 0, 1); + grid->addMultiCellWidget(d->dateDigitalizedCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->dateDigitalizedSubSecCheck, 4, 4, 1, 2); + grid->addMultiCellWidget(d->dateDigitalizedSel, 5, 5, 0, 0); + grid->addMultiCellWidget(d->dateDigitalizedSubSecEdit, 5, 5, 1, 1); QWhatsThis::add(d->dateDigitalizedSel, i18n("<p>Set here the date and time when the image was " "stored as digital data. If, for example, an image was " "captured by a digital still camera and at the same " "time the file was recorded, then Original and Digitization " "date and time will have the same contents.")); + QWhatsThis::add(d->dateDigitalizedSubSecEdit, i18n("<p>Set here the fractions of seconds for the date " + "and time when the image was stored as digital data.")); - grid->setColStretch(2, 10); + grid->setColStretch(3, 10); grid->setRowStretch(6, 10); // -------------------------------------------------------- @@ -121,6 +153,15 @@ connect(d->dateDigitalizedCheck, SIGNAL(toggled(bool)), d->dateDigitalizedSel, SLOT(setEnabled(bool))); + connect(d->dateCreatedSubSecCheck, SIGNAL(toggled(bool)), + d->dateCreatedSubSecEdit, SLOT(setEnabled(bool))); + + connect(d->dateOriginalSubSecCheck, SIGNAL(toggled(bool)), + d->dateOriginalSubSecEdit, SLOT(setEnabled(bool))); + + connect(d->dateDigitalizedSubSecCheck, SIGNAL(toggled(bool)), + d->dateDigitalizedSubSecEdit, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -137,7 +178,7 @@ exiv2Iface.setExif(exifData); QDateTime datetime; - QString datetimeStr; + QString datetimeStr, data; datetimeStr = exiv2Iface.getExifTagString("Exif.Image.DateTime", false); @@ -152,6 +193,19 @@ } d->dateCreatedSel->setEnabled(d->dateCreatedCheck->isChecked()); + data = exiv2Iface.getExifTagString("Exif.Photo.SubSecTime", false); + if (!data.isNull()) + { + bool ok = false; + int subsec = data.toInt(&ok); + if (ok) + { + d->dateCreatedSubSecEdit->setValue(subsec); + d->dateCreatedSubSecCheck->setChecked(true); + } + } + d->dateCreatedSubSecEdit->setEnabled(d->dateCreatedSubSecCheck->isChecked()); + datetimeStr = exiv2Iface.getExifTagString("Exif.Photo.DateTimeOriginal", false); if (!datetimeStr.isEmpty()) @@ -165,6 +219,19 @@ } d->dateOriginalSel->setEnabled(d->dateOriginalCheck->isChecked()); + data = exiv2Iface.getExifTagString("Exif.Photo.SubSecTimeOriginal", false); + if (!data.isNull()) + { + bool ok = false; + int subsec = data.toInt(&ok); + if (ok) + { + d->dateOriginalSubSecEdit->setValue(subsec); + d->dateOriginalSubSecCheck->setChecked(true); + } + } + d->dateOriginalSubSecEdit->setEnabled(d->dateOriginalSubSecCheck->isChecked()); + datetimeStr = exiv2Iface.getExifTagString("Exif.Photo.DateTimeDigitized", false); if (!datetimeStr.isEmpty()) @@ -177,6 +244,19 @@ } } d->dateDigitalizedSel->setEnabled(d->dateDigitalizedCheck->isChecked()); + + data = exiv2Iface.getExifTagString("Exif.Photo.SubSecTimeDigitized", false); + if (!data.isNull()) + { + bool ok = false; + int subsec = data.toInt(&ok); + if (ok) + { + d->dateDigitalizedSubSecEdit->setValue(subsec); + d->dateDigitalizedSubSecCheck->setChecked(true); + } + } + d->dateDigitalizedSubSecEdit->setEnabled(d->dateDigitalizedSubSecCheck->isChecked()); } void EXIFDateTime::applyMetadata(QByteArray& exifData) @@ -190,18 +270,36 @@ else exiv2Iface.removeExifTag("Exif.Image.DateTime"); + if (d->dateCreatedSubSecCheck->isChecked()) + exiv2Iface.setExifTagString("Exif.Photo.SubSecTime", + QString::number(d->dateCreatedSubSecEdit->value()).ascii()); + else + exiv2Iface.removeExifTag("Exif.Photo.SubSecTime"); + if (d->dateOriginalCheck->isChecked()) exiv2Iface.setExifTagString("Exif.Photo.DateTimeOriginal", d->dateOriginalSel->dateTime().toString(QString("yyyy:MM:dd hh:mm:ss")).ascii()); else exiv2Iface.removeExifTag("Exif.Photo.DateTimeOriginal"); + if (d->dateOriginalSubSecCheck->isChecked()) + exiv2Iface.setExifTagString("Exif.Photo.SubSecTimeOriginal", + QString::number(d->dateOriginalSubSecEdit->value()).ascii()); + else + exiv2Iface.removeExifTag("Exif.Photo.SubSecTimeOriginal"); + if (d->dateDigitalizedCheck->isChecked()) - exiv2Iface.setIptcTagString("Exif.Photo.DateTimeDigitized", + exiv2Iface.setExifTagString("Exif.Photo.DateTimeDigitized", d->dateDigitalizedSel->dateTime().toString(QString("yyyy:MM:dd hh:mm:ss")).ascii()); else exiv2Iface.removeExifTag("Exif.Photo.DateTimeDigitized"); + if (d->dateDigitalizedSubSecCheck->isChecked()) + exiv2Iface.setExifTagString("Exif.Photo.SubSecTimeDigitized", + QString::number(d->dateDigitalizedSubSecEdit->value()).ascii()); + else + exiv2Iface.removeExifTag("Exif.Photo.SubSecTimeDigitized"); + exifData = exiv2Iface.getExif(); } SVN commit 596794 by cgilles: kipiplugins from trunk : MetadataEdit plugin: started Exif Exposure informations editor. Not yet complete CCBUGS: 103255 M +2 -1 Makefile.am M +13 -11 exifeditdialog.cpp A exifexposure.cpp [License: GPL] A exifexposure.h [License: GPL] --- trunk/extragear/libs/kipi-plugins/metadataedit/Makefile.am #596793:596794 @@ -13,7 +13,8 @@ metadataitem.cpp iptceditdialog.cpp iptccaption.cpp \ iptccredits.cpp iptcstatus.cpp iptcorigin.cpp \ iptcdatetime.cpp iptckeywords.cpp iptccategories.cpp \ - exifeditdialog.cpp exifcaption.cpp exifdatetime.cpp + exifeditdialog.cpp exifcaption.cpp exifdatetime.cpp \ + exifexposure.cpp # Libs needed by the plugin kipiplugin_metadataedit_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \ --- trunk/extragear/libs/kipi-plugins/metadataedit/exifeditdialog.cpp #596793:596794 @@ -39,6 +39,7 @@ #include "exifcaption.h" #include "exifdatetime.h" +#include "exifexposure.h" #include "exifeditdialog.h" #include "exifeditdialog.moc" @@ -53,7 +54,7 @@ EXIFEditDialogDialogPrivate() { page_caption = 0; - page_keywords = 0; + page_exposure = 0; page_credits = 0; page_status = 0; page_origin = 0; @@ -62,7 +63,7 @@ captionPage = 0; datetimePage = 0; /* - keywordsPage = 0; + exposurePage = 0; creditsPage = 0; statusPage = 0; originPage = 0; @@ -73,7 +74,7 @@ QFrame *page_caption; QFrame *page_datetime; - QFrame *page_keywords; + QFrame *page_exposure; QFrame *page_categories; QFrame *page_credits; QFrame *page_status; @@ -81,9 +82,9 @@ EXIFCaption *captionPage; EXIFDateTime *datetimePage; -/* - EXIFKeywords *keywordsPage; - EXIFCategories *categoriesPage; + EXIFExposure *exposurePage; + +/* EXIFCategories *categoriesPage; EXIFCredits *creditsPage; EXIFStatus *statusPage; EXIFOrigin *originPage; @@ -107,11 +108,11 @@ BarIcon("today", KIcon::SizeMedium)); d->datetimePage = new EXIFDateTime(d->page_datetime, d->exifData); -/* d->page_keywords = addPage(i18n("Keywords"), i18n("EXIF Keywords Informations"), - BarIcon("bookmark", KIcon::SizeMedium)); - d->keywordsPage = new EXIFKeywords(d->page_keywords, d->exifData); + d->page_exposure = addPage(i18n("Exposure"), i18n("EXIF Exposure Informations"), + BarIcon("camera", KIcon::SizeMedium)); + d->exposurePage = new EXIFExposure(d->page_exposure, d->exifData); - d->page_categories = addPage(i18n("Categories"), i18n("EXIF Categories Informations"), +/* d->page_categories = addPage(i18n("Categories"), i18n("EXIF Categories Informations"), BarIcon("bookmark_folder", KIcon::SizeMedium)); d->categoriesPage = new EXIFCategories(d->page_categories, d->exifData); @@ -176,8 +177,9 @@ { d->captionPage->applyMetadata(d->exifData); d->datetimePage->applyMetadata(d->exifData); + d->exposurePage->applyMetadata(d->exifData); + /* - d->keywordsPage->applyMetadata(d->exifData); d->categoriesPage->applyMetadata(d->exifData); d->creditsPage->applyMetadata(d->exifData); d->statusPage->applyMetadata(d->exifData); SVN commit 596842 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : Exif Exposure editor : add Exposure Program settings CCBUGS: 103255 M +39 -39 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #596841:596842 @@ -23,8 +23,8 @@ #include <qlayout.h> #include <qlabel.h> #include <qwhatsthis.h> -#include <qvalidator.h> #include <qcheckbox.h> +#include <qcombobox.h> // KDE includes. @@ -47,13 +47,17 @@ EXIFExposurePriv() { - exposureTimeCheck = 0; - exposureTimeNumEdit = 0; - exposureTimeDenEdit = 0; + exposureTimeCheck = 0; + exposureProgramCheck = 0; + exposureTimeNumEdit = 0; + exposureTimeDenEdit = 0; } QCheckBox *exposureTimeCheck; + QCheckBox *exposureProgramCheck; + QComboBox *exposureProgramCB; + KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; }; @@ -80,42 +84,23 @@ "of picture, given in seconds.")); // -------------------------------------------------------- -/* - d->dateOriginalCheck = new QCheckBox(i18n("Original date and time"), parent); - d->dateOriginalSubSecCheck = new QCheckBox(i18n("Original sub-second"), parent); - d->dateOriginalSel = new KExposureWidget(parent); - d->dateOriginalSubSecEdit = new KIntSpinBox(0, 999, 1, 0, 10, parent); - d->dateOriginalSel->setExposure(QExposure::currentExposure()); - grid->addMultiCellWidget(d->dateOriginalCheck, 2, 2, 0, 0); - grid->addMultiCellWidget(d->dateOriginalSubSecCheck, 2, 2, 1, 2); - grid->addMultiCellWidget(d->dateOriginalSel, 3, 3, 0, 0); - grid->addMultiCellWidget(d->dateOriginalSubSecEdit, 3, 3, 1, 1); - QWhatsThis::add(d->dateOriginalSel, i18n("<p>Set here the date and time when the original image " - "data was generated. For a digital still camera the date and " - "time the picture was taken are recorded.")); - QWhatsThis::add(d->dateOriginalSubSecEdit, i18n("<p>Set here the fractions of seconds for the date " - "and time when the original image data was generated.")); - // -------------------------------------------------------- + d->exposureProgramCheck = new QCheckBox(i18n("Exposure Program:"), parent); + d->exposureProgramCB = new QComboBox(false, parent); + d->exposureProgramCB->insertItem(i18n("Not defined"), 0); + d->exposureProgramCB->insertItem(i18n("Manual"), 1); + d->exposureProgramCB->insertItem(i18n("Auto"), 2); + d->exposureProgramCB->insertItem(i18n("Aperture priority"), 3); + d->exposureProgramCB->insertItem(i18n("Shutter priority"), 4); + d->exposureProgramCB->insertItem(i18n("Creative program"), 5); + d->exposureProgramCB->insertItem(i18n("Action program"), 6); + d->exposureProgramCB->insertItem(i18n("Portrait mode"), 7); + d->exposureProgramCB->insertItem(i18n("Landscape mode"), 8); + grid->addMultiCellWidget(d->exposureProgramCheck, 2, 2, 0, 0); + grid->addMultiCellWidget(d->exposureProgramCB, 2, 2, 2, 4); + QWhatsThis::add(d->exposureProgramCB, i18n("<p>Select here the program used by the camera " + "to set exposure when the picture have been taken.")); - d->dateDigitalizedCheck = new QCheckBox(i18n("Digitization date and time"), parent); - d->dateDigitalizedSubSecCheck = new QCheckBox(i18n("Digitization sub-second"), parent); - d->dateDigitalizedSel = new KExposureWidget(parent); - d->dateDigitalizedSubSecEdit = new KIntSpinBox(0, 999, 1, 0, 10, parent); - d->dateDigitalizedSel->setExposure(QExposure::currentExposure()); - grid->addMultiCellWidget(d->dateDigitalizedCheck, 4, 4, 0, 0); - grid->addMultiCellWidget(d->dateDigitalizedSubSecCheck, 4, 4, 1, 2); - grid->addMultiCellWidget(d->dateDigitalizedSel, 5, 5, 0, 0); - grid->addMultiCellWidget(d->dateDigitalizedSubSecEdit, 5, 5, 1, 1); - QWhatsThis::add(d->dateDigitalizedSel, i18n("<p>Set here the date and time when the image was " - "stored as digital data. If, for example, an image was " - "captured by a digital still camera and at the same " - "time the file was recorded, then Original and Digitization " - "date and time will have the same contents.")); - QWhatsThis::add(d->dateDigitalizedSubSecEdit, i18n("<p>Set here the fractions of seconds for the date " - "and time when the image was stored as digital data.")); -*/ - grid->setColStretch(1, 10); grid->setRowStretch(6, 10); @@ -127,6 +112,9 @@ connect(d->exposureTimeCheck, SIGNAL(toggled(bool)), d->exposureTimeDenEdit, SLOT(setEnabled(bool))); + connect(d->exposureProgramCheck, SIGNAL(toggled(bool)), + d->exposureProgramCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -141,7 +129,8 @@ { KIPIPlugins::Exiv2Iface exiv2Iface; exiv2Iface.setExif(exifData); - int num=0, den=0; + int num=0, den=0; + long val=0; if (exiv2Iface.getExifTagRational("Exif.Photo.ExposureTime", num, den)) { @@ -152,6 +141,12 @@ d->exposureTimeNumEdit->setEnabled(d->exposureTimeCheck->isChecked()); d->exposureTimeDenEdit->setEnabled(d->exposureTimeCheck->isChecked()); + if (exiv2Iface.getExifTagLong("Exif.Photo.ExposureProgram", val)) + { + d->exposureProgramCB->setCurrentItem(val); + d->exposureProgramCheck->setChecked(true); + } + d->exposureProgramCB->setEnabled(d->exposureProgramCheck->isChecked()); } void EXIFExposure::applyMetadata(QByteArray& exifData) @@ -165,6 +160,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.ExposureTime"); + if (d->exposureProgramCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.ExposureProgram", d->exposureProgramCB->currentItem()); + else + exiv2Iface.removeExifTag("Exif.Photo.ExposureProgram"); + exifData = exiv2Iface.getExif(); } SVN commit 596848 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : Exif Exposure editor : add Exposure Mode settings CCBUGS: 103255 M +36 -1 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #596847:596848 @@ -15,7 +15,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * ============================================================ */ // QT includes. @@ -49,14 +49,19 @@ { exposureTimeCheck = 0; exposureProgramCheck = 0; + exposureModeCheck = 0; + exposureProgramCB = 0; + exposureModeCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; } QCheckBox *exposureTimeCheck; QCheckBox *exposureProgramCheck; + QCheckBox *exposureModeCheck; QComboBox *exposureProgramCB; + QComboBox *exposureModeCB; KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; @@ -101,6 +106,21 @@ QWhatsThis::add(d->exposureProgramCB, i18n("<p>Select here the program used by the camera " "to set exposure when the picture have been taken.")); + // -------------------------------------------------------- + + d->exposureModeCheck = new QCheckBox(i18n("Exposure Mode:"), parent); + d->exposureModeCB = new QComboBox(false, parent); + d->exposureModeCB->insertItem(i18n("Auto"), 0); + d->exposureModeCB->insertItem(i18n("Manual"), 1); + d->exposureModeCB->insertItem(i18n("Auto bracket"), 2); + grid->addMultiCellWidget(d->exposureModeCheck, 3, 3, 0, 0); + grid->addMultiCellWidget(d->exposureModeCB, 3, 3, 2, 4); + QWhatsThis::add(d->exposureModeCB, i18n("<p>Select here the mode used by the camera " + "to set exposure when the picture have been shot. " + "In auto-bracketing mode, the camera shoots a " + "series of frames of the same scene at different " + "exposure settings.")); + grid->setColStretch(1, 10); grid->setRowStretch(6, 10); @@ -115,6 +135,9 @@ connect(d->exposureProgramCheck, SIGNAL(toggled(bool)), d->exposureProgramCB, SLOT(setEnabled(bool))); + connect(d->exposureModeCheck, SIGNAL(toggled(bool)), + d->exposureModeCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -147,6 +170,13 @@ d->exposureProgramCheck->setChecked(true); } d->exposureProgramCB->setEnabled(d->exposureProgramCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.ExposureMode", val)) + { + d->exposureModeCB->setCurrentItem(val); + d->exposureModeCheck->setChecked(true); + } + d->exposureModeCB->setEnabled(d->exposureModeCheck->isChecked()); } void EXIFExposure::applyMetadata(QByteArray& exifData) @@ -165,6 +195,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.ExposureProgram"); + if (d->exposureModeCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.ExposureMode", d->exposureModeCB->currentItem()); + else + exiv2Iface.removeExifTag("Exif.Photo.ExposureMode"); + exifData = exiv2Iface.getExif(); } SVN commit 596893 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : Exif Exposure editor : add ISO speed ratings settings CCBUGS: 103255 M +73 -0 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #596892:596893 @@ -25,6 +25,7 @@ #include <qwhatsthis.h> #include <qcheckbox.h> #include <qcombobox.h> +#include <qlistbox.h> // KDE includes. @@ -50,8 +51,10 @@ exposureTimeCheck = 0; exposureProgramCheck = 0; exposureModeCheck = 0; + ISOSpeedCheck = 0; exposureProgramCB = 0; exposureModeCB = 0; + ISOSpeedCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; } @@ -59,9 +62,11 @@ QCheckBox *exposureTimeCheck; QCheckBox *exposureProgramCheck; QCheckBox *exposureModeCheck; + QCheckBox *ISOSpeedCheck; QComboBox *exposureProgramCB; QComboBox *exposureModeCB; + QComboBox *ISOSpeedCB; KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; @@ -121,6 +126,51 @@ "series of frames of the same scene at different " "exposure settings.")); + // -------------------------------------------------------- + + d->ISOSpeedCheck = new QCheckBox(i18n("ISO Speed Rating:"), parent); + d->ISOSpeedCB = new QComboBox(false, parent); + d->ISOSpeedCB->insertItem("10", 0); + d->ISOSpeedCB->insertItem("12", 1); + d->ISOSpeedCB->insertItem("16", 2); + d->ISOSpeedCB->insertItem("20", 3); + d->ISOSpeedCB->insertItem("25", 4); + d->ISOSpeedCB->insertItem("32", 5); + d->ISOSpeedCB->insertItem("40", 6); + d->ISOSpeedCB->insertItem("50", 7); + d->ISOSpeedCB->insertItem("64", 8); + d->ISOSpeedCB->insertItem("80", 9); + d->ISOSpeedCB->insertItem("100", 10); + d->ISOSpeedCB->insertItem("125", 11); + d->ISOSpeedCB->insertItem("160", 12); + d->ISOSpeedCB->insertItem("200", 13); + d->ISOSpeedCB->insertItem("250", 14); + d->ISOSpeedCB->insertItem("320", 15); + d->ISOSpeedCB->insertItem("400", 16); + d->ISOSpeedCB->insertItem("500", 17); + d->ISOSpeedCB->insertItem("640", 18); + d->ISOSpeedCB->insertItem("800", 19); + d->ISOSpeedCB->insertItem("1000", 20); + d->ISOSpeedCB->insertItem("1250", 21); + d->ISOSpeedCB->insertItem("1600", 22); + d->ISOSpeedCB->insertItem("2000", 23); + d->ISOSpeedCB->insertItem("2500", 24); + d->ISOSpeedCB->insertItem("3200", 25); + d->ISOSpeedCB->insertItem("4000", 26); + d->ISOSpeedCB->insertItem("5000", 27); + d->ISOSpeedCB->insertItem("6400", 28); + d->ISOSpeedCB->insertItem("8000", 29); + d->ISOSpeedCB->insertItem("10000", 30); + d->ISOSpeedCB->insertItem("12500", 31); + d->ISOSpeedCB->insertItem("16000", 32); + d->ISOSpeedCB->insertItem("20000", 33); + d->ISOSpeedCB->insertItem("25000", 34); + d->ISOSpeedCB->insertItem("32000", 35); + grid->addMultiCellWidget(d->ISOSpeedCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->ISOSpeedCB, 4, 4, 2, 4); + QWhatsThis::add(d->ISOSpeedCB, i18n("<p>Select here the ISO Speed of the digital still camera " + "witch have taken the picture.")); + grid->setColStretch(1, 10); grid->setRowStretch(6, 10); @@ -138,6 +188,9 @@ connect(d->exposureModeCheck, SIGNAL(toggled(bool)), d->exposureModeCB, SLOT(setEnabled(bool))); + connect(d->ISOSpeedCheck, SIGNAL(toggled(bool)), + d->ISOSpeedCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -177,6 +230,21 @@ d->exposureModeCheck->setChecked(true); } d->exposureModeCB->setEnabled(d->exposureModeCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.ISOSpeedRatings", val)) + { + int item = -1; + for (int i = 0 ; i < d->ISOSpeedCB->count() ; i++) + if (d->ISOSpeedCB->text(i) == QString::number(val)) + item = i; + + if (item != -1) + { + d->ISOSpeedCB->setCurrentItem(item); + d->ISOSpeedCheck->setChecked(true); + } + } + d->ISOSpeedCB->setEnabled(d->ISOSpeedCheck->isChecked()); } void EXIFExposure::applyMetadata(QByteArray& exifData) @@ -200,6 +268,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.ExposureMode"); + if (d->ISOSpeedCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.ISOSpeedRatings", d->ISOSpeedCB->currentText().toLong()); + else + exiv2Iface.removeExifTag("Exif.Photo.ISOSpeedRatings"); + exifData = exiv2Iface.getExif(); } SVN commit 597249 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : Exif Exposure editor : add Metering Mode settings CCBUGS: 103255 M +44 -5 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #597248:597249 @@ -52,9 +52,11 @@ exposureProgramCheck = 0; exposureModeCheck = 0; ISOSpeedCheck = 0; + meteringModeCheck = 0; exposureProgramCB = 0; exposureModeCB = 0; ISOSpeedCB = 0; + meteringModeCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; } @@ -63,10 +65,12 @@ QCheckBox *exposureProgramCheck; QCheckBox *exposureModeCheck; QCheckBox *ISOSpeedCheck; + QCheckBox *meteringModeCheck; QComboBox *exposureProgramCB; QComboBox *exposureModeCB; QComboBox *ISOSpeedCB; + QComboBox *meteringModeCB; KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; @@ -95,7 +99,7 @@ // -------------------------------------------------------- - d->exposureProgramCheck = new QCheckBox(i18n("Exposure Program:"), parent); + d->exposureProgramCheck = new QCheckBox(i18n("Exposure program:"), parent); d->exposureProgramCB = new QComboBox(false, parent); d->exposureProgramCB->insertItem(i18n("Not defined"), 0); d->exposureProgramCB->insertItem(i18n("Manual"), 1); @@ -113,7 +117,7 @@ // -------------------------------------------------------- - d->exposureModeCheck = new QCheckBox(i18n("Exposure Mode:"), parent); + d->exposureModeCheck = new QCheckBox(i18n("Exposure mode:"), parent); d->exposureModeCB = new QComboBox(false, parent); d->exposureModeCB->insertItem(i18n("Auto"), 0); d->exposureModeCB->insertItem(i18n("Manual"), 1); @@ -128,7 +132,24 @@ // -------------------------------------------------------- - d->ISOSpeedCheck = new QCheckBox(i18n("ISO Speed Rating:"), parent); + d->meteringModeCheck = new QCheckBox(i18n("Metering mode:"), parent); + d->meteringModeCB = new QComboBox(false, parent); + d->meteringModeCB->insertItem(i18n("Unknown"), 0); + d->meteringModeCB->insertItem(i18n("Average"), 1); + d->meteringModeCB->insertItem(i18n("Center weighted average"), 2); + d->meteringModeCB->insertItem(i18n("Spot"), 3); + d->meteringModeCB->insertItem(i18n("Multi-spot"), 4); + d->meteringModeCB->insertItem(i18n("Multi-segment"), 5); + d->meteringModeCB->insertItem(i18n("Partial"), 6); + d->meteringModeCB->insertItem(i18n("Other"), 7); + grid->addMultiCellWidget(d->meteringModeCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->meteringModeCB, 4, 4, 2, 4); + QWhatsThis::add(d->meteringModeCB, i18n("<p>Select here the metering mode used by the camera " + "to set exposure when the picture have been shot.")); + + // -------------------------------------------------------- + + d->ISOSpeedCheck = new QCheckBox(i18n("ISO speed rating:"), parent); d->ISOSpeedCB = new QComboBox(false, parent); d->ISOSpeedCB->insertItem("10", 0); d->ISOSpeedCB->insertItem("12", 1); @@ -166,8 +187,8 @@ d->ISOSpeedCB->insertItem("20000", 33); d->ISOSpeedCB->insertItem("25000", 34); d->ISOSpeedCB->insertItem("32000", 35); - grid->addMultiCellWidget(d->ISOSpeedCheck, 4, 4, 0, 0); - grid->addMultiCellWidget(d->ISOSpeedCB, 4, 4, 2, 4); + grid->addMultiCellWidget(d->ISOSpeedCheck, 5, 5, 0, 0); + grid->addMultiCellWidget(d->ISOSpeedCB, 5, 5, 2, 4); QWhatsThis::add(d->ISOSpeedCB, i18n("<p>Select here the ISO Speed of the digital still camera " "witch have taken the picture.")); @@ -188,6 +209,9 @@ connect(d->exposureModeCheck, SIGNAL(toggled(bool)), d->exposureModeCB, SLOT(setEnabled(bool))); + connect(d->meteringModeCheck, SIGNAL(toggled(bool)), + d->meteringModeCB, SLOT(setEnabled(bool))); + connect(d->ISOSpeedCheck, SIGNAL(toggled(bool)), d->ISOSpeedCB, SLOT(setEnabled(bool))); @@ -231,6 +255,13 @@ } d->exposureModeCB->setEnabled(d->exposureModeCheck->isChecked()); + if (exiv2Iface.getExifTagLong("Exif.Photo.MeteringMode", val)) + { + d->meteringModeCB->setCurrentItem(val > 6 ? 7 : val); + d->meteringModeCheck->setChecked(true); + } + d->meteringModeCB->setEnabled(d->meteringModeCheck->isChecked()); + if (exiv2Iface.getExifTagLong("Exif.Photo.ISOSpeedRatings", val)) { int item = -1; @@ -268,6 +299,14 @@ else exiv2Iface.removeExifTag("Exif.Photo.ExposureMode"); + if (d->meteringModeCheck->isChecked()) + { + long met = d->meteringModeCB->currentItem(); + exiv2Iface.setExifTagLong("Exif.Photo.MeteringMode", met > 6 ? 255 : met); + } + else + exiv2Iface.removeExifTag("Exif.Photo.MeteringMode"); + if (d->ISOSpeedCheck->isChecked()) exiv2Iface.setExifTagLong("Exif.Photo.ISOSpeedRatings", d->ISOSpeedCB->currentText().toLong()); else SVN commit 597256 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : Exif Exposure editor : add Light Source settings CCBUGS: 103255 M +63 -1 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #597255:597256 @@ -53,10 +53,12 @@ exposureModeCheck = 0; ISOSpeedCheck = 0; meteringModeCheck = 0; + lightSourceCheck = 0; exposureProgramCB = 0; exposureModeCB = 0; ISOSpeedCB = 0; meteringModeCB = 0; + lightSourceCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; } @@ -66,11 +68,13 @@ QCheckBox *exposureModeCheck; QCheckBox *ISOSpeedCheck; QCheckBox *meteringModeCheck; + QCheckBox *lightSourceCheck; QComboBox *exposureProgramCB; QComboBox *exposureModeCB; QComboBox *ISOSpeedCB; QComboBox *meteringModeCB; + QComboBox *lightSourceCB; KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; @@ -192,8 +196,38 @@ QWhatsThis::add(d->ISOSpeedCB, i18n("<p>Select here the ISO Speed of the digital still camera " "witch have taken the picture.")); + // -------------------------------------------------------- + + d->lightSourceCheck = new QCheckBox(i18n("Light source:"), parent); + d->lightSourceCB = new QComboBox(false, parent); + d->lightSourceCB->insertItem(i18n("Unknown"), 0); + d->lightSourceCB->insertItem(i18n("Daylight"), 1); + d->lightSourceCB->insertItem(i18n("Fluorescent"), 2); + d->lightSourceCB->insertItem(i18n("Tungsten (incandescent light)"), 3); + d->lightSourceCB->insertItem(i18n("Flash"), 4); + d->lightSourceCB->insertItem(i18n("Fine weather"), 5); + d->lightSourceCB->insertItem(i18n("Cloudy weather"), 6); + d->lightSourceCB->insertItem(i18n("Shade"), 7); + d->lightSourceCB->insertItem(i18n("Daylight fluorescent (D 5700 - 7100K)"), 8); + d->lightSourceCB->insertItem(i18n("Day white fluorescent (N 4600 - 5400K)"), 9); + d->lightSourceCB->insertItem(i18n("Cool white fluorescent (W 3900 - 4500K)"), 10); + d->lightSourceCB->insertItem(i18n("White fluorescent (WW 3200 - 3700K)"), 11); + d->lightSourceCB->insertItem(i18n("Standard light A"), 12); + d->lightSourceCB->insertItem(i18n("Standard light B"), 13); + d->lightSourceCB->insertItem(i18n("Standard light C"), 14); + d->lightSourceCB->insertItem(i18n("D55"), 15); + d->lightSourceCB->insertItem(i18n("D65"), 16); + d->lightSourceCB->insertItem(i18n("D75"), 17); + d->lightSourceCB->insertItem(i18n("D50"), 18); + d->lightSourceCB->insertItem(i18n("ISO studio tungsten"), 19); + d->lightSourceCB->insertItem(i18n("Other light source"), 20); + grid->addMultiCellWidget(d->lightSourceCheck, 6, 6, 0, 0); + grid->addMultiCellWidget(d->lightSourceCB, 6, 6, 2, 4); + QWhatsThis::add(d->lightSourceCB, i18n("<p>Select here the kind of light source used " + "to take the picture.")); + grid->setColStretch(1, 10); - grid->setRowStretch(6, 10); + grid->setRowStretch(7, 10); // -------------------------------------------------------- @@ -215,6 +249,9 @@ connect(d->ISOSpeedCheck, SIGNAL(toggled(bool)), d->ISOSpeedCB, SLOT(setEnabled(bool))); + connect(d->lightSourceCheck, SIGNAL(toggled(bool)), + d->lightSourceCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -276,6 +313,18 @@ } } d->ISOSpeedCB->setEnabled(d->ISOSpeedCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.LightSource", val)) + { + if (val > 8 && val < 25) + val = val - 4; + else if (val == 255) + val = 20; + + d->lightSourceCB->setCurrentItem(val); + d->lightSourceCheck->setChecked(true); + } + d->lightSourceCB->setEnabled(d->lightSourceCheck->isChecked()); } void EXIFExposure::applyMetadata(QByteArray& exifData) @@ -312,6 +361,19 @@ else exiv2Iface.removeExifTag("Exif.Photo.ISOSpeedRatings"); + if (d->lightSourceCheck->isChecked()) + { + long val = d->lightSourceCB->currentItem(); + if (val > 4 && val < 20) + val = val + 4; + else if (val == 20) + val = 255; + + exiv2Iface.setExifTagLong("Exif.Photo.LightSource", val); + } + else + exiv2Iface.removeExifTag("Exif.Photo.LightSource"); + exifData = exiv2Iface.getExif(); } SVN commit 597411 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Exposure informations editor: added Aperture (F-number) settings. CCBUGS: 103255 M +159 -5 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #597410:597411 @@ -26,6 +26,8 @@ #include <qcheckbox.h> #include <qcombobox.h> #include <qlistbox.h> +#include <qpair.h> +#include <qmap.h> // KDE includes. @@ -41,19 +43,39 @@ namespace KIPIMetadataEditPlugin { +/* + class Aperture + { + public: + Aperture() {} + Aperture(int num, int den) : m_num(num), m_den(den) {} + + int num() const { return m_num; } + int den() const { return m_den; } + double value() const { return (double)(m_num)/(double)(m_den); } + QString fnumber() const { return QString::number(value(), 'g', 1); } + + private: + + int m_num; + int m_den; + }; +*/ class EXIFExposurePriv { public: EXIFExposurePriv() { + apertureCheck = 0; exposureTimeCheck = 0; exposureProgramCheck = 0; exposureModeCheck = 0; ISOSpeedCheck = 0; meteringModeCheck = 0; lightSourceCheck = 0; + apertureCB = 0; exposureProgramCB = 0; exposureModeCB = 0; ISOSpeedCB = 0; @@ -61,8 +83,43 @@ lightSourceCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; + +/* apertureMap.insert( 1.0, Aperture(1, 1) ); + apertureMap.insert( 1.1, Aperture(1, 1) ); + apertureMap.insert( 1.2, Aperture(1, 1) ); + apertureMap.insert( 1.4, Aperture(1, 1) ); + apertureMap.insert( 1.6, Aperture(1, 1) ); + apertureMap.insert( 1.8, Aperture(1, 1) ); + apertureMap.insert( 2.0, Aperture(1, 1) ); + apertureMap.insert( 2.2, Aperture(1, 1) ); + apertureMap.insert( 2.5, Aperture(1, 1) ); + apertureMap.insert( 2.8, Aperture(1, 1) ); + apertureMap.insert( 3.2, Aperture(1, 1) ); + apertureMap.insert( 3.5, Aperture(1, 1) ); + apertureMap.insert( 4.0, Aperture(1, 1) ); + apertureMap.insert( 4.5, Aperture(1, 1) ); + apertureMap.insert( 5.0, Aperture(1, 1) ); + apertureMap.insert( 5.6, Aperture(1, 1) ); + apertureMap.insert( 6.3, Aperture(1, 1) ); + apertureMap.insert( 7.0, Aperture(1, 1) ); + apertureMap.insert( 8.0, Aperture(1, 1) ); + apertureMap.insert( 9.0, Aperture(1, 1) ); + apertureMap.insert( 10.0, Aperture(1, 1) ); + apertureMap.insert( 11.0, Aperture(1, 1) ); + apertureMap.insert( 12.0, Aperture(1, 1) ); + apertureMap.insert( 14.0, Aperture(1, 1) ); + apertureMap.insert( 16.0, Aperture(1, 1) ); + apertureMap.insert( 18.0, Aperture(1, 1) ); + apertureMap.insert( 20.0, Aperture(1, 1) ); + apertureMap.insert( 22.0, Aperture(1, 1) ); +*/ } +/* typedef QMap<double, Aperture> ApertureMap; + + ApertureMap apertureMap;*/ + + QCheckBox *apertureCheck; QCheckBox *exposureTimeCheck; QCheckBox *exposureProgramCheck; QCheckBox *exposureModeCheck; @@ -70,6 +127,7 @@ QCheckBox *meteringModeCheck; QCheckBox *lightSourceCheck; + QComboBox *apertureCB; QComboBox *exposureProgramCB; QComboBox *exposureModeCB; QComboBox *ISOSpeedCB; @@ -89,15 +147,82 @@ // -------------------------------------------------------- + d->apertureCheck = new QCheckBox(i18n("Aperture (f-number):"), parent); + d->apertureCB = new QComboBox(false, parent); + d->apertureCB->insertItem("1.0"); + d->apertureCB->insertItem("1.1"); + d->apertureCB->insertItem("1.2"); + d->apertureCB->insertItem("1.3"); + d->apertureCB->insertItem("1.4"); + d->apertureCB->insertItem("1.6"); + d->apertureCB->insertItem("1.8"); + d->apertureCB->insertItem("2.0"); + d->apertureCB->insertItem("2.2"); + d->apertureCB->insertItem("2.5"); + d->apertureCB->insertItem("2.8"); + d->apertureCB->insertItem("3.2"); + d->apertureCB->insertItem("3.5"); + d->apertureCB->insertItem("3.6"); + d->apertureCB->insertItem("4.0"); + d->apertureCB->insertItem("4.5"); + d->apertureCB->insertItem("4.9"); + d->apertureCB->insertItem("5.0"); + d->apertureCB->insertItem("5.6"); + d->apertureCB->insertItem("5.7"); + d->apertureCB->insertItem("6.3"); + d->apertureCB->insertItem("7.0"); + d->apertureCB->insertItem("7.1"); + d->apertureCB->insertItem("8.0"); + d->apertureCB->insertItem("9.0"); + d->apertureCB->insertItem("10.0"); + d->apertureCB->insertItem("10.1"); + d->apertureCB->insertItem("11.0"); + d->apertureCB->insertItem("11.3"); + d->apertureCB->insertItem("12.0"); + d->apertureCB->insertItem("12.7"); + d->apertureCB->insertItem("13.0"); + d->apertureCB->insertItem("14.0"); + d->apertureCB->insertItem("14.3"); + d->apertureCB->insertItem("16.0"); + d->apertureCB->insertItem("18.0"); + d->apertureCB->insertItem("20.0"); + d->apertureCB->insertItem("20.2"); + d->apertureCB->insertItem("22.0"); + d->apertureCB->insertItem("22.6"); + d->apertureCB->insertItem("25.0"); + d->apertureCB->insertItem("25.4"); + d->apertureCB->insertItem("28.5"); + d->apertureCB->insertItem("29.0"); + d->apertureCB->insertItem("32.0"); + d->apertureCB->insertItem("35.9"); + d->apertureCB->insertItem("36.0"); + d->apertureCB->insertItem("40.0"); + d->apertureCB->insertItem("40.3"); + d->apertureCB->insertItem("45.0"); + d->apertureCB->insertItem("45.3"); + d->apertureCB->insertItem("50.8"); + d->apertureCB->insertItem("51.0"); + d->apertureCB->insertItem("57.0"); + d->apertureCB->insertItem("64.0"); + d->apertureCB->insertItem("72.0"); + d->apertureCB->insertItem("81.0"); + d->apertureCB->insertItem("91.0"); + grid->addMultiCellWidget(d->apertureCheck, 0, 0, 0, 0); + grid->addMultiCellWidget(d->apertureCB, 0, 0, 2, 2); + QWhatsThis::add(d->apertureCB, i18n("<p>Select here the lens aperture used by camera " + "to take the picture.")); + + // -------------------------------------------------------- + d->exposureTimeCheck = new QCheckBox(i18n("Exposure time (seconds):"), parent); d->exposureTimeNumEdit = new KIntSpinBox(1, 100000, 1, 1, 10, parent); d->exposureTimeDenEdit = new KIntSpinBox(1, 100000, 1, 1, 10, parent); QLabel *exposureLabel = new QLabel("/", parent); exposureLabel->setAlignment (Qt::AlignRight|Qt::AlignVCenter); - grid->addMultiCellWidget(d->exposureTimeCheck, 0, 0, 0, 0); - grid->addMultiCellWidget(d->exposureTimeNumEdit, 0, 0, 2, 2); - grid->addMultiCellWidget(exposureLabel, 0, 0, 3, 3); - grid->addMultiCellWidget(d->exposureTimeDenEdit, 0, 0, 4, 4); + grid->addMultiCellWidget(d->exposureTimeCheck, 1, 1, 0, 0); + grid->addMultiCellWidget(d->exposureTimeNumEdit, 1, 1, 2, 2); + grid->addMultiCellWidget(exposureLabel, 1, 1, 3, 3); + grid->addMultiCellWidget(d->exposureTimeDenEdit, 1, 1, 4, 4); QWhatsThis::add(d->exposureTimeCheck, i18n("<p>Set on this option to set the exposure time " "of picture, given in seconds.")); @@ -232,6 +357,9 @@ // -------------------------------------------------------- + connect(d->apertureCheck, SIGNAL(toggled(bool)), + d->apertureCB, SLOT(setEnabled(bool))); + connect(d->exposureTimeCheck, SIGNAL(toggled(bool)), d->exposureTimeNumEdit, SLOT(setEnabled(bool))); @@ -267,8 +395,25 @@ { KIPIPlugins::Exiv2Iface exiv2Iface; exiv2Iface.setExif(exifData); - int num=0, den=0; + long int num=0, den=0; long val=0; + + if (exiv2Iface.getExifTagRational("Exif.Photo.FNumber", num, den)) + { + QString aperture = QString::number((double)(num)/(double)(den), 'f', 1); + + int item = -1; + for (int i = 0 ; i < d->apertureCB->count() ; i++) + if (d->apertureCB->text(i) == aperture) + item = i; + + if (item != -1) + { + d->apertureCB->setCurrentItem(item); + d->apertureCheck->setChecked(true); + } + } + d->apertureCB->setEnabled(d->apertureCheck->isChecked()); if (exiv2Iface.getExifTagRational("Exif.Photo.ExposureTime", num, den)) { @@ -336,6 +481,15 @@ exiv2Iface.setExif(exifData); if (d->exposureTimeCheck->isChecked()) + { + long int num=1, den=1; + exiv2Iface.convertToRational(d->apertureCB->currentText().toLong(), &num, &den, 1); + exiv2Iface.setExifTagRational("Exif.Photo.FNumber", num, den); + } + else + exiv2Iface.removeExifTag("Exif.Photo.FNumber"); + + if (d->exposureTimeCheck->isChecked()) exiv2Iface.setExifTagRational("Exif.Photo.ExposureTime", d->exposureTimeNumEdit->value(), d->exposureTimeDenEdit->value()); else SVN commit 597432 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Exposure informations editor: added lens Focal Length settings. CCBUGS: 103255 M +68 -36 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #597431:597432 @@ -75,6 +75,7 @@ ISOSpeedCheck = 0; meteringModeCheck = 0; lightSourceCheck = 0; + focalLengthCheck = 0; apertureCB = 0; exposureProgramCB = 0; exposureModeCB = 0; @@ -83,6 +84,7 @@ lightSourceCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; + focalLengthEdit = 0; /* apertureMap.insert( 1.0, Aperture(1, 1) ); apertureMap.insert( 1.1, Aperture(1, 1) ); @@ -119,23 +121,26 @@ ApertureMap apertureMap;*/ - QCheckBox *apertureCheck; - QCheckBox *exposureTimeCheck; - QCheckBox *exposureProgramCheck; - QCheckBox *exposureModeCheck; - QCheckBox *ISOSpeedCheck; - QCheckBox *meteringModeCheck; - QCheckBox *lightSourceCheck; + QCheckBox *apertureCheck; + QCheckBox *exposureTimeCheck; + QCheckBox *exposureProgramCheck; + QCheckBox *exposureModeCheck; + QCheckBox *ISOSpeedCheck; + QCheckBox *meteringModeCheck; + QCheckBox *lightSourceCheck; + QCheckBox *focalLengthCheck; + + QComboBox *apertureCB; + QComboBox *exposureProgramCB; + QComboBox *exposureModeCB; + QComboBox *ISOSpeedCB; + QComboBox *meteringModeCB; + QComboBox *lightSourceCB; - QComboBox *apertureCB; - QComboBox *exposureProgramCB; - QComboBox *exposureModeCB; - QComboBox *ISOSpeedCB; - QComboBox *meteringModeCB; - QComboBox *lightSourceCB; + KIntSpinBox *exposureTimeNumEdit; + KIntSpinBox *exposureTimeDenEdit; - KIntSpinBox *exposureTimeNumEdit; - KIntSpinBox *exposureTimeDenEdit; + KDoubleSpinBox *focalLengthEdit; }; EXIFExposure::EXIFExposure(QWidget* parent, QByteArray& exifData) @@ -147,6 +152,15 @@ // -------------------------------------------------------- + d->focalLengthCheck = new QCheckBox(i18n("Focal Length (mm):"), parent); + d->focalLengthEdit = new KDoubleSpinBox(1, 10000, 1, 50, 1, parent); + grid->addMultiCellWidget(d->focalLengthCheck, 0, 0, 0, 0); + grid->addMultiCellWidget(d->focalLengthEdit, 0, 0, 2, 2); + QWhatsThis::add(d->focalLengthEdit, i18n("<p>Set here the lens focal lenght in milimeters " + "used by camera to take the picture.")); + + // -------------------------------------------------------- + d->apertureCheck = new QCheckBox(i18n("Aperture (f-number):"), parent); d->apertureCB = new QComboBox(false, parent); d->apertureCB->insertItem("1.0"); @@ -207,8 +221,8 @@ d->apertureCB->insertItem("72.0"); d->apertureCB->insertItem("81.0"); d->apertureCB->insertItem("91.0"); - grid->addMultiCellWidget(d->apertureCheck, 0, 0, 0, 0); - grid->addMultiCellWidget(d->apertureCB, 0, 0, 2, 2); + grid->addMultiCellWidget(d->apertureCheck, 1, 1, 0, 0); + grid->addMultiCellWidget(d->apertureCB, 1, 1, 2, 2); QWhatsThis::add(d->apertureCB, i18n("<p>Select here the lens aperture used by camera " "to take the picture.")); @@ -219,10 +233,10 @@ d->exposureTimeDenEdit = new KIntSpinBox(1, 100000, 1, 1, 10, parent); QLabel *exposureLabel = new QLabel("/", parent); exposureLabel->setAlignment (Qt::AlignRight|Qt::AlignVCenter); - grid->addMultiCellWidget(d->exposureTimeCheck, 1, 1, 0, 0); - grid->addMultiCellWidget(d->exposureTimeNumEdit, 1, 1, 2, 2); - grid->addMultiCellWidget(exposureLabel, 1, 1, 3, 3); - grid->addMultiCellWidget(d->exposureTimeDenEdit, 1, 1, 4, 4); + grid->addMultiCellWidget(d->exposureTimeCheck, 2, 2, 0, 0); + grid->addMultiCellWidget(d->exposureTimeNumEdit, 2, 2, 2, 2); + grid->addMultiCellWidget(exposureLabel, 2, 2, 3, 3); + grid->addMultiCellWidget(d->exposureTimeDenEdit, 2, 2, 4, 4); QWhatsThis::add(d->exposureTimeCheck, i18n("<p>Set on this option to set the exposure time " "of picture, given in seconds.")); @@ -239,8 +253,8 @@ d->exposureProgramCB->insertItem(i18n("Action program"), 6); d->exposureProgramCB->insertItem(i18n("Portrait mode"), 7); d->exposureProgramCB->insertItem(i18n("Landscape mode"), 8); - grid->addMultiCellWidget(d->exposureProgramCheck, 2, 2, 0, 0); - grid->addMultiCellWidget(d->exposureProgramCB, 2, 2, 2, 5); + grid->addMultiCellWidget(d->exposureProgramCheck, 3, 3, 0, 0); + grid->addMultiCellWidget(d->exposureProgramCB, 3, 3, 2, 5); QWhatsThis::add(d->exposureProgramCB, i18n("<p>Select here the program used by the camera " "to set exposure when the picture have been taken.")); @@ -251,8 +265,8 @@ d->exposureModeCB->insertItem(i18n("Auto"), 0); d->exposureModeCB->insertItem(i18n("Manual"), 1); d->exposureModeCB->insertItem(i18n("Auto bracket"), 2); - grid->addMultiCellWidget(d->exposureModeCheck, 3, 3, 0, 0); - grid->addMultiCellWidget(d->exposureModeCB, 3, 3, 2, 5); + grid->addMultiCellWidget(d->exposureModeCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->exposureModeCB, 4, 4, 2, 5); QWhatsThis::add(d->exposureModeCB, i18n("<p>Select here the mode used by the camera " "to set exposure when the picture have been shot. " "In auto-bracketing mode, the camera shoots a " @@ -271,8 +285,8 @@ d->meteringModeCB->insertItem(i18n("Multi-segment"), 5); d->meteringModeCB->insertItem(i18n("Partial"), 6); d->meteringModeCB->insertItem(i18n("Other"), 7); - grid->addMultiCellWidget(d->meteringModeCheck, 4, 4, 0, 0); - grid->addMultiCellWidget(d->meteringModeCB, 4, 4, 2, 5); + grid->addMultiCellWidget(d->meteringModeCheck, 5, 5, 0, 0); + grid->addMultiCellWidget(d->meteringModeCB, 5, 5, 2, 5); QWhatsThis::add(d->meteringModeCB, i18n("<p>Select here the metering mode used by the camera " "to set exposure when the picture have been shot.")); @@ -316,8 +330,8 @@ d->ISOSpeedCB->insertItem("20000", 33); d->ISOSpeedCB->insertItem("25000", 34); d->ISOSpeedCB->insertItem("32000", 35); - grid->addMultiCellWidget(d->ISOSpeedCheck, 5, 5, 0, 0); - grid->addMultiCellWidget(d->ISOSpeedCB, 5, 5, 2, 5); + grid->addMultiCellWidget(d->ISOSpeedCheck, 6, 6, 0, 0); + grid->addMultiCellWidget(d->ISOSpeedCB, 6, 6, 2, 5); QWhatsThis::add(d->ISOSpeedCB, i18n("<p>Select here the ISO Speed of the digital still camera " "witch have taken the picture.")); @@ -346,17 +360,20 @@ d->lightSourceCB->insertItem(i18n("D50"), 18); d->lightSourceCB->insertItem(i18n("ISO studio tungsten"), 19); d->lightSourceCB->insertItem(i18n("Other light source"), 20); - grid->addMultiCellWidget(d->lightSourceCheck, 6, 6, 0, 0); - grid->addMultiCellWidget(d->lightSourceCB, 6, 6, 2, 5); + grid->addMultiCellWidget(d->lightSourceCheck, 7, 7, 0, 0); + grid->addMultiCellWidget(d->lightSourceCB, 7, 7, 2, 5); QWhatsThis::add(d->lightSourceCB, i18n("<p>Select here the kind of light source used " "to take the picture.")); grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(7, 10); + grid->setRowStretch(8, 10); // -------------------------------------------------------- + connect(d->focalLengthCheck, SIGNAL(toggled(bool)), + d->focalLengthEdit, SLOT(setEnabled(bool))); + connect(d->apertureCheck, SIGNAL(toggled(bool)), d->apertureCB, SLOT(setEnabled(bool))); @@ -395,9 +412,16 @@ { KIPIPlugins::Exiv2Iface exiv2Iface; exiv2Iface.setExif(exifData); - long int num=0, den=0; - long val=0; + long int num=1, den=1; + long val=0; + if (exiv2Iface.getExifTagRational("Exif.Photo.FocalLength", num, den)) + { + d->focalLengthEdit->setValue((double)(num) / (double)(den)); + d->focalLengthCheck->setChecked(true); + } + d->exposureTimeNumEdit->setEnabled(d->focalLengthCheck->isChecked()); + if (exiv2Iface.getExifTagRational("Exif.Photo.FNumber", num, den)) { QString aperture = QString::number((double)(num)/(double)(den), 'f', 1); @@ -479,11 +503,19 @@ { KIPIPlugins::Exiv2Iface exiv2Iface; exiv2Iface.setExif(exifData); + long int num=1, den=1; + if (d->focalLengthCheck->isChecked()) + { + exiv2Iface.convertToRational(d->focalLengthEdit->value(), &num, &den, 1); + exiv2Iface.setExifTagRational("Exif.Photo.FocalLength", num, den); + } + else + exiv2Iface.removeExifTag("Exif.Photo.FocalLength"); + if (d->exposureTimeCheck->isChecked()) { - long int num=1, den=1; - exiv2Iface.convertToRational(d->apertureCB->currentText().toLong(), &num, &den, 1); + exiv2Iface.convertToRational(d->apertureCB->currentText().toDouble(), &num, &den, 1); exiv2Iface.setExifTagRational("Exif.Photo.FNumber", num, den); } else SVN commit 597460 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Exposure informations editor: added Flash Mode settings. CCBUGS: 103255 M +82 -44 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #597459:597460 @@ -43,25 +43,23 @@ namespace KIPIMetadataEditPlugin { -/* - class Aperture + + class FlashMode { public: - Aperture() {} - Aperture(int num, int den) : m_num(num), m_den(den) {} + FlashMode() {} + FlashMode(int id, const QString& desc) : m_id(id), m_desc(desc) {} - int num() const { return m_num; } - int den() const { return m_den; } - double value() const { return (double)(m_num)/(double)(m_den); } - QString fnumber() const { return QString::number(value(), 'g', 1); } + int id() const { return m_id; } + QString desc() const { return m_desc; } private: - int m_num; - int m_den; + int m_id; + QString m_desc; }; -*/ + class EXIFExposurePriv { public: @@ -76,6 +74,7 @@ meteringModeCheck = 0; lightSourceCheck = 0; focalLengthCheck = 0; + flashModeCheck = 0; apertureCB = 0; exposureProgramCB = 0; exposureModeCB = 0; @@ -85,41 +84,35 @@ exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; focalLengthEdit = 0; + flashModeCB = 0; -/* apertureMap.insert( 1.0, Aperture(1, 1) ); - apertureMap.insert( 1.1, Aperture(1, 1) ); - apertureMap.insert( 1.2, Aperture(1, 1) ); - apertureMap.insert( 1.4, Aperture(1, 1) ); - apertureMap.insert( 1.6, Aperture(1, 1) ); - apertureMap.insert( 1.8, Aperture(1, 1) ); - apertureMap.insert( 2.0, Aperture(1, 1) ); - apertureMap.insert( 2.2, Aperture(1, 1) ); - apertureMap.insert( 2.5, Aperture(1, 1) ); - apertureMap.insert( 2.8, Aperture(1, 1) ); - apertureMap.insert( 3.2, Aperture(1, 1) ); - apertureMap.insert( 3.5, Aperture(1, 1) ); - apertureMap.insert( 4.0, Aperture(1, 1) ); - apertureMap.insert( 4.5, Aperture(1, 1) ); - apertureMap.insert( 5.0, Aperture(1, 1) ); - apertureMap.insert( 5.6, Aperture(1, 1) ); - apertureMap.insert( 6.3, Aperture(1, 1) ); - apertureMap.insert( 7.0, Aperture(1, 1) ); - apertureMap.insert( 8.0, Aperture(1, 1) ); - apertureMap.insert( 9.0, Aperture(1, 1) ); - apertureMap.insert( 10.0, Aperture(1, 1) ); - apertureMap.insert( 11.0, Aperture(1, 1) ); - apertureMap.insert( 12.0, Aperture(1, 1) ); - apertureMap.insert( 14.0, Aperture(1, 1) ); - apertureMap.insert( 16.0, Aperture(1, 1) ); - apertureMap.insert( 18.0, Aperture(1, 1) ); - apertureMap.insert( 20.0, Aperture(1, 1) ); - apertureMap.insert( 22.0, Aperture(1, 1) ); -*/ + flashModeMap.insert(0, FlashMode( 0x00, i18n("No flash") )); + flashModeMap.insert(1, FlashMode( 0x01, i18n("Fired") )); + flashModeMap.insert(2, FlashMode( 0x05, i18n("Fired, no strobe return light") )); + flashModeMap.insert(3, FlashMode( 0x07, i18n("Fired, strobe return light") )); + flashModeMap.insert(4, FlashMode( 0x09, i18n("Yes, compulsory") )); + flashModeMap.insert(5, FlashMode( 0x0d, i18n("Yes, compulsory, no return light") )); + flashModeMap.insert(6, FlashMode( 0x0f, i18n("Yes, compulsory, return light") )); + flashModeMap.insert(7, FlashMode( 0x10, i18n("No, compulsory") )); + flashModeMap.insert(8, FlashMode( 0x18, i18n("No, auto") )); + flashModeMap.insert(9, FlashMode( 0x19, i18n("Yes, auto") )); + flashModeMap.insert(10, FlashMode( 0x1d, i18n("Yes, auto, no return light") )); + flashModeMap.insert(11, FlashMode( 0x1f, i18n("Yes, auto, return light") )); + flashModeMap.insert(12, FlashMode( 0x20, i18n("No flash function") )); + flashModeMap.insert(13, FlashMode( 0x41, i18n("Yes, red-eye") )); + flashModeMap.insert(14, FlashMode( 0x45, i18n("Yes, red-eye, no return light") )); + flashModeMap.insert(15, FlashMode( 0x47, i18n("Yes, red-eye, return light") )); + flashModeMap.insert(16, FlashMode( 0x49, i18n("Yes, compulsory, red-eye") )); + flashModeMap.insert(17, FlashMode( 0x4d, i18n("Yes, compulsory, red-eye, no return light") )); + flashModeMap.insert(18, FlashMode( 0x4f, i18n("Yes, compulsory, red-eye, return light") )); + flashModeMap.insert(19, FlashMode( 0x59, i18n("Yes, auto, red-eye") )); + flashModeMap.insert(20, FlashMode( 0x5d, i18n("Yes, auto, red-eye, no return light") )); + flashModeMap.insert(21, FlashMode( 0x5f, i18n("Yes, auto, red-eye, return light") )); } -/* typedef QMap<double, Aperture> ApertureMap; + typedef QMap<int, FlashMode> FlashModeMap; - ApertureMap apertureMap;*/ + FlashModeMap flashModeMap; QCheckBox *apertureCheck; QCheckBox *exposureTimeCheck; @@ -129,6 +122,7 @@ QCheckBox *meteringModeCheck; QCheckBox *lightSourceCheck; QCheckBox *focalLengthCheck; + QCheckBox *flashModeCheck; QComboBox *apertureCB; QComboBox *exposureProgramCB; @@ -136,6 +130,7 @@ QComboBox *ISOSpeedCB; QComboBox *meteringModeCB; QComboBox *lightSourceCB; + QComboBox *flashModeCB; KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; @@ -148,7 +143,7 @@ { d = new EXIFExposurePriv; - QGridLayout* grid = new QGridLayout(parent, 8, 5, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 9, 5, KDialog::spacingHint()); // -------------------------------------------------------- @@ -365,9 +360,23 @@ QWhatsThis::add(d->lightSourceCB, i18n("<p>Select here the kind of light source used " "to take the picture.")); + // -------------------------------------------------------- + + d->flashModeCheck = new QCheckBox(i18n("Flash mode:"), parent); + d->flashModeCB = new QComboBox(false, parent); + + for (EXIFExposurePriv::FlashModeMap::Iterator it = d->flashModeMap.begin(); + it != d->flashModeMap.end(); ++it ) + d->flashModeCB->insertItem(it.data().desc()); + + grid->addMultiCellWidget(d->flashModeCheck, 8, 8, 0, 0); + grid->addMultiCellWidget(d->flashModeCB, 8, 8, 2, 5); + QWhatsThis::add(d->flashModeCB, i18n("<p>Select here the flash program mode used by camera " + "to take the picture.")); + grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(8, 10); + grid->setRowStretch(9, 10); // -------------------------------------------------------- @@ -398,6 +407,9 @@ connect(d->lightSourceCheck, SIGNAL(toggled(bool)), d->lightSourceCB, SLOT(setEnabled(bool))); + connect(d->flashModeCheck, SIGNAL(toggled(bool)), + d->flashModeCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -497,6 +509,24 @@ d->lightSourceCheck->setChecked(true); } d->lightSourceCB->setEnabled(d->lightSourceCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.Flash", val)) + { + int item = -1; + for (EXIFExposurePriv::FlashModeMap::Iterator it = d->flashModeMap.begin(); + it != d->flashModeMap.end(); ++it ) + { + if (it.data().id() == val) + item = it.key(); + } + + if (item != -1) + { + d->flashModeCB->setCurrentItem(item); + d->flashModeCheck->setChecked(true); + } + } + d->flashModeCB->setEnabled(d->flashModeCheck->isChecked()); } void EXIFExposure::applyMetadata(QByteArray& exifData) @@ -565,6 +595,14 @@ else exiv2Iface.removeExifTag("Exif.Photo.LightSource"); + if (d->flashModeCheck->isChecked()) + { + long val = d->flashModeCB->currentItem(); + exiv2Iface.setExifTagLong("Exif.Photo.Flash", d->flashModeMap[val].id()); + } + else + exiv2Iface.removeExifTag("Exif.Photo.Flash"); + exifData = exiv2Iface.getExif(); } Hey guy, I think this tool is now complete. I'm waiting your constructive comments before to close this B.K.O file. Thanks in advance... Gilles Caulier There is a fresh screenshot of Exif Editor at this url : http://digikam3rdparty.free.fr/Screenshots/newkipimetadataeditplugin2.png Gilles Caulier Wow. You really worked hard on this feature. Thanks a lot! I will have to look into this a bit more detail when I have time. Right now, I'm drowning in work, unfortunately ... :( Jens Jens, The most important is to check if an Exif tag is not missing. Not all Exif tags can be edited with this tool. I have only selected the most important for me, like a photographer. Gilles SVN commit 597975 by cgilles: kipi-plugins from trunk : MetadataEdit plugin : Finalize plugin BUG: 91812, 103255 M +17 -14 metadataitem.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/metadataitem.cpp #597974:597975 @@ -44,15 +44,17 @@ MetadataItemPriv() { - enabled = false; - dirty = false; - eraseExif = false; - eraseIptc = false; - readOnly = false; + enabled = false; + dirtyExif = false; + dirtyIptc = false; + eraseExif = false; + eraseIptc = false; + readOnly = false; } bool enabled; - bool dirty; + bool dirtyExif; + bool dirtyIptc; bool eraseExif; bool eraseIptc; bool readOnly; @@ -103,7 +105,7 @@ void MetadataItem::setExif(const QByteArray& exifData, bool dirty) { setEnabled(true); - d->dirty = dirty; + d->dirtyExif = dirty; d->exifData = exifData; d->eraseIptc = false; setText(2, hasExif() ? i18n("Yes") : i18n("No")); @@ -113,7 +115,7 @@ void MetadataItem::setIptc(const QByteArray& iptcData, bool dirty) { setEnabled(true); - d->dirty = dirty; + d->dirtyIptc = dirty; d->iptcData = iptcData; d->eraseIptc = false; setText(3, hasIptc() ? i18n("Yes") : i18n("No")); @@ -135,7 +137,7 @@ if (!isReadOnly()) { d->eraseExif = true; - d->dirty = true; + d->dirtyExif = true; setText(2, i18n("Removed!")); setText(4, i18n("Dirty!")); repaint(); @@ -147,7 +149,7 @@ if (!isReadOnly()) { d->eraseIptc = true; - d->dirty = true; + d->dirtyIptc = true; setText(3, i18n("Removed!")); setText(4, i18n("Dirty!")); repaint(); @@ -181,7 +183,7 @@ { ret &= exiv2Iface.clearExif(); } - else + else if (d->dirtyExif) { ret &= exiv2Iface.setExif(d->exifData); } @@ -190,7 +192,7 @@ { ret &= exiv2Iface.clearIptc(); } - else + else if (d->dirtyIptc) { ret &= exiv2Iface.setIptc(d->iptcData); } @@ -202,7 +204,8 @@ else setPixmap(1, SmallIcon("cancel")); - d->dirty = false; + d->dirtyExif = false; + d->dirtyIptc = false; } } @@ -219,7 +222,7 @@ bool MetadataItem::isDirty() { - return d->dirty; + return (d->dirtyExif || d->dirtyIptc); } bool MetadataItem::isReadOnly() Hi Gilles, the most important tags for me would be Date and Digitization Date, GPS Location, Comment and - for scanned pictures - photo properties like Exposure time, Flash, Aperture and so on. What would be even more important is that the data is held consistant over the different locations it is saved. I.e. if I change the date the picture was taken, this should be saved in the digikam DB, the EXIF field and the IPTC field (if activated in settings). Same for comments, and same for moving dates around (ie. batch adding or substracting values from a date). Thank your for your hard work! I really appreciate it! :) Jens SVN commit 598331 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif photo informations editor: added Max Aperture Value settings. CCBUGS: 103255 M +137 -81 exifphoto.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifphoto.cpp #598330:598331 @@ -18,6 +18,10 @@ * * ============================================================ */ +// C++ includes. + +#include <cmath> + // QT includes. #include <qlayout.h> @@ -67,6 +71,7 @@ EXIFPhotoPriv() { apertureCheck = 0; + maxApertureCheck = 0; exposureTimeCheck = 0; exposureProgramCheck = 0; exposureModeCheck = 0; @@ -76,6 +81,7 @@ focalLengthCheck = 0; flashModeCheck = 0; apertureCB = 0; + maxApertureCB = 0; exposureProgramCB = 0; exposureModeCB = 0; ISOSpeedCB = 0; @@ -108,13 +114,75 @@ flashModeMap.insert(19, FlashMode( 0x59, i18n("Yes, auto, red-eye") )); flashModeMap.insert(20, FlashMode( 0x5d, i18n("Yes, auto, red-eye, no return light") )); flashModeMap.insert(21, FlashMode( 0x5f, i18n("Yes, auto, red-eye, return light") )); + + apertureValues.append("f/1.0"); + apertureValues.append("f/1.1"); + apertureValues.append("f/1.2"); + apertureValues.append("f/1.3"); + apertureValues.append("f/1.4"); + apertureValues.append("f/1.6"); + apertureValues.append("f/1.8"); + apertureValues.append("f/2.0"); + apertureValues.append("f/2.2"); + apertureValues.append("f/2.5"); + apertureValues.append("f/2.8"); + apertureValues.append("f/3.2"); + apertureValues.append("f/3.5"); + apertureValues.append("f/3.6"); + apertureValues.append("f/4.0"); + apertureValues.append("f/4.5"); + apertureValues.append("f/4.9"); + apertureValues.append("f/5.0"); + apertureValues.append("f/5.6"); + apertureValues.append("f/5.7"); + apertureValues.append("f/6.3"); + apertureValues.append("f/7.0"); + apertureValues.append("f/7.1"); + apertureValues.append("f/8.0"); + apertureValues.append("f/9.0"); + apertureValues.append("f/10.0"); + apertureValues.append("f/10.1"); + apertureValues.append("f/11.0"); + apertureValues.append("f/11.3"); + apertureValues.append("f/12.0"); + apertureValues.append("f/12.7"); + apertureValues.append("f/13.0"); + apertureValues.append("f/14.0"); + apertureValues.append("f/14.3"); + apertureValues.append("f/16.0"); + apertureValues.append("f/18.0"); + apertureValues.append("f/20.0"); + apertureValues.append("f/20.2"); + apertureValues.append("f/22.0"); + apertureValues.append("f/22.6"); + apertureValues.append("f/25.0"); + apertureValues.append("f/25.4"); + apertureValues.append("f/28.5"); + apertureValues.append("f/29.0"); + apertureValues.append("f/32.0"); + apertureValues.append("f/35.9"); + apertureValues.append("f/36.0"); + apertureValues.append("f/40.0"); + apertureValues.append("f/40.3"); + apertureValues.append("f/45.0"); + apertureValues.append("f/45.3"); + apertureValues.append("f/50.8"); + apertureValues.append("f/51.0"); + apertureValues.append("f/57.0"); + apertureValues.append("f/64.0"); + apertureValues.append("f/72.0"); + apertureValues.append("f/81.0"); + apertureValues.append("f/91.0"); } typedef QMap<int, FlashMode> FlashModeMap; FlashModeMap flashModeMap; + QStringList apertureValues; + QCheckBox *apertureCheck; + QCheckBox *maxApertureCheck; QCheckBox *exposureTimeCheck; QCheckBox *exposureProgramCheck; QCheckBox *exposureModeCheck; @@ -125,6 +193,7 @@ QCheckBox *flashModeCheck; QComboBox *apertureCB; + QComboBox *maxApertureCB; QComboBox *exposureProgramCB; QComboBox *exposureModeCB; QComboBox *ISOSpeedCB; @@ -143,7 +212,7 @@ { d = new EXIFPhotoPriv; - QGridLayout* grid = new QGridLayout(parent, 9, 5, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 10, 5, KDialog::spacingHint()); // -------------------------------------------------------- @@ -156,66 +225,9 @@ // -------------------------------------------------------- - d->apertureCheck = new QCheckBox(i18n("Aperture (f-number):"), parent); + d->apertureCheck = new QCheckBox(i18n("Lens aperture (f-number):"), parent); d->apertureCB = new QComboBox(false, parent); - d->apertureCB->insertItem("f/1.0"); - d->apertureCB->insertItem("f/1.1"); - d->apertureCB->insertItem("f/1.2"); - d->apertureCB->insertItem("f/1.3"); - d->apertureCB->insertItem("f/1.4"); - d->apertureCB->insertItem("f/1.6"); - d->apertureCB->insertItem("f/1.8"); - d->apertureCB->insertItem("f/2.0"); - d->apertureCB->insertItem("f/2.2"); - d->apertureCB->insertItem("f/2.5"); - d->apertureCB->insertItem("f/2.8"); - d->apertureCB->insertItem("f/3.2"); - d->apertureCB->insertItem("f/3.5"); - d->apertureCB->insertItem("f/3.6"); - d->apertureCB->insertItem("f/4.0"); - d->apertureCB->insertItem("f/4.5"); - d->apertureCB->insertItem("f/4.9"); - d->apertureCB->insertItem("f/5.0"); - d->apertureCB->insertItem("f/5.6"); - d->apertureCB->insertItem("f/5.7"); - d->apertureCB->insertItem("f/6.3"); - d->apertureCB->insertItem("f/7.0"); - d->apertureCB->insertItem("f/7.1"); - d->apertureCB->insertItem("f/8.0"); - d->apertureCB->insertItem("f/9.0"); - d->apertureCB->insertItem("f/10.0"); - d->apertureCB->insertItem("f/10.1"); - d->apertureCB->insertItem("f/11.0"); - d->apertureCB->insertItem("f/11.3"); - d->apertureCB->insertItem("f/12.0"); - d->apertureCB->insertItem("f/12.7"); - d->apertureCB->insertItem("f/13.0"); - d->apertureCB->insertItem("f/14.0"); - d->apertureCB->insertItem("f/14.3"); - d->apertureCB->insertItem("f/16.0"); - d->apertureCB->insertItem("f/18.0"); - d->apertureCB->insertItem("f/20.0"); - d->apertureCB->insertItem("f/20.2"); - d->apertureCB->insertItem("f/22.0"); - d->apertureCB->insertItem("f/22.6"); - d->apertureCB->insertItem("f/25.0"); - d->apertureCB->insertItem("f/25.4"); - d->apertureCB->insertItem("f/28.5"); - d->apertureCB->insertItem("f/29.0"); - d->apertureCB->insertItem("f/32.0"); - d->apertureCB->insertItem("f/35.9"); - d->apertureCB->insertItem("f/36.0"); - d->apertureCB->insertItem("f/40.0"); - d->apertureCB->insertItem("f/40.3"); - d->apertureCB->insertItem("f/45.0"); - d->apertureCB->insertItem("f/45.3"); - d->apertureCB->insertItem("f/50.8"); - d->apertureCB->insertItem("f/51.0"); - d->apertureCB->insertItem("f/57.0"); - d->apertureCB->insertItem("f/64.0"); - d->apertureCB->insertItem("f/72.0"); - d->apertureCB->insertItem("f/81.0"); - d->apertureCB->insertItem("f/91.0"); + d->apertureCB->insertStringList(d->apertureValues); grid->addMultiCellWidget(d->apertureCheck, 1, 1, 0, 0); grid->addMultiCellWidget(d->apertureCB, 1, 1, 2, 2); QWhatsThis::add(d->apertureCB, i18n("<p>Select here the lens aperture used by camera " @@ -223,15 +235,25 @@ // -------------------------------------------------------- + d->maxApertureCheck = new QCheckBox(i18n("Max. lens aperture (f-number):"), parent); + d->maxApertureCB = new QComboBox(false, parent); + d->maxApertureCB->insertStringList(d->apertureValues); + grid->addMultiCellWidget(d->maxApertureCheck, 2, 2, 0, 0); + grid->addMultiCellWidget(d->maxApertureCB, 2, 2, 2, 2); + QWhatsThis::add(d->maxApertureCB, i18n("<p>Select here the smallest aperture of the lens used by camera " + "to take the picture.")); + + // -------------------------------------------------------- + d->exposureTimeCheck = new QCheckBox(i18n("Exposure time (seconds):"), parent); d->exposureTimeNumEdit = new KIntSpinBox(1, 100000, 1, 1, 10, parent); d->exposureTimeDenEdit = new KIntSpinBox(1, 100000, 1, 1, 10, parent); QLabel *exposureLabel = new QLabel("/", parent); exposureLabel->setAlignment (Qt::AlignRight|Qt::AlignVCenter); - grid->addMultiCellWidget(d->exposureTimeCheck, 2, 2, 0, 0); - grid->addMultiCellWidget(d->exposureTimeNumEdit, 2, 2, 2, 2); - grid->addMultiCellWidget(exposureLabel, 2, 2, 3, 3); - grid->addMultiCellWidget(d->exposureTimeDenEdit, 2, 2, 4, 4); + grid->addMultiCellWidget(d->exposureTimeCheck, 3, 3, 0, 0); + grid->addMultiCellWidget(d->exposureTimeNumEdit, 3, 3, 2, 2); + grid->addMultiCellWidget(exposureLabel, 3, 3, 3, 3); + grid->addMultiCellWidget(d->exposureTimeDenEdit, 3, 3, 4, 4); QWhatsThis::add(d->exposureTimeCheck, i18n("<p>Set on this option to set the exposure time " "of picture, given in seconds.")); @@ -248,8 +270,8 @@ d->exposureProgramCB->insertItem(i18n("Action program"), 6); d->exposureProgramCB->insertItem(i18n("Portrait mode"), 7); d->exposureProgramCB->insertItem(i18n("Landscape mode"), 8); - grid->addMultiCellWidget(d->exposureProgramCheck, 3, 3, 0, 0); - grid->addMultiCellWidget(d->exposureProgramCB, 3, 3, 2, 5); + grid->addMultiCellWidget(d->exposureProgramCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->exposureProgramCB, 4, 4, 2, 5); QWhatsThis::add(d->exposureProgramCB, i18n("<p>Select here the program used by the camera " "to set exposure when the picture have been taken.")); @@ -260,8 +282,8 @@ d->exposureModeCB->insertItem(i18n("Auto"), 0); d->exposureModeCB->insertItem(i18n("Manual"), 1); d->exposureModeCB->insertItem(i18n("Auto bracket"), 2); - grid->addMultiCellWidget(d->exposureModeCheck, 4, 4, 0, 0); - grid->addMultiCellWidget(d->exposureModeCB, 4, 4, 2, 5); + grid->addMultiCellWidget(d->exposureModeCheck, 5, 5, 0, 0); + grid->addMultiCellWidget(d->exposureModeCB, 5, 5, 2, 5); QWhatsThis::add(d->exposureModeCB, i18n("<p>Select here the mode used by the camera " "to set exposure when the picture have been shot. " "In auto-bracketing mode, the camera shoots a " @@ -280,8 +302,8 @@ d->meteringModeCB->insertItem(i18n("Multi-segment"), 5); d->meteringModeCB->insertItem(i18n("Partial"), 6); d->meteringModeCB->insertItem(i18n("Other"), 7); - grid->addMultiCellWidget(d->meteringModeCheck, 5, 5, 0, 0); - grid->addMultiCellWidget(d->meteringModeCB, 5, 5, 2, 5); + grid->addMultiCellWidget(d->meteringModeCheck, 6, 6, 0, 0); + grid->addMultiCellWidget(d->meteringModeCB, 6, 6, 2, 5); QWhatsThis::add(d->meteringModeCB, i18n("<p>Select here the metering mode used by the camera " "to set exposure when the picture have been shot.")); @@ -325,9 +347,9 @@ d->ISOSpeedCB->insertItem("20000", 33); d->ISOSpeedCB->insertItem("25000", 34); d->ISOSpeedCB->insertItem("32000", 35); - grid->addMultiCellWidget(d->ISOSpeedCheck, 6, 6, 0, 0); - grid->addMultiCellWidget(d->ISOSpeedCB, 6, 6, 2, 5); - QWhatsThis::add(d->ISOSpeedCB, i18n("<p>Select here the ISO Speed of the digital still camera " + grid->addMultiCellWidget(d->ISOSpeedCheck, 7, 7, 0, 0); + grid->addMultiCellWidget(d->ISOSpeedCB, 7, 7, 2, 5); + QWhatsThis::add(d->ISOSpeedCB, i18n("<p>Select here the ISO Speed of the camera " "witch have taken the picture.")); // -------------------------------------------------------- @@ -355,8 +377,8 @@ d->lightSourceCB->insertItem(i18n("D50"), 18); d->lightSourceCB->insertItem(i18n("ISO studio tungsten"), 19); d->lightSourceCB->insertItem(i18n("Other light source"), 20); - grid->addMultiCellWidget(d->lightSourceCheck, 7, 7, 0, 0); - grid->addMultiCellWidget(d->lightSourceCB, 7, 7, 2, 5); + grid->addMultiCellWidget(d->lightSourceCheck, 8, 8, 0, 0); + grid->addMultiCellWidget(d->lightSourceCB, 8, 8, 2, 5); QWhatsThis::add(d->lightSourceCB, i18n("<p>Select here the kind of light source used " "to take the picture.")); @@ -369,14 +391,14 @@ it != d->flashModeMap.end(); ++it ) d->flashModeCB->insertItem(it.data().desc()); - grid->addMultiCellWidget(d->flashModeCheck, 8, 8, 0, 0); - grid->addMultiCellWidget(d->flashModeCB, 8, 8, 2, 5); + grid->addMultiCellWidget(d->flashModeCheck, 9, 9, 0, 0); + grid->addMultiCellWidget(d->flashModeCB, 9, 9, 2, 5); QWhatsThis::add(d->flashModeCB, i18n("<p>Select here the flash program mode used by camera " "to take the picture.")); grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(9, 10); + grid->setRowStretch(10, 10); // -------------------------------------------------------- @@ -386,6 +408,9 @@ connect(d->apertureCheck, SIGNAL(toggled(bool)), d->apertureCB, SLOT(setEnabled(bool))); + connect(d->maxApertureCheck, SIGNAL(toggled(bool)), + d->maxApertureCB, SLOT(setEnabled(bool))); + connect(d->exposureTimeCheck, SIGNAL(toggled(bool)), d->exposureTimeNumEdit, SLOT(setEnabled(bool))); @@ -436,12 +461,12 @@ if (exiv2Iface.getExifTagRational("Exif.Photo.FNumber", num, den)) { - QString aperture = QString::number((double)(num)/(double)(den), 'f', 1); + QString fnumber = QString::number((double)(num)/(double)(den), 'f', 1); int item = -1; for (int i = 0 ; i < d->apertureCB->count() ; i++) { - if (d->apertureCB->text(i).remove(0, 2) == aperture) + if (d->apertureCB->text(i).remove(0, 2) == fnumber) item = i; } @@ -453,6 +478,27 @@ } d->apertureCB->setEnabled(d->apertureCheck->isChecked()); + if (exiv2Iface.getExifTagRational("Exif.Photo.MaxApertureValue", num, den)) + { + double maxAperture = pow(2.0, ((double)(num)/(double)(den))/2.0); + + QString fnumber = QString::number(maxAperture, 'f', 1); + + int item = -1; + for (int i = 0 ; i < d->apertureCB->count() ; i++) + { + if (d->maxApertureCB->text(i).remove(0, 2) == fnumber) + item = i; + } + + if (item != -1) + { + d->maxApertureCB->setCurrentItem(item); + d->maxApertureCheck->setChecked(true); + } + } + d->maxApertureCB->setEnabled(d->maxApertureCheck->isChecked()); + if (exiv2Iface.getExifTagRational("Exif.Photo.ExposureTime", num, den)) { d->exposureTimeNumEdit->setValue(num); @@ -545,7 +591,7 @@ else exiv2Iface.removeExifTag("Exif.Photo.FocalLength"); - if (d->exposureTimeCheck->isChecked()) + if (d->apertureCheck->isChecked()) { exiv2Iface.convertToRational(d->apertureCB->currentText().remove(0, 2).toDouble(), &num, &den, 1); exiv2Iface.setExifTagRational("Exif.Photo.FNumber", num, den); @@ -553,6 +599,16 @@ else exiv2Iface.removeExifTag("Exif.Photo.FNumber"); + if (d->maxApertureCheck->isChecked()) + { + double fnumber = d->maxApertureCB->currentText().remove(0, 2).toDouble(); + double aperture = 2.0*(log(fnumber)/log(2.0)); + exiv2Iface.convertToRational(aperture, &num, &den, 8); + exiv2Iface.setExifTagRational("Exif.Photo.MaxApertureValue", num, den); + } + else + exiv2Iface.removeExifTag("Exif.Photo.MaxApertureValue"); + if (d->exposureTimeCheck->isChecked()) exiv2Iface.setExifTagRational("Exif.Photo.ExposureTime", d->exposureTimeNumEdit->value(), d->exposureTimeDenEdit->value()); SVN commit 598367 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif photo informations editor: control Shutter Speed Value tag with Exposure Time tag CCBUGS: 103255 M +24 -1 exifphoto.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifphoto.cpp #598366:598367 @@ -457,7 +457,7 @@ d->focalLengthEdit->setValue((double)(num) / (double)(den)); d->focalLengthCheck->setChecked(true); } - d->exposureTimeNumEdit->setEnabled(d->focalLengthCheck->isChecked()); + d->focalLengthEdit->setEnabled(d->focalLengthCheck->isChecked()); if (exiv2Iface.getExifTagRational("Exif.Photo.FNumber", num, den)) { @@ -505,6 +505,18 @@ d->exposureTimeDenEdit->setValue(den); d->exposureTimeCheck->setChecked(true); } + else if (exiv2Iface.getExifTagRational("Exif.Photo.ShutterSpeedValue", num, den)) + { + double tmp = exp(log(2.0) * (double)(num)/(double)(den)); + if (tmp > 1.0) + num = (long int)(tmp + 0.5); + else + den = (long int)(1.0/tmp + 0.5); + + d->exposureTimeNumEdit->setValue(num); + d->exposureTimeDenEdit->setValue(den); + d->exposureTimeCheck->setChecked(true); + } d->exposureTimeNumEdit->setEnabled(d->exposureTimeCheck->isChecked()); d->exposureTimeDenEdit->setEnabled(d->exposureTimeCheck->isChecked()); @@ -610,10 +622,21 @@ exiv2Iface.removeExifTag("Exif.Photo.MaxApertureValue"); if (d->exposureTimeCheck->isChecked()) + { exiv2Iface.setExifTagRational("Exif.Photo.ExposureTime", d->exposureTimeNumEdit->value(), d->exposureTimeDenEdit->value()); + + double exposureTime = (double)(d->exposureTimeNumEdit->value())/ + (double)(d->exposureTimeDenEdit->value()); + double shutterSpeed = (-1.0)*(log(exposureTime)/log(2.0)); + exiv2Iface.convertToRational(shutterSpeed, &num, &den, 8); + exiv2Iface.setExifTagRational("Exif.Photo.ShutterSpeedValue", num, den); + } else + { exiv2Iface.removeExifTag("Exif.Photo.ExposureTime"); + exiv2Iface.removeExifTag("Exif.Photo.ShutterSpeedValue"); + } if (d->exposureProgramCheck->isChecked()) exiv2Iface.setExifTagLong("Exif.Photo.ExposureProgram", d->exposureProgramCB->currentItem()); SVN commit 598380 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif photo informations editor: control Aperture Value tag with FNumber tag CCBUGS: 103255 M +28 -0 exifphoto.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifphoto.cpp #598379:598380 @@ -476,6 +476,26 @@ d->apertureCheck->setChecked(true); } } + else if (exiv2Iface.getExifTagRational("Exif.Photo.ApertureValue", num, den)) + { + double aperture = pow(2.0, ((double)(num)/(double)(den))/2.0); + + QString fnumber = QString::number(aperture, 'f', 1); + + int item = -1; + for (int i = 0 ; i < d->apertureCB->count() ; i++) + { + if (d->apertureCB->text(i).remove(0, 2) == fnumber) + item = i; + } + + if (item != -1) + { + d->apertureCB->setCurrentItem(item); + d->apertureCheck->setChecked(true); + } + + } d->apertureCB->setEnabled(d->apertureCheck->isChecked()); if (exiv2Iface.getExifTagRational("Exif.Photo.MaxApertureValue", num, den)) @@ -607,9 +627,17 @@ { exiv2Iface.convertToRational(d->apertureCB->currentText().remove(0, 2).toDouble(), &num, &den, 1); exiv2Iface.setExifTagRational("Exif.Photo.FNumber", num, den); + + double fnumber = d->apertureCB->currentText().remove(0, 2).toDouble(); + double aperture = 2.0*(log(fnumber)/log(2.0)); + exiv2Iface.convertToRational(aperture, &num, &den, 8); + exiv2Iface.setExifTagRational("Exif.Photo.ApertureValue", num, den); } else + { exiv2Iface.removeExifTag("Exif.Photo.FNumber"); + exiv2Iface.removeExifTag("Exif.Photo.ApertureValue"); + } if (d->maxApertureCheck->isChecked()) { SVN commit 598385 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif photo informations editor: add White Balance settings CCBUGS: 103255 M +34 -3 exifphoto.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifphoto.cpp #598384:598385 @@ -80,6 +80,7 @@ lightSourceCheck = 0; focalLengthCheck = 0; flashModeCheck = 0; + whiteBalanceCheck = 0; apertureCB = 0; maxApertureCB = 0; exposureProgramCB = 0; @@ -91,6 +92,7 @@ exposureTimeDenEdit = 0; focalLengthEdit = 0; flashModeCB = 0; + whiteBalanceCB = 0; flashModeMap.insert(0, FlashMode( 0x00, i18n("No flash") )); flashModeMap.insert(1, FlashMode( 0x01, i18n("Fired") )); @@ -177,7 +179,7 @@ typedef QMap<int, FlashMode> FlashModeMap; - FlashModeMap flashModeMap; + FlashModeMap flashModeMap; QStringList apertureValues; @@ -191,6 +193,7 @@ QCheckBox *lightSourceCheck; QCheckBox *focalLengthCheck; QCheckBox *flashModeCheck; + QCheckBox *whiteBalanceCheck; QComboBox *apertureCB; QComboBox *maxApertureCB; @@ -200,6 +203,7 @@ QComboBox *meteringModeCB; QComboBox *lightSourceCB; QComboBox *flashModeCB; + QComboBox *whiteBalanceCB; KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; @@ -212,7 +216,7 @@ { d = new EXIFPhotoPriv; - QGridLayout* grid = new QGridLayout(parent, 10, 5, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 11, 5, KDialog::spacingHint()); // -------------------------------------------------------- @@ -396,9 +400,21 @@ QWhatsThis::add(d->flashModeCB, i18n("<p>Select here the flash program mode used by camera " "to take the picture.")); + // -------------------------------------------------------- + + d->whiteBalanceCheck = new QCheckBox(i18n("White balance:"), parent); + d->whiteBalanceCB = new QComboBox(false, parent); + d->whiteBalanceCB->insertItem(i18n("Auto"), 0); + d->whiteBalanceCB->insertItem(i18n("Manual"), 1); + grid->addMultiCellWidget(d->whiteBalanceCheck, 10, 10, 0, 0); + grid->addMultiCellWidget(d->whiteBalanceCB, 10, 10, 2, 5); + QWhatsThis::add(d->whiteBalanceCB, i18n("<p>Select here the white balance mode set by camera when " + "the picture have been shot.")); + + grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(10, 10); + grid->setRowStretch(11, 10); // -------------------------------------------------------- @@ -435,6 +451,9 @@ connect(d->flashModeCheck, SIGNAL(toggled(bool)), d->flashModeCB, SLOT(setEnabled(bool))); + connect(d->whiteBalanceCheck, SIGNAL(toggled(bool)), + d->whiteBalanceCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -607,6 +626,13 @@ } } d->flashModeCB->setEnabled(d->flashModeCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.WhiteBalance", val)) + { + d->whiteBalanceCB->setCurrentItem(val); + d->whiteBalanceCheck->setChecked(true); + } + d->whiteBalanceCB->setEnabled(d->whiteBalanceCheck->isChecked()); } void EXIFPhoto::applyMetadata(QByteArray& exifData) @@ -712,6 +738,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.Flash"); + if (d->whiteBalanceCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.WhiteBalance", d->whiteBalanceCB->currentItem()); + else + exiv2Iface.removeExifTag("Exif.Photo.WhiteBalance"); + exifData = exiv2Iface.getExif(); } SVN commit 598395 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif photo informations editor: add Focal Lenght In 35mm Film settings CCBUGS: 103255 M +53 -25 exifphoto.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifphoto.cpp #598394:598395 @@ -78,6 +78,7 @@ ISOSpeedCheck = 0; meteringModeCheck = 0; lightSourceCheck = 0; + focalLength35mmCheck = 0; focalLengthCheck = 0; flashModeCheck = 0; whiteBalanceCheck = 0; @@ -90,6 +91,7 @@ lightSourceCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; + focalLength35mmEdit = 0; focalLengthEdit = 0; flashModeCB = 0; whiteBalanceCB = 0; @@ -191,6 +193,7 @@ QCheckBox *ISOSpeedCheck; QCheckBox *meteringModeCheck; QCheckBox *lightSourceCheck; + QCheckBox *focalLength35mmCheck; QCheckBox *focalLengthCheck; QCheckBox *flashModeCheck; QCheckBox *whiteBalanceCheck; @@ -207,6 +210,7 @@ KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; + KIntSpinBox *focalLength35mmEdit; KDoubleSpinBox *focalLengthEdit; }; @@ -216,11 +220,11 @@ { d = new EXIFPhotoPriv; - QGridLayout* grid = new QGridLayout(parent, 11, 5, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 12, 5, KDialog::spacingHint()); // -------------------------------------------------------- - d->focalLengthCheck = new QCheckBox(i18n("Focal Length (mm):"), parent); + d->focalLengthCheck = new QCheckBox(i18n("Focal length (mm):"), parent); d->focalLengthEdit = new KDoubleSpinBox(1, 10000, 1, 50, 1, parent); grid->addMultiCellWidget(d->focalLengthCheck, 0, 0, 0, 0); grid->addMultiCellWidget(d->focalLengthEdit, 0, 0, 2, 2); @@ -229,11 +233,20 @@ // -------------------------------------------------------- + d->focalLength35mmCheck = new QCheckBox(i18n("Focal length in 35mm film (mm):"), parent); + d->focalLength35mmEdit = new KIntSpinBox(1, 10000, 1, 1, 10, parent); + grid->addMultiCellWidget(d->focalLength35mmCheck, 1, 1, 0, 0); + grid->addMultiCellWidget(d->focalLength35mmEdit, 1, 1, 2, 2); + QWhatsThis::add(d->focalLength35mmEdit, i18n("<p>Set here the lens focal lenght value in milimeters " + "used in 35 mm film.")); + + // -------------------------------------------------------- + d->apertureCheck = new QCheckBox(i18n("Lens aperture (f-number):"), parent); d->apertureCB = new QComboBox(false, parent); d->apertureCB->insertStringList(d->apertureValues); - grid->addMultiCellWidget(d->apertureCheck, 1, 1, 0, 0); - grid->addMultiCellWidget(d->apertureCB, 1, 1, 2, 2); + grid->addMultiCellWidget(d->apertureCheck, 2, 2, 0, 0); + grid->addMultiCellWidget(d->apertureCB, 2, 2, 2, 2); QWhatsThis::add(d->apertureCB, i18n("<p>Select here the lens aperture used by camera " "to take the picture.")); @@ -242,8 +255,8 @@ d->maxApertureCheck = new QCheckBox(i18n("Max. lens aperture (f-number):"), parent); d->maxApertureCB = new QComboBox(false, parent); d->maxApertureCB->insertStringList(d->apertureValues); - grid->addMultiCellWidget(d->maxApertureCheck, 2, 2, 0, 0); - grid->addMultiCellWidget(d->maxApertureCB, 2, 2, 2, 2); + grid->addMultiCellWidget(d->maxApertureCheck, 3, 3, 0, 0); + grid->addMultiCellWidget(d->maxApertureCB, 3, 3, 2, 2); QWhatsThis::add(d->maxApertureCB, i18n("<p>Select here the smallest aperture of the lens used by camera " "to take the picture.")); @@ -254,10 +267,10 @@ d->exposureTimeDenEdit = new KIntSpinBox(1, 100000, 1, 1, 10, parent); QLabel *exposureLabel = new QLabel("/", parent); exposureLabel->setAlignment (Qt::AlignRight|Qt::AlignVCenter); - grid->addMultiCellWidget(d->exposureTimeCheck, 3, 3, 0, 0); - grid->addMultiCellWidget(d->exposureTimeNumEdit, 3, 3, 2, 2); - grid->addMultiCellWidget(exposureLabel, 3, 3, 3, 3); - grid->addMultiCellWidget(d->exposureTimeDenEdit, 3, 3, 4, 4); + grid->addMultiCellWidget(d->exposureTimeCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->exposureTimeNumEdit, 4, 4, 2, 2); + grid->addMultiCellWidget(exposureLabel, 4, 4, 3, 3); + grid->addMultiCellWidget(d->exposureTimeDenEdit, 4, 4, 4, 4); QWhatsThis::add(d->exposureTimeCheck, i18n("<p>Set on this option to set the exposure time " "of picture, given in seconds.")); @@ -274,8 +287,8 @@ d->exposureProgramCB->insertItem(i18n("Action program"), 6); d->exposureProgramCB->insertItem(i18n("Portrait mode"), 7); d->exposureProgramCB->insertItem(i18n("Landscape mode"), 8); - grid->addMultiCellWidget(d->exposureProgramCheck, 4, 4, 0, 0); - grid->addMultiCellWidget(d->exposureProgramCB, 4, 4, 2, 5); + grid->addMultiCellWidget(d->exposureProgramCheck, 5, 5, 0, 0); + grid->addMultiCellWidget(d->exposureProgramCB, 5, 5, 2, 5); QWhatsThis::add(d->exposureProgramCB, i18n("<p>Select here the program used by the camera " "to set exposure when the picture have been taken.")); @@ -286,8 +299,8 @@ d->exposureModeCB->insertItem(i18n("Auto"), 0); d->exposureModeCB->insertItem(i18n("Manual"), 1); d->exposureModeCB->insertItem(i18n("Auto bracket"), 2); - grid->addMultiCellWidget(d->exposureModeCheck, 5, 5, 0, 0); - grid->addMultiCellWidget(d->exposureModeCB, 5, 5, 2, 5); + grid->addMultiCellWidget(d->exposureModeCheck, 6, 6, 0, 0); + grid->addMultiCellWidget(d->exposureModeCB, 6, 6, 2, 5); QWhatsThis::add(d->exposureModeCB, i18n("<p>Select here the mode used by the camera " "to set exposure when the picture have been shot. " "In auto-bracketing mode, the camera shoots a " @@ -306,8 +319,8 @@ d->meteringModeCB->insertItem(i18n("Multi-segment"), 5); d->meteringModeCB->insertItem(i18n("Partial"), 6); d->meteringModeCB->insertItem(i18n("Other"), 7); - grid->addMultiCellWidget(d->meteringModeCheck, 6, 6, 0, 0); - grid->addMultiCellWidget(d->meteringModeCB, 6, 6, 2, 5); + grid->addMultiCellWidget(d->meteringModeCheck, 7, 7, 0, 0); + grid->addMultiCellWidget(d->meteringModeCB, 7, 7, 2, 5); QWhatsThis::add(d->meteringModeCB, i18n("<p>Select here the metering mode used by the camera " "to set exposure when the picture have been shot.")); @@ -351,8 +364,8 @@ d->ISOSpeedCB->insertItem("20000", 33); d->ISOSpeedCB->insertItem("25000", 34); d->ISOSpeedCB->insertItem("32000", 35); - grid->addMultiCellWidget(d->ISOSpeedCheck, 7, 7, 0, 0); - grid->addMultiCellWidget(d->ISOSpeedCB, 7, 7, 2, 5); + grid->addMultiCellWidget(d->ISOSpeedCheck, 8, 8, 0, 0); + grid->addMultiCellWidget(d->ISOSpeedCB, 8, 8, 2, 5); QWhatsThis::add(d->ISOSpeedCB, i18n("<p>Select here the ISO Speed of the camera " "witch have taken the picture.")); @@ -381,8 +394,8 @@ d->lightSourceCB->insertItem(i18n("D50"), 18); d->lightSourceCB->insertItem(i18n("ISO studio tungsten"), 19); d->lightSourceCB->insertItem(i18n("Other light source"), 20); - grid->addMultiCellWidget(d->lightSourceCheck, 8, 8, 0, 0); - grid->addMultiCellWidget(d->lightSourceCB, 8, 8, 2, 5); + grid->addMultiCellWidget(d->lightSourceCheck, 9, 9, 0, 0); + grid->addMultiCellWidget(d->lightSourceCB, 9, 9, 2, 5); QWhatsThis::add(d->lightSourceCB, i18n("<p>Select here the kind of light source used " "to take the picture.")); @@ -395,8 +408,8 @@ it != d->flashModeMap.end(); ++it ) d->flashModeCB->insertItem(it.data().desc()); - grid->addMultiCellWidget(d->flashModeCheck, 9, 9, 0, 0); - grid->addMultiCellWidget(d->flashModeCB, 9, 9, 2, 5); + grid->addMultiCellWidget(d->flashModeCheck, 10, 10, 0, 0); + grid->addMultiCellWidget(d->flashModeCB, 10, 10, 2, 5); QWhatsThis::add(d->flashModeCB, i18n("<p>Select here the flash program mode used by camera " "to take the picture.")); @@ -406,21 +419,24 @@ d->whiteBalanceCB = new QComboBox(false, parent); d->whiteBalanceCB->insertItem(i18n("Auto"), 0); d->whiteBalanceCB->insertItem(i18n("Manual"), 1); - grid->addMultiCellWidget(d->whiteBalanceCheck, 10, 10, 0, 0); - grid->addMultiCellWidget(d->whiteBalanceCB, 10, 10, 2, 5); + grid->addMultiCellWidget(d->whiteBalanceCheck, 11, 11, 0, 0); + grid->addMultiCellWidget(d->whiteBalanceCB, 11, 11, 2, 5); QWhatsThis::add(d->whiteBalanceCB, i18n("<p>Select here the white balance mode set by camera when " "the picture have been shot.")); grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(11, 10); + grid->setRowStretch(12, 10); // -------------------------------------------------------- connect(d->focalLengthCheck, SIGNAL(toggled(bool)), d->focalLengthEdit, SLOT(setEnabled(bool))); + connect(d->focalLength35mmCheck, SIGNAL(toggled(bool)), + d->focalLength35mmEdit, SLOT(setEnabled(bool))); + connect(d->apertureCheck, SIGNAL(toggled(bool)), d->apertureCB, SLOT(setEnabled(bool))); @@ -478,6 +494,13 @@ } d->focalLengthEdit->setEnabled(d->focalLengthCheck->isChecked()); + if (exiv2Iface.getExifTagLong("Exif.Photo.FocalLengthIn35mmFilm", val)) + { + d->focalLength35mmEdit->setValue(val); + d->focalLength35mmCheck->setChecked(true); + } + d->focalLength35mmEdit->setEnabled(d->focalLength35mmCheck->isChecked()); + if (exiv2Iface.getExifTagRational("Exif.Photo.FNumber", num, den)) { QString fnumber = QString::number((double)(num)/(double)(den), 'f', 1); @@ -649,6 +672,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.FocalLength"); + if (d->focalLength35mmCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.FocalLengthIn35mmFilm", d->focalLength35mmEdit->value()); + else + exiv2Iface.removeExifTag("Exif.Photo.FocalLengthIn35mmFilm"); + if (d->apertureCheck->isChecked()) { exiv2Iface.convertToRational(d->apertureCB->currentText().remove(0, 2).toDouble(), &num, &den, 1); SVN commit 598407 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif photo informations editor: add Flash Energy settings CCBUGS: 103255 M +38 -4 exifphoto.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifphoto.cpp #598406:598407 @@ -81,6 +81,7 @@ focalLength35mmCheck = 0; focalLengthCheck = 0; flashModeCheck = 0; + flashEnergyCheck = 0; whiteBalanceCheck = 0; apertureCB = 0; maxApertureCB = 0; @@ -93,6 +94,7 @@ exposureTimeDenEdit = 0; focalLength35mmEdit = 0; focalLengthEdit = 0; + flashEnergyEdit = 0; flashModeCB = 0; whiteBalanceCB = 0; @@ -196,6 +198,7 @@ QCheckBox *focalLength35mmCheck; QCheckBox *focalLengthCheck; QCheckBox *flashModeCheck; + QCheckBox *flashEnergyCheck; QCheckBox *whiteBalanceCheck; QComboBox *apertureCB; @@ -212,6 +215,7 @@ KIntSpinBox *exposureTimeDenEdit; KIntSpinBox *focalLength35mmEdit; + KDoubleSpinBox *flashEnergyEdit; KDoubleSpinBox *focalLengthEdit; }; @@ -220,7 +224,7 @@ { d = new EXIFPhotoPriv; - QGridLayout* grid = new QGridLayout(parent, 12, 5, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 13, 5, KDialog::spacingHint()); // -------------------------------------------------------- @@ -415,19 +419,31 @@ // -------------------------------------------------------- + d->flashEnergyCheck = new QCheckBox(i18n("Flash energy (BCPS):"), parent); + d->flashEnergyEdit = new KDoubleSpinBox(1, 10000, 1, 1, 1, parent); + grid->addMultiCellWidget(d->flashEnergyCheck, 11, 11, 0, 0); + grid->addMultiCellWidget(d->flashEnergyEdit, 11, 11, 2, 2); + QWhatsThis::add(d->flashEnergyEdit, i18n("<p>Set here the flash enrgy used to take the picture " + "in BCPS unit. Beam Candle Power Seconds is the measure " + "of effective intensity of a light source when it is " + "focused into a beam by a reflector or lens. This value " + "is the effective intensity for a period of one second.")); + + // -------------------------------------------------------- + d->whiteBalanceCheck = new QCheckBox(i18n("White balance:"), parent); d->whiteBalanceCB = new QComboBox(false, parent); d->whiteBalanceCB->insertItem(i18n("Auto"), 0); d->whiteBalanceCB->insertItem(i18n("Manual"), 1); - grid->addMultiCellWidget(d->whiteBalanceCheck, 11, 11, 0, 0); - grid->addMultiCellWidget(d->whiteBalanceCB, 11, 11, 2, 5); + grid->addMultiCellWidget(d->whiteBalanceCheck, 12, 12, 0, 0); + grid->addMultiCellWidget(d->whiteBalanceCB, 12, 12, 2, 5); QWhatsThis::add(d->whiteBalanceCB, i18n("<p>Select here the white balance mode set by camera when " "the picture have been shot.")); grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(12, 10); + grid->setRowStretch(13, 10); // -------------------------------------------------------- @@ -467,6 +483,9 @@ connect(d->flashModeCheck, SIGNAL(toggled(bool)), d->flashModeCB, SLOT(setEnabled(bool))); + connect(d->flashEnergyCheck, SIGNAL(toggled(bool)), + d->flashEnergyEdit, SLOT(setEnabled(bool))); + connect(d->whiteBalanceCheck, SIGNAL(toggled(bool)), d->whiteBalanceCB, SLOT(setEnabled(bool))); @@ -650,6 +669,13 @@ } d->flashModeCB->setEnabled(d->flashModeCheck->isChecked()); + if (exiv2Iface.getExifTagRational("Exif.Photo.FlashEnergy", num, den)) + { + d->flashEnergyEdit->setValue((double)(num) / (double)(den)); + d->flashEnergyCheck->setChecked(true); + } + d->flashEnergyEdit->setEnabled(d->flashEnergyCheck->isChecked()); + if (exiv2Iface.getExifTagLong("Exif.Photo.WhiteBalance", val)) { d->whiteBalanceCB->setCurrentItem(val); @@ -766,6 +792,14 @@ else exiv2Iface.removeExifTag("Exif.Photo.Flash"); + if (d->flashEnergyCheck->isChecked()) + { + exiv2Iface.convertToRational(d->flashEnergyEdit->value(), &num, &den, 1); + exiv2Iface.setExifTagRational("Exif.Photo.FlashEnergy", num, den); + } + else + exiv2Iface.removeExifTag("Exif.Photo.FlashEnergy"); + if (d->whiteBalanceCheck->isChecked()) exiv2Iface.setExifTagLong("Exif.Photo.WhiteBalance", d->whiteBalanceCB->currentItem()); else SVN commit 598637 by cgilles: kipiplugins from trunk : MetadataEdit plugin: separate Exif photo informations to 3 sub-categories : Lens, Exposure, and Light CCBUGS: 103255 M +1 -1 Makefile.am M +28 -8 exifeditdialog.cpp A exifexposure.cpp [License: GPL] A exifexposure.h [License: GPL] A exiflens.cpp [License: GPL] A exiflens.h [License: GPL] A exiflight.cpp [License: GPL] A exiflight.h [License: GPL] D exifphoto.cpp D exifphoto.h --- trunk/extragear/libs/kipi-plugins/metadataedit/Makefile.am #598636:598637 @@ -14,7 +14,7 @@ iptccredits.cpp iptcstatus.cpp iptcorigin.cpp \ iptcdatetime.cpp iptckeywords.cpp iptccategories.cpp \ exifeditdialog.cpp exifcaption.cpp exifdatetime.cpp \ - exifphoto.cpp + exiflens.cpp exifexposure.cpp exiflight.cpp # Libs needed by the plugin kipiplugin_metadataedit_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \ --- trunk/extragear/libs/kipi-plugins/metadataedit/exifeditdialog.cpp #598636:598637 @@ -39,7 +39,9 @@ #include "exifcaption.h" #include "exifdatetime.h" -#include "exifphoto.h" +#include "exiflens.h" +#include "exifexposure.h" +#include "exiflight.h" #include "exifeditdialog.h" #include "exifeditdialog.moc" @@ -55,22 +57,30 @@ { page_caption = 0; page_datetime = 0; - page_photo = 0; + page_lens = 0; + page_exposure = 0; + page_light = 0; captionPage = 0; datetimePage = 0; - photoPage = 0; + lensPage = 0; + exposurePage = 0; + lightPage = 0; } QByteArray exifData; QFrame *page_caption; QFrame *page_datetime; - QFrame *page_photo; + QFrame *page_lens; + QFrame *page_exposure; + QFrame *page_light; EXIFCaption *captionPage; EXIFDateTime *datetimePage; - EXIFPhoto *photoPage; + EXIFLens *lensPage; + EXIFExposure *exposurePage; + EXIFLight *lightPage; }; EXIFEditDialog::EXIFEditDialog(QWidget* parent, QByteArray exifData, const QString& fileName) @@ -90,10 +100,18 @@ BarIcon("today", KIcon::SizeMedium)); d->datetimePage = new EXIFDateTime(d->page_datetime, d->exifData); - d->page_photo = addPage(i18n("Photo"), i18n("Pictures-Taking Conditions"), + d->page_lens = addPage(i18n("Lens"), i18n("Camera Lens Informations"), BarIcon("camera", KIcon::SizeMedium)); - d->photoPage = new EXIFPhoto(d->page_photo, d->exifData); + d->lensPage = new EXIFLens(d->page_lens, d->exifData); + d->page_exposure = addPage(i18n("Exposure"), i18n("Camera Exposure Informations"), + BarIcon("configure", KIcon::SizeMedium)); + d->exposurePage = new EXIFExposure(d->page_exposure, d->exifData); + + d->page_light = addPage(i18n("Light"), i18n("Light Source Informations"), + BarIcon("idea", KIcon::SizeMedium)); + d->lightPage = new EXIFLight(d->page_light, d->exifData); + readSettings(); show(); } @@ -142,7 +160,9 @@ { d->captionPage->applyMetadata(d->exifData); d->datetimePage->applyMetadata(d->exifData); - d->photoPage->applyMetadata(d->exifData); + d->lensPage->applyMetadata(d->exifData); + d->exposurePage->applyMetadata(d->exifData); + d->lightPage->applyMetadata(d->exifData); saveSettings(); accept(); SVN commit 598651 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Lens informations editor: add Digital Zoom Ratio settings CCBUGS: 103255 M +46 -15 exiflens.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exiflens.cpp #598650:598651 @@ -54,14 +54,16 @@ EXIFLensPriv() { - apertureCheck = 0; - maxApertureCheck = 0; - focalLength35mmCheck = 0; - focalLengthCheck = 0; - apertureCB = 0; - maxApertureCB = 0; - focalLength35mmEdit = 0; - focalLengthEdit = 0; + apertureCheck = 0; + maxApertureCheck = 0; + focalLength35mmCheck = 0; + focalLengthCheck = 0; + digitalZoomRatioCheck = 0; + apertureCB = 0; + maxApertureCB = 0; + focalLength35mmEdit = 0; + focalLengthEdit = 0; + digitalZoomRatioEdit = 0; apertureValues.append("f/1.0"); apertureValues.append("f/1.1"); @@ -129,6 +131,7 @@ QCheckBox *maxApertureCheck; QCheckBox *focalLength35mmCheck; QCheckBox *focalLengthCheck; + QCheckBox *digitalZoomRatioCheck; QComboBox *apertureCB; QComboBox *maxApertureCB; @@ -136,6 +139,7 @@ KIntSpinBox *focalLength35mmEdit; KDoubleSpinBox *focalLengthEdit; + KDoubleSpinBox *digitalZoomRatioEdit; }; EXIFLens::EXIFLens(QWidget* parent, QByteArray& exifData) @@ -143,12 +147,12 @@ { d = new EXIFLensPriv; - QGridLayout* grid = new QGridLayout(parent, 4, 2, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 5, 2, KDialog::spacingHint()); // -------------------------------------------------------- d->focalLengthCheck = new QCheckBox(i18n("Focal length (mm):"), parent); - d->focalLengthEdit = new KDoubleSpinBox(1, 10000, 1, 50, 1, parent); + d->focalLengthEdit = new KDoubleSpinBox(1.0, 10000.0, 1.0, 50.0, 1, parent); grid->addMultiCellWidget(d->focalLengthCheck, 0, 0, 0, 0); grid->addMultiCellWidget(d->focalLengthEdit, 0, 0, 1, 1); QWhatsThis::add(d->focalLengthEdit, i18n("<p>Set here the lens focal lenght in milimeters " @@ -166,11 +170,20 @@ // -------------------------------------------------------- + d->digitalZoomRatioCheck = new QCheckBox(i18n("Digital zoom ratio:"), parent); + d->digitalZoomRatioEdit = new KDoubleSpinBox(0.0, 100.0, 0.1, 1.0, 1, parent); + grid->addMultiCellWidget(d->digitalZoomRatioCheck, 2, 2, 0, 0); + grid->addMultiCellWidget(d->digitalZoomRatioEdit, 2, 2, 1, 1); + QWhatsThis::add(d->digitalZoomRatioEdit, i18n("<p>Set here the digital zoom ratio " + "used by camera to take the picture.")); + + // -------------------------------------------------------- + d->apertureCheck = new QCheckBox(i18n("Lens aperture (f-number):"), parent); d->apertureCB = new QComboBox(false, parent); d->apertureCB->insertStringList(d->apertureValues); - grid->addMultiCellWidget(d->apertureCheck, 2, 2, 0, 0); - grid->addMultiCellWidget(d->apertureCB, 2, 2, 1, 1); + grid->addMultiCellWidget(d->apertureCheck, 3, 3, 0, 0); + grid->addMultiCellWidget(d->apertureCB, 3, 3, 1, 1); QWhatsThis::add(d->apertureCB, i18n("<p>Select here the lens aperture used by camera " "to take the picture.")); @@ -179,14 +192,14 @@ d->maxApertureCheck = new QCheckBox(i18n("Max. lens aperture (f-number):"), parent); d->maxApertureCB = new QComboBox(false, parent); d->maxApertureCB->insertStringList(d->apertureValues); - grid->addMultiCellWidget(d->maxApertureCheck, 3, 3, 0, 0); - grid->addMultiCellWidget(d->maxApertureCB, 3, 3, 1, 1); + grid->addMultiCellWidget(d->maxApertureCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->maxApertureCB, 4, 4, 1, 1); QWhatsThis::add(d->maxApertureCB, i18n("<p>Select here the smallest aperture of the lens used by camera " "to take the picture.")); grid->setColStretch(1, 10); grid->setColStretch(2, 10); - grid->setRowStretch(4, 10); + grid->setRowStretch(5, 10); // -------------------------------------------------------- @@ -196,6 +209,9 @@ connect(d->focalLength35mmCheck, SIGNAL(toggled(bool)), d->focalLength35mmEdit, SLOT(setEnabled(bool))); + connect(d->digitalZoomRatioCheck, SIGNAL(toggled(bool)), + d->digitalZoomRatioEdit, SLOT(setEnabled(bool))); + connect(d->apertureCheck, SIGNAL(toggled(bool)), d->apertureCB, SLOT(setEnabled(bool))); @@ -233,6 +249,13 @@ } d->focalLength35mmEdit->setEnabled(d->focalLength35mmCheck->isChecked()); + if (exiv2Iface.getExifTagRational("Exif.Photo.DigitalZoomRatio", num, den)) + { + d->digitalZoomRatioEdit->setValue((num == 0) ? 0.0 : (double)(num) / (double)(den)); + d->digitalZoomRatioCheck->setChecked(true); + } + d->digitalZoomRatioEdit->setEnabled(d->digitalZoomRatioCheck->isChecked()); + if (exiv2Iface.getExifTagRational("Exif.Photo.FNumber", num, den)) { QString fnumber = QString::number((double)(num)/(double)(den), 'f', 1); @@ -313,6 +336,14 @@ else exiv2Iface.removeExifTag("Exif.Photo.FocalLengthIn35mmFilm"); + if (d->digitalZoomRatioCheck->isChecked()) + { + exiv2Iface.convertToRational(d->digitalZoomRatioEdit->value(), &num, &den, 1); + exiv2Iface.setExifTagRational("Exif.Photo.DigitalZoomRatio", num, den); + } + else + exiv2Iface.removeExifTag("Exif.Photo.DigitalZoomRatio"); + if (d->apertureCheck->isChecked()) { exiv2Iface.convertToRational(d->apertureCB->currentText().remove(0, 2).toDouble(), &num, &den, 1); SVN commit 598655 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Exposure informations editor: add Exposure Bias Value settings CCBUGS: 103255 M +38 -6 exifexposure.cpp M +5 -6 exiflens.cpp M +1 -2 exiflight.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #598654:598655 @@ -57,6 +57,7 @@ exposureTimeCheck = 0; exposureProgramCheck = 0; exposureModeCheck = 0; + exposureBiasCheck = 0; ISOSpeedCheck = 0; meteringModeCheck = 0; exposureProgramCB = 0; @@ -65,11 +66,13 @@ meteringModeCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; + exposureBiasEdit = 0; } QCheckBox *exposureTimeCheck; QCheckBox *exposureProgramCheck; QCheckBox *exposureModeCheck; + QCheckBox *exposureBiasCheck; QCheckBox *ISOSpeedCheck; QCheckBox *meteringModeCheck; @@ -80,6 +83,8 @@ KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; + + KDoubleSpinBox *exposureBiasEdit; }; EXIFExposure::EXIFExposure(QWidget* parent, QByteArray& exifData) @@ -87,7 +92,7 @@ { d = new EXIFExposurePriv; - QGridLayout* grid = new QGridLayout(parent, 5, 5, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 6, 5, KDialog::spacingHint()); // -------------------------------------------------------- @@ -138,6 +143,15 @@ // -------------------------------------------------------- + d->exposureBiasCheck = new QCheckBox(i18n("Exposure Bias (APEX):"), parent); + d->exposureBiasEdit = new KDoubleSpinBox(-99.99, 99.99, 0.1, 0.0, 2, parent); + grid->addMultiCellWidget(d->exposureBiasCheck, 3, 3, 0, 0); + grid->addMultiCellWidget(d->exposureBiasEdit, 3, 3, 2, 2); + QWhatsThis::add(d->exposureBiasEdit, i18n("<p>Set here the exposure bias value in APEX unit " + "used by camera to take the picture.")); + + // -------------------------------------------------------- + d->meteringModeCheck = new QCheckBox(i18n("Metering mode:"), parent); d->meteringModeCB = new QComboBox(false, parent); d->meteringModeCB->insertItem(i18n("Unknown"), 0); @@ -148,8 +162,8 @@ d->meteringModeCB->insertItem(i18n("Multi-segment"), 5); d->meteringModeCB->insertItem(i18n("Partial"), 6); d->meteringModeCB->insertItem(i18n("Other"), 7); - grid->addMultiCellWidget(d->meteringModeCheck, 3, 3, 0, 0); - grid->addMultiCellWidget(d->meteringModeCB, 3, 3, 2, 5); + grid->addMultiCellWidget(d->meteringModeCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->meteringModeCB, 4, 4, 2, 5); QWhatsThis::add(d->meteringModeCB, i18n("<p>Select here the metering mode used by the camera " "to set exposure when the picture have been shot.")); @@ -193,14 +207,14 @@ d->ISOSpeedCB->insertItem("20000", 33); d->ISOSpeedCB->insertItem("25000", 34); d->ISOSpeedCB->insertItem("32000", 35); - grid->addMultiCellWidget(d->ISOSpeedCheck, 4, 4, 0, 0); - grid->addMultiCellWidget(d->ISOSpeedCB, 4, 4, 2, 5); + grid->addMultiCellWidget(d->ISOSpeedCheck, 5, 5, 0, 0); + grid->addMultiCellWidget(d->ISOSpeedCB, 5, 5, 2, 5); QWhatsThis::add(d->ISOSpeedCB, i18n("<p>Select here the ISO Speed of the camera " "witch have taken the picture.")); grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(5, 10); + grid->setRowStretch(6, 10); // -------------------------------------------------------- @@ -216,6 +230,9 @@ connect(d->exposureModeCheck, SIGNAL(toggled(bool)), d->exposureModeCB, SLOT(setEnabled(bool))); + connect(d->exposureBiasCheck, SIGNAL(toggled(bool)), + d->exposureBiasEdit, SLOT(setEnabled(bool))); + connect(d->meteringModeCheck, SIGNAL(toggled(bool)), d->meteringModeCB, SLOT(setEnabled(bool))); @@ -274,6 +291,13 @@ } d->exposureModeCB->setEnabled(d->exposureModeCheck->isChecked()); + if (exiv2Iface.getExifTagRational("Exif.Photo.ExposureBiasValue", num, den)) + { + d->exposureBiasEdit->setValue((double)(num) / (double)(den)); + d->exposureBiasCheck->setChecked(true); + } + d->exposureBiasEdit->setEnabled(d->exposureBiasCheck->isChecked()); + if (exiv2Iface.getExifTagLong("Exif.Photo.MeteringMode", val)) { d->meteringModeCB->setCurrentItem(val > 6 ? 7 : val); @@ -330,6 +354,14 @@ else exiv2Iface.removeExifTag("Exif.Photo.ExposureMode"); + if (d->exposureBiasCheck->isChecked()) + { + exiv2Iface.convertToRational(d->exposureBiasEdit->value(), &num, &den, 1); + exiv2Iface.setExifTagRational("Exif.Photo.ExposureBiasValue", num, den); + } + else + exiv2Iface.removeExifTag("Exif.Photo.ExposureBiasValue"); + if (d->meteringModeCheck->isChecked()) { long met = d->meteringModeCB->currentItem(); --- trunk/extragear/libs/kipi-plugins/metadataedit/exiflens.cpp #598654:598655 @@ -154,7 +154,7 @@ d->focalLengthCheck = new QCheckBox(i18n("Focal length (mm):"), parent); d->focalLengthEdit = new KDoubleSpinBox(1.0, 10000.0, 1.0, 50.0, 1, parent); grid->addMultiCellWidget(d->focalLengthCheck, 0, 0, 0, 0); - grid->addMultiCellWidget(d->focalLengthEdit, 0, 0, 1, 1); + grid->addMultiCellWidget(d->focalLengthEdit, 0, 0, 2, 2); QWhatsThis::add(d->focalLengthEdit, i18n("<p>Set here the lens focal lenght in milimeters " "used by camera to take the picture.")); @@ -163,7 +163,7 @@ d->focalLength35mmCheck = new QCheckBox(i18n("Focal length in 35mm film (mm):"), parent); d->focalLength35mmEdit = new KIntSpinBox(1, 10000, 1, 1, 10, parent); grid->addMultiCellWidget(d->focalLength35mmCheck, 1, 1, 0, 0); - grid->addMultiCellWidget(d->focalLength35mmEdit, 1, 1, 1, 1); + grid->addMultiCellWidget(d->focalLength35mmEdit, 1, 1, 2, 2); QWhatsThis::add(d->focalLength35mmEdit, i18n("<p>Set here equivalent focal length assuming " "a 35mm film camera, in mm. A value of 0 means the focal " "length is unknown.")); @@ -173,7 +173,7 @@ d->digitalZoomRatioCheck = new QCheckBox(i18n("Digital zoom ratio:"), parent); d->digitalZoomRatioEdit = new KDoubleSpinBox(0.0, 100.0, 0.1, 1.0, 1, parent); grid->addMultiCellWidget(d->digitalZoomRatioCheck, 2, 2, 0, 0); - grid->addMultiCellWidget(d->digitalZoomRatioEdit, 2, 2, 1, 1); + grid->addMultiCellWidget(d->digitalZoomRatioEdit, 2, 2, 2, 2); QWhatsThis::add(d->digitalZoomRatioEdit, i18n("<p>Set here the digital zoom ratio " "used by camera to take the picture.")); @@ -183,7 +183,7 @@ d->apertureCB = new QComboBox(false, parent); d->apertureCB->insertStringList(d->apertureValues); grid->addMultiCellWidget(d->apertureCheck, 3, 3, 0, 0); - grid->addMultiCellWidget(d->apertureCB, 3, 3, 1, 1); + grid->addMultiCellWidget(d->apertureCB, 3, 3, 2, 2); QWhatsThis::add(d->apertureCB, i18n("<p>Select here the lens aperture used by camera " "to take the picture.")); @@ -193,12 +193,11 @@ d->maxApertureCB = new QComboBox(false, parent); d->maxApertureCB->insertStringList(d->apertureValues); grid->addMultiCellWidget(d->maxApertureCheck, 4, 4, 0, 0); - grid->addMultiCellWidget(d->maxApertureCB, 4, 4, 1, 1); + grid->addMultiCellWidget(d->maxApertureCB, 4, 4, 2, 2); QWhatsThis::add(d->maxApertureCB, i18n("<p>Select here the smallest aperture of the lens used by camera " "to take the picture.")); grid->setColStretch(1, 10); - grid->setColStretch(2, 10); grid->setRowStretch(5, 10); // -------------------------------------------------------- --- trunk/extragear/libs/kipi-plugins/metadataedit/exiflight.cpp #598654:598655 @@ -152,7 +152,7 @@ d->lightSourceCB->insertItem(i18n("ISO studio tungsten"), 19); d->lightSourceCB->insertItem(i18n("Other light source"), 20); grid->addMultiCellWidget(d->lightSourceCheck, 0, 0, 0, 0); - grid->addMultiCellWidget(d->lightSourceCB, 0, 0, 2, 5); + grid->addMultiCellWidget(d->lightSourceCB, 0, 0, 2, 3); QWhatsThis::add(d->lightSourceCB, i18n("<p>Select here the kind of light source used " "to take the picture.")); @@ -195,7 +195,6 @@ grid->setColStretch(1, 10); - grid->setColStretch(3, 10); grid->setRowStretch(4, 10); // -------------------------------------------------------- SVN commit 598657 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Exposure informations editor: handle Exposure Index settings accordinly with ISO Speed Rating settings CCBUGS: 103255 M +22 -0 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #598656:598657 @@ -318,6 +318,20 @@ d->ISOSpeedCheck->setChecked(true); } } + else if (exiv2Iface.getExifTagRational("Exif.Photo.ExposureIndex", num, den)) + { + val = num / den; + int item = -1; + for (int i = 0 ; i < d->ISOSpeedCB->count() ; i++) + if (d->ISOSpeedCB->text(i) == QString::number(val)) + item = i; + + if (item != -1) + { + d->ISOSpeedCB->setCurrentItem(item); + d->ISOSpeedCheck->setChecked(true); + } + } d->ISOSpeedCB->setEnabled(d->ISOSpeedCheck->isChecked()); } @@ -371,9 +385,17 @@ exiv2Iface.removeExifTag("Exif.Photo.MeteringMode"); if (d->ISOSpeedCheck->isChecked()) + { exiv2Iface.setExifTagLong("Exif.Photo.ISOSpeedRatings", d->ISOSpeedCB->currentText().toLong()); + + exiv2Iface.convertToRational(d->ISOSpeedCB->currentText().toDouble(), &num, &den, 1); + exiv2Iface.setExifTagRational("Exif.Photo.ExposureIndex", num, den); + } else + { exiv2Iface.removeExifTag("Exif.Photo.ISOSpeedRatings"); + exiv2Iface.removeExifTag("Exif.Photo.ExposureIndex"); + } exifData = exiv2Iface.getExif(); } SVN commit 598732 by cgilles: kipiplugins from trunk : MetadataEdit plugin: add Exif Picture Adjustments informations editor CCBUGS: 103255 M +1 -1 Makefile.am A exifadjust.cpp [License: GPL] A exifadjust.h [License: GPL] M +10 -0 exifeditdialog.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/Makefile.am #598731:598732 @@ -14,7 +14,7 @@ iptccredits.cpp iptcstatus.cpp iptcorigin.cpp \ iptcdatetime.cpp iptckeywords.cpp iptccategories.cpp \ exifeditdialog.cpp exifcaption.cpp exifdatetime.cpp \ - exiflens.cpp exifexposure.cpp exiflight.cpp + exiflens.cpp exifexposure.cpp exiflight.cpp exifadjust.cpp # Libs needed by the plugin kipiplugin_metadataedit_la_LIBADD = $(top_builddir)/kipi-plugins/common/exiv2iface/libexiv2iface.la \ --- trunk/extragear/libs/kipi-plugins/metadataedit/exifeditdialog.cpp #598731:598732 @@ -42,6 +42,7 @@ #include "exiflens.h" #include "exifexposure.h" #include "exiflight.h" +#include "exifadjust.h" #include "exifeditdialog.h" #include "exifeditdialog.moc" @@ -60,12 +61,14 @@ page_lens = 0; page_exposure = 0; page_light = 0; + page_adjust = 0; captionPage = 0; datetimePage = 0; lensPage = 0; exposurePage = 0; lightPage = 0; + adjustPage = 0; } QByteArray exifData; @@ -75,12 +78,14 @@ QFrame *page_lens; QFrame *page_exposure; QFrame *page_light; + QFrame *page_adjust; EXIFCaption *captionPage; EXIFDateTime *datetimePage; EXIFLens *lensPage; EXIFExposure *exposurePage; EXIFLight *lightPage; + EXIFAdjust *adjustPage; }; EXIFEditDialog::EXIFEditDialog(QWidget* parent, QByteArray exifData, const QString& fileName) @@ -112,6 +117,10 @@ BarIcon("idea", KIcon::SizeMedium)); d->lightPage = new EXIFLight(d->page_light, d->exifData); + d->page_adjust = addPage(i18n("Adjustments"), i18n("Pictures Adjustments Informations"), + BarIcon("blend", KIcon::SizeMedium)); + d->adjustPage = new EXIFAdjust(d->page_adjust, d->exifData); + readSettings(); show(); } @@ -163,6 +172,7 @@ d->lensPage->applyMetadata(d->exifData); d->exposurePage->applyMetadata(d->exifData); d->lightPage->applyMetadata(d->exifData); + d->adjustPage->applyMetadata(d->exifData); saveSettings(); accept(); SVN commit 598734 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Picture Adjustments informations editor: add Contrast settings CCBUGS: 103255 M +30 -0 exifadjust.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifadjust.cpp #598733:598734 @@ -56,14 +56,18 @@ { brightnessCheck = 0; gainControlCheck = 0; + contrastCheck = 0; brightnessEdit = 0; gainControlCB = 0; + contrastCB = 0; } QCheckBox *brightnessCheck; QCheckBox *gainControlCheck; + QCheckBox *contrastCheck; QComboBox *gainControlCB; + QComboBox *contrastCB; KDoubleSpinBox *brightnessEdit; }; @@ -98,7 +102,18 @@ QWhatsThis::add(d->gainControlCB, i18n("<p>Set here the degree of overall image gain adjustment " "used by camera to take the picture.")); + // -------------------------------------------------------- + d->contrastCheck = new QCheckBox(i18n("Contrast:"), parent); + d->contrastCB = new QComboBox(false, parent); + d->contrastCB->insertItem(i18n("Normal"), 0); + d->contrastCB->insertItem(i18n("Soft"), 1); + d->contrastCB->insertItem(i18n("Hard"), 2); + grid->addMultiCellWidget(d->contrastCheck, 2, 2, 0, 0); + grid->addMultiCellWidget(d->contrastCB, 2, 2, 2, 2); + QWhatsThis::add(d->contrastCB, i18n("<p>Set here the direction of contrast processing " + "applied by the camera to take the picture.")); + grid->setColStretch(1, 10); grid->setRowStretch(6, 10); @@ -110,6 +125,9 @@ connect(d->gainControlCheck, SIGNAL(toggled(bool)), d->gainControlCB, SLOT(setEnabled(bool))); + connect(d->contrastCheck, SIGNAL(toggled(bool)), + d->contrastCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -140,6 +158,13 @@ d->gainControlCheck->setChecked(true); } d->gainControlCB->setEnabled(d->gainControlCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.Contrast", val)) + { + d->contrastCB->setCurrentItem(val); + d->contrastCheck->setChecked(true); + } + d->contrastCB->setEnabled(d->contrastCheck->isChecked()); } void EXIFAdjust::applyMetadata(QByteArray& exifData) @@ -161,6 +186,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.GainControl"); + if (d->contrastCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.Contrast", d->contrastCB->currentItem()); + else + exiv2Iface.removeExifTag("Exif.Photo.Contrast"); + exifData = exiv2Iface.getExif(); } SVN commit 598735 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Picture Adjustments informations editor: add Saturation settings CCBUGS: 103255 M +31 -0 exifadjust.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifadjust.cpp #598734:598735 @@ -57,17 +57,21 @@ brightnessCheck = 0; gainControlCheck = 0; contrastCheck = 0; + saturationCheck = 0; brightnessEdit = 0; gainControlCB = 0; contrastCB = 0; + saturationCB = 0; } QCheckBox *brightnessCheck; QCheckBox *gainControlCheck; QCheckBox *contrastCheck; + QCheckBox *saturationCheck; QComboBox *gainControlCB; QComboBox *contrastCB; + QComboBox *saturationCB; KDoubleSpinBox *brightnessEdit; }; @@ -114,6 +118,18 @@ QWhatsThis::add(d->contrastCB, i18n("<p>Set here the direction of contrast processing " "applied by the camera to take the picture.")); + // -------------------------------------------------------- + + d->saturationCheck = new QCheckBox(i18n("Saturation:"), parent); + d->saturationCB = new QComboBox(false, parent); + d->saturationCB->insertItem(i18n("Normal"), 0); + d->saturationCB->insertItem(i18n("Low"), 1); + d->saturationCB->insertItem(i18n("High"), 2); + grid->addMultiCellWidget(d->saturationCheck, 3, 3, 0, 0); + grid->addMultiCellWidget(d->saturationCB, 3, 3, 2, 2); + QWhatsThis::add(d->saturationCB, i18n("<p>Set here the direction of saturation processing " + "applied by the camera to take the picture.")); + grid->setColStretch(1, 10); grid->setRowStretch(6, 10); @@ -128,6 +144,9 @@ connect(d->contrastCheck, SIGNAL(toggled(bool)), d->contrastCB, SLOT(setEnabled(bool))); + connect(d->saturationCheck, SIGNAL(toggled(bool)), + d->saturationCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -165,6 +184,13 @@ d->contrastCheck->setChecked(true); } d->contrastCB->setEnabled(d->contrastCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.Saturation", val)) + { + d->saturationCB->setCurrentItem(val); + d->saturationCheck->setChecked(true); + } + d->saturationCB->setEnabled(d->saturationCheck->isChecked()); } void EXIFAdjust::applyMetadata(QByteArray& exifData) @@ -191,6 +217,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.Contrast"); + if (d->saturationCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.Saturation", d->saturationCB->currentItem()); + else + exiv2Iface.removeExifTag("Exif.Photo.Saturation"); + exifData = exiv2Iface.getExif(); } SVN commit 598736 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Picture Adjustments informations editor: add Sharpness settings CCBUGS: 103255 M +33 -2 exifadjust.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifadjust.cpp #598735:598736 @@ -58,20 +58,24 @@ gainControlCheck = 0; contrastCheck = 0; saturationCheck = 0; + sharpnessCheck = 0; brightnessEdit = 0; gainControlCB = 0; contrastCB = 0; saturationCB = 0; + sharpnessCB = 0; } QCheckBox *brightnessCheck; QCheckBox *gainControlCheck; QCheckBox *contrastCheck; QCheckBox *saturationCheck; + QCheckBox *sharpnessCheck; QComboBox *gainControlCB; QComboBox *contrastCB; QComboBox *saturationCB; + QComboBox *sharpnessCB; KDoubleSpinBox *brightnessEdit; }; @@ -81,7 +85,7 @@ { d = new EXIFAdjustPriv; - QGridLayout* grid = new QGridLayout(parent, 6, 2, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 5, 2, KDialog::spacingHint()); // -------------------------------------------------------- @@ -130,8 +134,20 @@ QWhatsThis::add(d->saturationCB, i18n("<p>Set here the direction of saturation processing " "applied by the camera to take the picture.")); + // -------------------------------------------------------- + + d->sharpnessCheck = new QCheckBox(i18n("Sharpness:"), parent); + d->sharpnessCB = new QComboBox(false, parent); + d->sharpnessCB->insertItem(i18n("Normal"), 0); + d->sharpnessCB->insertItem(i18n("Soft"), 1); + d->sharpnessCB->insertItem(i18n("Hard"), 2); + grid->addMultiCellWidget(d->sharpnessCheck, 4, 4, 0, 0); + grid->addMultiCellWidget(d->sharpnessCB, 4, 4, 2, 2); + QWhatsThis::add(d->sharpnessCB, i18n("<p>Set here the direction of sharpness processing " + "applied by the camera to take the picture.")); + grid->setColStretch(1, 10); - grid->setRowStretch(6, 10); + grid->setRowStretch(5, 10); // -------------------------------------------------------- @@ -147,6 +163,9 @@ connect(d->saturationCheck, SIGNAL(toggled(bool)), d->saturationCB, SLOT(setEnabled(bool))); + connect(d->sharpnessCheck, SIGNAL(toggled(bool)), + d->sharpnessCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -191,6 +210,13 @@ d->saturationCheck->setChecked(true); } d->saturationCB->setEnabled(d->saturationCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.Sharpness", val)) + { + d->sharpnessCB->setCurrentItem(val); + d->sharpnessCheck->setChecked(true); + } + d->sharpnessCB->setEnabled(d->sharpnessCheck->isChecked()); } void EXIFAdjust::applyMetadata(QByteArray& exifData) @@ -222,6 +248,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.Saturation"); + if (d->sharpnessCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.Sharpness", d->sharpnessCB->currentItem()); + else + exiv2Iface.removeExifTag("Exif.Photo.Sharpness"); + exifData = exiv2Iface.getExif(); } SVN commit 598741 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Picture Adjustments informations editor: add Custom Rendered settings CCBUGS: 103255 M +42 -12 exifadjust.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifadjust.cpp #598740:598741 @@ -54,16 +54,18 @@ EXIFAdjustPriv() { - brightnessCheck = 0; - gainControlCheck = 0; - contrastCheck = 0; - saturationCheck = 0; - sharpnessCheck = 0; - brightnessEdit = 0; - gainControlCB = 0; - contrastCB = 0; - saturationCB = 0; - sharpnessCB = 0; + brightnessCheck = 0; + gainControlCheck = 0; + contrastCheck = 0; + saturationCheck = 0; + sharpnessCheck = 0; + customRenderedCheck = 0; + brightnessEdit = 0; + gainControlCB = 0; + contrastCB = 0; + saturationCB = 0; + sharpnessCB = 0; + customRenderedCB = 0; } QCheckBox *brightnessCheck; @@ -71,11 +73,13 @@ QCheckBox *contrastCheck; QCheckBox *saturationCheck; QCheckBox *sharpnessCheck; + QCheckBox *customRenderedCheck; QComboBox *gainControlCB; QComboBox *contrastCB; QComboBox *saturationCB; QComboBox *sharpnessCB; + QComboBox *customRenderedCB; KDoubleSpinBox *brightnessEdit; }; @@ -85,7 +89,7 @@ { d = new EXIFAdjustPriv; - QGridLayout* grid = new QGridLayout(parent, 5, 2, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 6, 2, KDialog::spacingHint()); // -------------------------------------------------------- @@ -146,8 +150,19 @@ QWhatsThis::add(d->sharpnessCB, i18n("<p>Set here the direction of sharpness processing " "applied by the camera to take the picture.")); + // -------------------------------------------------------- + + d->customRenderedCheck = new QCheckBox(i18n("Custom rendered:"), parent); + d->customRenderedCB = new QComboBox(false, parent); + d->customRenderedCB->insertItem(i18n("Normal process"), 0); + d->customRenderedCB->insertItem(i18n("Custom process"), 1); + grid->addMultiCellWidget(d->customRenderedCheck, 5, 5, 0, 0); + grid->addMultiCellWidget(d->customRenderedCB, 5, 5, 2, 2); + QWhatsThis::add(d->customRenderedCB, i18n("<p>Set here the use of special processing on " + "image data, such as rendering geared to output.")); + grid->setColStretch(1, 10); - grid->setRowStretch(5, 10); + grid->setRowStretch(6, 10); // -------------------------------------------------------- @@ -166,6 +181,9 @@ connect(d->sharpnessCheck, SIGNAL(toggled(bool)), d->sharpnessCB, SLOT(setEnabled(bool))); + connect(d->customRenderedCheck, SIGNAL(toggled(bool)), + d->customRenderedCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -217,6 +235,13 @@ d->sharpnessCheck->setChecked(true); } d->sharpnessCB->setEnabled(d->sharpnessCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.CustomRendered", val)) + { + d->customRenderedCB->setCurrentItem(val); + d->customRenderedCheck->setChecked(true); + } + d->customRenderedCB->setEnabled(d->customRenderedCheck->isChecked()); } void EXIFAdjust::applyMetadata(QByteArray& exifData) @@ -253,6 +278,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.Sharpness"); + if (d->customRenderedCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.CustomRendered", d->customRenderedCB->currentItem()); + else + exiv2Iface.removeExifTag("Exif.Photo.CustomRendered"); + exifData = exiv2Iface.getExif(); } SVN commit 598747 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Exposure informations editor: add Sensing Method settings CCBUGS: 103255 M +40 -2 exifexposure.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifexposure.cpp #598746:598747 @@ -60,10 +60,12 @@ exposureBiasCheck = 0; ISOSpeedCheck = 0; meteringModeCheck = 0; + sensingMethodCheck = 0; exposureProgramCB = 0; exposureModeCB = 0; ISOSpeedCB = 0; meteringModeCB = 0; + sensingMethodCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; exposureBiasEdit = 0; @@ -75,11 +77,13 @@ QCheckBox *exposureBiasCheck; QCheckBox *ISOSpeedCheck; QCheckBox *meteringModeCheck; + QCheckBox *sensingMethodCheck; QComboBox *exposureProgramCB; QComboBox *exposureModeCB; QComboBox *ISOSpeedCB; QComboBox *meteringModeCB; + QComboBox *sensingMethodCB; KIntSpinBox *exposureTimeNumEdit; KIntSpinBox *exposureTimeDenEdit; @@ -92,7 +96,7 @@ { d = new EXIFExposurePriv; - QGridLayout* grid = new QGridLayout(parent, 6, 5, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 7, 5, KDialog::spacingHint()); // -------------------------------------------------------- @@ -212,9 +216,25 @@ QWhatsThis::add(d->ISOSpeedCB, i18n("<p>Select here the ISO Speed of the camera " "witch have taken the picture.")); + // -------------------------------------------------------- + + d->sensingMethodCheck = new QCheckBox(i18n("Sensing method:"), parent); + d->sensingMethodCB = new QComboBox(false, parent); + d->sensingMethodCB->insertItem(i18n("Not defined"), 0); + d->sensingMethodCB->insertItem(i18n("One-chip color area"), 1); + d->sensingMethodCB->insertItem(i18n("Two-chip color area"), 2); + d->sensingMethodCB->insertItem(i18n("Three-chip color area"), 3); + d->sensingMethodCB->insertItem(i18n("Color sequential area"), 4); + d->sensingMethodCB->insertItem(i18n("Trilinear sensor"), 5); + d->sensingMethodCB->insertItem(i18n("Color sequential linear"), 6); + grid->addMultiCellWidget(d->sensingMethodCheck, 6, 6, 0, 0); + grid->addMultiCellWidget(d->sensingMethodCB, 6, 6, 2, 5); + QWhatsThis::add(d->sensingMethodCB, i18n("<p>Select here the image sensor type used by the camera " + "to take the picture.")); + grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(6, 10); + grid->setRowStretch(7, 10); // -------------------------------------------------------- @@ -239,6 +259,9 @@ connect(d->ISOSpeedCheck, SIGNAL(toggled(bool)), d->ISOSpeedCB, SLOT(setEnabled(bool))); + connect(d->sensingMethodCheck, SIGNAL(toggled(bool)), + d->sensingMethodCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -333,6 +356,13 @@ } } d->ISOSpeedCB->setEnabled(d->ISOSpeedCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.SensingMethod", val)) + { + d->sensingMethodCB->setCurrentItem(val > 6 ? val-2 : val-1); + d->sensingMethodCheck->setChecked(true); + } + d->sensingMethodCB->setEnabled(d->sensingMethodCheck->isChecked()); } void EXIFExposure::applyMetadata(QByteArray& exifData) @@ -397,6 +427,14 @@ exiv2Iface.removeExifTag("Exif.Photo.ExposureIndex"); } + if (d->sensingMethodCheck->isChecked()) + { + long sem = d->sensingMethodCB->currentItem(); + exiv2Iface.setExifTagLong("Exif.Photo.SensingMethod", sem > 4 ? sem+2 : sem+1); + } + else + exiv2Iface.removeExifTag("Exif.Photo.SensingMethod"); + exifData = exiv2Iface.getExif(); } SVN commit 598985 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Device informations editor: add File Source settings CCBUGS: 103255 M +34 -2 exifdevice.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifdevice.cpp #598984:598985 @@ -58,6 +58,7 @@ { makeCheck = 0; modelCheck = 0; + deviceTypeCheck = 0; exposureTimeCheck = 0; exposureProgramCheck = 0; exposureModeCheck = 0; @@ -79,6 +80,7 @@ QCheckBox *makeCheck; QCheckBox *modelCheck; + QCheckBox *deviceTypeCheck; QCheckBox *exposureTimeCheck; QCheckBox *exposureProgramCheck; QCheckBox *exposureModeCheck; @@ -87,6 +89,7 @@ QCheckBox *meteringModeCheck; QCheckBox *sensingMethodCheck; + QComboBox *deviceTypeCB; QComboBox *exposureProgramCB; QComboBox *exposureModeCB; QComboBox *ISOSpeedCB; @@ -115,7 +118,7 @@ // -------------------------------------------------------- - d->makeCheck = new QCheckBox(i18n("Make (*):"), parent); + d->makeCheck = new QCheckBox(i18n("Device manufacturer (*):"), parent); d->makeEdit = new KLineEdit(parent); d->makeEdit->setValidator(asciiValidator); grid->addMultiCellWidget(d->makeCheck, 0, 0, 0, 0); @@ -125,7 +128,7 @@ // -------------------------------------------------------- - d->modelCheck = new QCheckBox(i18n("Model (*):"), parent); + d->modelCheck = new QCheckBox(i18n("Device model (*):"), parent); d->modelEdit = new KLineEdit(parent); d->modelEdit->setValidator(asciiValidator); grid->addMultiCellWidget(d->modelCheck, 1, 1, 0, 0); @@ -135,6 +138,20 @@ // -------------------------------------------------------- + d->deviceTypeCheck = new QCheckBox(i18n("Device type:"), parent); + d->deviceTypeCB = new QComboBox(false, parent); + d->deviceTypeCB->insertItem(i18n("Film scanner"), 0); + d->deviceTypeCB->insertItem(i18n("Reflection print scanner"), 1); + d->deviceTypeCB->insertItem(i18n("Digital camera"), 2); + d->deviceTypeCheck->setTristate(true); + + grid->addMultiCellWidget(d->deviceTypeCheck, 2, 2, 0, 0); + grid->addMultiCellWidget(d->deviceTypeCB, 2, 2, 2, 5); + QWhatsThis::add(d->deviceTypeCB, i18n("<p>Select here the image input equipment type used to " + "generate the picture.")); + + // -------------------------------------------------------- + d->exposureTimeCheck = new QCheckBox(i18n("Exposure time (seconds):"), parent); d->exposureTimeNumEdit = new KIntSpinBox(1, 100000, 1, 1, 10, parent); d->exposureTimeDenEdit = new KIntSpinBox(1, 100000, 1, 1, 10, parent); @@ -285,6 +302,9 @@ connect(d->modelCheck, SIGNAL(toggled(bool)), d->modelEdit, SLOT(setEnabled(bool))); + connect(d->deviceTypeCheck, SIGNAL(toggled(bool)), + d->deviceTypeCB, SLOT(setEnabled(bool))); + connect(d->exposureTimeCheck, SIGNAL(toggled(bool)), d->exposureTimeNumEdit, SLOT(setEnabled(bool))); @@ -343,6 +363,13 @@ } d->modelEdit->setEnabled(d->modelCheck->isChecked()); + if (exiv2Iface.getExifTagLong("Exif.Photo.FileSource", val)) + { + d->deviceTypeCB->setCurrentItem(val-1); + d->deviceTypeCheck->setChecked(true); + } + d->deviceTypeCB->setEnabled(d->deviceTypeCheck->isChecked()); + if (exiv2Iface.getExifTagRational("Exif.Photo.ExposureTime", num, den)) { d->exposureTimeNumEdit->setValue(num); @@ -445,6 +472,11 @@ else exiv2Iface.removeExifTag("Exif.Image.Model"); + if (d->deviceTypeCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.FileSource", d->deviceTypeCB->currentItem()+1); + else + exiv2Iface.removeExifTag("Exif.Photo.FileSource"); + if (d->exposureTimeCheck->isChecked()) { exiv2Iface.setExifTagRational("Exif.Photo.ExposureTime", d->exposureTimeNumEdit->value(), SVN commit 598987 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Device informations editor: add Scene Capture Type settings CCBUGS: 103255 M +35 -3 exifdevice.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifdevice.cpp #598986:598987 @@ -66,11 +66,13 @@ ISOSpeedCheck = 0; meteringModeCheck = 0; sensingMethodCheck = 0; + sceneTypeCheck = 0; exposureProgramCB = 0; exposureModeCB = 0; ISOSpeedCB = 0; meteringModeCB = 0; sensingMethodCB = 0; + sceneTypeCB = 0; exposureTimeNumEdit = 0; exposureTimeDenEdit = 0; exposureBiasEdit = 0; @@ -88,6 +90,7 @@ QCheckBox *ISOSpeedCheck; QCheckBox *meteringModeCheck; QCheckBox *sensingMethodCheck; + QCheckBox *sceneTypeCheck; QComboBox *deviceTypeCB; QComboBox *exposureProgramCB; @@ -95,6 +98,7 @@ QComboBox *ISOSpeedCB; QComboBox *meteringModeCB; QComboBox *sensingMethodCB; + QComboBox *sceneTypeCB; KLineEdit *makeEdit; KLineEdit *modelEdit; @@ -110,7 +114,7 @@ { d = new EXIFDevicePriv; - QGridLayout* grid = new QGridLayout(parent, 11, 5, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 12, 5, KDialog::spacingHint()); // EXIF only accept printable Ascii char. QRegExp asciiRx("[\x20-\x7F]+$"); @@ -286,13 +290,26 @@ // -------------------------------------------------------- + d->sceneTypeCheck = new QCheckBox(i18n("Scene capture type:"), parent); + d->sceneTypeCB = new QComboBox(false, parent); + d->sceneTypeCB->insertItem(i18n("Standard"), 0); + d->sceneTypeCB->insertItem(i18n("Landscape"), 1); + d->sceneTypeCB->insertItem(i18n("Portrait"), 2); + d->sceneTypeCB->insertItem(i18n("Night scene"), 3); + grid->addMultiCellWidget(d->sceneTypeCheck, 10, 10, 0, 0); + grid->addMultiCellWidget(d->sceneTypeCB, 10, 10, 2, 5); + QWhatsThis::add(d->sceneTypeCB, i18n("<p>Select here the type of scene used by the camera " + "to take the picture.")); + + // -------------------------------------------------------- + QLabel *exifNote = new QLabel(i18n("<b>Note: EXIF text tags annoted by (*) only support printable " "ASCII characters set.</b>"), parent); - grid->addMultiCellWidget(exifNote, 10, 10, 0, 5); + grid->addMultiCellWidget(exifNote, 11, 11, 0, 5); grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(11, 10); + grid->setRowStretch(12, 10); // -------------------------------------------------------- @@ -329,6 +346,9 @@ connect(d->sensingMethodCheck, SIGNAL(toggled(bool)), d->sensingMethodCB, SLOT(setEnabled(bool))); + connect(d->sceneTypeCheck, SIGNAL(toggled(bool)), + d->sceneTypeCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -454,6 +474,13 @@ d->sensingMethodCheck->setChecked(true); } d->sensingMethodCB->setEnabled(d->sensingMethodCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.SceneCaptureType", val)) + { + d->sceneTypeCB->setCurrentItem(val); + d->sceneTypeCheck->setChecked(true); + } + d->sceneTypeCB->setEnabled(d->sceneTypeCheck->isChecked()); } void EXIFDevice::applyMetadata(QByteArray& exifData) @@ -541,6 +568,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.SensingMethod"); + if (d->sceneTypeCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.SceneCaptureType", d->sceneTypeCB->currentItem()); + else + exiv2Iface.removeExifTag("Exif.Photo.SceneCaptureType"); + exifData = exiv2Iface.getExif(); } SVN commit 598992 by cgilles: kipiplugins from trunk : MetadataEdit plugin: Exif Device informations editor: add Subject Distance Range settings CCBUGS: 103255 M +62 -32 exifdevice.cpp --- trunk/extragear/libs/kipi-plugins/metadataedit/exifdevice.cpp #598991:598992 @@ -56,28 +56,30 @@ EXIFDevicePriv() { - makeCheck = 0; - modelCheck = 0; - deviceTypeCheck = 0; - exposureTimeCheck = 0; - exposureProgramCheck = 0; - exposureModeCheck = 0; - exposureBiasCheck = 0; - ISOSpeedCheck = 0; - meteringModeCheck = 0; - sensingMethodCheck = 0; - sceneTypeCheck = 0; - exposureProgramCB = 0; - exposureModeCB = 0; - ISOSpeedCB = 0; - meteringModeCB = 0; - sensingMethodCB = 0; - sceneTypeCB = 0; - exposureTimeNumEdit = 0; - exposureTimeDenEdit = 0; - exposureBiasEdit = 0; - makeEdit = 0; - modelEdit = 0; + makeCheck = 0; + modelCheck = 0; + deviceTypeCheck = 0; + exposureTimeCheck = 0; + exposureProgramCheck = 0; + exposureModeCheck = 0; + exposureBiasCheck = 0; + ISOSpeedCheck = 0; + meteringModeCheck = 0; + sensingMethodCheck = 0; + sceneTypeCheck = 0; + subjectDistanceTypeCheck = 0; + exposureProgramCB = 0; + exposureModeCB = 0; + ISOSpeedCB = 0; + meteringModeCB = 0; + sensingMethodCB = 0; + sceneTypeCB = 0; + subjectDistanceTypeCB = 0; + exposureTimeNumEdit = 0; + exposureTimeDenEdit = 0; + exposureBiasEdit = 0; + makeEdit = 0; + modelEdit = 0; } QCheckBox *makeCheck; @@ -91,6 +93,7 @@ QCheckBox *meteringModeCheck; QCheckBox *sensingMethodCheck; QCheckBox *sceneTypeCheck; + QCheckBox *subjectDistanceTypeCheck; QComboBox *deviceTypeCB; QComboBox *exposureProgramCB; @@ -99,6 +102,7 @@ QComboBox *meteringModeCB; QComboBox *sensingMethodCB; QComboBox *sceneTypeCB; + QComboBox *subjectDistanceTypeCB; KLineEdit *makeEdit; KLineEdit *modelEdit; @@ -114,7 +118,7 @@ { d = new EXIFDevicePriv; - QGridLayout* grid = new QGridLayout(parent, 12, 5, KDialog::spacingHint()); + QGridLayout* grid = new QGridLayout(parent, 13, 5, KDialog::spacingHint()); // EXIF only accept printable Ascii char. QRegExp asciiRx("[\x20-\x7F]+$"); @@ -127,8 +131,8 @@ d->makeEdit->setValidator(asciiValidator); grid->addMultiCellWidget(d->makeCheck, 0, 0, 0, 0); grid->addMultiCellWidget(d->makeEdit, 0, 0, 2, 5); - QWhatsThis::add(d->makeEdit, i18n("<p>Set here the manufacturer of image input equipment. " - "This field is limited to ASCII characters.")); + QWhatsThis::add(d->makeEdit, i18n("<p>Set here the manufacturer of image input equipment used to " + "take the picture. This field is limited to ASCII characters.")); // -------------------------------------------------------- @@ -137,8 +141,8 @@ d->modelEdit->setValidator(asciiValidator); grid->addMultiCellWidget(d->modelCheck, 1, 1, 0, 0); grid->addMultiCellWidget(d->modelEdit, 1, 1, 2, 5); - QWhatsThis::add(d->modelEdit, i18n("<p>Set here the model of image input equipment. " - "This field is limited to ASCII characters.")); + QWhatsThis::add(d->modelEdit, i18n("<p>Set here the model of image input equipment used to " + "take the picture. This field is limited to ASCII characters.")); // -------------------------------------------------------- @@ -147,12 +151,10 @@ d->deviceTypeCB->insertItem(i18n("Film scanner"), 0); d->deviceTypeCB->insertItem(i18n("Reflection print scanner"), 1); d->deviceTypeCB->insertItem(i18n("Digital camera"), 2); - d->deviceTypeCheck->setTristate(true); - grid->addMultiCellWidget(d->deviceTypeCheck, 2, 2, 0, 0); grid->addMultiCellWidget(d->deviceTypeCB, 2, 2, 2, 5); QWhatsThis::add(d->deviceTypeCB, i18n("<p>Select here the image input equipment type used to " - "generate the picture.")); + "take the picture.")); // -------------------------------------------------------- @@ -303,13 +305,26 @@ // -------------------------------------------------------- + d->subjectDistanceTypeCheck = new QCheckBox(i18n("Subject distance type:"), parent); + d->subjectDistanceTypeCB = new QComboBox(false, parent); + d->subjectDistanceTypeCB->insertItem(i18n("Unknow"), 0); + d->subjectDistanceTypeCB->insertItem(i18n("Macro"), 1); + d->subjectDistanceTypeCB->insertItem(i18n("Close view"), 2); + d->subjectDistanceTypeCB->insertItem(i18n("Distant view"), 3); + grid->addMultiCellWidget(d->subjectDistanceTypeCheck, 11, 11, 0, 0); + grid->addMultiCellWidget(d->subjectDistanceTypeCB, 11, 11, 2, 5); + QWhatsThis::add(d->subjectDistanceTypeCB, i18n("<p>Select here the type of distance between " + "the subject and the image input equipment.")); + + // -------------------------------------------------------- + QLabel *exifNote = new QLabel(i18n("<b>Note: EXIF text tags annoted by (*) only support printable " "ASCII characters set.</b>"), parent); - grid->addMultiCellWidget(exifNote, 11, 11, 0, 5); + grid->addMultiCellWidget(exifNote, 12, 12, 0, 5); grid->setColStretch(1, 10); grid->setColStretch(5, 10); - grid->setRowStretch(12, 10); + grid->setRowStretch(13, 10); // -------------------------------------------------------- @@ -349,6 +364,9 @@ connect(d->sceneTypeCheck, SIGNAL(toggled(bool)), d->sceneTypeCB, SLOT(setEnabled(bool))); + connect(d->subjectDistanceTypeCheck, SIGNAL(toggled(bool)), + d->subjectDistanceTypeCB, SLOT(setEnabled(bool))); + // -------------------------------------------------------- readMetadata(exifData); @@ -481,6 +499,13 @@ d->sceneTypeCheck->setChecked(true); } d->sceneTypeCB->setEnabled(d->sceneTypeCheck->isChecked()); + + if (exiv2Iface.getExifTagLong("Exif.Photo.SubjectDistanceRange", val)) + { + d->subjectDistanceTypeCB->setCurrentItem(val); + d->subjectDistanceTypeCheck->setChecked(true); + } + d->subjectDistanceTypeCB->setEnabled(d->subjectDistanceTypeCheck->isChecked()); } void EXIFDevice::applyMetadata(QByteArray& exifData) @@ -573,6 +598,11 @@ else exiv2Iface.removeExifTag("Exif.Photo.SceneCaptureType"); + if (d->subjectDistanceTypeCheck->isChecked()) + exiv2Iface.setExifTagLong("Exif.Photo.SubjectDistanceRange", d->subjectDistanceTypeCB->currentItem()); + else + exiv2Iface.removeExifTag("Exif.Photo.SubjectDistanceRange"); + exifData = exiv2Iface.getExif(); } |