diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index 101acbf3f..1ed792cd8 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -90,6 +90,7 @@ ImageData::ImageData (Glib::ustring fname, RawMetaDataLocation* ri) { make = "Unknown"; model = "Unknown"; orientation = "Unknown"; + expcomp = 0; focal_len = 0; memset (&time, 0, sizeof(time)); } @@ -106,6 +107,7 @@ void ImageData::extractInfo () { model = ""; serial = ""; orientation = ""; + expcomp = 0; shutter = 0; aperture = 0; focal_len = 0; @@ -165,6 +167,8 @@ void ImageData::extractInfo () { aperture = exif->getTag ("ApertureValue")->toDouble (); if (exif->getTag ("FNumber")) aperture = exif->getTag ("FNumber")->toDouble (); + if (exif->getTag ("ExposureBiasValue")) + expcomp = exif->getTag ("ExposureBiasValue")->toDouble (); if (exif->getTag ("FocalLength")) focal_len = exif->getTag ("FocalLength")->toDouble (); if (exif->getTag ("ISOSpeedRatings")) @@ -334,6 +338,17 @@ std::string ImageMetaData::shutterToString (double shutter) { return buffer; } +std::string ImageMetaData::expcompToString (double expcomp) { + + char buffer[256]; + if (expcomp!=0.0){ + sprintf (buffer, "%0.1f", expcomp); + return buffer; + } + else + return ""; +} + double ImageMetaData::shutterFromString (std::string s) { int i = s.find_first_of ('/'); diff --git a/rtengine/imagedata.h b/rtengine/imagedata.h index 8d568cbb9..59b63b198 100644 --- a/rtengine/imagedata.h +++ b/rtengine/imagedata.h @@ -42,6 +42,7 @@ class ImageData : public ImageMetaData { double aperture; double focal_len; double shutter; + double expcomp; std::string make, model, serial; std::string orientation; std::string lens; @@ -65,6 +66,7 @@ class ImageData : public ImageMetaData { double getFNumber () const { return aperture; } double getFocalLen () const { return focal_len; } double getShutterSpeed () const { return shutter; } + double getExpComp () const { return expcomp; } std::string getMake () const { return make; } std::string getModel () const { return model; } std::string getLens () const { return lens; } diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 6b34ebcea..51d92ed92 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -71,6 +71,8 @@ namespace rtengine { virtual double getFocalLen () const =0; /** @return the shutter speed */ virtual double getShutterSpeed () const =0; + /** @return the exposure compensation */ + virtual double getExpComp () const =0; /** @return the maker of the camera */ virtual std::string getMake () const =0; /** @return the model of the camera */ @@ -90,6 +92,8 @@ namespace rtengine { static double apertureFromString (std::string shutter); /** Functions to convert between floating point and string representation of shutter and aperture */ static double shutterFromString (std::string shutter); + /** Functions to convert between floating point and string representation of exposure compensation */ + static std::string expcompToString (double expcomp); /** Reads metadata from file. * @param fname is the name of the file diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 36a21b80d..3df4d7a7b 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -660,26 +660,37 @@ void EditorPanel::error (Glib::ustring descr) { void EditorPanel::info_toggled () { Glib::ustring infoString; + Glib::ustring infoString1; //1-st line + Glib::ustring infoString2; //2-nd line + Glib::ustring infoString3; //3-rd line + Glib::ustring expcomp; + if (!ipc || !openThm) return; const rtengine::ImageMetaData* idata = ipc->getInitialImage()->getMetaData(); - if (idata && idata->hasExif()) -// infoString = Glib::ustring::compose ("%1 %2\nF/%3 %4 sec\n%5: %6\n%7: %8 mm\n", -// Glib::ustring(idata->getMake()), Glib::ustring(idata->getModel()), -// Glib::ustring(idata->apertureToString(idata->getFNumber())), Glib::ustring(idata->shutterToString(idata->getShutterSpeed())), -// M("QINFO_ISO"), idata->getISOSpeed(), -// M("QINFO_FOCALLENGTH"), idata->getFocalLen()) -// + Glib::ustring::compose ("%1: %2", M("QINFO_LENS"), Glib::ustring(idata->getLens())); -infoString = Glib::ustring::compose ( - "%1 + %2\nf/%3 %4s %5%6 %7mm\n%8%9", - Glib::ustring(idata->getMake()+" "+idata->getModel()), - Glib::ustring(idata->getLens()), - Glib::ustring(idata->apertureToString(idata->getFNumber())), - Glib::ustring(idata->shutterToString(idata->getShutterSpeed())), - M("QINFO_ISO"), idata->getISOSpeed(), - idata->getFocalLen(), - Glib::path_get_dirname(openThm->getFileName()) + G_DIR_SEPARATOR_S, - Glib::path_get_basename(openThm->getFileName()) - ); + if (idata && idata->hasExif()){ + infoString1 = Glib::ustring::compose ("%1 + %2", + Glib::ustring(idata->getMake()+" "+idata->getModel()), + Glib::ustring(idata->getLens())); + + infoString2 = Glib::ustring::compose ("f/%1 %2s %3%4 %5mm", + Glib::ustring(idata->apertureToString(idata->getFNumber())), + Glib::ustring(idata->shutterToString(idata->getShutterSpeed())), + M("QINFO_ISO"), idata->getISOSpeed(), + idata->getFocalLen()); + + expcomp = Glib::ustring(idata->expcompToString(idata->getExpComp())); + if (expcomp!=""){ + infoString2 = Glib::ustring::compose("%1 %2EV", + infoString2, + Glib::ustring(idata->expcompToString(idata->getExpComp()))); + } + + infoString3 = Glib::ustring::compose ("%1%2", + Glib::path_get_dirname(openThm->getFileName()) + G_DIR_SEPARATOR_S, + Glib::path_get_basename(openThm->getFileName())); + + infoString = Glib::ustring::compose ("%1\n%2\n%3",infoString1, infoString2, infoString3); + } else infoString = M("QINFO_NOEXIF");