initial commit
This commit is contained in:
+274
-4
@@ -1,14 +1,16 @@
|
||||
#include "cexportdialog.h"
|
||||
#include "ui_cexportdialog.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QCloseEvent>
|
||||
|
||||
cExportDialog::cExportDialog(QWidget *parent) :
|
||||
|
||||
cExportDialog::cExportDialog(const QList<IMAGEFORMAT>& imageFormats, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::cExportDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->m_lpQuality, &QSlider::valueChanged, this, &cExportDialog::onQualityChanged);
|
||||
initUI(imageFormats);
|
||||
createActions();
|
||||
}
|
||||
|
||||
cExportDialog::~cExportDialog()
|
||||
@@ -16,7 +18,275 @@ cExportDialog::~cExportDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cExportDialog::accept()
|
||||
{
|
||||
saveSettings();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void cExportDialog::reject()
|
||||
{
|
||||
saveSettings();
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void cExportDialog::saveSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("export/width", QVariant::fromValue(size().width()));
|
||||
settings.setValue("export/height", QVariant::fromValue(size().height()));
|
||||
settings.setValue("export/x", QVariant::fromValue(x()));
|
||||
settings.setValue("export/y", QVariant::fromValue(y()));
|
||||
|
||||
|
||||
if(ui->m_lpNewDirectoryTag->isChecked())
|
||||
settings.setValue("export/directoryMethod", QVariant::fromValue(QString("newDirectoryTag")));
|
||||
else if(ui->m_lpNewDirectory->isChecked())
|
||||
settings.setValue("export/directoryMethod", QVariant::fromValue(QString("newDirectory")));
|
||||
else
|
||||
settings.setValue("export/directoryMethod", QVariant::fromValue(QString("keepDirectory")));
|
||||
|
||||
settings.setValue("export/destinationPath", QVariant::fromValue(ui->m_lpDestinationPath->text()));
|
||||
settings.setValue("export/keepStructure", QVariant::fromValue(ui->m_lpKeepStructure->isChecked()));
|
||||
settings.setValue("export/destinationPathTag", QVariant::fromValue(ui->m_lpDestinationPathTag->text()));
|
||||
|
||||
|
||||
if(ui->m_lpNewFilename->isChecked())
|
||||
settings.setValue("export/fileMethod", QVariant::fromValue(QString("newFilename")));
|
||||
else
|
||||
settings.setValue("export/fileMethod", QVariant::fromValue(QString("keepFilename")));
|
||||
|
||||
if(ui->m_lpFilenameTag->isChecked())
|
||||
settings.setValue("export/filenamePlus", QVariant::fromValue(QString("TAG")));
|
||||
else
|
||||
settings.setValue("export/filenamePlus", QVariant::fromValue(QString("converted")));
|
||||
|
||||
settings.setValue("export/fileTag", QVariant::fromValue(ui->m_lpFileTag->text()));
|
||||
|
||||
if(ui->m_lpFileOverwrite->isChecked())
|
||||
settings.setValue("export/overwrite", QVariant::fromValue(QString("overwrite")));
|
||||
else if(ui->m_lpFileRename->isChecked())
|
||||
settings.setValue("export/overwrite", QVariant::fromValue(QString("rename")));
|
||||
else
|
||||
settings.setValue("export/overwrite", QVariant::fromValue(QString("ask")));
|
||||
|
||||
settings.setValue("export/fileFormat", QVariant::fromValue(ui->m_lpFileFormat->currentText()));
|
||||
settings.setValue("export/quality", QVariant::fromValue(ui->m_lpQuality->value()));
|
||||
}
|
||||
|
||||
void cExportDialog::initUI(const QList<IMAGEFORMAT>& imageFormats)
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
qint32 iX = settings.value("export/x", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iY = settings.value("export/y", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iWidth = settings.value("export/width", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iHeight = settings.value("export/height", QVariant::fromValue(-1)).toInt();
|
||||
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
resize(iWidth, iHeight);
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
|
||||
QString directoryMethod = settings.value("export/directoryMethod", QVariant::fromValue(QString("keepDirectory"))).toString();
|
||||
|
||||
if(directoryMethod == "newDirectoryTag")
|
||||
{
|
||||
ui->m_lpKeepDirectory->setChecked(false);
|
||||
ui->m_lpNewDirectory->setChecked(false);
|
||||
ui->m_lpNewDirectoryTag->setChecked(true);
|
||||
|
||||
ui->m_lpDestinationPath->setEnabled(false);
|
||||
ui->m_lpDestinationPathBrowse->setEnabled(false);
|
||||
}
|
||||
else if(directoryMethod == "newDirectory")
|
||||
{
|
||||
ui->m_lpKeepDirectory->setChecked(false);
|
||||
ui->m_lpNewDirectory->setChecked(true);
|
||||
ui->m_lpNewDirectoryTag->setChecked(false);
|
||||
|
||||
ui->m_lpDestinationPathTag->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpKeepDirectory->setChecked(true);
|
||||
ui->m_lpNewDirectory->setChecked(false);
|
||||
ui->m_lpNewDirectoryTag->setChecked(false);
|
||||
|
||||
ui->m_lpDestinationPath->setEnabled(false);
|
||||
ui->m_lpDestinationPathBrowse->setEnabled(false);
|
||||
ui->m_lpDestinationPathTag->setEnabled(false);
|
||||
|
||||
ui->m_lpKeepStructure->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->m_lpDestinationPath->setText(settings.value("export/destinationPath", QVariant::fromValue(QString(""))).toString());
|
||||
ui->m_lpKeepStructure->setChecked(settings.value("export/keepStructure", QVariant::fromValue(false)).toBool());
|
||||
ui->m_lpDestinationPathTag->setText(settings.value("export/destinationPathTag", QVariant::fromValue(QString(""))).toString());
|
||||
|
||||
QString fileMethod = settings.value("export/fileMethod", QVariant::fromValue(QString("keepFilename"))).toString();
|
||||
|
||||
if(fileMethod == "newFilename")
|
||||
{
|
||||
ui->m_lpKeepFilename->setChecked(false);
|
||||
ui->m_lpNewFilename->setChecked(true);
|
||||
|
||||
ui->m_lpFilenamePlusConverted->setEnabled(true);
|
||||
ui->m_lpFilenameTag->setEnabled(true);
|
||||
ui->m_lpFileTag->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpKeepFilename->setChecked(true);
|
||||
ui->m_lpNewFilename->setChecked(false);
|
||||
|
||||
ui->m_lpFilenamePlusConverted->setEnabled(false);
|
||||
ui->m_lpFilenameTag->setEnabled(false);
|
||||
ui->m_lpFileTag->setEnabled(false);
|
||||
}
|
||||
|
||||
QString filenamePlus = settings.value("export/filenamePlus", QVariant::fromValue(QString("converted"))).toString();
|
||||
|
||||
if(filenamePlus == "TAG")
|
||||
{
|
||||
ui->m_lpFilenamePlusConverted->setChecked(false);
|
||||
ui->m_lpFilenameTag->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpFilenamePlusConverted->setChecked(true);
|
||||
ui->m_lpFilenameTag->setChecked(false);
|
||||
|
||||
ui->m_lpFileTag->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->m_lpFileTag->setText(settings.value("export/fileTag", QVariant::fromValue(QString(""))).toString());
|
||||
|
||||
QString fileOverwrite = settings.value("export/overwrite", QVariant::fromValue(QString("ask"))).toString();
|
||||
|
||||
if(fileOverwrite == "overwrite")
|
||||
{
|
||||
ui->m_lpFileAsk->setChecked(false);
|
||||
ui->m_lpFileRename->setChecked(false);
|
||||
ui->m_lpFileOverwrite->setChecked(true);
|
||||
}
|
||||
else if(fileOverwrite == "rename")
|
||||
{
|
||||
ui->m_lpFileAsk->setChecked(false);
|
||||
ui->m_lpFileRename->setChecked(true);
|
||||
ui->m_lpFileOverwrite->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpFileAsk->setChecked(true);
|
||||
ui->m_lpFileRename->setChecked(false);
|
||||
ui->m_lpFileOverwrite->setChecked(false);
|
||||
}
|
||||
|
||||
for(int x = 0;x < imageFormats.count();x++)
|
||||
{
|
||||
IMAGEFORMAT i = imageFormats[x];
|
||||
|
||||
if(i.write)
|
||||
ui->m_lpFileFormat->addItem(i.description + " (" + i.extension + ")");
|
||||
}
|
||||
ui->m_lpFileFormat->setCurrentText(settings.value("export/fileFormat").toString());
|
||||
ui->m_lpQuality->setValue(settings.value("export/quality", QVariant::fromValue(50)).toInt());
|
||||
ui->m_lpQualityValue->setText(QString::number(ui->m_lpQuality->value()));
|
||||
|
||||
ui->m_lpPathTagHelp->setText("<table>"
|
||||
"<tr><td>%o</td><td>original directory</td></tr>"
|
||||
"<tr><td>%y</td><td>year of picture taken</td></tr>"
|
||||
"<tr><td>%m</td><td>month of picture taken</td></tr>"
|
||||
"<tr><td>%d</td><td>day of picture taken</td></tr>"
|
||||
"<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>%t</td><td>type of created picture</td></tr>"
|
||||
"</table>");
|
||||
ui->m_lpFileTagHelp->setText("<table>"
|
||||
"<tr><td>%o</td><td>original filename (without extension)</td></tr>"
|
||||
"<tr><td>%y</td><td>year of picture taken</td></tr>"
|
||||
"<tr><td>%m</td><td>month of picture taken</td></tr>"
|
||||
"<tr><td>%d</td><td>day of picture taken</td></tr>"
|
||||
"<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>%t</td><td>type of created picture</td></tr>"
|
||||
"</table>");
|
||||
}
|
||||
|
||||
void cExportDialog::createActions()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
connect(ui->m_lpQuality, &QSlider::valueChanged, this, &cExportDialog::onQualityChanged);
|
||||
|
||||
connect(ui->m_lpDirectoryMethod, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &cExportDialog::onDirectoryMethodChanged);
|
||||
connect(ui->m_lpFilenameMethod, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &cExportDialog::onFileMethodChanged);
|
||||
connect(ui->m_lpFilenameAdd, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &cExportDialog::onFileNamePlusChanged);
|
||||
connect(ui->m_lpFileOverwriteMethod, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &cExportDialog::onFileOverwriteMethodChanged);
|
||||
}
|
||||
|
||||
void cExportDialog::onQualityChanged(int value)
|
||||
{
|
||||
ui->m_lpQualityValue->setNum(value);
|
||||
}
|
||||
|
||||
void cExportDialog::onDirectoryMethodChanged(int /*id*/)
|
||||
{
|
||||
if(ui->m_lpNewDirectoryTag->isChecked())
|
||||
{
|
||||
ui->m_lpDestinationPath->setEnabled(false);
|
||||
ui->m_lpDestinationPathBrowse->setEnabled(false);
|
||||
ui->m_lpKeepStructure->setEnabled(false);
|
||||
ui->m_lpDestinationPathTag->setEnabled(true);
|
||||
}
|
||||
else if(ui->m_lpNewDirectory->isChecked())
|
||||
{
|
||||
ui->m_lpDestinationPath->setEnabled(true);
|
||||
ui->m_lpDestinationPathBrowse->setEnabled(true);
|
||||
ui->m_lpKeepStructure->setEnabled(true);
|
||||
ui->m_lpDestinationPathTag->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpDestinationPath->setEnabled(false);
|
||||
ui->m_lpDestinationPathBrowse->setEnabled(false);
|
||||
ui->m_lpKeepStructure->setEnabled(false);
|
||||
ui->m_lpDestinationPathTag->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void cExportDialog::onFileMethodChanged(int /*id*/)
|
||||
{
|
||||
if(ui->m_lpNewFilename->isChecked())
|
||||
{
|
||||
ui->m_lpFilenamePlusConverted->setEnabled(true);
|
||||
ui->m_lpFilenameTag->setEnabled(true);
|
||||
ui->m_lpFilenamePlusConverted->setEnabled(true);
|
||||
ui->m_lpFilenameTag->setEnabled(true);
|
||||
onFileNamePlusChanged(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpFilenamePlusConverted->setEnabled(false);
|
||||
ui->m_lpFilenameTag->setEnabled(false);
|
||||
ui->m_lpFileTag->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void cExportDialog::onFileNamePlusChanged(int /*id*/)
|
||||
{
|
||||
if(ui->m_lpNewFilename->isChecked() && ui->m_lpFilenameTag->isChecked())
|
||||
ui->m_lpFileTag->setEnabled(true);
|
||||
else
|
||||
ui->m_lpFileTag->setEnabled(false);
|
||||
}
|
||||
|
||||
void cExportDialog::onFileOverwriteMethodChanged(int /*id*/)
|
||||
{
|
||||
//NOTHING
|
||||
}
|
||||
|
||||
+33
-1
@@ -1,8 +1,25 @@
|
||||
#ifndef CEXPORTDIALOG_H
|
||||
#define CEXPORTDIALOG_H
|
||||
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/*
|
||||
* altes Verzeichnis
|
||||
* neues Verzeichnis, alte Struktur
|
||||
* neues Verzeichnis
|
||||
*
|
||||
* alter Name (umbenennen, wenn gleich)
|
||||
* alter Name + _converted
|
||||
* alter Name + tag
|
||||
* tag
|
||||
*
|
||||
* überschreiben / fragen / umbenennen
|
||||
*/
|
||||
|
||||
namespace Ui {
|
||||
class cExportDialog;
|
||||
}
|
||||
@@ -12,14 +29,29 @@ class cExportDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit cExportDialog(QWidget *parent = nullptr);
|
||||
explicit cExportDialog(const QList<IMAGEFORMAT>& imageFormats, QWidget *parent = nullptr);
|
||||
~cExportDialog();
|
||||
|
||||
private:
|
||||
Ui::cExportDialog *ui;
|
||||
|
||||
void accept();
|
||||
void reject();
|
||||
|
||||
void saveSettings();
|
||||
|
||||
void initUI(const QList<IMAGEFORMAT>& imageFormats);
|
||||
void createActions();
|
||||
|
||||
private slots:
|
||||
void onQualityChanged(int value);
|
||||
|
||||
void onDirectoryMethodChanged(int id);
|
||||
void onFileMethodChanged(int id);
|
||||
void onFileNamePlusChanged(int id);
|
||||
void onFileOverwriteMethodChanged(int id);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // CEXPORTDIALOG_H
|
||||
|
||||
+230
-72
@@ -6,96 +6,248 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>135</height>
|
||||
<width>554</width>
|
||||
<height>466</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>quality:</string>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Destination Path</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="m_lpDestinationPathBrowse">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QCheckBox" name="m_lpKeepStructure">
|
||||
<property name="text">
|
||||
<string>keep structure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="m_lpKeepDirectory">
|
||||
<property name="text">
|
||||
<string>keep directory</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpDirectoryMethod</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="m_lpDestinationPathTag"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="m_lpNewDirectoryTag">
|
||||
<property name="text">
|
||||
<string>TAG</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpDirectoryMethod</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="m_lpNewDirectory">
|
||||
<property name="text">
|
||||
<string>new directory</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpDirectoryMethod</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_lpDestinationPath"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="m_lpPathTagHelp">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>file format:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_lpFileFormat</cstring>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Filename</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="7" column="0" colspan="3">
|
||||
<widget class="QRadioButton" name="m_lpFileOverwrite">
|
||||
<property name="text">
|
||||
<string>overwrite existing file</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpFileOverwriteMethod</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="m_lpFilenameTag">
|
||||
<property name="text">
|
||||
<string>TAG:</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpFilenameAdd</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="m_lpFilenamePlusConverted">
|
||||
<property name="text">
|
||||
<string>old filename + _converted</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpFilenameAdd</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="m_lpKeepFilename">
|
||||
<property name="text">
|
||||
<string>keep filename</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpFilenameMethod</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="m_lpFileTag"/>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="3">
|
||||
<widget class="QRadioButton" name="m_lpFileRename">
|
||||
<property name="text">
|
||||
<string>auto rename existing file</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpFileOverwriteMethod</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QRadioButton" name="m_lpFileAsk">
|
||||
<property name="text">
|
||||
<string>ask before overwrite existing file</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpFileOverwriteMethod</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="m_lpFileTagHelp">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="m_lpNewFilename">
|
||||
<property name="text">
|
||||
<string>rename</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">m_lpFilenameMethod</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_lpFileFormat"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>destination path:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_lpDestinationPath</cstring>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>File Format</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0">
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSlider" name="m_lpQuality">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpQualityValue">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_lpQuality</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>file format:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_lpFileFormat</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_lpFileFormat"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>quality:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSlider" name="m_lpQuality">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpQualityValue">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_lpQuality</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_lpDestinationPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpDestinationPathBrowse">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
@@ -133,4 +285,10 @@
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="m_lpFilenameMethod"/>
|
||||
<buttongroup name="m_lpFilenameAdd"/>
|
||||
<buttongroup name="m_lpFileOverwriteMethod"/>
|
||||
<buttongroup name="m_lpDirectoryMethod"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
+230
-68
@@ -2,7 +2,6 @@
|
||||
#include "ui_cmainwindow.h"
|
||||
|
||||
#include "cimage.h"
|
||||
#include "cexif.h"
|
||||
#include "cexportdialog.h"
|
||||
#include "cfiledialog.h"
|
||||
|
||||
@@ -27,6 +26,7 @@ cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::cMainWindow),
|
||||
m_lpSplashScreen(lpSplashScreen),
|
||||
m_lpProgressBar(nullptr),
|
||||
m_working(false)
|
||||
{
|
||||
initUI();
|
||||
@@ -91,6 +91,10 @@ void cMainWindow::initUI()
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
}
|
||||
|
||||
m_lpProgressBar = new QProgressBar(this);
|
||||
m_lpProgressBar->setVisible(false);
|
||||
ui->m_lpStatusBar->addPermanentWidget(m_lpProgressBar);
|
||||
}
|
||||
|
||||
void cMainWindow::createActions()
|
||||
@@ -189,58 +193,6 @@ void cMainWindow::addImageFormat(const char* shortName, const char* description,
|
||||
m_imageFormats.append(i);
|
||||
}
|
||||
|
||||
QString cMainWindow::generateReadList()
|
||||
{
|
||||
QString all("all supported files (");
|
||||
QString readList;
|
||||
|
||||
for(int z = 0;z < m_imageFormats.count();z++)
|
||||
{
|
||||
IMAGEFORMAT i = m_imageFormats[z];
|
||||
|
||||
if(i.read)
|
||||
{
|
||||
all.append(i.extension);
|
||||
all.append(" ");
|
||||
|
||||
readList.append(";;");
|
||||
readList.append(i.description);
|
||||
readList.append(" (");
|
||||
readList.append(i.extension);
|
||||
readList.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
readList.prepend(all);
|
||||
return(readList);
|
||||
}
|
||||
|
||||
QString cMainWindow::generateWriteList()
|
||||
{
|
||||
QString all("all supported files (");
|
||||
QString writeList;
|
||||
|
||||
for(int z = 0;z < m_imageFormats.count();z++)
|
||||
{
|
||||
IMAGEFORMAT i = m_imageFormats[z];
|
||||
|
||||
if(i.write)
|
||||
{
|
||||
all.append(i.extension);
|
||||
all.append(" ");
|
||||
|
||||
writeList.append(";;");
|
||||
writeList.append(i.description);
|
||||
writeList.append(" (");
|
||||
writeList.append(i.extension);
|
||||
writeList.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
writeList.prepend(all);
|
||||
return(writeList);
|
||||
}
|
||||
|
||||
void cMainWindow::onAddFile()
|
||||
{
|
||||
QSettings settings;
|
||||
@@ -253,7 +205,7 @@ void cMainWindow::onAddFile()
|
||||
fileDialog.setDirectory(path);
|
||||
fileDialog.setFileMode(QFileDialog::ExistingFiles);
|
||||
fileDialog.setViewMode(QFileDialog::Detail);
|
||||
fileDialog.setNameFilter(generateReadList());
|
||||
fileDialog.setNameFilter(generateReadList(m_imageFormats));
|
||||
if(!fileDialog.exec())
|
||||
return;
|
||||
|
||||
@@ -300,12 +252,15 @@ void cMainWindow::onAddFolder()
|
||||
settings.setValue("import/recursive", QVariant::fromValue(checked));
|
||||
|
||||
m_working = true;
|
||||
ui->m_lpStatusBar->showMessage(tr("importing..."));
|
||||
qApp->processEvents();
|
||||
|
||||
addPath(path, checked);
|
||||
|
||||
for(int i = 0;i < m_lpFileListModel->columnCount();i++)
|
||||
ui->m_lpFileList->resizeColumnToContents(i);
|
||||
|
||||
ui->m_lpStatusBar->showMessage(tr("done."), 3000);
|
||||
m_working = false;
|
||||
}
|
||||
|
||||
@@ -324,6 +279,8 @@ void cMainWindow::onClearList()
|
||||
void cMainWindow::onAddEntrys(const QStringList& fileList)
|
||||
{
|
||||
m_working = true;
|
||||
ui->m_lpStatusBar->showMessage(tr("importing..."));
|
||||
qApp->processEvents();
|
||||
|
||||
for(int i = 0;i < fileList.count();i++)
|
||||
{
|
||||
@@ -345,11 +302,15 @@ void cMainWindow::onAddEntrys(const QStringList& fileList)
|
||||
for(int i = 0;i < m_lpFileListModel->columnCount();i++)
|
||||
ui->m_lpFileList->resizeColumnToContents(i);
|
||||
|
||||
ui->m_lpStatusBar->showMessage(tr("done."), 3000);
|
||||
m_working = false;
|
||||
}
|
||||
|
||||
void cMainWindow::addPath(const QString& path, bool recursive)
|
||||
{
|
||||
ui->m_lpStatusBar->showMessage(QString(tr("importing %1...")).arg(path));
|
||||
qApp->processEvents();
|
||||
|
||||
QDir dir(path);
|
||||
QStringList dirList = dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||
QStringList fileList = dir.entryList(QDir::Files);
|
||||
@@ -366,6 +327,9 @@ void cMainWindow::addPath(const QString& path, bool recursive)
|
||||
|
||||
void cMainWindow::addFile(const QString& file)
|
||||
{
|
||||
ui->m_lpStatusBar->showMessage(QString(tr("importing %1...")).arg(file));
|
||||
qApp->processEvents();
|
||||
|
||||
if(isInList(file))
|
||||
return;
|
||||
|
||||
@@ -415,9 +379,29 @@ bool cMainWindow::isInList(const QString& file)
|
||||
|
||||
void cMainWindow::onConvert()
|
||||
{
|
||||
cExportDialog* lpExportDialog = new cExportDialog(this);
|
||||
lpExportDialog->exec();
|
||||
delete lpExportDialog;
|
||||
cExportDialog exportDialog(m_imageFormats, this);
|
||||
if(exportDialog.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
doExport();
|
||||
}
|
||||
|
||||
void cMainWindow::onThumbnailSize(int size)
|
||||
{
|
||||
ui->m_lpThumbnailSizeValue->setText(QString::number(size));
|
||||
ui->m_lpFileList->setIconSize(QSize(size, size));
|
||||
}
|
||||
|
||||
void cMainWindow::doExport()
|
||||
{
|
||||
EXPORTSETTINGS exportSettings;
|
||||
bool overwriteAll = false;
|
||||
|
||||
getExportSettings(exportSettings);
|
||||
|
||||
m_lpProgressBar->setRange(0, m_lpFileListModel->rowCount());
|
||||
m_lpProgressBar->setValue(0);
|
||||
m_lpProgressBar->setVisible(true);
|
||||
|
||||
for(int i = 0;i < m_lpFileListModel->rowCount();i++)
|
||||
{
|
||||
@@ -429,20 +413,198 @@ void cMainWindow::onConvert()
|
||||
if(!lpExif)
|
||||
continue;
|
||||
|
||||
cImage image(lpExif->fileName());
|
||||
if(image.isNull())
|
||||
continue;
|
||||
overwriteAll = exportFile(exportSettings, lpExif, overwriteAll);
|
||||
|
||||
QString newFile = lpExif->fileName();
|
||||
newFile = newFile.left(newFile.lastIndexOf("."));
|
||||
newFile.append("_converted.jpg");
|
||||
|
||||
image.save(newFile);
|
||||
m_lpProgressBar->setValue(i);
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
m_lpProgressBar->setVisible(false);
|
||||
ui->m_lpStatusBar->showMessage(tr("export done."), 3000);
|
||||
}
|
||||
|
||||
void cMainWindow::onThumbnailSize(int size)
|
||||
void cMainWindow::getExportSettings(EXPORTSETTINGS& exportSettings)
|
||||
{
|
||||
ui->m_lpThumbnailSizeValue->setText(QString::number(size));
|
||||
ui->m_lpFileList->setIconSize(QSize(size, size));
|
||||
QSettings settings;
|
||||
QString tmp;
|
||||
|
||||
tmp = settings.value("export/directoryMethod", QVariant::fromValue(QString("keepDirectory"))).toString();
|
||||
|
||||
if(tmp == "newDirectoryTag")
|
||||
exportSettings.directoryMethod = DIRECTORY_METHOD_TAG;
|
||||
else if(tmp == "newDirectory")
|
||||
exportSettings.directoryMethod = DIRECTORY_METHOD_NEW;
|
||||
else
|
||||
exportSettings.directoryMethod = DIRECTORY_METHOD_KEEP;
|
||||
|
||||
exportSettings.directory = settings.value("export/destinationPath", QVariant::fromValue(QString(""))).toString();
|
||||
exportSettings.keepStructure = settings.value("export/keepStructure", QVariant::fromValue(false)).toBool();
|
||||
exportSettings.directoryTag = settings.value("export/destinationPathTag", QVariant::fromValue(QString(""))).toString();
|
||||
|
||||
|
||||
tmp = settings.value("export/fileMethod", QVariant::fromValue(QString("keepFilename"))).toString();
|
||||
|
||||
if(tmp == "newFilename")
|
||||
exportSettings.fileMethod = FILE_METHOD_RENAME;
|
||||
else
|
||||
exportSettings.fileMethod = FILE_METHOD_KEEP;
|
||||
|
||||
|
||||
tmp = settings.value("export/filenamePlus", QVariant::fromValue(QString("converted"))).toString();
|
||||
|
||||
if(tmp == "TAG")
|
||||
exportSettings.fileAdd = FILE_ADD_TAG;
|
||||
else
|
||||
exportSettings.fileAdd = FILE_ADD_CONVERTED;
|
||||
|
||||
exportSettings.fileTag = settings.value("export/fileTag", QVariant::fromValue(QString(""))).toString();
|
||||
|
||||
tmp = settings.value("export/overwrite", QVariant::fromValue(QString("ask"))).toString();
|
||||
|
||||
if(tmp == "overwrite")
|
||||
exportSettings.fileOverwrite = FILE_OVERWRITE_OVERWRITE;
|
||||
else if(tmp == "rename")
|
||||
exportSettings.fileOverwrite = FILE_OVERWRITE_RENAME;
|
||||
else
|
||||
exportSettings.fileOverwrite = FILE_OVERWRITE_ASK;
|
||||
|
||||
exportSettings.fileFormat = settings.value("export/fileFormat").toString();
|
||||
exportSettings.quality = settings.value("export/quality", QVariant::fromValue(50)).toInt();
|
||||
}
|
||||
|
||||
bool cMainWindow::exportFile(const EXPORTSETTINGS& exportSettings, cEXIF* lpExif, bool overwriteAll)
|
||||
{
|
||||
QString destPath;
|
||||
QString destFile;
|
||||
QFileInfo fileInfo(lpExif->fileName());
|
||||
QString extension = exportSettings.fileFormat;
|
||||
|
||||
extension = extension.mid(extension.lastIndexOf(".")+1);
|
||||
extension = extension.left(extension.length()-1);
|
||||
|
||||
switch(exportSettings.directoryMethod)
|
||||
{
|
||||
case DIRECTORY_METHOD_NEW:
|
||||
destPath = exportSettings.directory;
|
||||
if(exportSettings.keepStructure)
|
||||
destPath.append("/" + fileInfo.absolutePath().replace(":", ""));
|
||||
break;
|
||||
case DIRECTORY_METHOD_KEEP:
|
||||
destPath = fileInfo.absolutePath();
|
||||
break;
|
||||
case DIRECTORY_METHOD_TAG:
|
||||
destPath = replaceTags(exportSettings.directoryTag, lpExif, extension);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(exportSettings.fileMethod)
|
||||
{
|
||||
case FILE_METHOD_KEEP:
|
||||
destFile = fileInfo.baseName() + "." + extension;
|
||||
break;
|
||||
case FILE_METHOD_RENAME:
|
||||
switch(exportSettings.fileAdd)
|
||||
{
|
||||
case FILE_ADD_CONVERTED:
|
||||
destFile = fileInfo.baseName() + "_converted" + "." + extension;
|
||||
break;
|
||||
case FILE_ADD_TAG:
|
||||
destFile = replaceTags(fileInfo.baseName(), lpExif, extension, false) + "." + extension;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
destFile.prepend(destPath + "/");
|
||||
QFileInfo destInfo(destFile);
|
||||
|
||||
if(destInfo.exists() && !overwriteAll)
|
||||
{
|
||||
switch(exportSettings.fileOverwrite)
|
||||
{
|
||||
case FILE_OVERWRITE_ASK:
|
||||
{
|
||||
QMessageBox::StandardButton ret = QMessageBox::question(this, tr("File Exists"), QString(tr("File %1 exists. Do you want to overwrite?")).arg(destFile), QMessageBox::Yes | QMessageBox::No | QMessageBox::YesAll);
|
||||
if(ret == QMessageBox::YesAll)
|
||||
overwriteAll = true;
|
||||
else if(ret == QMessageBox::No)
|
||||
return(overwriteAll);
|
||||
}
|
||||
break;
|
||||
case FILE_OVERWRITE_RENAME:
|
||||
destFile = findFreeFileName(destFile);
|
||||
if(destFile.isEmpty())
|
||||
{
|
||||
QMessageBox::information(this, tr("File Export"), QString("%1 cannot be renamed.").arg(lpExif->fileName()));
|
||||
return(overwriteAll);
|
||||
}
|
||||
break;
|
||||
case FILE_OVERWRITE_OVERWRITE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ui->m_lpStatusBar->showMessage(QString(tr("loading %1...")).arg(lpExif->fileName()));
|
||||
qApp->processEvents();
|
||||
|
||||
cImage image(lpExif->fileName());
|
||||
if(!image.isNull())
|
||||
{
|
||||
QFileInfo info(destFile);
|
||||
|
||||
if(info.exists())
|
||||
qDebug() << "MACHMA NED!!!";
|
||||
else
|
||||
{
|
||||
ui->m_lpStatusBar->showMessage(QString(tr("converting to %1...")).arg(destFile));
|
||||
qApp->processEvents();
|
||||
|
||||
QDir dir;
|
||||
QFileInfo info(destFile);
|
||||
|
||||
if(dir.mkpath(info.absolutePath()))
|
||||
image.save(destFile);
|
||||
}
|
||||
}
|
||||
|
||||
return(overwriteAll);
|
||||
}
|
||||
|
||||
QString cMainWindow::replaceTags(const QString& path, cEXIF* lpExif, const QString& extension, bool directory)
|
||||
{
|
||||
QString dest = path;
|
||||
QFileInfo fileInfo(lpExif->fileName());
|
||||
|
||||
if(directory)
|
||||
dest = dest.replace("%o", fileInfo.absolutePath());
|
||||
else
|
||||
dest = dest.replace("%o", fileInfo.fileName());
|
||||
|
||||
dest = dest.replace("%y", lpExif->dateTime().toString("yyyy"));
|
||||
dest = dest.replace("%m", lpExif->dateTime().toString("MM"));
|
||||
dest = dest.replace("%d", lpExif->dateTime().toString("dd"));
|
||||
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("%t", extension);
|
||||
|
||||
dest = dest.replace("\\", "/");
|
||||
|
||||
return(dest);
|
||||
}
|
||||
|
||||
QString cMainWindow::findFreeFileName(const QString& fileName)
|
||||
{
|
||||
QFileInfo fileInfo(fileName);
|
||||
QString newName;
|
||||
int number = 1;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
newName = fileInfo.absolutePath() + "/" + fileInfo.baseName() + QString::number(number) + "." + fileInfo.suffix();
|
||||
|
||||
if(!QFileInfo::exists(newName))
|
||||
return(newName);
|
||||
}
|
||||
// return("");
|
||||
}
|
||||
|
||||
+52
-13
@@ -3,6 +3,8 @@
|
||||
|
||||
|
||||
#include "csplashscreen.h"
|
||||
#include "common.h"
|
||||
#include "cexif.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QCloseEvent>
|
||||
@@ -10,20 +12,53 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QMimeDatabase>
|
||||
|
||||
#include <QProgressBar>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class cMainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
typedef struct tagIMAGEFORMAT
|
||||
enum DIRECTORY_METHOD
|
||||
{
|
||||
QString shortName;
|
||||
QString description;
|
||||
QString extension;
|
||||
bool read;
|
||||
bool write;
|
||||
} IMAGEFORMAT;
|
||||
DIRECTORY_METHOD_KEEP = 1,
|
||||
DIRECTORY_METHOD_NEW = 2,
|
||||
DIRECTORY_METHOD_TAG = 3,
|
||||
};
|
||||
|
||||
enum FILE_METHOD
|
||||
{
|
||||
FILE_METHOD_KEEP = 1,
|
||||
FILE_METHOD_RENAME = 2,
|
||||
};
|
||||
|
||||
enum FILE_OVERWRITE
|
||||
{
|
||||
FILE_OVERWRITE_ASK = 1,
|
||||
FILE_OVERWRITE_RENAME = 2,
|
||||
FILE_OVERWRITE_OVERWRITE = 3,
|
||||
};
|
||||
|
||||
enum FILE_ADD
|
||||
{
|
||||
FILE_ADD_CONVERTED = 1,
|
||||
FILE_ADD_TAG = 2,
|
||||
};
|
||||
|
||||
typedef struct tagEXPORTSETTINGS
|
||||
{
|
||||
DIRECTORY_METHOD directoryMethod;
|
||||
QString directory;
|
||||
bool keepStructure;
|
||||
QString directoryTag;
|
||||
FILE_METHOD fileMethod;
|
||||
FILE_ADD fileAdd;
|
||||
QString fileTag;
|
||||
FILE_OVERWRITE fileOverwrite;
|
||||
QString fileFormat;
|
||||
int quality;
|
||||
} EXPORTSETTINGS;
|
||||
|
||||
|
||||
class cMainWindow : public QMainWindow
|
||||
@@ -38,6 +73,7 @@ private:
|
||||
Ui::cMainWindow* ui;
|
||||
cSplashScreen* m_lpSplashScreen; /*!< TODO: describe */
|
||||
QStandardItemModel* m_lpFileListModel;
|
||||
QProgressBar* m_lpProgressBar; /*!< TODO: describe */
|
||||
|
||||
QMimeDatabase m_mimeDB;
|
||||
QList<IMAGEFORMAT> m_imageFormats;
|
||||
@@ -54,6 +90,15 @@ private:
|
||||
|
||||
bool isInList(const QString& file);
|
||||
|
||||
void doExport();
|
||||
void getExportSettings(EXPORTSETTINGS& exportSettings);
|
||||
bool exportFile(const EXPORTSETTINGS& exportSettings, cEXIF* lpExif, bool overwriteAll);
|
||||
QString replaceTags(const QString& path, cEXIF* lpExif, const QString& extension = QString(""), bool directory = true);
|
||||
QString findFreeFileName(const QString& fileName);
|
||||
|
||||
void setImageFormats();
|
||||
void addImageFormat(const char* shortName, const char* description, const char* extension, QList<QByteArray>& readList, QList<QByteArray>& writeList);
|
||||
|
||||
private slots:
|
||||
void onAddFile();
|
||||
void onAddFolder();
|
||||
@@ -66,11 +111,5 @@ private slots:
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
void setImageFormats();
|
||||
void addImageFormat(const char* shortName, const char* description, const char* extension, QList<QByteArray>& readList, QList<QByteArray>& writeList);
|
||||
|
||||
QString generateReadList();
|
||||
QString generateWriteList();
|
||||
};
|
||||
#endif // CMAINWINDOW_H
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#include "common.h"
|
||||
|
||||
|
||||
QString generateReadList(const QList<IMAGEFORMAT>& imageFormats)
|
||||
{
|
||||
QString all("all supported files (");
|
||||
QString readList;
|
||||
|
||||
for(int z = 0;z < imageFormats.count();z++)
|
||||
{
|
||||
IMAGEFORMAT i = imageFormats[z];
|
||||
|
||||
if(i.read)
|
||||
{
|
||||
all.append(i.extension);
|
||||
all.append(" ");
|
||||
|
||||
readList.append(";;");
|
||||
readList.append(i.description);
|
||||
readList.append(" (");
|
||||
readList.append(i.extension);
|
||||
readList.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
readList.prepend(all);
|
||||
return(readList);
|
||||
}
|
||||
|
||||
QString generateWriteList(const QList<IMAGEFORMAT>& imageFormats)
|
||||
{
|
||||
QString all("all supported files (");
|
||||
QString writeList;
|
||||
|
||||
for(int z = 0;z < imageFormats.count();z++)
|
||||
{
|
||||
IMAGEFORMAT i = imageFormats[z];
|
||||
|
||||
if(i.write)
|
||||
{
|
||||
all.append(i.extension);
|
||||
all.append(" ");
|
||||
|
||||
writeList.append(";;");
|
||||
writeList.append(i.description);
|
||||
writeList.append(" (");
|
||||
writeList.append(i.extension);
|
||||
writeList.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
writeList.prepend(all);
|
||||
return(writeList);
|
||||
}
|
||||
|
||||
@@ -18,4 +18,18 @@
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct tagIMAGEFORMAT
|
||||
{
|
||||
QString shortName;
|
||||
QString description;
|
||||
QString extension;
|
||||
bool read;
|
||||
bool write;
|
||||
} IMAGEFORMAT;
|
||||
|
||||
|
||||
QString generateReadList(const QList<IMAGEFORMAT>& imageFormats);
|
||||
QString generateWriteList(const QList<IMAGEFORMAT>& imageFormats);
|
||||
|
||||
|
||||
#endif // COMMON_H
|
||||
|
||||
@@ -48,6 +48,7 @@ SOURCES += \
|
||||
cexportdialog.cpp \
|
||||
cfiledialog.cpp \
|
||||
cimage.cpp \
|
||||
common.cpp \
|
||||
csplashscreen.cpp \
|
||||
ctreeview.cpp \
|
||||
main.cpp \
|
||||
|
||||
Reference in New Issue
Block a user