]> gitweb.hamatoma.de Git - reqt/commitdiff
reimgconvert: gui redesign, search separated
authorhama <hama@siduction.net>
Wed, 20 Jan 2016 00:29:45 +0000 (01:29 +0100)
committerhama <hama@siduction.net>
Wed, 20 Jan 2016 00:29:45 +0000 (01:29 +0100)
* removed unneeded elements (layouts...)
* search is a separate thread
* recursive processing
* new: showing other files

14 files changed:
appl/rebackgui/about.ui [new file with mode: 0644]
appl/rebackgui/aboutdialog.cpp [new file with mode: 0644]
appl/rebackgui/aboutdialog.hpp [new file with mode: 0644]
appl/rebackgui/aboutdialog.ui [new file with mode: 0644]
appl/rebackgui/main.cpp [new file with mode: 0644]
appl/rebackgui/mainwindow.cpp [new file with mode: 0644]
appl/rebackgui/mainwindow.hpp [new file with mode: 0644]
appl/rebackgui/mainwindow.ui [new file with mode: 0644]
appl/rebackgui/rebackgui.pro [new file with mode: 0644]
appl/reimgconvert/converter.cpp
appl/reimgconvert/converter.hpp
appl/reimgconvert/mainwindow.cpp
appl/reimgconvert/mainwindow.hpp
appl/reimgconvert/mainwindow.ui

diff --git a/appl/rebackgui/about.ui b/appl/rebackgui/about.ui
new file mode 100644 (file)
index 0000000..a6d80c5
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AboutDialog</class>
+ <widget class="QDialog" name="AboutDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>225</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>About</string>
+  </property>
+  <widget class="QTextEdit" name="textEdit">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>20</y>
+     <width>351</width>
+     <height>141</height>
+    </rect>
+   </property>
+   <property name="html">
+    <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;ReFind&lt;/span&gt; for searching files in a directory tree&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This is a program of the project &amp;quot;&lt;span style=&quot; font-weight:600;&quot;&gt;Re&lt;/span&gt;al &lt;span style=&quot; font-weight:600;&quot;&gt;Pub&lt;/span&gt;lic &lt;span style=&quot; font-weight:600;&quot;&gt;Lib&lt;/span&gt;rary&amp;quot;.&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Sources are public domain and available under https://github.com/republib&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Implemented in QT (C++) 5.x&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>280</x>
+     <y>180</y>
+     <width>93</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&amp;OK</string>
+   </property>
+  </widget>
+  <action name="action_OK">
+   <property name="text">
+    <string>&amp;OK</string>
+   </property>
+  </action>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>action_OK</sender>
+   <signal>triggered()</signal>
+   <receiver>AboutDialog</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>112</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/appl/rebackgui/aboutdialog.cpp b/appl/rebackgui/aboutdialog.cpp
new file mode 100644 (file)
index 0000000..eedd0a8
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * aboutdialog.cpp
+ *
+ * (Un)License: Public Domain
+ * You can use and modify this file without any restriction.
+ * Do what you want.
+ * No warranties and disclaimer of any damages.
+ * More info: http://unlicense.org
+ * The latest sources: https://github.com/republib
+ */
+
+#include "aboutdialog.hpp"
+#include "ui_aboutdialog.h"
+
+AboutDialog::AboutDialog(const QString& version, QWidget *parent) :
+         QDialog(parent), ui(new Ui::AboutDialog){
+   ui->setupUi(this);
+   ui->labelVersion->setText(version);
+}
+
+AboutDialog::~AboutDialog(){
+   delete ui;
+}
diff --git a/appl/rebackgui/aboutdialog.hpp b/appl/rebackgui/aboutdialog.hpp
new file mode 100644 (file)
index 0000000..bf51cc7
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * aboutdialog.hpp
+ *
+ * (Un)License: Public Domain
+ * You can use and modify this file without any restriction.
+ * Do what you want.
+ * No warranties and disclaimer of any damages.
+ * More info: http://unlicense.org
+ * The latest sources: https://github.com/republib
+ */
+
+#ifndef ABOUTDIALOG_HPP
+#define ABOUTDIALOG_HPP
+
+#include <QDialog>
+
+namespace Ui {
+class AboutDialog;
+}
+
+class AboutDialog: public QDialog {
+   Q_OBJECT
+
+public:
+   explicit AboutDialog(const QString& version, QWidget *parent = 0);
+   ~AboutDialog();
+
+private:
+   Ui::AboutDialog *ui;
+};
+
+#endif // ABOUTDIALOG_HPP
diff --git a/appl/rebackgui/aboutdialog.ui b/appl/rebackgui/aboutdialog.ui
new file mode 100644 (file)
index 0000000..a4e82da
--- /dev/null
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AboutDialog</class>
+ <widget class="QDialog" name="AboutDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>423</width>
+    <height>289</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <property name="modal">
+   <bool>true</bool>
+  </property>
+  <widget class="QTextEdit" name="textEdit">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>20</y>
+     <width>381</width>
+     <height>221</height>
+    </rect>
+   </property>
+   <property name="readOnly">
+    <bool>true</bool>
+   </property>
+   <property name="html">
+    <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;ReImgConvert&lt;/span&gt; for converting images to smaller dimensions/size.&lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This is a program of the project&lt;/p&gt;
+&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Re&lt;/span&gt;al &lt;span style=&quot; font-weight:600;&quot;&gt;Pub&lt;/span&gt;lic &lt;span style=&quot; font-weight:600;&quot;&gt;Lib&lt;/span&gt;rary (RePubLib)&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Sources are public domain and available under&lt;/p&gt;
+&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/republib&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/republib&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Implemented in QT (C++) 5.x&lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Icons: Mark James, &lt;a href=&quot;http://famfamfam.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://famfamfam.com&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+   <property name="acceptRichText">
+    <bool>false</bool>
+   </property>
+   <property name="textInteractionFlags">
+    <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+   </property>
+  </widget>
+  <widget class="QWidget" name="layoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>250</y>
+     <width>381</width>
+     <height>29</height>
+    </rect>
+   </property>
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <item>
+     <widget class="QLabel" name="label">
+      <property name="text">
+       <string>Version:</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLabel" name="labelVersion">
+      <property name="text">
+       <string>2015.05.00</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <spacer name="horizontalSpacer">
+      <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>
+     <widget class="QPushButton" name="pushButtonOK">
+      <property name="text">
+       <string>&amp;OK</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>pushButtonOK</sender>
+   <signal>clicked()</signal>
+   <receiver>AboutDialog</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>196</x>
+     <y>183</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>108</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/appl/rebackgui/main.cpp b/appl/rebackgui/main.cpp
new file mode 100644 (file)
index 0000000..b5e8a18
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+*/
+
+#include "mainwindow.hpp"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+       QApplication a(argc, argv);
+       MainWindow w;
+       w.show();
+
+       return a.exec();
+}
diff --git a/appl/rebackgui/mainwindow.cpp b/appl/rebackgui/mainwindow.cpp
new file mode 100644 (file)
index 0000000..5ef22d6
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+*/
+
+#include "mainwindow.hpp"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+       QMainWindow(parent),
+       ui(new Ui::MainWindow)
+{
+       ui->setupUi(this);
+}
+
+MainWindow::~MainWindow()
+{
+       delete ui;
+}
diff --git a/appl/rebackgui/mainwindow.hpp b/appl/rebackgui/mainwindow.hpp
new file mode 100644 (file)
index 0000000..754b001
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+*/
+
+#ifndef MAINWINDOW_HPP
+#define MAINWINDOW_HPP
+
+#include "base/rebase.hpp"
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public ReHomeApplication
+{
+       Q_OBJECT
+
+public:
+       explicit MainWindow(QWidget *parent = 0);
+       ~MainWindow();
+
+private:
+       Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_HPP
diff --git a/appl/rebackgui/mainwindow.ui b/appl/rebackgui/mainwindow.ui
new file mode 100644 (file)
index 0000000..6050363
--- /dev/null
@@ -0,0 +1,24 @@
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>MainWindow</string>
+  </property>
+  <widget class="QMenuBar" name="menuBar" />
+  <widget class="QToolBar" name="mainToolBar" />
+  <widget class="QWidget" name="centralWidget" />
+  <widget class="QStatusBar" name="statusBar" />
+ </widget>
+ <layoutDefault spacing="6" margin="11" />
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/appl/rebackgui/rebackgui.pro b/appl/rebackgui/rebackgui.pro
new file mode 100644 (file)
index 0000000..ae124c7
--- /dev/null
@@ -0,0 +1,39 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2016-01-18T00:51:17
+#
+#-------------------------------------------------
+
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = rebackgui
+TEMPLATE = app
+INCLUDEPATH = ../.. /usr/include/c++/4.9
+
+SOURCES += main.cpp\
+        ../../base/ReException.cpp \
+        ../../base/ReQStringUtils.cpp \
+        ../../base/ReFileUtils.cpp \
+        ../../base/ReLogger.cpp \
+        ../../gui/ReStateStorage.cpp \
+        ../../gui/ReGuiValidator.cpp \
+        ../../gui/ReGuiQueue.cpp \
+        mainwindow.cpp \
+        aboutdialog.cpp
+
+HEADERS  += mainwindow.hpp \
+        ../../base/rebase.hpp \
+        ../../base/ReQStringUtils.hpp \
+        ../../gui/ReStateStorage.hpp \
+        ../../gui/ReGuiValidator.hpp \
+        ../../gui/regui.hpp \
+        aboutdialog.hpp
+
+FORMS    += mainwindow.ui \
+        aboutdialog.ui
+
+DISTFILES += \
+       ReBackGui.html
+
index 50bbde8b2863c8416c75bcd1a8860dfbd9f618c9..26d446e97362cb18b5462d7a10c342338f0c4b35 100644 (file)
  *
  */
 
-QString sizeToString(qint64 size);
+bool Converter::m_shouldStop = false;
+QStringList Converter::m_files;
+uint64_t Converter::m_totalBytes = 0;
+int Converter::m_totalFiles = 0;
+bool Converter::m_searchReady = false;
+QMutex Converter::m_mutex;
+
+/**
+ * Constructor.
+ *
+ * @param directory            the base directory of the images to inspect
+ * @param mainWindow
+ */
+Converter::Converter(const QString &directory, MainWindow *mainWindow):
+       m_sourceDir(directory),
+       m_mainWindow(mainWindow)
+{
+}
+
+/**
+ * @brief Logs an error message.
+ *
+ * @param message   the message to log
+ * @return          <code>false</code>
+ * @throws ConverterException
+ */
+bool Converter::error(const QString& message){
+   m_mainWindow->log(message);
+   throw ConverterException(message);
+   return false;
+}
+
+/**
+ * @brief Logs a message.
+ *
+ * @param message   the message to log
+ * @return          <code>true</code>
+ */
+bool Converter::log(const QString& message){
+   printf("%s\n", I18N::s2b(message).constData());
+   m_mainWindow->log(message);
+   return true;
+}
+
 
 /**
  * @brief Constructor.
@@ -111,37 +154,36 @@ QString sizeToString(qint64 size);
  *                          but larger
  * @param mainWindow        the window. Will be used for output
  */
-Converter::Converter(const QString& directory, const QString& targetDirectory,
+TaskConverter::TaskConverter(const QString& directory, const QString& targetDirectory,
    const QString& sourcePattern, const QString& targetType,
        bool simpleConversion, int maxWidth, int maxHeight, int landscapeX,
    int landscapeY, int portraitX, int portraitY, int squareX, int quality,
    MainWindow* mainWindow) :
-                       m_dir(directory),
-                       m_targetDir(targetDirectory),
-                       m_sourcePattern(sourcePattern),
-                       m_targetType(targetType),
-                       m_landscapeWidth(landscapeX),
-                       m_landscapeHeight(landscapeY),
-                       m_portraitWidth(portraitX),
-                       m_portraitHeight(portraitY),
-                       m_squareWidth(squareX),
-                       m_quality(targetType == "jpg" ? quality : 0),
-                       m_mainWindows(mainWindow),
-                       m_shouldStop(false),
-                       m_imageInfo(
-                          new QRegularExpression(" (PNG|GIF|JPEG) (\\d+)x(\\d+) ")),
-                       m_groupWidth(2),
-                       m_groupHeight(3),
-                       m_simpleMode(simpleConversion),
-                       m_maxWidth(maxWidth),
-                       m_maxHeight(maxHeight)
+       Converter(directory, mainWindow),
+       m_targetDir(targetDirectory),
+       m_targetType(targetType),
+       m_landscapeWidth(landscapeX),
+       m_landscapeHeight(landscapeY),
+       m_portraitWidth(portraitX),
+       m_portraitHeight(portraitY),
+       m_squareWidth(squareX),
+       m_quality(targetType == "jpg" ? quality : 0),
+       m_imageInfo(
+          new QRegularExpression(" (PNG|GIF|JPEG) (\\d+)x(\\d+) ")),
+       m_groupWidth(2),
+       m_groupHeight(3),
+       m_simpleMode(simpleConversion),
+       m_maxWidth(maxWidth),
+       m_maxHeight(maxHeight)
 {
+       ReQStringUtils::ensureLastChar(m_sourceDir, OS_SEPARATOR);
+       ReQStringUtils::ensureLastChar(m_targetDir, OS_SEPARATOR);
 }
 
 /**
  * @brief Destructor.
  */
-Converter::~Converter(){
+TaskConverter::~TaskConverter(){
    delete m_imageInfo;
 }
 
@@ -158,16 +200,6 @@ void addArg(QStringList& args, const char* prefix, int value){
    args << arg;
 }
 
-/**
- * @brief Changes the state of the thread.
- *
- * @param state     the new state
- * @param info      an info about the change
- */
-void Converter::changeState(Converter::State state, const QString& info){
-   m_mainWindows->onThreadStateChanged(state, info);
-}
-
 /**
  * Converts an image into another format.
  *
@@ -179,7 +211,7 @@ void Converter::changeState(Converter::State state, const QString& info){
  * @param heightNew the new height of the image
  * @param quality   0 or quality in % (only for JPEG targets)
  */
-void Converter::convert(const QString& source, const QString& target, int width,
+void TaskConverter::callExternProgram(const QString& source, const QString& target, int width,
    int height, int widthNew, int heightNew, int quality){
    QStringList args;
    // convert -size 100x200 source.png -resize 50x100 target.jpg";
@@ -202,6 +234,42 @@ void Converter::convert(const QString& source, const QString& target, int width,
    process.close();
 }
 
+/**
+ * @brief Converts one file.
+ *
+ * @param source               the file's name with path
+ * @param target               the new filename with path
+ * @param size                 the size of the file (in byte)
+ * @param sizeTarget   OUT: the file size of the target
+ */
+void TaskConverter::convertOneFile(const QString& source, const QString& target,
+   qint64 size, qint64& sizeTarget){
+   int width = 0;
+   int height = 0;
+   QString info;
+   clock_t start = clock();
+   if (readProperties(source, width, height, info)){
+          int widthNew = width;
+          int heightNew = height;
+          if (m_simpleMode)
+                  handleSimple(width, height, widthNew, heightNew);
+          else
+                  handleUserDefined(width, height, widthNew, heightNew);
+          QString node = ReFileUtils::nodeOf(source);
+         log(
+                node + " " + info + " " + ReQStringUtils::readableSize(size)
+                       + QString(" -> %1x%2 ").arg(widthNew).arg(heightNew));
+         callExternProgram(source, target, width, height, widthNew, heightNew, m_quality);
+         struct stat info;
+         if (stat(I18N::s2b(target).constData(), &info) == 0){
+                 sizeTarget = info.st_size;
+                m_mainWindow->logAppendLast(ReQStringUtils::readableSize(sizeTarget)
+                                                                         + " " + ReQStringUtils::readableDuration(
+                                                                                 clock() - start));
+         }
+   }
+}
+
 /**
  * Converts an image with a given maximal width and size.
  *
@@ -211,7 +279,7 @@ void Converter::convert(const QString& source, const QString& target, int width,
  * @param heightNew    OUT: the height of the converted image
  * @return                     <code>true</code>: the image needs to be converted
  */
-bool Converter::handleSimple(int width, int height, int& widthNew, int& heightNew)
+bool TaskConverter::handleSimple(int width, int height, int& widthNew, int& heightNew)
 {
        bool doConvert = false;
        if (width > m_maxWidth){
@@ -237,7 +305,7 @@ bool Converter::handleSimple(int width, int height, int& widthNew, int& heightNe
  * @param heightNew    OUT: the height of the converted image
  * @return                     <code>true</code>: the image needs to be converted
  */
-bool Converter::handleUserDefined(int width, int height, int& widthNew, int& heightNew){
+bool TaskConverter::handleUserDefined(int width, int height, int& widthNew, int& heightNew){
        bool doConvert = false;
        if (abs(width - height) < 5){
           // Square format:
@@ -272,67 +340,6 @@ bool Converter::handleUserDefined(int width, int height, int& widthNew, int& hei
        return doConvert;
 }
 
-/**
- * @brief Converts one file.
- *
- * @param source               the file's name with path
- * @param target               the new filename with path
- * @param size                 the size of the file (in byte)
- * @param sizeTarget   OUT: the file size of the target
- */
-void Converter::convertOneFile(const QString& source, const QString& target,
-   qint64 size, qint64& sizeTarget){
-   int width = 0;
-   int height = 0;
-   QString info;
-   clock_t start = clock();
-   if (readProperties(source, width, height, info)){
-          int widthNew = width;
-          int heightNew = height;
-          if (m_simpleMode)
-                  handleSimple(width, height, widthNew, heightNew);
-          else
-                  handleUserDefined(width, height, widthNew, heightNew);
-          QString node = ReFileUtils::nodeOf(source);
-         log(
-                node + " " + info + " " + ReQStringUtils::readableSize(size)
-                       + QString(" -> %1x%2 ").arg(widthNew).arg(heightNew));
-         convert(source, target, width, height, widthNew, heightNew, m_quality);
-         struct stat info;
-         if (stat(I18N::s2b(target).constData(), &info) == 0){
-                 sizeTarget = info.st_size;
-                m_mainWindows->logAppendLast(ReQStringUtils::readableSize(sizeTarget)
-                                                                         + " " + ReQStringUtils::readableDuration(
-                                                                                 clock() - start));
-         }
-   }
-}
-
-/**
- * @brief Logs an error message.
- *
- * @param message   the message to log
- * @return          <code>false</code>
- * @throws ConverterException
- */
-bool Converter::error(const QString& message){
-   m_mainWindows->log(message);
-   throw ConverterException(message);
-   return false;
-}
-
-/**
- * @brief Logs a message.
- *
- * @param message   the message to log
- * @return          <code>true</code>
- */
-bool Converter::log(const QString& message){
-   printf("%s\n", I18N::s2b(message).constData());
-   m_mainWindows->log(message);
-   return true;
-}
-
 /**
  * Reads the image properties.
  *
@@ -343,7 +350,7 @@ bool Converter::log(const QString& message){
  * @return          <code>true</code>: success
  *                  <code>false</code>: properties not readable
  */
-bool Converter::readProperties(const QString& name, int& width, int& height,
+bool TaskConverter::readProperties(const QString& name, int& width, int& height,
    QString& info){
        QPixmap image(name);
 
@@ -366,7 +373,7 @@ bool Converter::readProperties(const QString& name, int& width, int& height,
  * @return          <code>true</code>: success
  *                  <code>false</code>: properties not readable
  */
-bool Converter::readPropertiesByIdentify(const QString& name, int& width, int& height,
+bool TaskConverter::readPropertiesByIdentify(const QString& name, int& width, int& height,
    QString& info){
    QStringList args;
    args << name;
@@ -400,67 +407,68 @@ bool Converter::readPropertiesByIdentify(const QString& name, int& width, int& h
 /**
  * @brief Runs the thread's task.
  *
- * <ul>
- *<li>Makes the target directory (if necessary)</li>
- *<li>Search the images *.png / *.jpg and converts them</li>
- *</ul>
+ * Makes the target directory (if necessary).
+ * Converts all files from the filelist created by TaskSearch.
  */
-void Converter::run(){
+void TaskConverter::run(){
    QString msg;
    clock_t start = clock();
    uint64_t preSize = 0;
    uint64_t postSize = 0;
    uint64_t lengthTarget = 0;
    int no = 0;
+   QString info;
+   QString node;
+   QString targetDir;
    try{
-         if (!m_dir.exists())
-                error(
-                       QObject::tr("Directory does not exist: ") + m_dir.absolutePath());
-         if (!m_targetDir.exists()){
-                QString parentName = m_targetDir.path();
-                QString subdir = m_targetDir.dirName();
-                QDir parent(m_targetDir.path());
-                parent.cdUp();
-                parent.mkdir(subdir);
-         }
-         if (!m_targetDir.exists()){
-                error(
-                       QObject::tr("Cannot create the target directory: ")
-                          + m_targetDir.absolutePath());
-         }
-         changeState(Converter::STATE_STARTING, "");
+          while (! m_shouldStop && ! m_searchReady){
+                  m_mutex.lock();
+                  if (m_files.size() == 0)
+                          info.clear();
+                  else{
+                          info = m_files.first();
+                          m_files.removeFirst();
+                  }
+                  m_mutex.unlock();
+                  if (info.isEmpty()){
+                          QThread::sleep(50);
+                  } else {
+                          int ix = info.indexOf('\t');
+                          node = info.mid(ix + 1);
+                          info.resize(ix);
+                          targetDir = m_targetDir;
+                          if (!info.isEmpty())
+                                  targetDir += info + OS_SEPARATOR;
+                          if (! QDir(targetDir).exists())
+                                  _mkdir(I18N::s2b(targetDir).constData());
+                          QDir dir(targetDir);
+                          if (! dir.exists()){
+                                  error(tr("cannot create directory: %1").arg(targetDir));
+                          }else {
+                                  no++;
+                                  QString path = m_sourceDir + info + node;
+                                  qint64 length = QFileInfo(path).size();
+                                  QString nodeTarget = ReFileUtils::replaceExtension(node,
+                                         "." + m_targetType);
+                                  QString target = m_targetDir + info + nodeTarget;
+                                  convertOneFile(path, target, length, lengthTarget);
+                                  preSize += length;
+                                  postSize += lengthTarget;
+                                  int percentFiles = int(no * 100 / max(1, m_totalFiles));
+                                  int percentSize = int(preSize * 100 / max(1, m_totalBytes));
+                                  m_mainWindow->setStatusMessage(LOG_INFO,
+                                                               tr("%1 file(s) of %2 (%3 %), %4 -> %5 (%6 %)")
+                                                                       .arg(no).arg(m_totalFiles)
+                                                                       .arg(percentFiles + percentSize / 2)
+                                                                          .arg(ReQStringUtils::readableSize(preSize))
+                                                                          .arg(ReQStringUtils::readableSize(postSize))
+                                                                         .arg(postSize * 100.0 / max(1, preSize), 0,
+                                                                                  'f', 2));
+
+                               }
+                  }
+          }
          m_shouldStop = false;
-         QDirIterator it(m_dir.absolutePath());
-         QRegExp regExpr(m_sourcePattern, Qt::CaseInsensitive, QRegExp::Wildcard);
-         while (it.hasNext()){
-                if (m_shouldStop){
-                       log(QObject::tr("Canceled by the user"));
-                       break;
-                }
-                it.next();
-                if (it.fileInfo().isDir())
-                       continue;
-                QString node = it.fileName();
-                if (regExpr.indexIn(node) >= 0){
-                       no++;
-                       QString path = m_dir.absoluteFilePath(node);
-                       qint64 length = it.fileInfo().size();
-                       QString nodeTarget = ReFileUtils::replaceExtension(node,
-                          "." + m_targetType);
-                       QString target = m_targetDir.absoluteFilePath(nodeTarget);
-                       convertOneFile(path, target, length, lengthTarget);
-                       preSize += length;
-                       postSize += lengthTarget;
-                       m_mainWindows->setStatusMessage(LOG_INFO,
-                                                                                       tr("%1 file(s) %2 -> %3 (%4 %)")
-                                                          .arg(no)
-                                                               .arg(ReQStringUtils::readableSize(preSize))
-                                                               .arg(ReQStringUtils::readableSize(postSize))
-                                                          .arg(postSize * 100.0 / max(1, preSize), 0,
-                                                                       'f', 2));
-                }
-         }
-         changeState(Converter::STATE_SUB_TASK_STOPPED, msg);
    } catch (ConverterException exc){
          log(
                 QObject::tr("Execution stopped because of error(s): ")
@@ -472,29 +480,137 @@ void Converter::run(){
                        .arg(ReQStringUtils::readableSize(postSize))
                   .arg(postSize * 100.0 / preSize, 0, 'f', 2)
                   .arg(ReQStringUtils::readableDuration(clock() - start));
-   changeState(Converter::STATE_READY, msg);
+   m_mainWindow->finishTask(msg);
 }
 
 /**
- * @brief Search for the Perl script which make the conversion itself.
+ * Constructor.
  *
- * @param node  the name of script without path.
- * @return      the full name of the script (with path)
+ * @param directory            the base directory to inspect
+ * @param sourcePattern        the pattern of the image files to convert
+ * @param mainWindow   the parent
  */
-QString findScript(const QString& node){
-   static QString rc;
-   if (rc.isEmpty()){
+TaskSearch::TaskSearch(const QString& directory,
+   const QString& sourcePattern, bool recursive, MainWindow* mainWindow) :
+       Converter(directory, mainWindow),
+       m_sourcePattern(sourcePattern),
+       m_recursive(recursive)
+{
+}
 
-         QDir dir = QDir::current();
-         QFile scriptFile(dir.filePath(node));
-         if (!scriptFile.exists()){
-                extern char** g_argv;
-                dir.setPath(g_argv[0]);
-                dir.cdUp();
-                scriptFile.setFileName(dir.filePath(node));
-         }
-         if (scriptFile.exists())
-                rc = scriptFile.fileName();
-   }
-   return rc;
+/**
+ * Search the image files in one directory and write it to a list.
+ *
+ * This method is recursive.
+ *
+ * @param dir  the directory to inspect
+ */
+void TaskSearch::searchOneDirectory(const QString& dir){
+       QDirIterator it(dir);
+       QRegExp regExpr(m_sourcePattern, Qt::CaseInsensitive, QRegExp::Wildcard);
+       QString relPath;
+       QString info;
+       if (dir.length() > m_sourceDir.length())
+               relPath = m_sourceDir.mid(m_sourceDir.length());
+       while (it.hasNext()){
+          if (m_shouldStop){
+                 break;
+          }
+          it.next();
+          if (! it.fileInfo().isDir() && regExpr.indexIn(it.fileName()) >= 0){
+                  info = relPath + "\t" + it.fileName();
+                  m_mutex.lock();
+                  m_files.append(info);
+                  m_mutex.unlock();
+          }
+       }
+       if (m_recursive && ! m_shouldStop){
+               QDirIterator it2(dir);
+               while (it2.hasNext()){
+                       if (m_shouldStop){
+                          break;
+                       }
+                  it2.next();
+
+                  if (it2.fileInfo().isDir()){
+                          searchOneDirectory(it2.filePath());
+                  }
+               }
+       }
 }
+
+/**
+ * Search the input files and write it into the result list.
+ */
+void TaskSearch::run(){
+       m_searchReady = false;
+       searchOneDirectory(m_sourceDir);
+       m_searchReady = true;
+}
+
+/**
+ * Constructor.
+ *
+ * @param directory            the base directory to inspect
+ * @param sourcePattern        the pattern of the image files to convert
+ * @param mainWindow   the parent
+ */
+TaskShowOther::TaskShowOther(const QString& directory,
+   const QString& sourcePattern, bool recursive, MainWindow* mainWindow) :
+       Converter(directory, mainWindow),
+       m_sourcePattern(sourcePattern),
+       m_recursive(recursive)
+{
+}
+
+/**
+ * Search the image files in one directory and write it to a list.
+ *
+ * This method is recursive.
+ *
+ * @param dir  the directory to inspect
+ */
+void TaskShowOther::processOneDirectory(const QString& dir){
+       QDirIterator it(dir);
+       QRegExp regExpr(m_sourcePattern, Qt::CaseInsensitive, QRegExp::Wildcard);
+       QString relPath;
+       QString info;
+       if (dir.length() > m_sourceDir.length())
+               relPath = m_sourceDir.mid(m_sourceDir.length());
+       while (it.hasNext()){
+          if (m_shouldStop){
+                 break;
+          }
+          it.next();
+          if (! it.fileInfo().isDir() && regExpr.indexIn(it.fileName()) < 0){
+                  info = relPath + it.fileName();
+                  m_totalFiles++;
+                  m_mainWindow->remoteLog(info);
+          }
+       }
+       if (m_recursive && ! m_shouldStop){
+               QDirIterator it2(dir);
+               while (it2.hasNext()){
+                       if (m_shouldStop){
+                          break;
+                       }
+                  it2.next();
+
+                  if (it2.fileInfo().isDir()){
+                          processOneDirectory(it2.filePath());
+                  }
+               }
+       }
+}
+
+/**
+ * Search the input files and write it into the result list.
+ */
+void TaskShowOther::run(){
+       m_searchReady = false;
+       m_totalFiles = 0;
+       processOneDirectory(m_sourceDir);
+       m_searchReady = true;
+       m_mainWindow->finishTask(tr("Found: %1 file(s)").arg(m_totalFiles));
+}
+
index 0ba19a1f0a70d27a0a8e9b43b4c22daa2533ad30..891374aad1ab3cfaae12cc396cbcbcdfc9763dbe 100644 (file)
@@ -18,6 +18,7 @@
 #include <QProcess>
 #include <QList>
 #include <QThread>
+#include <QMutex>
 
 class MainWindow;
 class ConverterException {
@@ -41,56 +42,90 @@ public:
 
 class Converter: public QThread {
    Q_OBJECT
+
 public:
-   enum State {
-         STATE_UNDEF, STATE_STARTING, STATE_SUB_TASK_STOPPED, STATE_READY,
-   };
-public:
-   Converter(const QString& directory, const QString& targetDirectory,
-         const QString& sourcePattern, const QString& targetType,
-       bool simpleConversion, int maxWidth, int maxHeight, int landscapeX,
-         int landscapeY, int portraitX, int portraitY, int squareX, int quality,
-         MainWindow* mainWindows);
-   ~Converter();
+   Converter(const QString& directory, MainWindow* mainWindow);
 public:
    bool error(const QString& message);
    bool log(const QString& message);
-   void run();
-   void stop(){
-         m_shouldStop = true;
-   }
 protected:
-   bool buildArgs();
-   void changeState(State state, const QString& info);
-   void convert(const QString& source, const QString& target, int width,
-         int height, int widthNew, int heightNew, int quality);
-   void convertOneFile(const QString& source, const QString& target,
-         qint64 size, qint64& sizeTarget);
-   bool handleSimple(int width, int height, int& widthNew, int& heightNew);
-   bool handleUserDefined(int width, int height, int& widthNew, int& heightNew);
-   bool readProperties(const QString& name, int &width, int &height,
-         QString &info);
-   bool readPropertiesByIdentify(const QString& name, int &width, int &height,
-         QString &info);
+       virtual void run() = 0;
+protected:
+   QString m_sourceDir;
+   MainWindow* m_mainWindow;
+public:
+   static bool m_shouldStop;
+   static QStringList m_files;
+   static qint64 m_totalBytes;
+   static int m_totalFiles;
+   static bool m_searchReady;
+   static QMutex m_mutex;
+};
+
+class TaskConverter : public Converter {
+public:
+       TaskConverter(const QString& directory, const QString& targetDirectory,
+          const QString& sourcePattern, const QString& targetType,
+        bool simpleConversion, int maxWidth, int maxHeight, int landscapeX,
+          int landscapeY, int portraitX, int portraitY, int squareX, int quality,
+          MainWindow* mainWindows);
+       ~TaskConverter();
+protected:
+       virtual void run();
+protected:
+       bool buildArgs();
+       void callExternProgram(const QString& source, const QString& target, int width,
+          int height, int widthNew, int heightNew, int quality);
+       void converterTask();
+       void convertOneFile(const QString& source, const QString& target,
+          qint64 size, qint64& sizeTarget);
+       bool handleSimple(int width, int height, int& widthNew, int& heightNew);
+       bool handleUserDefined(int width, int height, int& widthNew, int& heightNew);
+       bool readProperties(const QString& name, int &width, int &height,
+          QString &info);
+       bool readPropertiesByIdentify(const QString& name, int &width, int &height,
+                                                                 QString &info);
+private:
+       QString m_targetDir;
+       QString m_targetType;
+       int m_landscapeWidth;
+       int m_landscapeHeight;
+       int m_portraitWidth;
+       int m_portraitHeight;
+       int m_squareWidth;
+       int m_quality;
+       QRegularExpression* m_imageInfo;
+       int m_groupWidth;
+       int m_groupHeight;
+       bool m_simpleMode;
+       int m_maxWidth;
+       int m_maxHeight;
+};
+
+class TaskSearch : public Converter {
+public:
+       TaskSearch(const QString& dir, const QString& sourcePattern,
+                          bool recursive, MainWindow* mainWindows);
+protected:
+       virtual void run();
+protected:
+   void searchOneDirectory(const QString& dir);
+private:
+   QString m_sourcePattern;
+   bool m_recursive;
+};
+
+class TaskShowOther : public Converter {
+public:
+       TaskShowOther(const QString& dir, const QString& sourcePattern,
+                          bool recursive, MainWindow* mainWindows);
+protected:
+       virtual void run();
+protected:
+   void processOneDirectory(const QString& dir);
 private:
-   QDir m_dir;
-   QDir m_targetDir;
    QString m_sourcePattern;
-   QString m_targetType;
-   int m_landscapeWidth;
-   int m_landscapeHeight;
-   int m_portraitWidth;
-   int m_portraitHeight;
-   int m_squareWidth;
-   int m_quality;
-   MainWindow* m_mainWindows;
-   bool m_shouldStop;
-   QRegularExpression* m_imageInfo;
-   int m_groupWidth;
-   int m_groupHeight;
-   bool m_simpleMode;
-   int m_maxWidth;
-   int m_maxHeight;
+   bool m_recursive;
 };
 
 #endif // CONVERTER_HPP
index 5f8006d041873d941a39899a15c722d92053cb29..5a6fef5e1edb4517432929ef7c1f15c9411bbc8e 100644 (file)
@@ -34,7 +34,9 @@ const QString VERSION("2016.01.15");
 MainWindow::MainWindow(const QString& homeDir, QWidget *parent) :
                        ReHomeApplication("reimgconvert", homeDir, 2, 100100100, parent),
                        ui(new Ui::MainWindow),
-                       m_converter(NULL),
+                       m_taskConvert(NULL),
+                       m_taskSearch(NULL),
+                       m_taskShowOther(NULL),
                        m_logger(),
                        m_guiQueue(),
                        m_guiTimer(new QTimer(this)){
@@ -57,13 +59,14 @@ MainWindow::MainWindow(const QString& homeDir, QWidget *parent) :
    connect(ui->pushButtonSelectDest, SIGNAL(clicked()), this,
          SLOT(selectTarget()));
    connect(ui->actionSelectSource, SIGNAL(triggered()), this,
-         SLOT(selectSource()));
+         SLOT(onSelectSource()));
    connect(ui->pushButtonSelectSource, SIGNAL(clicked()), this,
-         SLOT(selectSource()));
+         SLOT(onSelectSource()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
    connect(ui->comboBoxTemplate, SIGNAL(currentIndexChanged(const QString&)),
                        this, SLOT(onTemplateChangeIndex(const QString&)));
    connect(m_guiTimer, SIGNAL(timeout()), this, SLOT(guiTimerUpdate()));
+   connect(ui->pushButtonShowOtherFiles, SIGNAL(clicked()), this, SLOT(onShowOtherFiles()));
    restoreState();
    m_guiTimer->start(100);
 }
@@ -73,7 +76,9 @@ MainWindow::MainWindow(const QString& homeDir, QWidget *parent) :
  */
 MainWindow::~MainWindow(){
    delete ui;
-   delete m_converter;
+   delete m_taskConvert;
+       delete m_taskSearch;
+       delete m_taskShowOther;
 }
 
 /**
@@ -110,6 +115,18 @@ bool MainWindow::error(const QString& message){
        return false;
 }
 
+/**
+ * Finishs a task with sending a ready message.
+ *
+ * Note: the method is called from a non-main thread.
+ *
+ * @param message      the message to show
+ */
+void MainWindow::finishTask(const QString& message){
+       Converter::m_mutex.lock();
+       m_guiQueue.pushBack(ReGuiQueueItem(ReGuiQueueItem::ReadyMessage, NULL, message));
+       Converter::m_mutex.unlock();
+}
 /**
  * Callback method of the GUI timer.
  */
@@ -117,7 +134,9 @@ void MainWindow::guiTimerUpdate()
 {
        int count = m_guiQueue.count();
        while(count-- > 0){
+               Converter::m_mutex.lock();
                ReGuiQueueItem item = m_guiQueue.popFront();
+               Converter::m_mutex.unlock();
                if (item.m_type == ReGuiQueueItem::Undef)
                        break;
                if (! item.apply()){
@@ -147,7 +166,6 @@ void MainWindow::guiTimerUpdate()
                                        + " " + item.m_value);
                                break;
                        }
-
                }
        }
 }
@@ -173,8 +191,10 @@ bool MainWindow::log(const QString& message){
  * @return          <code>true</code>
  */
 bool MainWindow::logAppendLast(const QString& message){
+       Converter::m_mutex.lock();
        m_guiQueue.pushBack(ReGuiQueueItem(ReGuiQueueItem::ListAppendToCurrent,
                                                                           ui->listWidget, message));
+       Converter::m_mutex.unlock();
    return true;
 }
 
@@ -182,8 +202,8 @@ bool MainWindow::logAppendLast(const QString& message){
  * @brief Handles the button click on "convert".
  */
 void MainWindow::onConvert(){
-   startStop(true);
-   delete m_converter;
+       Converter::m_shouldStop = false;
+       startStop(true);
    m_errors = 0;
    int landscapeX = comboInt(ui->comboBoxLandscapeX, 0, "*", 0);
    int landscapeY = comboInt(ui->comboBoxLandscapeY, 0, "*", 0);
@@ -198,18 +218,48 @@ void MainWindow::onConvert(){
    bool simpleConversion = match.hasMatch();
    if (m_errors == 0){
           saveState();
-         m_converter = new Converter(ui->comboBoxSourceDir->currentText(),
+          delete m_taskSearch;
+          m_taskSearch = new TaskSearch(ui->comboBoxSourceDir->currentText(),
+                               ui->comboBoxSourcePattern->currentText(),
+                               ui->checkBoxCopyOtherFiles->isChecked(), this);
+          m_taskSearch->start();
+
+          delete m_taskConvert;
+         m_taskConvert = new TaskConverter(ui->comboBoxSourceDir->currentText(),
                 ui->comboBoxTargetDir->currentText(),
                 ui->comboBoxSourcePattern->currentText(),
                 ui->comboBoxDestType->currentText(),
                simpleConversion, maxWidth, maxHeight,
                landscapeX, landscapeY, portraitX,
                 portraitY, squareX, quality, this);
-         // start the thread:
-         m_converter->start();
+          m_taskConvert->start();
    }
 }
 
+
+/**
+ * Selects the destination directory with a dialog.
+ */
+void MainWindow::onSelectSource(){
+   QString dir = QFileDialog::getExistingDirectory(this,
+         tr("Select Source Directory"), ui->comboBoxSourceDir->currentText(),
+         QFileDialog::ShowDirsOnly);
+   if (!dir.isEmpty())
+         ui->comboBoxSourceDir->setCurrentText(dir);
+}
+
+/**
+ * Shows the files not matching the file pattern (describing the images).
+ */
+void MainWindow::onShowOtherFiles(){
+       Converter::m_shouldStop = false;
+       startStop(true);
+       delete m_taskShowOther;
+       m_taskShowOther = new TaskShowOther(ui->comboBoxSourceDir->currentText(),
+                        ui->comboBoxSourcePattern->currentText(),
+                        ui->checkBoxCopyOtherFiles->isChecked(), this);
+       m_taskShowOther->start();
+}
 /**
  * @brief Handles the click on the button "file select".
  *
@@ -230,7 +280,7 @@ void MainWindow::onSourceFileSelect(){
  * @brief Handles the click on the button "stop".
  */
 void MainWindow::onStop(){
-   m_converter->stop();
+   Converter::m_shouldStop = true;
 }
 
 /**
@@ -247,26 +297,17 @@ void MainWindow::onTemplateChangeIndex(const QString & text){
 }
 
 /**
- * @brief Handles the event "thread changed".
+ * Writes a text to the log.
  *
- * Note: this method is called from a non main thread
+ * Note: this method is called from a non-main thread
  *
- * @param state     the new state of the thread
- * @param info      info about the new state. Not used
+ * @param message   the text to set
  */
-void MainWindow::onThreadStateChanged(Converter::State state, const QString& info){
-   switch (state) {
-   case Converter::STATE_READY:
-         m_guiQueue.pushBack(ReGuiQueueItem(ReGuiQueueItem::ReadyMessage, NULL, info));
-         //ui->statusBar->showMessage(info);
-         break;
-   case Converter::STATE_SUB_TASK_STOPPED:
-         //ui->statusBar->showMessage(info);
-         break;
-   case Converter::STATE_STARTING:
-   default:
-         break;
-   }
+void MainWindow::remoteLog(const QString& message){
+       Converter::m_mutex.lock();
+       m_guiQueue.pushBack(ReGuiQueueItem(ReGuiQueueItem::ListEnd,
+                                                                          ui->listWidget, message));
+       Converter::m_mutex.unlock();
 }
 /**
  * Reads the history of the widget values and other parameters and set it.
@@ -330,17 +371,6 @@ bool MainWindow::say(ReLoggerLevel level, const QString& message)
        return level == LOG_ERROR;
 }
 
-/**
- * Selects the destination directory with a dialog.
- */
-void MainWindow::selectSource(){
-   QString dir = QFileDialog::getExistingDirectory(this,
-         tr("Select Source Directory"), ui->comboBoxSourceDir->currentText(),
-         QFileDialog::ShowDirsOnly);
-   if (!dir.isEmpty())
-         ui->comboBoxSourceDir->setCurrentText(dir);
-}
-
 /**
  * Sets the maximal dimensions (from the "simple" interface).
  *
@@ -384,8 +414,10 @@ void MainWindow::selectTarget(){
  * @param message   the text to set
  */
 void MainWindow::setRemoteStatus(const QString& message){
+       Converter::m_mutex.lock();
        m_guiQueue.pushBack(ReGuiQueueItem(ReGuiQueueItem::StatusLine,
                                                                           NULL, message));
+       Converter::m_mutex.unlock();
 }
 
 /**
@@ -406,6 +438,7 @@ void MainWindow::setStatusMessage(bool error, const QString& message){
  */
 void MainWindow::startStop(bool isStart){
        ui->actionStart->setEnabled(!isStart);
+       ui->pushButtonShowOtherFiles->setEnabled(! isStart);
        ui->actionStop->setEnabled(isStart);
        ui->pushButtonConvert->setEnabled(! isStart);
        ui->pushButtonStop->setEnabled(isStart);
index 05ececf4468ca0b06dde87be7c1a60a8272cccdf..148371aba7ced841c66a12e7c72420db4b849c91 100644 (file)
@@ -35,9 +35,10 @@ public:
 public:
        virtual void aboutToQuit();
    bool error(const QString& message);
+   void finishTask(const QString& message);
    bool log(const QString& message);
    bool logAppendLast(const QString& message);
-   void onThreadStateChanged(Converter::State state, const QString& info);
+   void remoteLog(const QString& message);
    void setRemoteStatus(const QString& message);
    void setStatusMessage(bool error, const QString& message);
 public:
@@ -52,14 +53,17 @@ private slots:
    void clear();
    void guiTimerUpdate();
    void onConvert();
+   void onShowOtherFiles();
    void onSourceFileSelect();
    void onStop();
    void onTemplateChangeIndex(const QString& text);
-   void selectSource();
+   void onSelectSource();
    void selectTarget();
 private:
    Ui::MainWindow *ui;
-   Converter* m_converter;
+   TaskConverter* m_taskConvert;
+   TaskSearch* m_taskSearch;
+   TaskShowOther* m_taskShowOther;
    QLabel* m_statusMessage;
    ReLogger m_logger;
    ReGuiQueue m_guiQueue;
index 21bcb38cb3c3e4fe11cf1c10d1699660712bf9a8..dcd95ab87e898fd4ac40450bae16f04490c1503f 100644 (file)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>823</width>
+    <width>958</width>
     <height>783</height>
    </rect>
   </property>
    <string>ReImgConvert</string>
   </property>
   <widget class="QWidget" name="centralWidget">
-   <layout class="QVBoxLayout" name="verticalLayout_3">
+   <layout class="QVBoxLayout" name="verticalLayout">
     <item>
-     <widget class="QWidget" name="widget" native="true">
-      <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_4">
-             <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>
-             </item>
-             <item>
-              <widget class="QComboBox" name="comboBoxTemplate">
-               <property name="minimumSize">
-                <size>
-                 <width>316</width>
-                 <height>0</height>
-                </size>
-               </property>
-               <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>
-               <item>
-                <property name="text">
-                 <string>User defined</string>
-                </property>
-               </item>
-              </widget>
-             </item>
-             <item>
-              <spacer name="horizontalSpacer_6">
-               <property name="orientation">
-                <enum>Qt::Horizontal</enum>
-               </property>
-               <property name="sizeHint" stdset="0">
-                <size>
-                 <width>40</width>
-                 <height>20</height>
-                </size>
-               </property>
-              </spacer>
-             </item>
-            </layout>
-           </item>
-           <item>
-            <layout class="QHBoxLayout" name="horizontalLayout_5">
-             <item>
-              <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>
-              <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_5">
-               <property name="orientation">
-                <enum>Qt::Horizontal</enum>
-               </property>
-               <property name="sizeHint" stdset="0">
-                <size>
-                 <width>40</width>
-                 <height>20</height>
-                </size>
-               </property>
-              </spacer>
-             </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>65</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>
-            <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>65</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>
-            <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>
-           <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>
-          </layout>
-          <zorder>groupBox_2</zorder>
-          <zorder>groupBox_3</zorder>
-          <zorder>groupBox</zorder>
-          <zorder>horizontalSpacer_2</zorder>
-         </widget>
-        </widget>
-       </item>
-       <item>
-        <layout class="QGridLayout" name="gridLayout">
-         <item row="0" column="2">
-          <widget class="QLabel" name="label_10">
+     <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>
+       <widget class="QWidget" name="">
+        <property name="geometry">
+         <rect>
+          <x>11</x>
+          <y>11</y>
+          <width>561</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout_4">
+         <item>
+          <widget class="QLabel" name="label_2">
            <property name="minimumSize">
             <size>
-             <width>100</width>
+             <width>110</width>
              <height>0</height>
             </size>
            </property>
             </size>
            </property>
            <property name="text">
-            <string>File Pattern:</string>
+            <string>Template:</string>
            </property>
           </widget>
          </item>
-         <item row="0" column="1">
-          <widget class="QComboBox" name="comboBoxQuality">
+         <item>
+          <widget class="QComboBox" name="comboBoxTemplate">
            <property name="minimumSize">
             <size>
-             <width>100</width>
+             <width>390</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>
+           <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>
+           <item>
+            <property name="text">
+             <string>User defined</string>
+            </property>
+           </item>
           </widget>
          </item>
-         <item row="0" column="4">
-          <widget class="QLabel" name="label_11">
-           <property name="minimumSize">
-            <size>
-             <width>100</width>
-             <height>0</height>
-            </size>
+         <item>
+          <spacer name="horizontalSpacer_6">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
            </property>
-           <property name="maximumSize">
+           <property name="sizeHint" stdset="0">
             <size>
-             <width>100</width>
-             <height>16777215</height>
+             <width>40</width>
+             <height>20</height>
             </size>
            </property>
-           <property name="text">
-            <string>Dest. Type:</string>
-           </property>
-          </widget>
+          </spacer>
          </item>
-         <item row="0" column="5">
-          <widget class="QComboBox" name="comboBoxDestType">
+        </layout>
+       </widget>
+       <widget class="QWidget" name="">
+        <property name="geometry">
+         <rect>
+          <x>13</x>
+          <y>62</y>
+          <width>560</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout_9">
+         <item>
+          <widget class="QLabel" name="label_14">
            <property name="minimumSize">
             <size>
-             <width>100</width>
+             <width>110</width>
              <height>0</height>
             </size>
            </property>
              <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>
+           <property name="text">
+            <string>Max. Width:</string>
+           </property>
           </widget>
          </item>
-         <item row="0" column="3">
-          <widget class="QComboBox" name="comboBoxSourcePattern">
+         <item>
+          <widget class="QComboBox" name="comboBoxMaxWidth">
            <property name="minimumSize">
             <size>
-             <width>100</width>
+             <width>125</width>
              <height>0</height>
             </size>
            </property>
              <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>
-         <item row="0" column="0">
-          <widget class="QLabel" name="label_6">
+         <item>
+          <widget class="QLabel" name="label_15">
            <property name="minimumSize">
             <size>
-             <width>100</width>
+             <width>125</width>
              <height>0</height>
             </size>
            </property>
             </size>
            </property>
            <property name="text">
-            <string>Quality (%)</string>
+            <string>Max. Height:</string>
            </property>
           </widget>
          </item>
-         <item row="0" column="6">
-          <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>
-        </layout>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_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="comboBoxSourceDir">
-               <property name="editable">
-                <bool>true</bool>
-               </property>
-               <property name="currentText">
-                <string>/tmp/img</string>
-               </property>
-              </widget>
-             </item>
-             <item>
-              <widget class="QPushButton" name="pushButtonSelectSource">
-               <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>
-         </item>
-         <item>
-          <layout class="QVBoxLayout" name="verticalLayout_5">
-           <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>
-            <layout class="QHBoxLayout" name="horizontalLayout_6">
-             <item>
-              <widget class="QComboBox" name="comboBoxTargetDir">
-               <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>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_7">
-         <item>
-          <widget class="QPushButton" name="pushButtonConvert">
+          <widget class="QComboBox" name="comboBoxMaxHeight">
            <property name="minimumSize">
             <size>
-             <width>150</width>
+             <width>125</width>
              <height>0</height>
             </size>
            </property>
            <property name="maximumSize">
             <size>
-             <width>150</width>
+             <width>100</width>
              <height>16777215</height>
             </size>
            </property>
-           <property name="toolTip">
-            <string>Converts the images</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 name="editable">
+            <bool>true</bool>
            </property>
           </widget>
          </item>
          <item>
-          <spacer name="horizontalSpacer">
+          <spacer name="horizontalSpacer_5">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>
            </property>
            </property>
           </spacer>
          </item>
-         <item>
-          <widget class="QPushButton" name="pushButtonClear">
-           <property name="toolTip">
-            <string>Clears the list</string>
-           </property>
-           <property name="text">
-            <string>C&amp;lear</string>
-           </property>
-           <property name="shortcut">
-            <string notr="true">Ctrl+L</string>
+        </layout>
+       </widget>
+      </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>250</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>234</width>
+             <height>65</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>125</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>125</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>
-          <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>
+         </widget>
+        </item>
+        <item>
+         <widget class="QGroupBox" name="groupBox_2">
+          <property name="minimumSize">
+           <size>
+            <width>250</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>234</width>
+             <height>65</height>
+            </rect>
            </property>
-          </spacer>
-         </item>
-         <item>
-          <widget class="QPushButton" name="pushButtonStop">
-           <property name="enabled">
-            <bool>true</bool>
+           <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>125</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>125</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>
+         <widget class="QGroupBox" name="groupBox_3">
+          <property name="minimumSize">
+           <size>
+            <width>250</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>125</width>
+             <height>26</height>
+            </rect>
            </property>
            <property name="minimumSize">
             <size>
-             <width>150</width>
+             <width>125</width>
              <height>0</height>
             </size>
            </property>
            <property name="maximumSize">
             <size>
-             <width>150</width>
+             <width>100</width>
              <height>16777215</height>
             </size>
            </property>
-           <property name="toolTip">
-            <string>Stops the conversion</string>
+           <property name="editable">
+            <bool>true</bool>
            </property>
-           <property name="text">
-            <string>&amp;Stop</string>
+          </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="icon">
-            <iconset resource="reimgconvert.qrc">
-             <normaloff>:/main/icons/cancel.png</normaloff>:/main/icons/cancel.png</iconset>
+           <property name="text">
+            <string>Max. Width/Height:</string>
            </property>
           </widget>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <widget class="QListWidget" name="listWidget"/>
-       </item>
-      </layout>
-      <zorder>listWidget</zorder>
-      <zorder>tabWidget</zorder>
-      <zorder></zorder>
+         </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>
+       </layout>
+       <zorder>groupBox_2</zorder>
+       <zorder>groupBox_3</zorder>
+       <zorder>groupBox</zorder>
+       <zorder>horizontalSpacer_2</zorder>
+      </widget>
      </widget>
     </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_5">
+      <item>
+       <widget class="QLabel" name="label_6">
+        <property name="minimumSize">
+         <size>
+          <width>125</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>
+       <widget class="QComboBox" name="comboBoxQuality">
+        <property name="minimumSize">
+         <size>
+          <width>125</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>
+       <widget class="QLabel" name="label_10">
+        <property name="minimumSize">
+         <size>
+          <width>125</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>
+       <widget class="QComboBox" name="comboBoxSourcePattern">
+        <property name="minimumSize">
+         <size>
+          <width>125</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>
+      <item>
+       <widget class="QLabel" name="label_11">
+        <property name="minimumSize">
+         <size>
+          <width>125</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>
+       <widget class="QComboBox" name="comboBoxDestType">
+        <property name="minimumSize">
+         <size>
+          <width>125</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>
+      <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>
+     </layout>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_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="comboBoxSourceDir">
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+            <property name="currentText">
+             <string>/tmp/img</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="pushButtonSelectSource">
+            <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>
+      </item>
+      <item>
+       <layout class="QVBoxLayout" name="verticalLayout_5">
+        <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>
+         <layout class="QHBoxLayout" name="horizontalLayout_6">
+          <item>
+           <widget class="QComboBox" name="comboBoxTargetDir">
+            <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>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_8">
+      <item>
+       <widget class="QCheckBox" name="checkBoxRecursive">
+        <property name="minimumSize">
+         <size>
+          <width>125</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="toolTip">
+         <string>Process the subdirectories too</string>
+        </property>
+        <property name="text">
+         <string>Recursive</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="checkBoxCopyOtherFiles">
+        <property name="minimumSize">
+         <size>
+          <width>125</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="toolTip">
+         <string>Files not matching the file pattern will be copied too (and not ignored)</string>
+        </property>
+        <property name="text">
+         <string>Copy other files</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer_7">
+        <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>
+       <widget class="QPushButton" name="pushButtonShowOtherFiles">
+        <property name="minimumSize">
+         <size>
+          <width>150</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>Show other files</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_7">
+      <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>Converts the images</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>
+       <spacer name="horizontalSpacer">
+        <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>
+       <widget class="QPushButton" name="pushButtonClear">
+        <property name="minimumSize">
+         <size>
+          <width>150</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="toolTip">
+         <string>Clears the list</string>
+        </property>
+        <property name="text">
+         <string>C&amp;lear</string>
+        </property>
+        <property name="shortcut">
+         <string notr="true">Ctrl+L</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <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>
+       <widget class="QPushButton" name="pushButtonStop">
+        <property name="enabled">
+         <bool>true</bool>
+        </property>
+        <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>Stops the conversion</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>
+    <item>
+     <widget class="QListWidget" name="listWidget"/>
+    </item>
    </layout>
   </widget>
   <widget class="QMenuBar" name="menuBar">
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>823</width>
+     <width>958</width>
      <height>26</height>
     </rect>
    </property>