[Digikam-devel] [Bug 103255] wish: *add* (not edit) EXIF headers like date, comment etc

Gilles Caulier caulier.gilles at free.fr
Wed Oct 18 18:00:19 BST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=103255         




------- Additional Comments From caulier.gilles free fr  2006-10-18 19:00 -------
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();
 }



More information about the Digikam-devel mailing list