center thumbnail, extend TAGs

This commit is contained in:
2019-11-12 22:35:36 +01:00
parent a120d57b89
commit ede485d68c
4 changed files with 56 additions and 71 deletions
-66
View File
@@ -76,28 +76,6 @@ bool cEXIF::fromFile(const QString& szFileName)
QImage image;
image.loadFromData(static_cast<const uchar*>(previewImage.pData()), static_cast<qint32>(previewImage.size()));
// QTransform rotation;
// int angle = 0;
// switch(imageOrientation())
// {
// case 8:
// angle = 270;
// break;
// case 3:
// angle = 180;
// break;
// case 6:
// angle = 90;
// break;
// }
// if(angle != 0)
// {
// rotation.rotate(angle);
// image = image.transformed(rotation);
// }
m_previewList.append(image);
}
}
@@ -126,28 +104,6 @@ bool cEXIF::fromFile(const QString& szFileName)
QImage image;
image.loadFromData(static_cast<const uchar*>(previewImage.pData()), static_cast<qint32>(previewImage.size()));
// QTransform rotation;
// int angle = 0;
// switch(imageOrientation())
// {
// case 8:
// angle = 270;
// break;
// case 3:
// angle = 180;
// break;
// case 6:
// angle = 90;
// break;
// }
// if(angle != 0)
// {
// rotation.rotate(angle);
// image = image.transformed(rotation);
// }
m_previewList.append(image);
}
}
@@ -177,28 +133,6 @@ bool cEXIF::fromFile(const QString& szFileName)
QImage image;
image.loadFromData(static_cast<const uchar*>(previewImage.pData()), static_cast<qint32>(previewImage.size()));
// QTransform rotation;
// int angle = 0;
// switch(imageOrientation())
// {
// case 8:
// angle = 270;
// break;
// case 3:
// angle = 180;
// break;
// case 6:
// angle = 90;
// break;
// }
// if(angle != 0)
// {
// rotation.rotate(angle);
// image = image.transformed(rotation);
// }
m_previewList.append(image);
}
}
+19
View File
@@ -9,6 +9,7 @@
#include <QSettings>
#include <QCloseEvent>
#include <QImageWriter>
#include <QFileDialog>
cExportDialog::cExportDialog(const QList<IMAGEFORMAT>& imageFormats, QWidget *parent) :
@@ -210,6 +211,8 @@ void cExportDialog::initUI(const QList<IMAGEFORMAT>& imageFormats)
"<tr><td>%H</td><td>hour of picture taken</td></tr>"
"<tr><td>%M</td><td>minute of picture taken</td></tr>"
"<tr><td>%S</td><td>second of picture taken</td></tr>"
"<tr><td>%c</td><td>camera manufacturer</td></tr>"
"<tr><td>%l</td><td>camera model</td></tr>"
"<tr><td>%t</td><td>type of created picture</td></tr>"
"</table>");
ui->m_lpFileTagHelp->setText("<table>"
@@ -220,6 +223,8 @@ void cExportDialog::initUI(const QList<IMAGEFORMAT>& imageFormats)
"<tr><td>%H</td><td>hour of picture taken</td></tr>"
"<tr><td>%M</td><td>minute of picture taken</td></tr>"
"<tr><td>%S</td><td>second of picture taken</td></tr>"
"<tr><td>%c</td><td>camera manufacturer</td></tr>"
"<tr><td>%l</td><td>camera model</td></tr>"
"<tr><td>%t</td><td>type of created picture</td></tr>"
"</table>");
@@ -238,6 +243,8 @@ void cExportDialog::createActions()
connect(ui->m_lpFileOverwriteMethod, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &cExportDialog::onFileOverwriteMethodChanged);
connect(ui->m_lpFileFormat, &QComboBox::currentTextChanged, this, &cExportDialog::onFileFormatChanged);
connect(ui->m_lpDestinationPathBrowse, &QPushButton::clicked, this, &cExportDialog::onPathSelect);
}
void cExportDialog::onQualityChanged(int value)
@@ -318,6 +325,18 @@ void cExportDialog::onFileFormatChanged(const QString &text)
}
}
void cExportDialog::onPathSelect()
{
QSettings settings;
QString szPath = settings.value("export/path", QDir::homePath()).toString();
szPath = QFileDialog::getExistingDirectory(this, tr("Export Directory"), szPath, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if(szPath.isEmpty())
return;
ui->m_lpDestinationPath->setText(szPath);
}
/*
QImageWriter writer(destFile);
+6
View File
@@ -135,6 +135,12 @@ private slots:
\param text
*/
void onFileFormatChanged(const QString &text);
/*!
\brief
\fn onPathSelect
*/
void onPathSelect();
protected:
};
+31 -5
View File
@@ -3,6 +3,8 @@
*/
#include "common.h"
#include "cmainwindow.h"
#include "ui_cmainwindow.h"
@@ -104,7 +106,7 @@ void cMainWindow::initUI()
m_lpProgressBar->setVisible(false);
ui->m_lpStatusBar->addPermanentWidget(m_lpProgressBar);
QStringList headerLabels = QStringList() << tr("path") << tr("file") << tr("size") << tr("date") << tr("width") << tr("height") << ("");
QStringList headerLabels = QStringList() << tr("icon") << tr("path") << tr("file") << tr("size") << tr("date") << tr("width") << tr("height") << ("");
m_lpFileListModel->setHorizontalHeaderLabels(headerLabels);
}
@@ -293,7 +295,7 @@ void cMainWindow::onClearList()
m_lpFileListModel->clear();
QStringList headerLabels = QStringList() << tr("path") << tr("file") << tr("size") << tr("date") << tr("width") << tr("height") << ("");
QStringList headerLabels = QStringList() << tr("icon") << tr("path") << tr("file") << tr("size") << tr("date") << tr("width") << tr("height") << ("");
m_lpFileListModel->setHorizontalHeaderLabels(headerLabels);
countImages();
@@ -369,6 +371,15 @@ void cMainWindow::addFile(const QString& file)
QList<QStandardItem*> items;
QImage thumbnail = lpExif->thumbnail();
QImage thumb(THUMBNAIL_WIDTH, thumbnail.height(), QImage::Format_ARGB32);
thumb.fill(qRgba(0, 0, 0, 0));
QPainter painter(&thumb);
painter.drawImage((THUMBNAIL_WIDTH-thumbnail.width())/2, 0, thumbnail);
QIcon icon = QIcon(QPixmap::fromImage(thumb));
items.append(new QStandardItem(""));
items.append(new QStandardItem(info.path()));
items.append(new QStandardItem(info.fileName()));
items.append(new QStandardItem(QString::number(info.size()/1024)+" kb"));
@@ -376,12 +387,12 @@ void cMainWindow::addFile(const QString& file)
items.append(new QStandardItem(QString::number(lpExif->imageWidth())));
items.append(new QStandardItem(QString::number(lpExif->imageHeight())));
items[0]->setIcon(QIcon(QPixmap::fromImage(lpExif->thumbnail())));
// items[0]->setCheckable(true);
items[2]->setTextAlignment(Qt::AlignRight | Qt::AlignCenter);
items[0]->setIcon(icon);
items[0]->setTextAlignment(Qt::AlignHCenter | Qt::AlignCenter);
items[3]->setTextAlignment(Qt::AlignRight | Qt::AlignCenter);
items[4]->setTextAlignment(Qt::AlignRight | Qt::AlignCenter);
items[5]->setTextAlignment(Qt::AlignRight | Qt::AlignCenter);
items[6]->setTextAlignment(Qt::AlignRight | Qt::AlignCenter);
items[0]->setData(QVariant::fromValue(lpExif), Qt::UserRole+1);
@@ -728,6 +739,14 @@ QString cMainWindow::replaceTags(const QString& path, cEXIF* lpExif, const QStri
{
QString dest = path;
QFileInfo fileInfo(lpExif->fileName());
QString model = lpExif->cameraModel().replace("/", "_").replace("\\", "_").replace(":", "_");
QString maker = lpExif->cameraMake().replace("/", "_").replace("\\", "_").replace(":", "_");
if(model.isEmpty())
model = "UNKNOWN";
if(maker.isEmpty())
maker = "UNKNOWN";
if(directory)
dest = dest.replace("%o", fileInfo.absolutePath());
@@ -740,6 +759,8 @@ QString cMainWindow::replaceTags(const QString& path, cEXIF* lpExif, const QStri
dest = dest.replace("%H", lpExif->dateTime().toString("hh"));
dest = dest.replace("%M", lpExif->dateTime().toString("mm"));
dest = dest.replace("%S", lpExif->dateTime().toString("ss"));
dest = dest.replace("%c", maker);
dest = dest.replace("%l", model);
dest = dest.replace("%t", extension);
dest = dest.replace("\\", "/");
@@ -747,6 +768,11 @@ QString cMainWindow::replaceTags(const QString& path, cEXIF* lpExif, const QStri
return(dest);
}
/*
if(!lpPicture->cameraModel().isEmpty())
szPath.append("/" + lpPicture->cameraModel().replace("/", "_").replace("\\", "_").replace(":", "_"));
*/
QString cMainWindow::findFreeFileName(const QString& fileName)
{
QFileInfo fileInfo(fileName);