export dialog
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
/*!
|
||||
\file cexportdialog.cpp
|
||||
|
||||
*/
|
||||
|
||||
#include "cexportdialog.h"
|
||||
#include "ui_cexportdialog.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
cExportDialog::cExportDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::cExportDialog)
|
||||
{
|
||||
initUI();
|
||||
createActions();
|
||||
}
|
||||
|
||||
cExportDialog::~cExportDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cExportDialog::initUI()
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QSettings settings;
|
||||
|
||||
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 str = settings.value("export/filter", "exportAll").toString();
|
||||
if(str == "exportAll")
|
||||
{
|
||||
ui->m_lpExportAll->setChecked(true);
|
||||
ui->m_lpExportSelection->setChecked(false);
|
||||
ui->m_lpExportFilter->setChecked(false);
|
||||
}
|
||||
else if(str == "exportSelection")
|
||||
{
|
||||
ui->m_lpExportAll->setChecked(false);
|
||||
ui->m_lpExportSelection->setChecked(true);
|
||||
ui->m_lpExportFilter->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpExportAll->setChecked(false);
|
||||
ui->m_lpExportSelection->setChecked(false);
|
||||
ui->m_lpExportFilter->setChecked(true);
|
||||
}
|
||||
|
||||
ui->m_lpKeepFilename->setChecked(settings.value("export/keepFilename", true).toBool());
|
||||
ui->m_lpRenameFilename->setChecked(!settings.value("export/keepFilename", true).toBool());
|
||||
ui->m_lpFilePattern->setText(settings.value("export/filePattern", "%o").toString());
|
||||
|
||||
ui->m_lpKeepStructure->setChecked(settings.value("export/keepStructure", true).toBool());
|
||||
ui->m_lpRenameStructure->setChecked(!settings.value("export/keepStructure", true).toBool());
|
||||
ui->m_lpStructurePattern->setText(settings.value("export/structurePattern", "%o").toString());
|
||||
}
|
||||
|
||||
void cExportDialog::createActions()
|
||||
{
|
||||
connect(ui->m_lpPathSelect, &QPushButton::clicked, this, &cExportDialog::onPathSelect);
|
||||
}
|
||||
|
||||
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_lpPath->setText(szPath);
|
||||
settings.setValue("export/path", szPath);
|
||||
}
|
||||
|
||||
void cExportDialog::accept()
|
||||
{
|
||||
savePosition();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void cExportDialog::reject()
|
||||
{
|
||||
savePosition();
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void cExportDialog::savePosition()
|
||||
{
|
||||
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_lpExportAll->isChecked())
|
||||
settings.setValue()
|
||||
QString str = settings.value("export/filter", "exportAll").toString();
|
||||
if(str == "exportAll")
|
||||
{
|
||||
ui->m_lpExportAll->setChecked(true);
|
||||
ui->m_lpExportSelection->setChecked(false);
|
||||
ui->m_lpExportFilter->setChecked(false);
|
||||
}
|
||||
else if(str == "exportSelection")
|
||||
{
|
||||
ui->m_lpExportAll->setChecked(false);
|
||||
ui->m_lpExportSelection->setChecked(true);
|
||||
ui->m_lpExportFilter->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpExportAll->setChecked(false);
|
||||
ui->m_lpExportSelection->setChecked(false);
|
||||
ui->m_lpExportFilter->setChecked(true);
|
||||
}
|
||||
|
||||
ui->m_lpKeepFilename->setChecked(settings.value("export/keepFilename", true).toBool());
|
||||
ui->m_lpRenameFilename->setChecked(!settings.value("export/keepFilename", true).toBool());
|
||||
ui->m_lpFilePattern->setText(settings.value("export/filePattern", "%o").toString());
|
||||
|
||||
ui->m_lpKeepStructure->setChecked(settings.value("export/keepStructure", true).toBool());
|
||||
ui->m_lpRenameStructure->setChecked(!settings.value("export/keepStructure", true).toBool());
|
||||
ui->m_lpStructurePattern->setText(settings.value("export/structurePattern", "%o").toString());
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*!
|
||||
\file cexportdialog.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CEXPORTDIALOG_H
|
||||
#define CEXPORTDIALOG_H
|
||||
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class cExportDialog;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cExportDialog cexportdialog.h "cexportdialog.h"
|
||||
*/
|
||||
class cExportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cExportDialog
|
||||
\param parent
|
||||
*/
|
||||
explicit cExportDialog(QWidget *parent = nullptr);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn ~cExportDialog
|
||||
*/
|
||||
~cExportDialog();
|
||||
|
||||
private slots:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onPathSelect
|
||||
*/
|
||||
void onPathSelect();
|
||||
|
||||
private:
|
||||
Ui::cExportDialog* ui; /*!< TODO: describe */
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn initUI
|
||||
*/
|
||||
void initUI();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn createActions
|
||||
*/
|
||||
void createActions();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn accept
|
||||
*/
|
||||
void accept();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn reject
|
||||
*/
|
||||
void reject();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn savePosition
|
||||
*/
|
||||
void savePosition();
|
||||
};
|
||||
|
||||
#endif // CEXPORTDIALOG_H
|
||||
@@ -0,0 +1,240 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>cExportDialog</class>
|
||||
<widget class="QDialog" name="cExportDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>609</width>
|
||||
<height>247</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Export</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_lpPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpPathSelect">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Filter</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_lpExportAll">
|
||||
<property name="text">
|
||||
<string>all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_lpExportFilter">
|
||||
<property name="text">
|
||||
<string>all in filter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_lpExportSelection">
|
||||
<property name="text">
|
||||
<string>selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Filename</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_lpKeepFilename">
|
||||
<property name="text">
|
||||
<string>keep filename</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_lpRenameFilename">
|
||||
<property name="text">
|
||||
<string>rename to:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_lpFilePattern"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body>%t = title<br>%n = original filename<br>%d = original date<br>%m = camera model</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Structure</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_lpKeepStructure">
|
||||
<property name="text">
|
||||
<string>keep structure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_lpRenameStructure">
|
||||
<property name="text">
|
||||
<string>rename to:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_lpStructurePattern"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string><html><head/><body>%t = title<br>%n = original filename<br>%d = original date<br>%m = camera model</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>cExportDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>cExportDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
+33
-21
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "cmainwindow.h"
|
||||
#include "cimportdialog.h"
|
||||
#include "cexportdialog.h"
|
||||
|
||||
#include "cdatepicker.h"
|
||||
#include "cdatetimepicker.h"
|
||||
@@ -51,7 +52,6 @@ cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) :
|
||||
initUI();
|
||||
createActions();
|
||||
|
||||
// onFileNew();
|
||||
QSettings settings;
|
||||
m_szOldPath = settings.value("file/lastPath", QDir::homePath()).toString();
|
||||
m_pictureLibrary.openDatabase(m_szOldPath);
|
||||
@@ -73,6 +73,28 @@ cMainWindow::~cMainWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("main/width", QVariant::fromValue(size().width()));
|
||||
settings.setValue("main/height", QVariant::fromValue(size().height()));
|
||||
settings.setValue("main/x", QVariant::fromValue(x()));
|
||||
settings.setValue("main/y", QVariant::fromValue(y()));
|
||||
if(this->isMaximized())
|
||||
settings.setValue("main/maximized", QVariant::fromValue(true));
|
||||
else
|
||||
settings.setValue("main/maximized", QVariant::fromValue(false));
|
||||
|
||||
QList<qint32> sizes = ui->m_lpSplitter->sizes();
|
||||
|
||||
for(int x = 0;x < sizes.count();x++)
|
||||
settings.setValue(QString("main/splitter%1").arg(x+1), QVariant::fromValue(sizes[x]));
|
||||
|
||||
m_lpFilterPanel->saveSettings();
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void cMainWindow::initUI()
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -180,26 +202,6 @@ void cMainWindow::createContextActions()
|
||||
connect(m_lpUnsetHDRAction, &QAction::triggered, this, &cMainWindow::onUnsetHDR);
|
||||
}
|
||||
|
||||
void cMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("main/width", QVariant::fromValue(size().width()));
|
||||
settings.setValue("main/height", QVariant::fromValue(size().height()));
|
||||
settings.setValue("main/x", QVariant::fromValue(x()));
|
||||
settings.setValue("main/y", QVariant::fromValue(y()));
|
||||
if(this->isMaximized())
|
||||
settings.setValue("main/maximized", QVariant::fromValue(true));
|
||||
else
|
||||
settings.setValue("main/maximized", QVariant::fromValue(false));
|
||||
|
||||
QList<qint32> sizes = ui->m_lpSplitter->sizes();
|
||||
|
||||
for(int x = 0;x < sizes.count();x++)
|
||||
settings.setValue(QString("main/splitter%1").arg(x+1), QVariant::fromValue(sizes[x]));
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void cMainWindow::createFileActions()
|
||||
{
|
||||
m_lpFileMenu = menuBar()->addMenu(tr("&File"));
|
||||
@@ -223,6 +225,9 @@ void cMainWindow::createFileActions()
|
||||
m_lpFileImportAction = m_lpFileMenu->addAction(tr("&Import..."), this, &cMainWindow::onFileImport);
|
||||
m_lpFileToolBar->addAction(m_lpFileImportAction);
|
||||
|
||||
m_lpFileExportAction = m_lpFileMenu->addAction(tr("&Export..."), this, &cMainWindow::onFileExport);
|
||||
m_lpFileToolBar->addAction(m_lpFileExportAction);
|
||||
|
||||
m_lpFileMenu->addSeparator();
|
||||
|
||||
for(int i = 0; i < MaxRecentFiles;i++)
|
||||
@@ -599,6 +604,13 @@ void cMainWindow::onFileImport()
|
||||
displayData();
|
||||
}
|
||||
|
||||
void cMainWindow::onFileExport()
|
||||
{
|
||||
cExportDialog exportDialog(this);
|
||||
if(exportDialog.exec() == QDialog::Rejected)
|
||||
return;
|
||||
}
|
||||
|
||||
void cMainWindow::onThumbnailViewContextMenu(const QPoint& pos)
|
||||
{
|
||||
QMenu menu(this);
|
||||
|
||||
@@ -93,6 +93,7 @@ private:
|
||||
QAction* m_lpFileOpenAction; /*!< TODO: describe */
|
||||
QAction* m_lpFileSaveAsAction; /*!< TODO: describe */
|
||||
QAction* m_lpFileImportAction; /*!< TODO: describe */
|
||||
QAction* m_lpFileExportAction; /*!< TODO: describe */
|
||||
QAction* m_lpFileQuitAction; /*!< TODO: describe */
|
||||
|
||||
QAction* m_lpSeparatorRecent; /*!< TODO: describe */
|
||||
@@ -231,6 +232,12 @@ private slots:
|
||||
\fn onFileImport
|
||||
*/
|
||||
void onFileImport();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onFileExport
|
||||
*/
|
||||
void onFileExport();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
+6
-3
@@ -78,7 +78,8 @@ SOURCES += \
|
||||
ctoolboxlocation.cpp \
|
||||
ctoolboxtag.cpp \
|
||||
cspoiler.cpp \
|
||||
cfilterpanel.cpp
|
||||
cfilterpanel.cpp \
|
||||
cexportdialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
cmainwindow.h \
|
||||
@@ -105,7 +106,8 @@ HEADERS += \
|
||||
ctoolboxlocation.h \
|
||||
ctoolboxtag.h \
|
||||
cspoiler.h \
|
||||
cfilterpanel.h
|
||||
cfilterpanel.h \
|
||||
cexportdialog.h
|
||||
|
||||
FORMS += \
|
||||
cmainwindow.ui \
|
||||
@@ -118,7 +120,8 @@ FORMS += \
|
||||
cimageviewer.ui \
|
||||
ctoolboxlocation.ui \
|
||||
ctoolboxtag.ui \
|
||||
cfilterpanel.ui
|
||||
cfilterpanel.ui \
|
||||
cexportdialog.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
|
||||
Reference in New Issue
Block a user