image count, export options
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <QSettings>
|
||||
#include <QCloseEvent>
|
||||
#include <QImageWriter>
|
||||
|
||||
|
||||
cExportDialog::cExportDialog(const QList<IMAGEFORMAT>& imageFormats, QWidget *parent) :
|
||||
@@ -221,6 +222,8 @@ void cExportDialog::initUI(const QList<IMAGEFORMAT>& imageFormats)
|
||||
"<tr><td>%S</td><td>second of picture taken</td></tr>"
|
||||
"<tr><td>%t</td><td>type of created picture</td></tr>"
|
||||
"</table>");
|
||||
|
||||
onFileFormatChanged(ui->m_lpFileFormat->currentText());
|
||||
}
|
||||
|
||||
void cExportDialog::createActions()
|
||||
@@ -233,6 +236,8 @@ void cExportDialog::createActions()
|
||||
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);
|
||||
|
||||
connect(ui->m_lpFileFormat, &QComboBox::currentTextChanged, this, &cExportDialog::onFileFormatChanged);
|
||||
}
|
||||
|
||||
void cExportDialog::onQualityChanged(int value)
|
||||
@@ -295,3 +300,45 @@ void cExportDialog::onFileOverwriteMethodChanged(int /*id*/)
|
||||
{
|
||||
//NOTHING
|
||||
}
|
||||
|
||||
void cExportDialog::onFileFormatChanged(const QString &text)
|
||||
{
|
||||
QString ext = text.mid(text.lastIndexOf("*.")+1).replace(")", "");
|
||||
QImageWriter writer("test" + ext);
|
||||
|
||||
if(writer.supportsOption(QImageIOHandler::Quality))
|
||||
{
|
||||
ui->m_lpQuality->setEnabled(true);
|
||||
ui->m_lpQualityValue->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpQuality->setEnabled(false);
|
||||
ui->m_lpQualityValue->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
QImageWriter writer(destFile);
|
||||
|
||||
qDebug() << "QImageIOHandler::Size: " << writer.supportsOption(QImageIOHandler::Size);
|
||||
qDebug() << "QImageIOHandler::ClipRect: " << writer.supportsOption(QImageIOHandler::ClipRect);
|
||||
qDebug() << "QImageIOHandler::ScaledSize: " << writer.supportsOption(QImageIOHandler::ScaledSize);
|
||||
qDebug() << "QImageIOHandler::ScaledClipRect: " << writer.supportsOption(QImageIOHandler::ScaledClipRect);
|
||||
qDebug() << "QImageIOHandler::Description: " << writer.supportsOption(QImageIOHandler::Description);
|
||||
qDebug() << "QImageIOHandler::CompressionRatio: " << writer.supportsOption(QImageIOHandler::CompressionRatio);
|
||||
qDebug() << "QImageIOHandler::Gamma: " << writer.supportsOption(QImageIOHandler::Gamma);
|
||||
qDebug() << "QImageIOHandler::Quality: " << writer.supportsOption(QImageIOHandler::Quality);
|
||||
qDebug() << "QImageIOHandler::Name: " << writer.supportsOption(QImageIOHandler::Name);
|
||||
qDebug() << "QImageIOHandler::SubType: " << writer.supportsOption(QImageIOHandler::SubType);
|
||||
qDebug() << "QImageIOHandler::IncrementalReading: " << writer.supportsOption(QImageIOHandler::IncrementalReading);
|
||||
qDebug() << "QImageIOHandler::Endianness: " << writer.supportsOption(QImageIOHandler::Endianness);
|
||||
qDebug() << "QImageIOHandler::Animation: " << writer.supportsOption(QImageIOHandler::Animation);
|
||||
qDebug() << "QImageIOHandler::BackgroundColor: " << writer.supportsOption(QImageIOHandler::BackgroundColor);
|
||||
qDebug() << "QImageIOHandler::ImageFormat: " << writer.supportsOption(QImageIOHandler::ImageFormat);
|
||||
qDebug() << "QImageIOHandler::SupportedSubTypes: " << writer.supportsOption(QImageIOHandler::SupportedSubTypes);
|
||||
qDebug() << "QImageIOHandler::OptimizedWrite: " << writer.supportsOption(QImageIOHandler::OptimizedWrite);
|
||||
qDebug() << "QImageIOHandler::ProgressiveScanWrite: " << writer.supportsOption(QImageIOHandler::ProgressiveScanWrite);
|
||||
qDebug() << "QImageIOHandler::ImageTransformation: " << writer.supportsOption(QImageIOHandler::ImageTransformation);
|
||||
qDebug() << "QImageIOHandler::TransformedByDefault: " << writer.supportsOption(QImageIOHandler::TransformedByDefault);
|
||||
*/
|
||||
|
||||
@@ -128,6 +128,13 @@ private slots:
|
||||
\param id
|
||||
*/
|
||||
void onFileOverwriteMethodChanged(int id);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onFileFormatChanged
|
||||
\param text
|
||||
*/
|
||||
void onFileFormatChanged(const QString &text);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
+5
-2
@@ -191,6 +191,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSlider" name="m_lpQuality">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@@ -286,9 +289,9 @@
|
||||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="m_lpFilenameMethod"/>
|
||||
<buttongroup name="m_lpDirectoryMethod"/>
|
||||
<buttongroup name="m_lpFilenameAdd"/>
|
||||
<buttongroup name="m_lpFileOverwriteMethod"/>
|
||||
<buttongroup name="m_lpDirectoryMethod"/>
|
||||
<buttongroup name="m_lpFilenameMethod"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
+28
-5
@@ -38,6 +38,8 @@ cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) :
|
||||
createActions();
|
||||
|
||||
setImageFormats();
|
||||
|
||||
countImages();
|
||||
}
|
||||
|
||||
cMainWindow::~cMainWindow()
|
||||
@@ -270,6 +272,8 @@ void cMainWindow::onAddFolder()
|
||||
|
||||
ui->m_lpStatusBar->showMessage(tr("done."), 3000);
|
||||
m_working = false;
|
||||
|
||||
countImages();
|
||||
}
|
||||
|
||||
void cMainWindow::onRemoveSelected()
|
||||
@@ -289,6 +293,8 @@ void cMainWindow::onClearList()
|
||||
|
||||
QStringList headerLabels = QStringList() << tr("path") << tr("file") << tr("size") << tr("date") << tr("width") << tr("height") << ("");
|
||||
m_lpFileListModel->setHorizontalHeaderLabels(headerLabels);
|
||||
|
||||
countImages();
|
||||
}
|
||||
|
||||
void cMainWindow::onAddEntrys(const QStringList& fileList)
|
||||
@@ -319,6 +325,8 @@ void cMainWindow::onAddEntrys(const QStringList& fileList)
|
||||
|
||||
ui->m_lpStatusBar->showMessage(tr("done."), 3000);
|
||||
m_working = false;
|
||||
|
||||
countImages();
|
||||
}
|
||||
|
||||
void cMainWindow::addPath(const QString& path, bool recursive)
|
||||
@@ -377,6 +385,7 @@ void cMainWindow::addFile(const QString& file)
|
||||
|
||||
m_lpFileListModel->appendRow(items);
|
||||
|
||||
countImages();
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
@@ -432,7 +441,7 @@ void cMainWindow::doExport()
|
||||
|
||||
overwrite = exportFile(exportSettings, lpExif, overwrite);
|
||||
|
||||
m_lpProgressBar->setValue(i);
|
||||
m_lpProgressBar->setValue(i+1);
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
@@ -598,9 +607,9 @@ OVERWRITE cMainWindow::exportFile(const EXPORTSETTINGS& exportSettings, cEXIF* l
|
||||
|
||||
QFileInfo info(destFile);
|
||||
|
||||
if(info.exists())
|
||||
qDebug() << "MACHMA NED!!!";
|
||||
else
|
||||
// if(info.exists())
|
||||
// qDebug() << "MACHMA NED!!!";
|
||||
// else
|
||||
{
|
||||
ui->m_lpStatusBar->showMessage(QString(tr("converting to %1...")).arg(destFile));
|
||||
qApp->processEvents();
|
||||
@@ -609,7 +618,7 @@ OVERWRITE cMainWindow::exportFile(const EXPORTSETTINGS& exportSettings, cEXIF* l
|
||||
QFileInfo info(destFile);
|
||||
|
||||
if(dir.mkpath(info.absolutePath()))
|
||||
image.save(destFile);
|
||||
image.save(destFile, nullptr, exportSettings.quality);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,4 +676,18 @@ void cMainWindow::onDeleteEntrys()
|
||||
auto idx = ui->m_lpFileList->selectionModel()->selectedIndexes().first();
|
||||
m_lpFileListModel->removeRow(idx.row(), idx.parent());
|
||||
}
|
||||
|
||||
countImages();
|
||||
}
|
||||
|
||||
void cMainWindow::countImages()
|
||||
{
|
||||
int count = m_lpFileListModel->rowCount();
|
||||
|
||||
ui->m_lpStatusBar->showMessage(QString("%1 image(s)").arg(count));
|
||||
|
||||
if(count)
|
||||
ui->m_lpConvert->setEnabled(true);
|
||||
else
|
||||
ui->m_lpConvert->setEnabled(false);
|
||||
}
|
||||
|
||||
+9
-2
@@ -130,8 +130,8 @@ private:
|
||||
QStandardItemModel* m_lpFileListModel; /*!< TODO: describe */
|
||||
QProgressBar* m_lpProgressBar; /*!< TODO: describe */
|
||||
|
||||
QMimeDatabase m_mimeDB;
|
||||
QList<IMAGEFORMAT> m_imageFormats;
|
||||
QMimeDatabase m_mimeDB; /*!< TODO: describe */
|
||||
QList<IMAGEFORMAT> m_imageFormats; /*!< TODO: describe */
|
||||
|
||||
bool m_working; /*!< TODO: describe */
|
||||
|
||||
@@ -246,6 +246,13 @@ private:
|
||||
*/
|
||||
void addImageFormat(const char* shortName, const char* description, const char* extension, QList<QByteArray>& readList, QList<QByteArray>& writeList);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn countImages
|
||||
*/
|
||||
void countImages();
|
||||
|
||||
private slots:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
Reference in New Issue
Block a user