Enhancement: exposure comp in preview's image info (issue 954)
This commit is contained in:
parent
d76f3c38c5
commit
24d0a1657b
@ -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 ('/');
|
||||
|
@ -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; }
|
||||
|
@ -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
|
||||
|
@ -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\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>",
|
||||
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 ("<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(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 <span size=\"large\">%2</span><span size=\"small\">EV</span>",
|
||||
infoString2,
|
||||
Glib::ustring(idata->expcompToString(idata->getExpComp())));
|
||||
}
|
||||
|
||||
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
|
||||
infoString = M("QINFO_NOEXIF");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user