]> gitweb.hamatoma.de Git - reqt/commitdiff
ReFind: history of some text comboboxes
authorhama <hama@siduction.net>
Mon, 1 Jun 2015 22:13:24 +0000 (00:13 +0200)
committerhama <hama@siduction.net>
Mon, 1 Jun 2015 22:13:24 +0000 (00:13 +0200)
* ReFind: version 2015.06.01
* ReImgConvert: combobox history

12 files changed:
appl/.gitignore
appl/refind/dialogoptions.hpp
appl/refind/mainwindow.cpp
appl/refind/mainwindow.hpp
appl/reimgconvert/converter.cpp
appl/reimgconvert/main.cpp
appl/reimgconvert/mainwindow.cpp
appl/reimgconvert/mainwindow.hpp
appl/reimgconvert/mainwindow.ui
appl/reimgconvert/reimgconvert.pro
gui/ReGuiValidator.cpp
gui/ReGuiValidator.hpp

index 5ec952f4829950cc05c3c2471ca633bfa3759008..511285d8545273b9dcc81c920467da83b4537afa 100644 (file)
@@ -1,2 +1,4 @@
 build-reviewer-Desktop5-Debug/
 
+build-refind-Desktop5-Debug/
+build-reimgconvert-Desktop5-Debug/
index 5f15e91794d7f63815f6fe3ac70f60202314ca10..6684443351e809f88d65176acadbfb6408e66495 100644 (file)
@@ -16,15 +16,14 @@ class DialogOptions;
 }
 
 class DialogOptions;
-class TableKeyPressEater : public QObject
-{
-    Q_OBJECT
+class TableKeyPressEater: public QObject {
+   Q_OBJECT
 public:
-    TableKeyPressEater(DialogOptions* dialog);
+   TableKeyPressEater(DialogOptions* dialog);
 protected:
-    bool eventFilter(QObject *obj, QEvent *event);
+   bool eventFilter(QObject *obj, QEvent *event);
 private:
-    DialogOptions* m_dialog;
+   DialogOptions* m_dialog;
 };
 
 class DialogOptions: public QDialog {
@@ -32,8 +31,7 @@ class DialogOptions: public QDialog {
 
 public:
    explicit DialogOptions(ContextHandlerList& handlers, QWidget *parent = 0);
-   ~DialogOptions();
-private slots:
+   ~DialogOptions();private slots:
    void accepted();
    void add();
    void cellEntered(int row, int column);
@@ -46,7 +44,8 @@ public:
    void handleKey(int key);
 private:
    void currentToTable(int row);
-   void currentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
+   void currentItemChanged(QTableWidgetItem* current,
+      QTableWidgetItem* previous);
    void fillContextHandler(int row, ContextHandler& handler);
    void fillTable();
    void fromTable();
index 636017101785b17430d0257bff8858b361e1da7e..c7ec31bf11b78e55ea3502986fd8fb0a3b816a45 100644 (file)
@@ -31,7 +31,7 @@
 #include <QProcess>
 #include <QMessageBox>
 
-const QString VERSION("2015.05.27");
+const QString VERSION("2015.06.01");
 /**
  * @brief Constructor.
  *
@@ -52,7 +52,7 @@ MainWindow::MainWindow(const QString& startDir, const QString& homeDir,
             m_contextHandlers(){
    ui->setupUi(this);
    initializeHome();
-   m_statusMessage = new QLabel(tr("Welcome at reviewer"));
+   m_statusMessage = new QLabel(tr("Welcome at refind"));
    if (!startDir.isEmpty())
       ui->comboBoxDirectory->setCurrentText(startDir);
    if (ui->comboBoxDirectory->currentText().isEmpty())
@@ -188,9 +188,9 @@ QString MainWindow::buildAbsPath(int row, bool withNode, bool uriFormat){
       rc += cellAsText(row, TC_NODE);
    }
    if (uriFormat){
-       rc = "file://" + rc;
+      rc = "file://" + rc;
 #if defined WIN32
-       rc = rc.replace('\\', '/');
+      rc = rc.replace('\\', '/');
 #endif
    }
    return rc;
@@ -713,7 +713,7 @@ ui->checkBoxTextIgnoreCase->setChecked(false);
 }
 
 /**
- * Handles the push of the button "select directory".
+ * Reads the history of the widget values and other parameters and set it.
  */
 void MainWindow::restoreState(){
 ReStateStorage storage(m_storageFile);
@@ -737,7 +737,7 @@ storage.close();
 }
 
 /**
- * Handles the push of the button "select directory".
+ * Stores the history of the widget values and other parameters.
  */
 void MainWindow::saveState(){
 ReStateStorage storage(m_storageFile);
@@ -766,7 +766,7 @@ storage.close();
 void MainWindow::search(){
 m_errors = 0;
 QApplication::setOverrideCursor (QCursor(Qt::WaitCursor));QString
-path = ui->comboBoxDirectory->currentText();
+path = comboText(ui->comboBoxDirectory);
 QFileInfo dir(path);
 if (!dir.exists())
    guiError(ui->comboBoxDirectory, tr("directory not found: ") + path);
@@ -784,11 +784,11 @@ else{
    finder.setMaxDepth(comboInt(ui->comboBoxMaxDepth, -1));
    finder.setFiletypes(buildFileTypes());
    QStringList patterns;
-   QString value = ui->comboBoxFilePatterns->currentText();
+   QString value = comboText(ui->comboBoxFilePatterns);
    if (!value.isEmpty())
       patterns = value.split(",");
    finder.setPatterns(patterns);
-   value = ui->comboBoxExcludedDirs->currentText();
+   value = comboText(ui->comboBoxExcludedDirs);
    if (value.indexOf('/') >= 0 || value.indexOf('\\') >= 0)
       guiError(ui->comboBoxExcludedDirs, tr("no path delimiter allowed"));
    else if (value.indexOf('*') >= 0)
@@ -799,7 +799,7 @@ else{
    finder.setExcludedDirs(patterns);
    prepareTextFind();
    if (m_errors == 0){
-      if (!ui->comboBoxTextPattern->currentText().isEmpty())
+      if (!comboText(ui->comboBoxTextPattern).isEmpty())
          finder.setTextFinder(&m_textFinder);
       m_statistics.clear();
       clock_t start = clock();
index d93c9b8f00e79e16e554b6202537cb332820c2b4..e353573cff0b2c21dff5adda3dd0fbdf22efeddf 100644 (file)
@@ -45,8 +45,7 @@ public:
    ~MainWindow();
 
 public:
-   void fileDragging();
-private slots:
+   void fileDragging();private slots:
    void about();
    void absPathToClipboard();
    void baseDirToClipboard();
index c1faf6126c5733ab51279b7c172e22bead86b061..c8f40095637d8f15501a50f3f27a660e87738689 100644 (file)
@@ -6,7 +6,8 @@
  * The original sources can be found on https://github.com/republib.
  */
 
-#include "../../base/rebase.hpp"
+#include "base/rebase.hpp"
+#include "gui/regui.hpp"
 #include "converter.hpp"
 #include "mainwindow.hpp"
 #include <QRegularExpression>
index 6d571f3d49ad791dbe98d364cb75fc8c158b5afc..4f431aa452827d270ecc2de2ceb0f5110049fa24 100644 (file)
@@ -6,13 +6,16 @@
  * The original sources can be found on https://github.com/republib.
  */
 
+#include "base/rebase.hpp"
+#include "gui/regui.hpp"
 #include "mainwindow.hpp"
 #include <QApplication>
 char** g_argv;
 int main(int argc, char *argv[]){
    g_argv = argv;
+   QString homeDir = argc > 1 ? argv[1] : "";
    QApplication a(argc, argv);
-   MainWindow w;
+   MainWindow w(homeDir);
    w.show();
 
    return a.exec();
index 4ffd4af8a975f16e0d817d99a3cf83059071c655..e4187d849e83c1bedcfd4cdb951d6799b99e5d36 100644 (file)
@@ -6,6 +6,8 @@
  * The original sources can be found on https://github.com/republib.
  */
 
+#include "base/rebase.hpp"
+#include "gui/regui.hpp"
 #include "mainwindow.hpp"
 #include "ui_mainwindow.h"
 #include "aboutdialog.hpp"
@@ -26,51 +28,71 @@ const QString VERSION("2015.05.31");
  *
  * @param parent        NULL or the parent (who destroys the objects at the end)
  */
-MainWindow::MainWindow(QWidget *parent) :
-         QMainWindow(parent), ui(new Ui::MainWindow), m_converter(NULL){
+MainWindow::MainWindow(const QString& homeDir, QWidget *parent) :
+            QMainWindow(parent),
+            m_homeDir(homeDir),
+            m_storageFile(),
+            ui(new Ui::MainWindow),
+            m_converter(NULL){
+
    ui->setupUi(this);
+   initializeHome();
    switchRun(true);
-   QStringList defaultX;
-   defaultX.append("*");
-   defaultX.append("1024");
-   defaultX.append("1920");
-   defaultX.append("800");
-   QStringList defaultY;
-   defaultY.append("*");
-   defaultY.append("768");
-   defaultY.append("1050");
-   defaultY.append("600");
-   QStringList quality;
-   quality.append("70");
-   quality.append("85");
-   quality.append("100");
-   QStringList target;
-   target.append("normal");
-   target.append("mini");
-   target.append("1024");
-   target.append("1920");
-   ui->comboLandscapeX->addItems(defaultX);
-   ui->comboLandscapeY->addItems(defaultY);
-   ui->comboPortraitX->addItems(defaultX);
-   ui->comboPortraitY->addItems(defaultY);
-   ui->comboSquareX->addItems(defaultX);
-   ui->comboQuality->addItems(quality);
-   ui->comboTarget->addItems(target);
-   ui->comboLandscapeX->setCurrentText("1024");
-   ui->comboLandscapeY->setCurrentText("*");
-   ui->comboPortraitX->setCurrentText("*");
-   ui->comboPortraitY->setCurrentText("768");
-   ui->comboSquareX->setCurrentText("768");
-   ui->comboQuality->setCurrentText("70");
-   ui->comboTarget->setCurrentText("normal");
-   ui->buttonStop->hide();
-
+   m_statusMessage = new QLabel(tr("Welcome at reimgconvert"));
+   statusBar()->addWidget(m_statusMessage);
    connect(ui->actionSelectDestination, SIGNAL(triggered()), this,
       SLOT(selectDestination()));
    connect(ui->pushButtonSelectDest, SIGNAL(clicked()), this,
       SLOT(selectDestination()));
+   connect(ui->actionSelectSource, SIGNAL(triggered()), this,
+      SLOT(selectSource()));
+   connect(ui->pushButtonSelectDest, SIGNAL(clicked()), this,
+      SLOT(selectDestination()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
+   restoreState();
+   connect(ui->comboBoxTemplate, SIGNAL(currentIndexChanged(const QString&)),
+            this, SLOT(on_templateChangeIndex(const QString&)));
+   connect(ui->pushButtonActivate, SIGNAL(clicked()), this, SLOT(activate()));
+   restoreState();
+}
+
+/**
+ * @brief Destructor
+ */
+MainWindow::~MainWindow(){
+   delete ui;
+   delete m_converter;
+}
 
+/**
+ * Slot when the pushbutton "activate" is clicked.
+ */
+void MainWindow::activate(){
+   int width = comboInt(ui->comboBoxMaxWidth, 0);
+   int height = comboInt(ui->comboBoxMaxHeight, 0);
+   setMaxDimensions(width, height);
+}
+
+/**
+ * Sets the maximal dimensions (from the "simple" interface).
+ *
+ * @param maxWidth  the maximal width
+ * @param maxHeight the maximal height
+ */
+void MainWindow::setMaxDimensions(int maxWidth, int maxHeight){
+   if (maxWidth > maxHeight){
+      ui->comboBoxLandscapeX->setCurrentText(QString::number(maxWidth));
+      ui->comboBoxLandscapeY->setCurrentText("*");
+      ui->comboBoxPortraitX->setCurrentText("*");
+      ui->comboBoxPortraitY->setCurrentText(QString::number(maxHeight));
+      ui->comboBoxSquareX->setCurrentText(QString::number(maxHeight));
+   }else{
+      ui->comboBoxLandscapeY->setCurrentText(QString::number(maxHeight));
+      ui->comboBoxLandscapeX->setCurrentText("*");
+      ui->comboBoxPortraitY->setCurrentText("*");
+      ui->comboBoxPortraitX->setCurrentText(QString::number(maxWidth));
+      ui->comboBoxSquareX->setCurrentText(QString::number(maxWidth));
+   }
 }
 
 /**
@@ -78,18 +100,21 @@ MainWindow::MainWindow(QWidget *parent) :
  */
 void MainWindow::selectDestination(){
    QString dir = QFileDialog::getExistingDirectory(this,
-      tr("Select Destination Directory"), ui->comboTarget->currentText(),
+      tr("Select Destination Directory"), ui->comboBoxTarget->currentText(),
       QFileDialog::ShowDirsOnly);
    if (!dir.isEmpty())
-      ui->comboTarget->setCurrentText(dir);
+      ui->comboBoxTarget->setCurrentText(dir);
 }
 
 /**
- * @brief Destructor
+ * Selects the destination directory with a dialog.
  */
-MainWindow::~MainWindow(){
-   delete ui;
-   delete m_converter;
+void MainWindow::selectSource(){
+   QString dir = QFileDialog::getExistingDirectory(this,
+      tr("Select Source Directory"), ui->comboBoxSourceDir->currentText(),
+      QFileDialog::ShowDirsOnly);
+   if (!dir.isEmpty())
+      ui->comboBoxSourceDir->setCurrentText(dir);
 }
 
 /**
@@ -101,63 +126,87 @@ void MainWindow::about(){
 }
 
 /**
- * @brief Logs a message
- *
- * @param message   the message to log
- * @return          <code>true</code>
+ * initializeHomeializes the program home directory.
  */
-bool MainWindow::log(const QString& message){
-   ui->listWidget->insertItem(0, message);
-   return true;
+void MainWindow::initializeHome(){
+   if (m_homeDir.isEmpty()){
+      m_homeDir = QDir::home().absoluteFilePath(".reimgconvert");
+   }
+
+   QDir home(m_homeDir);
+   if (!home.exists()){
+      if (!home.mkpath(m_homeDir)){
+         m_homeDir = home.tempPath() + "/.reimgconvert";
+         home.mkpath(m_homeDir);
+      }
+   }
+   if (!m_homeDir.endsWith("/"))
+      m_homeDir += "/";
+   m_storageFile = m_homeDir + "state.conf";
+   restoreState();
 }
 
 /**
- * @brief Logs a message
+ * @brief Handles the click on the button "stop".
+ */
+void MainWindow::on_pushButtonStop_clicked(){
+   m_converter->stop();
+   ui->pushButtonConvert->show();
+   ui->pushButtonStop->hide();
+}
+
+/**
+ * @brief Handles the click on the button "file select".
  *
- * @param message   the message to log
- * @return          <code>true</code>
+ * Shows a selection dialog for directories and sets the source directory
+ * onto the selected directory.
  */
-bool MainWindow::logAppendLast(const QString& message){
-   QListWidgetItem* item = ui->listWidget->item(0);
-   item->setText(item->text() + " " + message);
-   return true;
+void MainWindow::on_pushButtonFileSelect_clicked(){
+   QFileDialog selection;
+   selection.setFileMode(QFileDialog::DirectoryOnly);
+   QString dir = ui->comboBoxSourceDir->currentText();
+   if (!dir.isEmpty())
+      selection.setDirectory(dir);
+   if (selection.exec())
+      ui->comboBoxSourceDir->setCurrentText(selection.selectedFiles().at(0));
 }
 
 /**
- * Enables/disables the buttons/actions relevant for running.
+ * Slot when the value of the template combobox has been changed.
  *
- * @param runActive <code>true</code>: the conversion is possible
+ * @param text  the new selected combobox text
  */
-void MainWindow::switchRun(bool runActive){
-   if (runActive){
-      ui->buttonConvert->show();
-      ui->buttonStop->hide();
-   }else{
-      ui->buttonConvert->hide();
-      ui->buttonStop->show();
-   }
-   ui->actionConvert->setEnabled(runActive);
-   ui->actionStop->setEnabled(not runActive);
+void MainWindow::on_templateChangeIndex(const QString & text){
+   QRegularExpression rexpr("(\\d+)x(\\d+)");
+   QRegularExpressionMatch match = rexpr.match(text);
+   int width = match.captured(1).toInt();
+   int height = match.captured(2).toInt();
+   setMaxDimensions(width, height);
 }
 
 /**
  * @brief Handles the button click on "convert".
  */
-void MainWindow::on_buttonConvert_clicked(){
+void MainWindow::on_pushButtonConvert_clicked(){
    switchRun(false);
    delete m_converter;
-   m_converter = new Converter(ui->comboSourceDir->currentText(),
-      ui->comboLandscapeX->currentText(),
-      ui->comboBoxSourcePattern->currentText(),
-      ui->comboBoxDestType->currentText(),
-      atol(ui->comboLandscapeX->currentText().toLatin1().constData()),
-      atol(ui->comboLandscapeY->currentText().toLatin1().constData()),
-      atol(ui->comboPortraitX->currentText().toLatin1().constData()),
-      atol(ui->comboPortraitY->currentText().toLatin1().constData()),
-      atol(ui->comboSquareX->currentText().toLatin1().constData()),
-      atol(ui->comboQuality->currentText().toLatin1().constData()), this);
-   // start the thread:
-   m_converter->start();
+   m_errors = 0;
+   int landscapeX = comboInt(ui->comboBoxLandscapeX, 0, "*", 0);
+   int landscapeY = comboInt(ui->comboBoxLandscapeY, 0, "*", 0);
+   int portraitX = comboInt(ui->comboBoxPortraitX, 0, "*", 0);
+   int portraitY = comboInt(ui->comboBoxPortraitY, 0, "*", 0);
+   int squareX = comboInt(ui->comboBoxSquareX, 0);
+   int quality = comboInt(ui->comboBoxQuality, 70);
+   if (m_errors == 0){
+      m_converter = new Converter(ui->comboBoxSourceDir->currentText(),
+         ui->comboBoxLandscapeX->currentText(),
+         ui->comboBoxSourcePattern->currentText(),
+         ui->comboBoxDestType->currentText(), landscapeX, landscapeY, portraitX,
+         portraitY, squareX, quality, this);
+      // start the thread:
+      m_converter->start();
+   }
+
 }
 
 /**
@@ -169,8 +218,8 @@ void MainWindow::on_buttonConvert_clicked(){
 void MainWindow::on_threadStateChanged(Converter::State state, const QString&){
    switch (state) {
    case Converter::STATE_READY:
-      ui->buttonConvert->show();
-      ui->buttonStop->hide();
+      ui->pushButtonConvert->show();
+      ui->pushButtonStop->hide();
       //ui->statusBar->showMessage(info);
       break;
    case Converter::STATE_SUB_TASK_STOPPED:
@@ -180,30 +229,95 @@ void MainWindow::on_threadStateChanged(Converter::State state, const QString&){
    default:
       break;
    }
+}
 
+/**
+ * @brief Logs a message
+ *
+ * @param message   the message to log
+ * @return          <code>true</code>
+ */
+bool MainWindow::log(const QString& message){
+   ui->listWidget->insertItem(0, message);
+   return true;
 }
+
 /**
- * @brief Handles the click on the button "stop".
+ * @brief Logs a message
+ *
+ * @param message   the message to log
+ * @return          <code>true</code>
  */
-void MainWindow::on_buttonStop_clicked(){
-   m_converter->stop();
-   ui->buttonConvert->show();
-   ui->buttonStop->hide();
+bool MainWindow::logAppendLast(const QString& message){
+   QListWidgetItem* item = ui->listWidget->item(0);
+   item->setText(item->text() + " " + message);
+   return true;
 }
 
 /**
- * @brief Handles the click on the button "file select".
+ * Reads the history of the widget values and other parameters and set it.
+ */
+void MainWindow::restoreState(){
+   ReStateStorage storage(m_storageFile);
+   storage.setForm("main");
+   storage.restore(ui->comboBoxMaxHeight, "comboBoxMaxHeight", true);
+   storage.restore(ui->comboBoxMaxWidth, "comboBoxMaxWidth", true);
+   storage.restore(ui->comboBoxSourcePattern, "comboBoxSourcePattern", true);
+   storage.restore(ui->comboBoxLandscapeX, "comboBoxLandscapeX", true);
+   storage.restore(ui->comboBoxLandscapeY, "comboBoxLandscapeY");
+   storage.restore(ui->comboBoxPortraitX, "comboBoxPortraitX", true);
+   storage.restore(ui->comboBoxPortraitY, "comboBoxPortraitY", true);
+   storage.restore(ui->comboBoxQuality, "comboBoxQuality", true);
+   storage.restore(ui->comboBoxSourceDir, "comboBoxSourceDir", true);
+   storage.restore(ui->comboBoxSquareX, "comboBoxSquareX", true);
+   storage.restore(ui->comboBoxTarget, "comboBoxTarget", true);
+   storage.close();
+}
+
+/**
+ * Stores the history of the widget values and other parameters.
+ */
+void MainWindow::saveState(){
+   ReStateStorage storage(m_storageFile);
+   storage.setForm("main");
+   storage.store(ui->comboBoxMaxHeight, "comboBoxMaxHeight");
+   storage.store(ui->comboBoxMaxWidth, "comboBoxMaxWidth");
+   storage.store(ui->comboBoxSourcePattern, "comboBoxSourcePattern");
+   storage.store(ui->comboBoxLandscapeX, "comboBoxLandscapeX");
+   storage.store(ui->comboBoxLandscapeY, "comboBoxLandscapeY");
+   storage.store(ui->comboBoxPortraitX, "comboBoxPortraitX");
+   storage.store(ui->comboBoxPortraitY, "comboBoxPortraitY");
+   storage.store(ui->comboBoxQuality, "comboBoxQuality");
+   storage.store(ui->comboBoxSourceDir, "comboBoxSourceDir");
+   storage.store(ui->comboBoxSquareX, "comboBoxSquareX");
+   storage.store(ui->comboBoxTarget, "comboBoxTarget");
+   storage.close();
+}
+
+/**
+ * Writes a text to the status line.
  *
- * Shows a selection dialog for directories and sets the source directory
- * onto the selected directory.
+ * @param error     <code>true</code>: the message is an error message
+ * @param message   the text to set
  */
-void MainWindow::on_buttonFileSelect_clicked(){
-   QFileDialog selection;
-   selection.setFileMode(QFileDialog::DirectoryOnly);
-   QString dir = ui->comboSourceDir->currentText();
-   if (!dir.isEmpty())
-      selection.setDirectory(dir);
-   if (selection.exec())
-      ui->comboSourceDir->setCurrentText(selection.selectedFiles().at(0));
+void MainWindow::setStatusMessage(bool error, const QString& message){
+   m_statusMessage->setText(message);
+}
+
+/**
+ * Enables/disables the buttons/actions relevant for running.
+ *
+ * @param runActive <code>true</code>: the conversion is possible
+ */
+void MainWindow::switchRun(bool runActive){
+   if (runActive){
+      ui->pushButtonConvert->show();
+      ui->pushButtonStop->hide();
+   }else{
+      ui->pushButtonConvert->hide();
+      ui->pushButtonStop->show();
+   }
+   ui->actionConvert->setEnabled(runActive);
+   ui->actionStop->setEnabled(not runActive);
 }
 
index 43f957f42748474c0c300d592dd7834e5958f09b..637f568a404ad5c6dea7a41a7aa5ca83142e0a52 100644 (file)
 #include <QMainWindow>
 #include <QFileDialog>
 #include <QResizeEvent>
+#include <QLabel>
 #include "converter.hpp"
+#include "gui/regui.hpp"
 namespace Ui {
 class MainWindow;
 }
 
-class MainWindow: public QMainWindow, public ConvertLogger {
+class MainWindow: public QMainWindow,
+   public ReGuiValidator,
+   public ConvertLogger {
    Q_OBJECT
 
 public:
-   explicit MainWindow(QWidget *parent = 0);
+   explicit MainWindow(const QString& homeDir, QWidget *parent = 0);
    ~MainWindow();
 
 public:
@@ -31,16 +35,28 @@ public:
    }
    bool log(const QString& message);
    bool logAppendLast(const QString& message);
-   void switchRun(bool runActive);private slots:
+   void setStatusMessage(bool error, const QString& message);
+   void switchRun(bool runActive);
+private:
+   void initializeHome();
+   void restoreState();
+   void saveState();
+   void setMaxDimensions(int maxWidth, int maxHeight);public slots:
+   void on_threadStateChanged(Converter::State state, const QString& info);private slots:
+   void activate();
    void about();
-   void on_buttonFileSelect_clicked();
-   void on_buttonStop_clicked();
-   void on_buttonConvert_clicked();
-   void selectDestination();public slots:
-   void on_threadStateChanged(Converter::State state, const QString& info);
+   void on_pushButtonFileSelect_clicked();
+   void on_pushButtonStop_clicked();
+   void on_pushButtonConvert_clicked();
+   void on_templateChangeIndex(const QString& text);
+   void selectDestination();
+   void selectSource();
 private:
+   QString m_homeDir;
+   QString m_storageFile;
    Ui::MainWindow *ui;
    Converter* m_converter;
+   QLabel* m_statusMessage;
 };
 
 #endif // MAINWINDOW_HPP
index 34b0e9b3b522d05c6e149a9508c7be0adafebf5f..63681a25940d3934abac26168b65dadec30288b9 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>772</width>
-    <height>556</height>
+    <width>799</width>
+    <height>651</height>
    </rect>
   </property>
   <property name="minimumSize">
    </size>
   </property>
   <property name="windowTitle">
-   <string>Bilder verkleinern V1.0</string>
+   <string>ReImgConvert</string>
   </property>
   <widget class="QWidget" name="centralWidget">
-   <layout class="QVBoxLayout" name="verticalLayout_4">
-    <item>
-     <widget class="QWidget" name="widget" native="true">
-      <layout class="QVBoxLayout" name="verticalLayout">
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_5">
+   <widget class="QWidget" name="widget" native="true">
+    <property name="geometry">
+     <rect>
+      <x>11</x>
+      <y>11</y>
+      <width>787</width>
+      <height>647</height>
+     </rect>
+    </property>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <widget class="QTabWidget" name="tabWidget">
+       <property name="minimumSize">
+        <size>
+         <width>0</width>
+         <height>150</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>16777215</width>
+         <height>150</height>
+        </size>
+       </property>
+       <property name="currentIndex">
+        <number>0</number>
+       </property>
+       <widget class="QWidget" name="tab_2">
+        <attribute name="title">
+         <string>Dimensions (quick)</string>
+        </attribute>
+        <layout class="QVBoxLayout" name="verticalLayout_6">
          <item>
-          <layout class="QHBoxLayout" name="horizontalLayout_3">
+          <layout class="QHBoxLayout" name="horizontalLayout_4">
            <item>
-            <widget class="QGroupBox" name="groupBox">
+            <widget class="QLabel" name="label_2">
              <property name="minimumSize">
               <size>
-               <width>230</width>
-               <height>100</height>
+               <width>100</width>
+               <height>0</height>
               </size>
              </property>
              <property name="maximumSize">
               <size>
-               <width>230</width>
-               <height>100</height>
+               <width>100</width>
+               <height>16777215</height>
               </size>
              </property>
-             <property name="title">
-              <string>Portrait:</string>
+             <property name="text">
+              <string>Template:</string>
              </property>
-             <widget class="QWidget" name="layoutWidget1">
-              <property name="geometry">
-               <rect>
-                <x>2</x>
-                <y>30</y>
-                <width>221</width>
-                <height>61</height>
-               </rect>
+            </widget>
+           </item>
+           <item>
+            <widget class="QComboBox" name="comboBoxTemplate">
+             <item>
+              <property name="text">
+               <string>Website: 1024x768</string>
               </property>
-              <layout class="QFormLayout" name="formLayout">
-               <item row="0" column="0">
-                <widget class="QLabel" name="label_9">
-                 <property name="minimumSize">
-                  <size>
-                   <width>100</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="maximumSize">
-                  <size>
-                   <width>100</width>
-                   <height>16777215</height>
-                  </size>
-                 </property>
-                 <property name="text">
-                  <string>Max. Width:</string>
-                 </property>
-                </widget>
-               </item>
-               <item row="0" column="1">
-                <widget class="QComboBox" name="comboPortraitX">
-                 <property name="minimumSize">
-                  <size>
-                   <width>100</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="maximumSize">
-                  <size>
-                   <width>100</width>
-                   <height>16777215</height>
-                  </size>
-                 </property>
-                 <property name="editable">
-                  <bool>true</bool>
-                 </property>
-                </widget>
-               </item>
-               <item row="1" column="0">
-                <widget class="QLabel" name="label">
-                 <property name="minimumSize">
-                  <size>
-                   <width>100</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="maximumSize">
-                  <size>
-                   <width>100</width>
-                   <height>16777215</height>
-                  </size>
-                 </property>
-                 <property name="text">
-                  <string>Max. Height:</string>
-                 </property>
-                </widget>
-               </item>
-               <item row="1" column="1">
-                <widget class="QComboBox" name="comboPortraitY">
-                 <property name="minimumSize">
-                  <size>
-                   <width>100</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="maximumSize">
-                  <size>
-                   <width>100</width>
-                   <height>16777215</height>
-                  </size>
-                 </property>
-                 <property name="editable">
-                  <bool>true</bool>
-                 </property>
-                </widget>
-               </item>
-              </layout>
-             </widget>
+             </item>
+             <item>
+              <property name="text">
+               <string>Website II: 800x600</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Photo: 2048x1536</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Photo II: 3072x2304</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Midi: 600x400</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Mini: 150x100</string>
+              </property>
+             </item>
             </widget>
            </item>
+          </layout>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout_5">
            <item>
-            <spacer name="horizontalSpacer">
+            <layout class="QFormLayout" name="formLayout_7">
+             <item row="0" column="0">
+              <widget class="QLabel" name="label_14">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>Max. Width:</string>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="1">
+              <widget class="QComboBox" name="comboBoxMaxWidth">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="editable">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </item>
+           <item>
+            <spacer name="horizontalSpacer_6">
              <property name="orientation">
               <enum>Qt::Horizontal</enum>
              </property>
             </spacer>
            </item>
            <item>
-            <widget class="QGroupBox" name="groupBox_2">
-             <property name="minimumSize">
-              <size>
-               <width>230</width>
-               <height>100</height>
-              </size>
-             </property>
-             <property name="maximumSize">
-              <size>
-               <width>230</width>
-               <height>100</height>
-              </size>
-             </property>
-             <property name="title">
-              <string>Landscape:</string>
-             </property>
-             <widget class="QWidget" name="layoutWidget2">
-              <property name="geometry">
-               <rect>
-                <x>3</x>
-                <y>31</y>
-                <width>221</width>
-                <height>61</height>
-               </rect>
-              </property>
-              <layout class="QFormLayout" name="formLayout_2">
-               <item row="0" column="0">
-                <widget class="QLabel" name="label_3">
-                 <property name="minimumSize">
-                  <size>
-                   <width>100</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="maximumSize">
-                  <size>
-                   <width>100</width>
-                   <height>16777215</height>
-                  </size>
-                 </property>
-                 <property name="text">
-                  <string>Max. Width:</string>
-                 </property>
-                </widget>
-               </item>
-               <item row="0" column="1">
-                <widget class="QComboBox" name="comboLandscapeX">
-                 <property name="minimumSize">
-                  <size>
-                   <width>100</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="maximumSize">
-                  <size>
-                   <width>100</width>
-                   <height>16777215</height>
-                  </size>
-                 </property>
-                 <property name="editable">
-                  <bool>true</bool>
-                 </property>
-                </widget>
-               </item>
-               <item row="1" column="0">
-                <widget class="QLabel" name="label_4">
-                 <property name="minimumSize">
-                  <size>
-                   <width>100</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="maximumSize">
-                  <size>
-                   <width>100</width>
-                   <height>16777215</height>
-                  </size>
-                 </property>
-                 <property name="text">
-                  <string>Max. Height:</string>
-                 </property>
-                </widget>
-               </item>
-               <item row="1" column="1">
-                <widget class="QComboBox" name="comboLandscapeY">
-                 <property name="minimumSize">
-                  <size>
-                   <width>100</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="maximumSize">
-                  <size>
-                   <width>100</width>
-                   <height>16777215</height>
-                  </size>
-                 </property>
-                 <property name="editable">
-                  <bool>true</bool>
-                 </property>
-                </widget>
-               </item>
-              </layout>
-             </widget>
-            </widget>
+            <layout class="QFormLayout" name="formLayout_8">
+             <item row="0" column="0">
+              <widget class="QLabel" name="label_15">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>Max. Height:</string>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="1">
+              <widget class="QComboBox" name="comboBoxMaxHeight">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="editable">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+            </layout>
            </item>
            <item>
-            <spacer name="horizontalSpacer_2">
+            <spacer name="horizontalSpacer_5">
              <property name="orientation">
               <enum>Qt::Horizontal</enum>
              </property>
             </spacer>
            </item>
            <item>
-            <widget class="QGroupBox" name="groupBox_3">
-             <property name="minimumSize">
-              <size>
-               <width>150</width>
-               <height>100</height>
-              </size>
-             </property>
-             <property name="maximumSize">
-              <size>
-               <width>150</width>
-               <height>100</height>
-              </size>
-             </property>
-             <property name="title">
-              <string>Square:</string>
+            <widget class="QPushButton" name="pushButtonActivate">
+             <property name="text">
+              <string>&amp;Activate</string>
              </property>
-             <widget class="QComboBox" name="comboSquareX">
-              <property name="geometry">
-               <rect>
-                <x>0</x>
-                <y>60</y>
-                <width>100</width>
-                <height>26</height>
-               </rect>
-              </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </widget>
+       <widget class="QWidget" name="tab">
+        <attribute name="title">
+         <string>Dimensions (separated)</string>
+        </attribute>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QGroupBox" name="groupBox">
+           <property name="minimumSize">
+            <size>
+             <width>230</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>230</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="title">
+            <string>Portrait:</string>
+           </property>
+           <widget class="QWidget" name="layoutWidget1">
+            <property name="geometry">
+             <rect>
+              <x>2</x>
+              <y>30</y>
+              <width>221</width>
+              <height>61</height>
+             </rect>
+            </property>
+            <layout class="QFormLayout" name="formLayout">
+             <item row="0" column="0">
+              <widget class="QLabel" name="label_9">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>Max. Width:</string>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="1">
+              <widget class="QComboBox" name="comboBoxPortraitX">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="editable">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="0">
+              <widget class="QLabel" name="label">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>Max. Height:</string>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="1">
+              <widget class="QComboBox" name="comboBoxPortraitY">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="editable">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>48</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QGroupBox" name="groupBox_2">
+           <property name="minimumSize">
+            <size>
+             <width>230</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>230</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="title">
+            <string>Landscape:</string>
+           </property>
+           <widget class="QWidget" name="layoutWidget2">
+            <property name="geometry">
+             <rect>
+              <x>3</x>
+              <y>31</y>
+              <width>221</width>
+              <height>61</height>
+             </rect>
+            </property>
+            <layout class="QFormLayout" name="formLayout_2">
+             <item row="0" column="0">
+              <widget class="QLabel" name="label_3">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>Max. Width:</string>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="1">
+              <widget class="QComboBox" name="comboBoxLandscapeX">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="editable">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="0">
+              <widget class="QLabel" name="label_4">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>Max. Height:</string>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="1">
+              <widget class="QComboBox" name="comboBoxLandscapeY">
+               <property name="minimumSize">
+                <size>
+                 <width>100</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>100</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="editable">
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>47</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QGroupBox" name="groupBox_3">
+           <property name="minimumSize">
+            <size>
+             <width>150</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>150</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="title">
+            <string>Square:</string>
+           </property>
+           <widget class="QComboBox" name="comboBoxSquareX">
+            <property name="geometry">
+             <rect>
+              <x>0</x>
+              <y>60</y>
+              <width>100</width>
+              <height>26</height>
+             </rect>
+            </property>
+            <property name="minimumSize">
+             <size>
+              <width>100</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+           </widget>
+           <widget class="QLabel" name="label_5">
+            <property name="geometry">
+             <rect>
+              <x>0</x>
+              <y>40</y>
+              <width>141</width>
+              <height>18</height>
+             </rect>
+            </property>
+            <property name="text">
+             <string>Max. Width/Height:</string>
+            </property>
+           </widget>
+          </widget>
+         </item>
+        </layout>
+        <zorder>groupBox_2</zorder>
+        <zorder>groupBox_3</zorder>
+        <zorder>groupBox</zorder>
+        <zorder>horizontalSpacer</zorder>
+       </widget>
+      </widget>
+     </item>
+     <item>
+      <widget class="QGroupBox" name="groupBox_4">
+       <property name="minimumSize">
+        <size>
+         <width>0</width>
+         <height>150</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>16777215</width>
+         <height>150</height>
+        </size>
+       </property>
+       <property name="title">
+        <string>Others:</string>
+       </property>
+       <layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,0">
+        <property name="sizeConstraint">
+         <enum>QLayout::SetFixedSize</enum>
+        </property>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_7">
+          <item>
+           <layout class="QFormLayout" name="formLayout_3">
+            <item row="0" column="0">
+             <widget class="QLabel" name="label_6">
               <property name="minimumSize">
                <size>
                 <width>100</width>
                 <height>16777215</height>
                </size>
               </property>
-              <property name="editable">
-               <bool>true</bool>
-              </property>
-             </widget>
-             <widget class="QLabel" name="label_5">
-              <property name="geometry">
-               <rect>
-                <x>0</x>
-                <y>40</y>
-                <width>141</width>
-                <height>18</height>
-               </rect>
-              </property>
               <property name="text">
-               <string>Max. Width/Height:</string>
+               <string>Quality (%)</string>
               </property>
              </widget>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <widget class="QGroupBox" name="groupBox_4">
-         <property name="minimumSize">
-          <size>
-           <width>0</width>
-           <height>150</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>16777215</width>
-           <height>999999</height>
-          </size>
-         </property>
-         <property name="title">
-          <string>Others:</string>
-         </property>
-         <layout class="QVBoxLayout" name="verticalLayout_3">
-          <item>
-           <layout class="QHBoxLayout" name="horizontalLayout_7">
-            <item>
-             <layout class="QFormLayout" name="formLayout_3">
-              <item row="0" column="0">
-               <widget class="QLabel" name="label_6">
-                <property name="minimumSize">
-                 <size>
-                  <width>100</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>100</width>
-                  <height>16777215</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string>Quality (%)</string>
-                </property>
-               </widget>
-              </item>
-              <item row="0" column="1">
-               <widget class="QComboBox" name="comboQuality">
-                <property name="minimumSize">
-                 <size>
-                  <width>100</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>100</width>
-                  <height>16777215</height>
-                 </size>
-                </property>
-                <property name="editable">
-                 <bool>true</bool>
-                </property>
-               </widget>
-              </item>
-             </layout>
             </item>
-            <item>
-             <spacer name="horizontalSpacer_4">
-              <property name="orientation">
-               <enum>Qt::Horizontal</enum>
-              </property>
-              <property name="sizeHint" stdset="0">
+            <item row="0" column="1">
+             <widget class="QComboBox" name="comboBoxQuality">
+              <property name="minimumSize">
                <size>
-                <width>40</width>
-                <height>20</height>
+                <width>100</width>
+                <height>0</height>
                </size>
               </property>
-             </spacer>
-            </item>
-            <item>
-             <layout class="QFormLayout" name="formLayout_5">
-              <property name="fieldGrowthPolicy">
-               <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
-              </property>
-              <item row="0" column="0">
-               <widget class="QLabel" name="label_10">
-                <property name="minimumSize">
-                 <size>
-                  <width>100</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>100</width>
-                  <height>16777215</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string>File Pattern:</string>
-                </property>
-               </widget>
-              </item>
-              <item row="0" column="1">
-               <widget class="QComboBox" name="comboBoxSourcePattern">
-                <property name="minimumSize">
-                 <size>
-                  <width>100</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>100</width>
-                  <height>16777215</height>
-                 </size>
-                </property>
-                <property name="toolTip">
-                 <string>A pattern of the source files with wildcards '*' (anything) and '?' (exact one char)</string>
-                </property>
-                <property name="editable">
-                 <bool>true</bool>
-                </property>
-                <item>
-                 <property name="text">
-                  <string notr="true">*.jpg</string>
-                 </property>
-                </item>
-                <item>
-                 <property name="text">
-                  <string notr="true">*.png</string>
-                 </property>
-                </item>
-                <item>
-                 <property name="text">
-                  <string>*.gif</string>
-                 </property>
-                </item>
-               </widget>
-              </item>
-             </layout>
-            </item>
-            <item>
-             <spacer name="horizontalSpacer_3">
-              <property name="orientation">
-               <enum>Qt::Horizontal</enum>
-              </property>
-              <property name="sizeHint" stdset="0">
+              <property name="maximumSize">
                <size>
-                <width>40</width>
-                <height>20</height>
+                <width>100</width>
+                <height>16777215</height>
                </size>
               </property>
-             </spacer>
-            </item>
-            <item>
-             <layout class="QFormLayout" name="formLayout_6">
-              <item row="0" column="0">
-               <widget class="QLabel" name="label_11">
-                <property name="minimumSize">
-                 <size>
-                  <width>100</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>100</width>
-                  <height>16777215</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string>Dest. Type:</string>
-                </property>
-               </widget>
-              </item>
-              <item row="0" column="1">
-               <widget class="QComboBox" name="comboBoxDestType">
-                <property name="minimumSize">
-                 <size>
-                  <width>100</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>100</width>
-                  <height>16777215</height>
-                 </size>
-                </property>
-                <item>
-                 <property name="text">
-                  <string notr="true">jpg</string>
-                 </property>
-                </item>
-                <item>
-                 <property name="text">
-                  <string notr="true">png</string>
-                 </property>
-                </item>
-               </widget>
-              </item>
-             </layout>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
             </item>
            </layout>
           </item>
           <item>
-           <layout class="QHBoxLayout" name="horizontalLayout_6">
-            <item>
-             <widget class="QLabel" name="label_7">
+           <spacer name="horizontalSpacer_4">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>40</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item>
+           <layout class="QFormLayout" name="formLayout_5">
+            <property name="fieldGrowthPolicy">
+             <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+            </property>
+            <item row="0" column="0">
+             <widget class="QLabel" name="label_10">
               <property name="minimumSize">
                <size>
                 <width>100</width>
                </size>
               </property>
               <property name="text">
-               <string>Destination: </string>
+               <string>File Pattern:</string>
               </property>
              </widget>
             </item>
-            <item>
-             <widget class="QComboBox" name="comboTarget">
+            <item row="0" column="1">
+             <widget class="QComboBox" name="comboBoxSourcePattern">
+              <property name="minimumSize">
+               <size>
+                <width>100</width>
+                <height>0</height>
+               </size>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>100</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="toolTip">
+               <string>A pattern of the source files with wildcards '*' (anything) and '?' (exact one char)</string>
+              </property>
               <property name="editable">
                <bool>true</bool>
               </property>
-              <property name="currentText">
-               <string/>
-              </property>
+              <item>
+               <property name="text">
+                <string notr="true">*.jpg</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string notr="true">*.png</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>*.gif</string>
+               </property>
+              </item>
              </widget>
             </item>
-            <item>
-             <widget class="QPushButton" name="pushButtonSelectDest">
+           </layout>
+          </item>
+          <item>
+           <spacer name="horizontalSpacer_3">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>40</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item>
+           <layout class="QFormLayout" name="formLayout_6">
+            <item row="0" column="0">
+             <widget class="QLabel" name="label_11">
               <property name="minimumSize">
                <size>
-                <width>50</width>
+                <width>100</width>
                 <height>0</height>
                </size>
               </property>
               <property name="maximumSize">
                <size>
-                <width>50</width>
+                <width>100</width>
                 <height>16777215</height>
                </size>
               </property>
               <property name="text">
-               <string>...</string>
+               <string>Dest. Type:</string>
               </property>
              </widget>
             </item>
-           </layout>
-          </item>
-          <item>
-           <layout class="QHBoxLayout" name="horizontalLayout_8">
-            <item>
-             <layout class="QHBoxLayout" name="horizontalLayout_4">
+            <item row="0" column="1">
+             <widget class="QComboBox" name="comboBoxDestType">
+              <property name="minimumSize">
+               <size>
+                <width>100</width>
+                <height>0</height>
+               </size>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>100</width>
+                <height>16777215</height>
+               </size>
+              </property>
               <item>
-               <widget class="QLabel" name="label_2">
-                <property name="minimumSize">
-                 <size>
-                  <width>100</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="maximumSize">
-                 <size>
-                  <width>100</width>
-                  <height>16777215</height>
-                 </size>
-                </property>
-                <property name="text">
-                 <string>Template:</string>
-                </property>
-               </widget>
+               <property name="text">
+                <string notr="true">jpg</string>
+               </property>
               </item>
               <item>
-               <widget class="QComboBox" name="comboBox">
-                <item>
-                 <property name="text">
-                  <string>Website: 1024x768</string>
-                 </property>
-                </item>
-                <item>
-                 <property name="text">
-                  <string>Website II: 800x600</string>
-                 </property>
-                </item>
-                <item>
-                 <property name="text">
-                  <string>Photo: 2048x1536</string>
-                 </property>
-                </item>
-                <item>
-                 <property name="text">
-                  <string>Photo II: 3072x2304</string>
-                 </property>
-                </item>
-                <item>
-                 <property name="text">
-                  <string>Midi: 600x400</string>
-                 </property>
-                </item>
-                <item>
-                 <property name="text">
-                  <string>Mini: 150x100</string>
-                 </property>
-                </item>
-               </widget>
+               <property name="text">
+                <string notr="true">png</string>
+               </property>
               </item>
-             </layout>
+             </widget>
             </item>
            </layout>
           </item>
          </layout>
-        </widget>
-       </item>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_6">
+          <item>
+           <widget class="QLabel" name="label_7">
+            <property name="minimumSize">
+             <size>
+              <width>100</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Destination: </string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QComboBox" name="comboBoxTarget">
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+            <property name="currentText">
+             <string/>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="pushButtonSelectDest">
+            <property name="minimumSize">
+             <size>
+              <width>50</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>50</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>...</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <layout class="QVBoxLayout" name="verticalLayout_2">
          <item>
-          <layout class="QVBoxLayout" name="verticalLayout_2">
-           <item>
-            <widget class="QLabel" name="label_8">
-             <property name="text">
-              <string>Source Directory (Images):</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <layout class="QHBoxLayout" name="horizontalLayout">
-             <item>
-              <widget class="QComboBox" name="comboSourceDir">
-               <property name="editable">
-                <bool>true</bool>
-               </property>
-               <property name="currentText">
-                <string>/tmp/img</string>
-               </property>
-              </widget>
-             </item>
-             <item>
-              <widget class="QPushButton" name="buttonFileSelect">
-               <property name="maximumSize">
-                <size>
-                 <width>30</width>
-                 <height>16777215</height>
-                </size>
-               </property>
-               <property name="toolTip">
-                <string>Auswahldialog</string>
-               </property>
-               <property name="text">
-                <string>...</string>
-               </property>
-              </widget>
-             </item>
-            </layout>
-           </item>
-          </layout>
+          <widget class="QLabel" name="label_8">
+           <property name="text">
+            <string>Source Directory (Images):</string>
+           </property>
+          </widget>
          </item>
          <item>
-          <layout class="QVBoxLayout" name="verticalLayout_5">
+          <layout class="QHBoxLayout" name="horizontalLayout">
            <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>
-           <item>
-            <widget class="QPushButton" name="buttonConvert">
-             <property name="minimumSize">
-              <size>
-               <width>150</width>
-               <height>0</height>
-              </size>
-             </property>
-             <property name="maximumSize">
-              <size>
-               <width>150</width>
-               <height>16777215</height>
-              </size>
-             </property>
-             <property name="toolTip">
-              <string>Alle Bilder aus dem Quellverzeichnis konvertieren und im Zielverzeichnis ablegen</string>
+            <widget class="QComboBox" name="comboBoxSourceDir">
+             <property name="editable">
+              <bool>true</bool>
              </property>
-             <property name="text">
-              <string>&amp;Convert</string>
-             </property>
-             <property name="icon">
-              <iconset resource="reimgconvert.qrc">
-               <normaloff>:/main/icons/action_go.png</normaloff>:/main/icons/action_go.png</iconset>
+             <property name="currentText">
+              <string>/tmp/img</string>
              </property>
             </widget>
            </item>
            <item>
-            <widget class="QPushButton" name="buttonStop">
-             <property name="minimumSize">
-              <size>
-               <width>150</width>
-               <height>0</height>
-              </size>
-             </property>
+            <widget class="QPushButton" name="pushButtonSelectSource">
              <property name="maximumSize">
               <size>
-               <width>150</width>
+               <width>30</width>
                <height>16777215</height>
               </size>
              </property>
              <property name="toolTip">
-              <string>Alle Bilder aus dem Quellverzeichnis konvertieren und im Zielverzeichnis ablegen</string>
+              <string>Auswahldialog</string>
              </property>
              <property name="text">
-              <string>&amp;Stop</string>
-             </property>
-             <property name="icon">
-              <iconset resource="reimgconvert.qrc">
-               <normaloff>:/main/icons/cancel.png</normaloff>:/main/icons/cancel.png</iconset>
+              <string>...</string>
              </property>
             </widget>
            </item>
         </layout>
        </item>
        <item>
-        <widget class="QListWidget" name="listWidget"/>
+        <layout class="QVBoxLayout" name="verticalLayout_5">
+         <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>
+         <item>
+          <widget class="QPushButton" name="pushButtonConvert">
+           <property name="minimumSize">
+            <size>
+             <width>150</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>150</width>
+             <height>16777215</height>
+            </size>
+           </property>
+           <property name="toolTip">
+            <string>Alle Bilder aus dem Quellverzeichnis konvertieren und im Zielverzeichnis ablegen</string>
+           </property>
+           <property name="text">
+            <string>&amp;Convert</string>
+           </property>
+           <property name="icon">
+            <iconset resource="reimgconvert.qrc">
+             <normaloff>:/main/icons/action_go.png</normaloff>:/main/icons/action_go.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonStop">
+           <property name="minimumSize">
+            <size>
+             <width>150</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>150</width>
+             <height>16777215</height>
+            </size>
+           </property>
+           <property name="toolTip">
+            <string>Alle Bilder aus dem Quellverzeichnis konvertieren und im Zielverzeichnis ablegen</string>
+           </property>
+           <property name="text">
+            <string>&amp;Stop</string>
+           </property>
+           <property name="icon">
+            <iconset resource="reimgconvert.qrc">
+             <normaloff>:/main/icons/cancel.png</normaloff>:/main/icons/cancel.png</iconset>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
       </layout>
-      <zorder>listWidget</zorder>
-      <zorder>groupBox_4</zorder>
-     </widget>
-    </item>
-   </layout>
+     </item>
+     <item>
+      <widget class="QListWidget" name="listWidget"/>
+     </item>
+    </layout>
+    <zorder>listWidget</zorder>
+    <zorder>groupBox_4</zorder>
+    <zorder>tabWidget</zorder>
+   </widget>
   </widget>
   <widget class="QMenuBar" name="menuBar">
    <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>772</width>
+     <width>799</width>
      <height>23</height>
     </rect>
    </property>
    <addaction name="separator"/>
    <addaction name="action_Exit"/>
   </widget>
+  <widget class="QToolBar" name="toolBar_2">
+   <property name="windowTitle">
+    <string>toolBar_2</string>
+   </property>
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
   <action name="actionConvert">
    <property name="icon">
     <iconset resource="reimgconvert.qrc">
index 075cbef3ada49d841884ef0838d9cc9422299d11..03d87e6f825030231f5e797a98c5ee4969739780 100644 (file)
@@ -17,18 +17,29 @@ SOURCES += main.cpp\
         ../../base/ReException.cpp \
         ../../base/ReQStringUtil.cpp \
         ../../base/ReLogger.cpp \
+        ../../gui/ReStateStorage.cpp \
+        ../../gui/ReGuiValidator.cpp \
         mainwindow.cpp \
         converter.cpp \
-    aboutdialog.cpp
+        aboutdialog.cpp
 
 HEADERS  += mainwindow.hpp \
+        ../../base/rebase.hpp \
+        ../../base/ReQStringUtil.hpp \
+        ../../gui/ReStateStorage.hpp \
+        ../../gui/ReGuiValidator.hpp \
+        ../../gui/regui.hpp \
         converter.hpp \
-    aboutdialog.hpp
+        aboutdialog.hpp
 
 FORMS    += mainwindow.ui \
-    aboutdialog.ui
+        aboutdialog.ui
 
 RESOURCES += \
         reimgconvert.qrc
 
+TRANSLATIONS = reimgconvert_de.ts
+
+CODECFORSRC = UTF-8
+
 OTHER_FILES +=
index 8c985e82748741bcc134a82ead6fb6ee4e1c3ec8..2f90347eac79ef5e79602488527ca2679dca81ff 100644 (file)
@@ -55,19 +55,26 @@ QDateTime ReGuiValidator::comboDate(QComboBox* combo){
  *
  * @param combo         the combobox with the integer
  * @param defaultValue  the value if the combobox is empty or invalid
+ * @param specialString NULL or a (non integer) string which is allowed
+ * @param specialValue  the value which is returned if specialString is found
  * @return              <code>defaultValue</code>: empty or invalid input<br>
  *                      otherwise: or the size resulting from the formula
  */
-int ReGuiValidator::comboInt(QComboBox* combo, int defaultValue){
+int ReGuiValidator::comboInt(QComboBox* combo, int defaultValue,
+   const char* specialString, int specialValue){
    QString value = combo->currentText();
    int rc = defaultValue;
    if (!value.isEmpty()){
-      uint nValue = 0;
-      if (ReQStringUtil::lengthOfUInt(value, 0, 10, &nValue) == 0)
-         guiError(combo, QObject::tr("not an integer: ") + value);
-      else{
-         setInHistory(combo, value);
-         rc = (int) nValue;
+      if (specialString != NULL && value == specialString){
+         rc = specialValue;
+      }else{
+         uint nValue = 0;
+         if (ReQStringUtil::lengthOfUInt(value, 0, 10, &nValue) == 0)
+            guiError(combo, QObject::tr("not an integer: ") + value);
+         else{
+            setInHistory(combo, value);
+            rc = (int) nValue;
+         }
       }
    }
    return rc;
index 59e669763d6c418a8771b569862c0327c4ed8752..fb4d0771c467d184f73f16b79d725123e0b46d50 100644 (file)
@@ -21,7 +21,8 @@ public:
    ~ReGuiValidator();
 public:
    QDateTime comboDate(QComboBox* combo);
-   int comboInt(QComboBox* combo, int defaultValue);
+   int comboInt(QComboBox* combo, int defaultValue, const char* specialString =
+      NULL, int specialValue = 0);
    int64_t comboSize(QComboBox* combo);
    QString comboText(QComboBox* combo);
    virtual void guiError(QWidget* widget, const QString& message);