Closed Beep6581 closed 6 years ago
@Beep6581 Like so?
diff --git a/src/Image.cpp b/src/Image.cpp
index da5dfec..4b1df64 100644
--- a/src/Image.cpp
+++ b/src/Image.cpp
@@ -60,6 +60,7 @@ void Image::buildImage(uint16_t * rawImage, const RawParameters & params) {
Image & Image::operator=(Image && move) {
*static_cast<Array2D<uint16_t> *>(this) = (Array2D<uint16_t> &&)std::move(move);
+ filename = move.filename;
scaled.swap(move.scaled);
satThreshold = move.satThreshold;
max = move.max;
diff --git a/src/Image.hpp b/src/Image.hpp
index 972fdeb..0bc760b 100644
--- a/src/Image.hpp
+++ b/src/Image.hpp
@@ -24,7 +24,11 @@
#define _IMAGE_H_
#include <memory>
+
+#include <QString>
+
#include <interpolation.h>
+
#include "Array2D.hpp"
@@ -37,7 +41,9 @@ public:
static const int scaleSteps = 6;
Image() : Array2D<uint16_t>() {}
- Image(uint16_t * rawImage, const RawParameters & params) {
+ Image(uint16_t * rawImage, const RawParameters & params, const QString& _filename) :
+ filename(_filename)
+ {
buildImage(rawImage, params);
}
Image(const Image & copy) = delete;
@@ -47,6 +53,11 @@ public:
}
Image & operator=(Image && move);
+ const QString& getFilename() const
+ {
+ return filename;
+ }
+
bool good() const {
return width > 0;
}
@@ -90,6 +101,8 @@ private:
void setLinear(double slope);
};
+ QString filename;
+
std::unique_ptr<Array2D<uint16_t>[]> scaled;
uint16_t satThreshold, max;
double brightness;
diff --git a/src/ImageIO.cpp b/src/ImageIO.cpp
index 92de20e..b1e55dd 100644
--- a/src/ImageIO.cpp
+++ b/src/ImageIO.cpp
@@ -33,7 +33,7 @@
using namespace std;
using namespace hdrmerge;
-Image ImageIO::loadRawImage(RawParameters & rawParameters, int shot_select) {
+Image ImageIO::loadRawImage(const QString& filename, RawParameters & rawParameters, int shot_select) {
LibRaw rawProcessor;
auto & d = rawProcessor.imgdata;
d.params.shot_select = shot_select;
@@ -54,7 +54,7 @@ Image ImageIO::loadRawImage(RawParameters & rawParameters, int shot_select) {
} else {
Log::msg(Log::DEBUG, "LibRaw::open_file(", rawParameters.fileName, ") failed.");
}
- return Image(d.rawdata.raw_image, rawParameters);
+ return Image(d.rawdata.raw_image, rawParameters, filename);
}
int ImageIO::getFrameCount(RawParameters & rawParameters) {
@@ -90,7 +90,7 @@ int ImageIO::load(const LoadOptions & options, ProgressIndicator & progress) {
{
Timer t("Load files");
if(numImages == 1) { // check for multiframe raw files
- QString name = options.fileNames[0];
+ const QString name = options.fileNames[0];
unique_ptr<RawParameters> params(new RawParameters(name));
int frameCount = getFrameCount(*params);
step = 100 / (frameCount + 1);
@@ -101,7 +101,7 @@ int ImageIO::load(const LoadOptions & options, ProgressIndicator & progress) {
p += step;
unique_ptr<RawParameters> params(new RawParameters(name));
- Image image = loadRawImage(*params, i);
+ Image image = loadRawImage(name, *params, i);
if (!image.good()) {
error = 1;
failedImage = i;
@@ -121,12 +121,12 @@ int ImageIO::load(const LoadOptions & options, ProgressIndicator & progress) {
} else {
step = 100 / (numImages + 1);
for (int i = 0; i < numImages; ++i) {
- QString name = options.fileNames[i];
+ const QString name = options.fileNames[i];
progress.advance(p, "Loading %1", name.toLocal8Bit().constData());
p += step;
unique_ptr<RawParameters> params(new RawParameters(name));
- Image image = loadRawImage(*params);;
+ Image image = loadRawImage(name, *params);
if (!image.good()) {
error = 1;
failedImage = i;
diff --git a/src/ImageIO.hpp b/src/ImageIO.hpp
index 4a81980..563d006 100644
--- a/src/ImageIO.hpp
+++ b/src/ImageIO.hpp
@@ -52,7 +52,7 @@ public:
QString getInputPath() const;
QString replaceArguments(const QString & pattern, const QString & outFileName) const;
static int getFrameCount(RawParameters & rawParameters) ;
- static Image loadRawImage(RawParameters & rawParameters, int shot_select = 0);
+ static Image loadRawImage(const QString& filename, RawParameters & rawParameters, int shot_select = 0);
static QImage renderPreview(const Array2D<float> & rawData, const RawParameters & rawParameters, float expShift, bool halfsize = false);
struct QDateInterval {
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index ae23a9f..215d7cb 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -29,6 +29,7 @@
#include <QHBoxLayout>
#include <QMessageBox>
#include <QFileDialog>
+#include <QFileInfo>
#include <QMenuBar>
#include <QProgressDialog>
#include <QSettings>
@@ -308,7 +309,7 @@ void MainWindow::createLayerSelector() {
QAction * action = new QAction(QIcon(getColorIcon(i)), QString::number(i), layerSelectorGroup);
action->setCheckable(true);
double logExp = logLeastExp - std::log2(images.getImage(i - 1).getRelativeExposure());
- action->setToolTip(QString("+%1 EV").arg(logExp, 0, 'f', 2));
+ action->setToolTip(QString("%1: +%2 EV").arg(QFileInfo(images.getImage(i - 1).getFilename()).baseName()).arg(logExp, 0, 'f', 2));
if (i < 10)
action->setShortcut(Qt::Key_0 + i);
else if (i == 10)
@@ -325,6 +326,7 @@ void MainWindow::createLayerSelector() {
lastLayer->setLayout(new QHBoxLayout());
QLabel * lastIcon = new QLabel(lastLayer);
lastIcon->setPixmap(getColorIcon(numImages));
+ lastIcon->setToolTip(QString("%1: +0 EV").arg(QFileInfo(images.getImage(numImages - 1).getFilename()).baseName()));
lastLayer->layout()->addWidget(lastIcon);
lastLayer->layout()->addWidget(new QLabel(QString::number(numImages)));
//lastLayer->setMinimumHeight(layerSelector->widgetForAction(firstAction)->height());
Best, Flössie
And here I thought I was going to have to spend months plowing through fields of fire and thorns to figure out how to implement this myself, when a gift falls from the heavens... :) I will test after work!
Small gifts preserve friendships. :smile:
@Floessie it works very well, +1 for commit/PR :)
@Beep6581 Your wish is my command. :wink:
12 hours - what a life! ;)
The colored square image icons in the toolbar have tooltips which show the EV value. The tooltip does not appear for the darkest image - it is implied that it's 0EV, but in my opinion it should explicitly show that. Furthermore, it would be useful if the tooltips showed the filename of the image they apply to.