[solang] Read the nmm:flash and nmm:whiteBalance properties too



commit 24ad1c86b6057304a748cb6ba5351ae8aa4b67fa
Author: Debarshi Ray <rishi gnu org>
Date:   Mon Jan 25 12:31:48 2010 +0200

    Read the nmm:flash and nmm:whiteBalance properties too

 src/attribute/basic-exif-view.cpp |   19 +++++++++++++++
 src/common/exif-data.cpp          |   45 ++++++++++++++++++++++++++++++++++++-
 src/common/exif-data.h            |   17 +++++++++++++-
 src/common/photo.cpp              |   16 +++++++++----
 4 files changed, 90 insertions(+), 7 deletions(-)
---
diff --git a/src/attribute/basic-exif-view.cpp b/src/attribute/basic-exif-view.cpp
index fd170f7..6c3b8df 100644
--- a/src/attribute/basic-exif-view.cpp
+++ b/src/attribute/basic-exif-view.cpp
@@ -125,6 +125,25 @@ BasicExifView::populate(const ExifData& data) throw()
                                    = exposure_time_data;
     }
 
+    const Glib::ustring & flash_data = data.get_flash();
+
+    if (false == flash_data.empty())
+    {
+        const Glib::ustring flash_desc = _("Flash");
+        const ExifDataKeyPtr key(new ExifDataKey(
+                                     flash_desc,
+                                     "nmm:flash",
+                                     data.get_flash_enum()));
+
+        Gtk::TreeModel::iterator model_iter = listStore_->append();
+        Gtk::TreeModel::Row row = *model_iter;
+
+        row[modelColumnRecord_.get_column_key()] = key;
+        row[modelColumnRecord_.get_column_description()]
+                                   = flash_desc;
+        row[modelColumnRecord_.get_column_value()] = flash_data;
+    }
+
     const Glib::ustring & fnumber_data = data.get_fnumber();
 
     if (false == fnumber_data.empty())
diff --git a/src/common/exif-data.cpp b/src/common/exif-data.cpp
index c63d093..7471999 100644
--- a/src/common/exif-data.cpp
+++ b/src/common/exif-data.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
- * Copyright (C) 2009 Debarshi Ray <rishi gnu org>
+ * Copyright (C) 2009, 2010 Debarshi Ray <rishi gnu org>
  * Copyright (C) 2009 Santanu Sinha <santanu sinha gmail com>
  * 
  * Solang is free software: you can redistribute it and/or modify it
@@ -30,6 +30,12 @@
 namespace Solang
 {
 
+const Glib::ustring ExifData::flashOff_
+    = "http://www.tracker-project.org/temp/nmm#flash-off";;
+
+const Glib::ustring ExifData::flashOn_
+    = "http://www.tracker-project.org/temp/nmm#flash-on";;
+
 const Glib::ustring ExifData::meteringModeAverage_
     = "http://www.tracker-project.org/temp/nmm#metering-mode-average";;
 
@@ -59,6 +65,8 @@ const Glib::ustring ExifData::whiteBalanceManual_
 ExifData::ExifData() :
     camera_(),
     exposureTime_(),
+    flash_(),
+    flashEnum_(),
     fnumber_(),
     isoSpeed_(),
     meteringMode_(),
@@ -73,6 +81,8 @@ ExifData::ExifData() :
 ExifData::ExifData(const ExifData &rhs) :
     camera_(rhs.camera_),
     exposureTime_(rhs.exposureTime_),
+    flash_(rhs.flash_),
+    flashEnum_(rhs.flashEnum_),
     fnumber_(rhs.fnumber_),
     isoSpeed_(rhs.isoSpeed_),
     meteringMode_(rhs.meteringMode_),
@@ -101,6 +111,18 @@ ExifData::get_exposure_time() const throw()
 }
 
 const Glib::ustring &
+ExifData::get_flash() const throw()
+{
+    return flash_;
+}
+
+const Glib::ustring &
+ExifData::get_flash_enum() const throw()
+{
+    return flashEnum_;
+}
+
+const Glib::ustring &
 ExifData::get_fnumber() const throw()
 {
     return fnumber_;
@@ -132,6 +154,25 @@ ExifData::set_exposure_time(const Glib::ustring & exposure_time)
 }
 
 void
+ExifData::set_flash(const Glib::ustring & flash) throw()
+{
+    if (flashOff_ == flash)
+    {
+        flash_ = _("Off");
+    }
+    else if (flashOn_ == flash)
+    {
+        flash_ = _("On");
+    }
+    else
+    {
+        flash_ = "";
+    }
+
+    flashEnum_ = flash;
+}
+
+void
 ExifData::set_fnumber(const Glib::ustring & fnumber) throw()
 {
     fnumber_ = fnumber;
@@ -211,6 +252,8 @@ ExifData &ExifData::operator =(const ExifData &rhs)
     {
         camera_ = rhs.camera_;
         exposureTime_ = rhs.exposureTime_;
+        flash_ = rhs.flash_;
+        flashEnum_ = rhs.flashEnum_;
         fnumber_ = rhs.fnumber_;
         isoSpeed_ = rhs.isoSpeed_;
         meteringMode_ = rhs.meteringMode_;
diff --git a/src/common/exif-data.h b/src/common/exif-data.h
index eada0a5..aafa673 100644
--- a/src/common/exif-data.h
+++ b/src/common/exif-data.h
@@ -1,6 +1,6 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
- * Copyright (C) 2009 Debarshi Ray <rishi gnu org>
+ * Copyright (C) 2009, 2010 Debarshi Ray <rishi gnu org>
  * Copyright (C) 2009 Santanu Sinha <santanu sinha gmail com>
  *
  * Solang is free software: you can redistribute it and/or modify it
@@ -33,6 +33,10 @@ namespace Solang
 class ExifData
 {
     private:
+        static const Glib::ustring flashOff_;
+
+        static const Glib::ustring flashOn_;
+
         static const Glib::ustring meteringModeAverage_;
 
         static const Glib::ustring meteringModeCenterWeightedAverage_;
@@ -51,6 +55,8 @@ class ExifData
 
         Glib::ustring        camera_;
         Glib::ustring        exposureTime_;
+        Glib::ustring        flash_;
+        Glib::ustring        flashEnum_;
         Glib::ustring        fnumber_;
         Glib::ustring        isoSpeed_;
         Glib::ustring        meteringMode_;
@@ -72,6 +78,12 @@ class ExifData
         get_camera() const throw();
 
         const Glib::ustring &
+        get_flash() const throw();
+
+        const Glib::ustring &
+        get_flash_enum() const throw();
+
+        const Glib::ustring &
         get_fnumber() const throw();
 
         const Glib::ustring &
@@ -121,6 +133,9 @@ class ExifData
                           throw();
 
         void
+        set_flash(const Glib::ustring & flash) throw();
+
+        void
         set_fnumber(const Glib::ustring & fnumber) throw();
 
         void
diff --git a/src/common/photo.cpp b/src/common/photo.cpp
index b9c0dba..48c257f 100644
--- a/src/common/photo.cpp
+++ b/src/common/photo.cpp
@@ -1,5 +1,6 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
+ * Copyright (C) 2009, 2010 Debarshi Ray <rishi gnu org>
  * Copyright (C) 2009 Santanu Sinha <santanu sinha gmail com>
  *
  * Solang is free software: you can redistribute it and/or modify it
@@ -34,10 +35,12 @@ Photo::parse_exif_data(const UStringList & data, ExifData & exif_data)
 {
     exif_data.set_camera(data[0]);
     exif_data.set_exposure_time(data[1]);
-    exif_data.set_fnumber(data[2]);
-    exif_data.set_focal_length(data[3]);
-    exif_data.set_iso_speed(data[4]);
-    exif_data.set_metering_mode(data[5]);
+    exif_data.set_flash(data[2]);
+    exif_data.set_fnumber(data[3]);
+    exif_data.set_focal_length(data[4]);
+    exif_data.set_iso_speed(data[5]);
+    exif_data.set_metering_mode(data[6]);
+    exif_data.set_white_balance(data[7]);
 }
 
 Photo::Photo(const Glib::ustring & uri,
@@ -99,17 +102,20 @@ Glib::ustring
 Photo::get_exif_data_query() const throw()
 {
     return Glib::ustring::compose(
-        "SELECT ?camera ?exposure ?fn ?focal ?iso ?metering "
+        "SELECT ?camera ?exposure ?flash ?fn ?focal ?iso ?metering"
+        "       ?white "
         "WHERE {"
         "  ?photo a nmm:Photo ;"
         "  nie:isStoredAs ?data ."
         "  ?data nie:url '%1' ."
         "  OPTIONAL { ?photo nmm:camera ?camera . }"
         "  OPTIONAL { ?photo nmm:exposureTime ?exposure . }"
+        "  OPTIONAL { ?photo nmm:flash ?flash . }"
         "  OPTIONAL { ?photo nmm:fnumber ?fn . }"
         "  OPTIONAL { ?photo nmm:focalLength ?focal . }"
         "  OPTIONAL { ?photo nmm:isoSpeed ?iso . }"
         "  OPTIONAL { ?photo nmm:meteringMode ?metering . }"
+        "  OPTIONAL { ?photo nmm:whiteBalance ?white . }"
         "}",
         uri_);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]