Enhancement: exposure comp in preview's image info (issue 954)
This commit is contained in:
@@ -90,6 +90,7 @@ ImageData::ImageData (Glib::ustring fname, RawMetaDataLocation* ri) {
|
|||||||
make = "Unknown";
|
make = "Unknown";
|
||||||
model = "Unknown";
|
model = "Unknown";
|
||||||
orientation = "Unknown";
|
orientation = "Unknown";
|
||||||
|
expcomp = 0;
|
||||||
focal_len = 0;
|
focal_len = 0;
|
||||||
memset (&time, 0, sizeof(time));
|
memset (&time, 0, sizeof(time));
|
||||||
}
|
}
|
||||||
@@ -106,6 +107,7 @@ void ImageData::extractInfo () {
|
|||||||
model = "";
|
model = "";
|
||||||
serial = "";
|
serial = "";
|
||||||
orientation = "";
|
orientation = "";
|
||||||
|
expcomp = 0;
|
||||||
shutter = 0;
|
shutter = 0;
|
||||||
aperture = 0;
|
aperture = 0;
|
||||||
focal_len = 0;
|
focal_len = 0;
|
||||||
@@ -165,6 +167,8 @@ void ImageData::extractInfo () {
|
|||||||
aperture = exif->getTag ("ApertureValue")->toDouble ();
|
aperture = exif->getTag ("ApertureValue")->toDouble ();
|
||||||
if (exif->getTag ("FNumber"))
|
if (exif->getTag ("FNumber"))
|
||||||
aperture = exif->getTag ("FNumber")->toDouble ();
|
aperture = exif->getTag ("FNumber")->toDouble ();
|
||||||
|
if (exif->getTag ("ExposureBiasValue"))
|
||||||
|
expcomp = exif->getTag ("ExposureBiasValue")->toDouble ();
|
||||||
if (exif->getTag ("FocalLength"))
|
if (exif->getTag ("FocalLength"))
|
||||||
focal_len = exif->getTag ("FocalLength")->toDouble ();
|
focal_len = exif->getTag ("FocalLength")->toDouble ();
|
||||||
if (exif->getTag ("ISOSpeedRatings"))
|
if (exif->getTag ("ISOSpeedRatings"))
|
||||||
@@ -334,6 +338,17 @@ std::string ImageMetaData::shutterToString (double shutter) {
|
|||||||
return buffer;
|
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) {
|
double ImageMetaData::shutterFromString (std::string s) {
|
||||||
|
|
||||||
int i = s.find_first_of ('/');
|
int i = s.find_first_of ('/');
|
||||||
|
@@ -42,6 +42,7 @@ class ImageData : public ImageMetaData {
|
|||||||
double aperture;
|
double aperture;
|
||||||
double focal_len;
|
double focal_len;
|
||||||
double shutter;
|
double shutter;
|
||||||
|
double expcomp;
|
||||||
std::string make, model, serial;
|
std::string make, model, serial;
|
||||||
std::string orientation;
|
std::string orientation;
|
||||||
std::string lens;
|
std::string lens;
|
||||||
@@ -65,6 +66,7 @@ class ImageData : public ImageMetaData {
|
|||||||
double getFNumber () const { return aperture; }
|
double getFNumber () const { return aperture; }
|
||||||
double getFocalLen () const { return focal_len; }
|
double getFocalLen () const { return focal_len; }
|
||||||
double getShutterSpeed () const { return shutter; }
|
double getShutterSpeed () const { return shutter; }
|
||||||
|
double getExpComp () const { return expcomp; }
|
||||||
std::string getMake () const { return make; }
|
std::string getMake () const { return make; }
|
||||||
std::string getModel () const { return model; }
|
std::string getModel () const { return model; }
|
||||||
std::string getLens () const { return lens; }
|
std::string getLens () const { return lens; }
|
||||||
|
@@ -71,6 +71,8 @@ namespace rtengine {
|
|||||||
virtual double getFocalLen () const =0;
|
virtual double getFocalLen () const =0;
|
||||||
/** @return the shutter speed */
|
/** @return the shutter speed */
|
||||||
virtual double getShutterSpeed () const =0;
|
virtual double getShutterSpeed () const =0;
|
||||||
|
/** @return the exposure compensation */
|
||||||
|
virtual double getExpComp () const =0;
|
||||||
/** @return the maker of the camera */
|
/** @return the maker of the camera */
|
||||||
virtual std::string getMake () const =0;
|
virtual std::string getMake () const =0;
|
||||||
/** @return the model of the camera */
|
/** @return the model of the camera */
|
||||||
@@ -90,6 +92,8 @@ namespace rtengine {
|
|||||||
static double apertureFromString (std::string shutter);
|
static double apertureFromString (std::string shutter);
|
||||||
/** Functions to convert between floating point and string representation of shutter and aperture */
|
/** Functions to convert between floating point and string representation of shutter and aperture */
|
||||||
static double shutterFromString (std::string shutter);
|
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.
|
/** Reads metadata from file.
|
||||||
* @param fname is the name of the file
|
* @param fname is the name of the file
|
||||||
|
@@ -660,26 +660,37 @@ void EditorPanel::error (Glib::ustring descr) {
|
|||||||
void EditorPanel::info_toggled () {
|
void EditorPanel::info_toggled () {
|
||||||
|
|
||||||
Glib::ustring infoString;
|
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;
|
if (!ipc || !openThm) return;
|
||||||
const rtengine::ImageMetaData* idata = ipc->getInitialImage()->getMetaData();
|
const rtengine::ImageMetaData* idata = ipc->getInitialImage()->getMetaData();
|
||||||
if (idata && idata->hasExif())
|
if (idata && idata->hasExif()){
|
||||||
// infoString = Glib::ustring::compose ("%1 %2\nF/%3 %4 sec\n%5: %6\n%7: %8 mm\n",
|
infoString1 = Glib::ustring::compose ("%1 + %2",
|
||||||
// Glib::ustring(idata->getMake()), Glib::ustring(idata->getModel()),
|
Glib::ustring(idata->getMake()+" "+idata->getModel()),
|
||||||
// Glib::ustring(idata->apertureToString(idata->getFNumber())), Glib::ustring(idata->shutterToString(idata->getShutterSpeed())),
|
Glib::ustring(idata->getLens()));
|
||||||
// M("QINFO_ISO"), idata->getISOSpeed(),
|
|
||||||
// M("QINFO_FOCALLENGTH"), idata->getFocalLen())
|
infoString2 = Glib::ustring::compose ("<span size=\"small\">f/</span><span size=\"large\">%1</span> <span size=\"large\">%2</span><span size=\"small\">s</span> <span size=\"small\">%3</span><span size=\"large\">%4</span> <span size=\"large\">%5</span><span size=\"small\">mm</span>",
|
||||||
// + Glib::ustring::compose ("%1: %2", M("QINFO_LENS"), Glib::ustring(idata->getLens()));
|
Glib::ustring(idata->apertureToString(idata->getFNumber())),
|
||||||
infoString = Glib::ustring::compose (
|
Glib::ustring(idata->shutterToString(idata->getShutterSpeed())),
|
||||||
"%1 + %2\n<span size=\"small\">f/</span><span size=\"large\">%3</span> <span size=\"large\">%4</span><span size=\"small\">s</span> <span size=\"small\">%5</span><span size=\"large\">%6</span> <span size=\"large\">%7</span><span size=\"small\">mm</span>\n<span size=\"small\">%8</span><span>%9</span>",
|
M("QINFO_ISO"), idata->getISOSpeed(),
|
||||||
Glib::ustring(idata->getMake()+" "+idata->getModel()),
|
idata->getFocalLen());
|
||||||
Glib::ustring(idata->getLens()),
|
|
||||||
Glib::ustring(idata->apertureToString(idata->getFNumber())),
|
expcomp = Glib::ustring(idata->expcompToString(idata->getExpComp()));
|
||||||
Glib::ustring(idata->shutterToString(idata->getShutterSpeed())),
|
if (expcomp!=""){
|
||||||
M("QINFO_ISO"), idata->getISOSpeed(),
|
infoString2 = Glib::ustring::compose("%1 <span size=\"large\">%2</span><span size=\"small\">EV</span>",
|
||||||
idata->getFocalLen(),
|
infoString2,
|
||||||
Glib::path_get_dirname(openThm->getFileName()) + G_DIR_SEPARATOR_S,
|
Glib::ustring(idata->expcompToString(idata->getExpComp())));
|
||||||
Glib::path_get_basename(openThm->getFileName())
|
}
|
||||||
);
|
|
||||||
|
infoString3 = Glib::ustring::compose ("<span size=\"small\">%1</span><span>%2</span>",
|
||||||
|
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
|
else
|
||||||
infoString = M("QINFO_NOEXIF");
|
infoString = M("QINFO_NOEXIF");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user