]> gitweb.hamatoma.de Git - reqt/commitdiff
refind: design, filter conditions
authorhama <hama@siduction.net>
Sat, 11 Apr 2015 00:31:48 +0000 (02:31 +0200)
committerhama <hama@siduction.net>
Sat, 11 Apr 2015 00:31:48 +0000 (02:31 +0200)
appl/refind/filefinder.cpp
appl/refind/filefinder.hpp
appl/refind/main.cpp
appl/refind/mainwindow.cpp
appl/refind/mainwindow.hpp
appl/refind/mainwindow.ui
base/ReQStringUtil.cpp

index eb3e733871c1cc21b51fa2381b33908f4195455a..91b609ea71e555b8400429930d47e5df74d8f7df 100644 (file)
@@ -20,26 +20,57 @@ FileFinder::FileFinder() :
             m_minDepth(0),
             m_maxDepth(512),
             m_baseDir(""),
-            m_checkDates(false){
+            m_checkDates(false),
+            m_countDirs(0),
+            m_countFiles(0),
+            m_bytes(0){
    m_youngerThan.setMSecsSinceEpoch(0);
    m_olderThan.setMSecsSinceEpoch(0);
 }
 
 /**
-  * Resets the data.
+ * Returns the sum of sizes of the found files.
+ * @return  the sum of the sizes
+ */
+int64_t FileFinder::bytes() const{
+   return m_bytes;
+}
+
+/**
+ * Resets the data.
  */
 void FileFinder::clear(){
-    m_lines = 0;
-    m_patterns.clear();
-    m_minSize = 0;
-    m_maxSize = -1;
-    m_youngerThan.setMSecsSinceEpoch(0);
-    m_olderThan.setMSecsSinceEpoch(0);
-    m_fileTypes = 0;
-    m_minDepth = 0;
-    m_maxDepth = 512;
-    // m_baseDir;
-    m_checkDates = false;
+   m_lines = 0;
+   m_patterns.clear();
+   m_minSize = 0;
+   m_maxSize = -1;
+   m_youngerThan.setMSecsSinceEpoch(0);
+   m_olderThan.setMSecsSinceEpoch(0);
+   m_fileTypes = 0;
+   m_minDepth = 0;
+   m_maxDepth = 512;
+   // m_baseDir;
+   m_checkDates = false;
+   m_countDirs = m_countFiles = 0;
+   m_bytes = 0;
+}
+
+/**
+ * Returns the number of the found directories.
+ *
+ * @return the number of directories in the result table
+ */
+int FileFinder::countDirs() const{
+   return m_countDirs;
+}
+
+/**
+ * Returns the number of the found files.
+ *
+ * @return the number of files in the result table
+ */
+int FileFinder::countFiles() const{
+   return m_countFiles;
 }
 
 /**
@@ -50,7 +81,22 @@ void FileFinder::clear(){
  */
 QString fileSize(int64_t size){
    QString rc;
-   rc.sprintf("%.6f MB", (double) size / 1000000.0);
+   rc.sprintf("%.6f", (double) size / 1000000.0);
+   return rc;
+}
+/**
+ * Returns the type of the file.
+ * @param info  the file info
+ * @return      a string describing the text
+ */
+QString typeOf(QFileInfo& info){
+   QString rc;
+   if (info.isDir())
+      rc = QObject::tr("dir");
+   else if (info.isSymLink())
+      rc = QObject::tr("link");
+   else
+      rc = QObject::tr("file");
    return rc;
 }
 
@@ -65,32 +111,50 @@ void FileFinder::fillTable(const QString& path, int depth, QTableWidget* table){
    QDir dir(path);
    QFileInfoList entries;
    if (m_patterns.count() == 0)
-      entries = dir.entryInfoList(m_fileTypes, QDir::NoSort);
+      entries = dir.entryInfoList(m_fileTypes | QDir::NoDotAndDotDot,
+         QDir::NoSort);
    else
       entries = dir.entryInfoList(m_patterns, m_fileTypes, QDir::NoSort);
    QList <QFileInfo>::iterator it;
    QString relativePath = path.mid(1 + m_baseDir.length());
+   QString node, ext;
    for (it = entries.begin(); it != entries.end(); ++it){
+      node = it->fileName();
+      if (node == "." || node == "..")
+         continue;
       if (depth >= m_minDepth && isValid(*it)){
          if (m_lines >= table->rowCount()){
             table->setRowCount(m_lines + 500);
          }
-         table->setItem(m_lines, TC_NODE, new QTableWidgetItem(it->fileName()));
+         bool isDir = it->isDir();
+         if (isDir)
+            m_countDirs++;
+         else
+            m_countFiles++;
+         table->setItem(m_lines, TC_NODE, new QTableWidgetItem(node));
+         int ix = node.lastIndexOf('.');
+         ext = ix <= 0 ? "" : node.mid(ix + 1).toLower();
+         table->setItem(m_lines, TC_EXT, new QTableWidgetItem(ext));
+         table->setItem(m_lines, TC_TYPE, new QTableWidgetItem(typeOf(*it)));
          table->setItem(m_lines, TC_PATH, new QTableWidgetItem(relativePath));
-         QTableWidgetItem* item = new QTableWidgetItem(it->isDir() ? "dir" : fileSize(it->size()));
+         QTableWidgetItem* item = new QTableWidgetItem(
+            isDir ? "" : fileSize(it->size()));
+         if (!isDir)
+            m_bytes += it->size();
          item->setTextAlignment(Qt::AlignRight);
-         table->setItem(m_lines, TC_SIZE,item);
+         table->setItem(m_lines, TC_SIZE, item);
          table->setItem(m_lines, TC_MODIFIED,
             new QTableWidgetItem(
-               it->lastModified().toString("yyyy.MM.dd hh:mm:ss")));
+               it->lastModified().toString("yyyy.MM.dd/hh:mm:ss")));
          m_lines++;
       }
    }
-   if (depth <= m_maxDepth){
+   if (depth < m_maxDepth){
       entries = dir.entryInfoList(
          QDir::NoSymLinks | QDir::NoDotAndDotDot | QDir::AllDirs, QDir::NoSort);
       for (it = entries.begin(); it != entries.end(); ++it){
-         fillTable(path + QDir::separator() + it->fileName(), depth + 1, table);
+         QString node = it->fileName();
+         fillTable(path + QDir::separator() + node, depth + 1, table);
       }
    }
    table->setRowCount(m_lines);
@@ -106,10 +170,11 @@ bool FileFinder::isValid(const QFileInfo& file){
    int64_t size = file.size();
    bool rc = size >= m_minSize && (m_maxSize < 0 || size <= m_maxSize);
    bool checkYounger;
-   if (rc && ((checkYounger = m_youngerThan.toMSecsSinceEpoch() > 0)
-              || m_olderThan.toMSecsSinceEpoch() > 0)){
+   if (rc
+      && ((checkYounger = m_youngerThan.toMSecsSinceEpoch() > 0)
+         || m_olderThan.toMSecsSinceEpoch() > 0)){
       QDateTime date = file.lastModified();
-      rc = ! checkYounger || date >= m_youngerThan;
+      rc = !checkYounger || date >= m_youngerThan;
       if (rc)
          rc = m_olderThan.toMSecsSinceEpoch() == 0 || date <= m_olderThan;
    }
@@ -179,7 +244,7 @@ void FileFinder::setMinSize(const int64_t& minSize){
 void FileFinder::setOlderThan(const QDateTime& olderThan){
    m_olderThan = olderThan;
    if (m_olderThan.toMSecsSinceEpoch() > 0)
-       m_checkDates = true;
+      m_checkDates = true;
 }
 
 /**
@@ -199,6 +264,6 @@ void FileFinder::setPatterns(const QStringList& patterns){
 void FileFinder::setYoungerThan(const QDateTime& youngerThan){
    m_youngerThan = youngerThan;
    if (youngerThan.toMSecsSinceEpoch() > 0)
-       m_checkDates = true;
+      m_checkDates = true;
 }
 
index 6421c12733b2dfbcb4e4fefcb836741a7412b117..20a558e91e89450f3cf9eea7a173a51a3563d892 100644 (file)
@@ -17,8 +17,11 @@ class FileFinder {
 public:
    FileFinder();
 public:
-   void fillTable(const QString& path, int depth, QTableWidget* table);
+   int64_t bytes() const;
    void clear();
+   int countFiles() const;
+   int countDirs() const;
+   void fillTable(const QString& path, int depth, QTableWidget* table);
    void setBaseDir(const QString& baseDir);
    void setFiletypes(const QDir::Filters& filetypes);
    void setMaxDepth(int maxDepth);
@@ -28,7 +31,6 @@ public:
    void setMaxSize(const int64_t& maxSize);
    void setMinSize(const int64_t& minSize);
    void setYoungerThan(const QDateTime& youngerThan);
-
 private:
    bool isValid(const QFileInfo& file);
 private:
@@ -43,6 +45,9 @@ private:
    int m_maxDepth;
    QString m_baseDir;
    bool m_checkDates;
+   int m_countFiles;
+   int m_countDirs;
+   int64_t m_bytes;
 };
 
 #endif // FILEFINDER_HPP
index 511737832e47fb59a73d3fb182e848d5252ddaeb..1feb89c25b1067ff4339708fac01f443dc7a1beb 100644 (file)
@@ -9,15 +9,13 @@
  * The latest sources: https://github.com/republib
  */
 
-
 #include "mainwindow.hpp"
 #include <QApplication>
 
-int main(int argc, char *argv[])
-{
-    QApplication a(argc, argv);
-    MainWindow w;
-    w.show();
+int main(int argc, char *argv[]){
+   QApplication a(argc, argv);
+   MainWindow w;
+   w.show();
 
-    return a.exec();
+   return a.exec();
 }
index 12f4d3c143770b5f789bee2ab3260915bfb0d924..d6ebe3c687276ab0b17042244f279dfc988fd269 100644 (file)
@@ -9,7 +9,6 @@
  * The latest sources: https://github.com/republib
  */
 
-
 #include <QDir>
 #include "base/rebase.hpp"
 #include "mainwindow.hpp"
  * @param parent    NULL or the parent widget
  */
 MainWindow::MainWindow(QWidget *parent) :
-    QMainWindow(parent),
-    ui(new Ui::MainWindow),
-    m_statusMessage(NULL),
-    m_stdLabelBackgroundRole(NULL),
-    m_errors(0)
-{
-    ui->setupUi(this);
-    m_statusMessage = new QLabel(tr("Willkommen bei refind"));
-    ui->comboBoxDirectory->setCurrentText(QDir::currentPath());
-    statusBar()->addWidget(m_statusMessage);
-    connect(ui->pushButtonSearch, SIGNAL(clicked()), this, SLOT(search()));
-    connect(ui->pushButtonUp, SIGNAL(clicked()), this, SLOT(up()));
-    ui->tableWidget->setColumnWidth(TC_NODE, 200);
-    ui->tableWidget->setColumnWidth(TC_SIZE, 125);
-    ui->tableWidget->setColumnWidth(TC_MODIFIED, 175);
-    ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
+            QMainWindow(parent),
+            ui(new Ui::MainWindow),
+            m_statusMessage(NULL),
+            m_stdLabelBackgroundRole(NULL),
+            m_errors(0){
+   ui->setupUi(this);
+   m_statusMessage = new QLabel(tr("Willkommen bei refind"));
+   ui->comboBoxDirectory->setCurrentText(QDir::currentPath());
+   statusBar()->addWidget(m_statusMessage);
+   connect(ui->pushButtonSearch, SIGNAL(clicked()), this, SLOT(search()));
+   connect(ui->pushButtonSearch2, SIGNAL(clicked()), this, SLOT(search()));
+   connect(ui->pushButtonUp, SIGNAL(clicked()), this, SLOT(up()));
+   ui->tableWidget->setColumnWidth(TC_NODE, 200);
+   ui->tableWidget->setColumnWidth(TC_EXT, 40);
+   ui->tableWidget->setColumnWidth(TC_SIZE, 125);
+   ui->tableWidget->setColumnWidth(TC_MODIFIED, 175);
+   ui->tableWidget->setColumnWidth(TC_TYPE, 50);
+   ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
 }
 
 /**
  * @brief Destructor.
  */
-MainWindow::~MainWindow()
-{
-    delete ui;
+MainWindow::~MainWindow(){
+   delete ui;
 }
 /**
  * Returns the date given as formula in a combobox.
@@ -55,23 +55,46 @@ MainWindow::~MainWindow()
  * @return the date resulting from the formula or begin of the epoch (error case)
  */
 QDateTime MainWindow::comboDate(QComboBox* combo){
-    QDateTime rc;
-    QString value = combo->currentText();
-    if (value.isEmpty())
-        rc.setMSecsSinceEpoch(0);
-    else {
-        ReDateTimeParser parser(value);
-        if (parser.isValid()){
-            rc.setMSecsSinceEpoch(QDateTime().addSecs(-parser.asInt64()).currentMSecsSinceEpoch());
-            setInHistory(combo, value);
-            combo->setCurrentText(rc.toString("yyyy.MM.dd hh:mm"));
-        } else{
-            guiError(combo, parser.errorMessage());
-            rc.setMSecsSinceEpoch(0);
-        }
-    }
-    return rc;
+   QDateTime rc;
+   QString value = combo->currentText();
+   if (value.isEmpty())
+      rc.setMSecsSinceEpoch(0);
+   else{
+      ReDateTimeParser parser(value);
+      if (parser.isValid()){
+         rc = parser.asDateTime();
+         setInHistory(combo, value);
+         combo->setCurrentText(rc.toString("yyyy.MM.dd/hh:mm"));
+      }else{
+         guiError(combo, parser.errorMessage());
+         rc.setMSecsSinceEpoch(0);
+      }
+   }
+   return rc;
+}
+/**
+ * Returns an integer given in a combobox.
+ *
+ * @param combo         the combobox with the integer
+ * @param defaultValue  the value if the combobox is empty or invalid
+ * @return              <code>defaultValue</code>: empty or invalid input<br>
+ *                      otherwise: or the size resulting from the formula
+ */
+int MainWindow::comboInt(QComboBox* combo, int defaultValue){
+   QString value = combo->currentText();
+   int rc = defaultValue;
+   if (!value.isEmpty()){
+      uint nValue = 0;
+      if (ReQStringUtil::lengthOfUInt(value, 0, 10, &nValue) == 0)
+         guiError(combo, QObject::tr("not an integer: ") + value);
+      else{
+         setInHistory(combo, value);
+         rc = (int) nValue;
+      }
+   }
+   return rc;
 }
+
 /**
  * Returns the size (in bytes) given as formula in a combobox.
  *
@@ -81,17 +104,18 @@ QDateTime MainWindow::comboDate(QComboBox* combo){
  *              otherwise: or the size resulting from the formula
  */
 int64_t MainWindow::comboSize(QComboBox* combo){
-    QString value = combo->currentText();
-    int64_t rc = -1;
-    if (! value.isEmpty()){
-        ReSizeParser parser(value);
-        int64_t rc = parser.asInt64(-1);
-        if (rc >= 0)
-            setInHistory(combo, value);
-        else
-            guiError(combo, parser.errorMessage());
-    }
-    return rc;
+   QString value = combo->currentText();
+   int64_t rc = -1;
+   if (!value.isEmpty()){
+      ReSizeParser parser(value);
+      rc = parser.asInt64(-1);
+      if (rc >= 0){
+         setInHistory(combo, value);
+         combo->setCurrentText(QString("").sprintf("%lld", rc));
+      }else
+         guiError(combo, parser.errorMessage());
+   }
+   return rc;
 }
 
 /**
@@ -101,38 +125,48 @@ int64_t MainWindow::comboSize(QComboBox* combo){
  * @param message   the error message
  */
 void MainWindow::guiError(QWidget* widget, const QString& message){
-    widget->setFocus(Qt::OtherFocusReason);
-    setStatusMessage(true, message);
-    m_errors++;
+   widget->setFocus(Qt::OtherFocusReason);
+   setStatusMessage(true, message);
+   m_errors++;
 }
 
 QString MainWindow::comboText(QComboBox* combo){
-    QString rc = combo->currentText();
-    setInHistory(combo, rc);
-    return rc;
+   QString rc = combo->currentText();
+   setInHistory(combo, rc);
+   return rc;
 }
 
-
 /**
  * Handles the "search" button.
  */
 void MainWindow::search(){
-    m_errors = 0;
-    QString path = ui->comboBoxDirectory->currentText();
-    FileFinder finder;
-    finder.setBaseDir(path);
-    finder.setMaxSize(comboSize(ui->comboBoxMaxSize));
-    finder.setMinSize(comboSize(ui->comboBoxMinSize));
-    finder.setOlderThan(comboDate(ui->comboBoxOlder));
-    finder.setYoungerThan(comboDate(ui->comboBoxYounger));
-    QStringList patterns;
-    QString value = ui->comboBoxFilePatterns->currentText();
-    if (! value.isEmpty())
-        patterns = value.split(";");
-    finder.setPatterns(patterns);
-    if (m_errors == 0)
-        finder.fillTable(path, 0, ui->tableWidget);
- }
+   m_errors = 0;
+   QString path = ui->comboBoxDirectory->currentText();
+   FileFinder finder;
+   finder.setBaseDir(path);
+   finder.setMaxSize(comboSize(ui->comboBoxMaxSize));
+   finder.setMinSize(comboSize(ui->comboBoxMinSize));
+   finder.setOlderThan(comboDate(ui->comboBoxOlder));
+   finder.setYoungerThan(comboDate(ui->comboBoxYounger));
+   finder.setMinDepth(comboInt(ui->comboBoxMinDepth, 0));
+   finder.setMaxDepth(comboInt(ui->comboBoxMaxDepth, -1));
+   QStringList patterns;
+   QString value = ui->comboBoxFilePatterns->currentText();
+   if (!value.isEmpty())
+      patterns = value.split(";");
+   finder.setPatterns(patterns);
+   if (m_errors == 0){
+      clock_t start = clock();
+      finder.fillTable(path, 0, ui->tableWidget);
+      QString msg;
+      msg.sprintf(
+         QObject::tr(
+            "Found: %d dir(s) and %d file(s) with %.6f MByte. Duration of the search: %.3f sec").toUtf8(),
+         finder.countDirs(), finder.countFiles(), finder.bytes() / 1000000.0,
+         (double) (clock() - start) / CLOCKS_PER_SEC);
+      setStatusMessage(false, msg);
+   }
+}
 
 /**
  * @brief Sets a text in a combobox uses as history.
@@ -144,22 +178,22 @@ void MainWindow::search(){
  * @param value     the text to set
  */
 void MainWindow::setInHistory(QComboBox* combo, const QString& value){
-    if (value.isEmpty()){
-        // nothing to do
-    } else if (combo->count() == 0)
-        combo->addItem(value);
-    else {
-        if (value != combo->itemText(0)){
-            combo->insertItem(0, value);
-        }
-        for (int ii = 1; ii < combo->count(); ii++){
-            if (value == combo->itemText(ii)){
-                combo->removeItem(ii);
-            }
-        }
-        if (combo->count() > 20)
-            combo->removeItem(20);
-    }
+   if (value.isEmpty()){
+      // nothing to do
+   }else if (combo->count() == 0)
+      combo->addItem(value);
+   else{
+      if (value != combo->itemText(0)){
+         combo->insertItem(0, value);
+      }
+      for (int ii = 1; ii < combo->count(); ii++){
+         if (value == combo->itemText(ii)){
+            combo->removeItem(ii);
+         }
+      }
+      if (combo->count() > 20)
+         combo->removeItem(20);
+   }
 }
 
 /**
@@ -169,21 +203,23 @@ void MainWindow::setInHistory(QComboBox* combo, const QString& value){
  * @param message   the text to set
  */
 void MainWindow::setStatusMessage(bool error, const QString& message){
-    if (m_stdLabelBackgroundRole == NULL)
-        m_stdLabelBackgroundRole = new QPalette::ColorRole(m_statusMessage->backgroundRole());
-    m_statusMessage->setBackgroundRole(error ? QPalette::HighlightedText : *m_stdLabelBackgroundRole);
-    m_statusMessage->setText(message);
+   if (m_stdLabelBackgroundRole == NULL)
+      m_stdLabelBackgroundRole = new QPalette::ColorRole(
+         m_statusMessage->backgroundRole());
+   m_statusMessage->setBackgroundRole(
+      error ? QPalette::HighlightedText : *m_stdLabelBackgroundRole);
+   m_statusMessage->setText(message);
 }
 
 /**
  * @brief Handles the "up" button: go to the parent directory.
  */
 void MainWindow::up(){
-    QString path = ui->comboBoxDirectory->currentText();
-    int ix = path.lastIndexOf(QDir::separator());
-    if (ix >= 0){
-        path = path.mid(0, ix);
-        ui->comboBoxDirectory->setEditText(path);
-        setInHistory(ui->comboBoxDirectory, path);
-    }
+   QString path = ui->comboBoxDirectory->currentText();
+   int ix = path.lastIndexOf(QDir::separator());
+   if (ix >= 0){
+      path = path.mid(0, ix);
+      ui->comboBoxDirectory->setEditText(path);
+      setInHistory(ui->comboBoxDirectory, path);
+   }
 }
index c50994419656c7793a496058cfd8fbbe55f4c691..99def87c0beb5e1d9f78fd16b9c4b490dc16ed79 100644 (file)
@@ -9,7 +9,6 @@
  * The latest sources: https://github.com/republib
  */
 
-
 #ifndef MAINWINDOW_HPP
 #define MAINWINDOW_HPP
 
 #include <QComboBox>
 #include <QLabel>
 
-
 namespace Ui {
 class MainWindow;
 }
 enum TableColumns {
-    TC_NODE, TC_SIZE, TC_MODIFIED, TC_PATH
+   TC_NODE, TC_EXT, TC_SIZE, TC_MODIFIED, TC_TYPE, TC_PATH
 };
 
-class MainWindow : public QMainWindow
-{
+class MainWindow: public QMainWindow {
 
-    Q_OBJECT
+   Q_OBJECT
 
 public:
-    explicit MainWindow(QWidget *parent = 0);
-    ~MainWindow();
+   explicit MainWindow(QWidget *parent = 0);
+   ~MainWindow();
 
 private slots:
-    void search();
-    void up();
+   void search();
+   void up();
 private:
-    QDateTime comboDate(QComboBox* combo);
-    int64_t comboSize(QComboBox* combo);
-    QString comboText(QComboBox* combo);
-    void guiError(QWidget* widget, const QString& message);
-    void setInHistory(QComboBox* combo, const QString& value);
-    void setStatusMessage(bool error, const QString& message);
+   QDateTime comboDate(QComboBox* combo);
+   int comboInt(QComboBox* combo, int defaultValue);
+   int64_t comboSize(QComboBox* combo);
+   QString comboText(QComboBox* combo);
+   void guiError(QWidget* widget, const QString& message);
+   void setInHistory(QComboBox* combo, const QString& value);
+   void setStatusMessage(bool error, const QString& message);
 private:
-    Ui::MainWindow *ui;
-    QLabel* m_statusMessage;
-    QPalette::ColorRole* m_stdLabelBackgroundRole;
-    int m_errors;
+   Ui::MainWindow *ui;
+   QLabel* m_statusMessage;
+   QPalette::ColorRole* m_stdLabelBackgroundRole;
+   int m_errors;
 };
 
 #endif // MAINWINDOW_HPP
index 0c7a9a35d0bbc918ecddfda98ff5460219efc014..0727c6bf7791c64cfa0bb9f1aebb31960ade1f76 100644 (file)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1134</width>
+    <width>888</width>
     <height>579</height>
    </rect>
   </property>
         <property name="maximumSize">
          <size>
           <width>16777215</width>
-          <height>130</height>
+          <height>150</height>
          </size>
         </property>
         <property name="currentIndex">
-         <number>0</number>
+         <number>1</number>
         </property>
         <widget class="QWidget" name="tabMain">
          <attribute name="title">
          </attribute>
          <layout class="QHBoxLayout" name="horizontalLayout_4">
           <item>
-           <layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0,0,1,0,1" columnminimumwidth="0,1,0,0,1,0,1">
-            <item row="0" column="5" colspan="2">
-             <widget class="QPushButton" name="pushButtonSearch">
-              <property name="text">
-               <string>Search</string>
-              </property>
-              <property name="shortcut">
-               <string>Ctrl+F</string>
+           <layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0,0,0,0">
+            <item row="0" column="0">
+             <widget class="QLabel" name="label">
+              <property name="maximumSize">
+               <size>
+                <width>100</width>
+                <height>16777215</height>
+               </size>
               </property>
-             </widget>
-            </item>
-            <item row="0" column="1" colspan="3">
-             <widget class="QComboBox" name="comboBoxDirectory">
-              <property name="editable">
-               <bool>true</bool>
+              <property name="text">
+               <string>Directory:</string>
               </property>
              </widget>
             </item>
-            <item row="0" column="4">
-             <layout class="QHBoxLayout" name="horizontalLayout_3">
+            <item row="2" column="5" colspan="2">
+             <layout class="QHBoxLayout" name="horizontalLayout">
               <item>
-               <widget class="QPushButton" name="pushButtonUp">
+               <widget class="QCheckBox" name="checkBox">
+                <property name="minimumSize">
+                 <size>
+                  <width>75</width>
+                  <height>0</height>
+                 </size>
+                </property>
                 <property name="maximumSize">
                  <size>
-                  <width>50</width>
+                  <width>100</width>
                   <height>16777215</height>
                  </size>
                 </property>
                 <property name="text">
-                 <string>Up</string>
+                 <string>Dirs</string>
+                </property>
+                <property name="checked">
+                 <bool>true</bool>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="QPushButton" name="pushButtonDirectory">
+               <widget class="QCheckBox" name="checkBox_4">
+                <property name="minimumSize">
+                 <size>
+                  <width>75</width>
+                  <height>0</height>
+                 </size>
+                </property>
                 <property name="maximumSize">
                  <size>
-                  <width>50</width>
+                  <width>100</width>
                   <height>16777215</height>
                  </size>
                 </property>
                 <property name="text">
-                 <string>...</string>
+                 <string>Links</string>
+                </property>
+                <property name="checked">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QCheckBox" name="checkBox_3">
+                <property name="minimumSize">
+                 <size>
+                  <width>75</width>
+                  <height>0</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>100</width>
+                  <height>16777215</height>
+                 </size>
+                </property>
+                <property name="text">
+                 <string>Hidden</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QCheckBox" name="checkBox_5">
+                <property name="minimumSize">
+                 <size>
+                  <width>75</width>
+                  <height>0</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>100</width>
+                  <height>16777215</height>
+                 </size>
+                </property>
+                <property name="text">
+                 <string>Specials</string>
                 </property>
                </widget>
               </item>
+              <item>
+               <spacer name="horizontalSpacer_2">
+                <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 row="0" column="0">
-             <widget class="QLabel" name="label">
-              <property name="maximumSize">
-               <size>
-                <width>200</width>
-                <height>16777215</height>
-               </size>
-              </property>
-              <property name="text">
-               <string>Directory:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="2" column="1">
+            <item row="3" column="1">
              <widget class="QComboBox" name="comboBoxTextPattern">
               <property name="minimumSize">
                <size>
-                <width>300</width>
+                <width>275</width>
                 <height>0</height>
                </size>
               </property>
               </property>
              </widget>
             </item>
-            <item row="1" column="0">
-             <widget class="QLabel" name="label_2">
+            <item row="3" column="0">
+             <widget class="QLabel" name="label_3">
               <property name="maximumSize">
                <size>
                 <width>200</width>
                </size>
               </property>
               <property name="text">
-               <string>File Patterns:</string>
+               <string>Text Pattern:</string>
               </property>
              </widget>
             </item>
-            <item row="2" column="2">
-             <widget class="QCheckBox" name="checkBoxTextIgnoreCase">
-              <property name="text">
-               <string>ignore case</string>
-              </property>
-             </widget>
+            <item row="1" column="5">
+             <layout class="QVBoxLayout" name="verticalLayout_4"/>
             </item>
             <item row="2" column="0">
-             <widget class="QLabel" name="label_3">
+             <widget class="QLabel" name="label_2">
               <property name="maximumSize">
                <size>
                 <width>200</width>
                </size>
               </property>
               <property name="text">
-               <string>Text Pattern:</string>
+               <string>File Patterns:</string>
               </property>
              </widget>
             </item>
-            <item row="1" column="1">
+            <item row="2" column="1">
              <widget class="QComboBox" name="comboBoxFilePatterns">
               <property name="editable">
                <bool>true</bool>
               </property>
              </widget>
             </item>
-            <item row="1" column="4">
-             <widget class="QLabel" name="label_10">
-              <property name="text">
-               <string>Exclude Patterns:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="6">
-             <widget class="QComboBox" name="comboBoxExcludes">
-              <property name="editable">
-               <bool>true</bool>
-              </property>
-             </widget>
-            </item>
-            <item row="2" column="4" colspan="3">
-             <layout class="QHBoxLayout" name="horizontalLayout">
+            <item row="3" column="5" colspan="2">
+             <layout class="QHBoxLayout" name="horizontalLayout_5">
               <item>
-               <widget class="QCheckBox" name="checkBox">
+               <widget class="QCheckBox" name="checkBoxRegExpr">
+                <property name="minimumSize">
+                 <size>
+                  <width>157</width>
+                  <height>0</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>200</width>
+                  <height>16777215</height>
+                 </size>
+                </property>
                 <property name="text">
-                 <string>Dirs</string>
+                 <string>Regular expr.</string>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="QCheckBox" name="checkBox_2">
+               <widget class="QCheckBox" name="checkBoxBinaryFiles">
+                <property name="minimumSize">
+                 <size>
+                  <width>150</width>
+                  <height>0</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>200</width>
+                  <height>16777215</height>
+                 </size>
+                </property>
                 <property name="text">
-                 <string>Files</string>
+                 <string>Binary files</string>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="QCheckBox" name="checkBox_4">
-                <property name="text">
-                 <string>Links</string>
+               <spacer name="horizontalSpacer_3">
+                <property name="orientation">
+                 <enum>Qt::Horizontal</enum>
                 </property>
-               </widget>
+                <property name="sizeHint" stdset="0">
+                 <size>
+                  <width>40</width>
+                  <height>20</height>
+                 </size>
+                </property>
+               </spacer>
               </item>
+             </layout>
+            </item>
+            <item row="0" column="6">
+             <widget class="QPushButton" name="pushButtonSearch">
+              <property name="text">
+               <string>Search</string>
+              </property>
+              <property name="shortcut">
+               <string>Ctrl+F</string>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="5">
+             <layout class="QHBoxLayout" name="horizontalLayout_3">
               <item>
-               <widget class="QCheckBox" name="checkBox_3">
+               <widget class="QPushButton" name="pushButtonUp">
+                <property name="minimumSize">
+                 <size>
+                  <width>50</width>
+                  <height>0</height>
+                 </size>
+                </property>
+                <property name="maximumSize">
+                 <size>
+                  <width>75</width>
+                  <height>16777215</height>
+                 </size>
+                </property>
                 <property name="text">
-                 <string>Hidden</string>
+                 <string>Up</string>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="QCheckBox" name="checkBox_5">
+               <widget class="QPushButton" name="pushButtonDirectory">
+                <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>Specials</string>
+                 <string>...</string>
                 </property>
                </widget>
               </item>
              </layout>
             </item>
+            <item row="0" column="1" colspan="2">
+             <widget class="QComboBox" name="comboBoxDirectory">
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="3" column="2">
+             <widget class="QCheckBox" name="checkBoxTextIgnoreCase">
+              <property name="maximumSize">
+               <size>
+                <width>125</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>ignore case</string>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="2">
+             <widget class="QCheckBox" name="checkBox_2">
+              <property name="text">
+               <string>Files</string>
+              </property>
+              <property name="checked">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
            </layout>
           </item>
          </layout>
         </widget>
         <widget class="QWidget" name="tab_2">
          <attribute name="title">
-          <string>Size, Date, Depth</string>
+          <string>Size, Date, Depth, Excluded Dirs</string>
          </attribute>
          <widget class="QWidget" name="">
           <property name="geometry">
            <rect>
-            <x>0</x>
+            <x>10</x>
             <y>0</y>
-            <width>412</width>
-            <height>94</height>
+            <width>812</width>
+            <height>113</height>
            </rect>
           </property>
           <layout class="QGridLayout" name="gridLayout_2">
-           <item row="0" column="2">
-            <widget class="QLabel" name="label_5">
+           <property name="topMargin">
+            <number>10</number>
+           </property>
+           <property name="bottomMargin">
+            <number>10</number>
+           </property>
+           <item row="0" column="0">
+            <widget class="QLabel" name="label_4">
              <property name="maximumSize">
               <size>
                <width>150</width>
               </size>
              </property>
              <property name="text">
-              <string>Max Size</string>
+              <string>Min. Size:</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="3">
-            <widget class="QComboBox" name="comboBoxMaxSize">
+           <item row="0" column="1">
+            <widget class="QComboBox" name="comboBoxMinSize">
+             <property name="minimumSize">
+              <size>
+               <width>175</width>
+               <height>0</height>
+              </size>
+             </property>
              <property name="maximumSize">
               <size>
                <width>200</width>
              </property>
             </widget>
            </item>
-           <item row="0" column="0">
-            <widget class="QLabel" name="label_4">
+           <item row="0" column="2">
+            <widget class="QLabel" name="label_6">
              <property name="maximumSize">
               <size>
-               <width>150</width>
+               <width>200</width>
                <height>16777215</height>
               </size>
              </property>
              <property name="text">
-              <string>Min. Size:</string>
+              <string>Younger than:</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="3">
-            <widget class="QComboBox" name="comboBoxOlder">
-             <property name="maximumSize">
+           <item row="0" column="3">
+            <widget class="QComboBox" name="comboBoxYounger">
+             <property name="minimumSize">
               <size>
                <width>200</width>
+               <height>0</height>
+              </size>
+             </property>
+             <property name="maximumSize">
+              <size>
+               <width>16777215</width>
                <height>16777215</height>
               </size>
              </property>
              </property>
             </widget>
            </item>
-           <item row="1" column="2">
-            <widget class="QLabel" name="label_7">
+           <item row="0" column="4">
+            <widget class="QLabel" name="label_11">
+             <property name="text">
+              <string>Min. Depth:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="5">
+            <widget class="QComboBox" name="comboBoxMinDepth">
+             <property name="editable">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0">
+            <widget class="QLabel" name="label_5">
              <property name="maximumSize">
               <size>
-               <width>200</width>
+               <width>150</width>
                <height>16777215</height>
               </size>
              </property>
              <property name="text">
-              <string>Older than:</string>
+              <string>Max Size:</string>
              </property>
             </widget>
            </item>
-           <item row="0" column="1">
-            <widget class="QComboBox" name="comboBoxMinSize">
+           <item row="1" column="1">
+            <widget class="QComboBox" name="comboBoxMaxSize">
+             <property name="minimumSize">
+              <size>
+               <width>175</width>
+               <height>0</height>
+              </size>
+             </property>
              <property name="maximumSize">
               <size>
                <width>200</width>
              </property>
             </widget>
            </item>
-           <item row="1" column="1">
-            <widget class="QComboBox" name="comboBoxYounger">
+           <item row="1" column="2">
+            <widget class="QLabel" name="label_7">
              <property name="maximumSize">
               <size>
                <width>200</width>
                <height>16777215</height>
               </size>
              </property>
-             <property name="editable">
-              <bool>true</bool>
+             <property name="text">
+              <string>Older than:</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="0">
-            <widget class="QLabel" name="label_6">
+           <item row="1" column="3">
+            <widget class="QComboBox" name="comboBoxOlder">
              <property name="maximumSize">
               <size>
                <width>200</width>
                <height>16777215</height>
               </size>
              </property>
-             <property name="text">
-              <string>Younger than:</string>
+             <property name="editable">
+              <bool>true</bool>
              </property>
             </widget>
            </item>
-           <item row="2" column="0">
-            <widget class="QLabel" name="label_11">
+           <item row="1" column="4">
+            <widget class="QLabel" name="label_12">
              <property name="text">
-              <string>Min. Depth</string>
+              <string>Max. Depth:</string>
              </property>
             </widget>
            </item>
-           <item row="2" column="1">
-            <widget class="QComboBox" name="comboBoxMinDepth">
+           <item row="1" column="5">
+            <widget class="QComboBox" name="comboBoxMaxDepth">
              <property name="editable">
               <bool>true</bool>
              </property>
             </widget>
            </item>
-           <item row="2" column="2">
-            <widget class="QLabel" name="label_12">
+           <item row="2" column="0">
+            <widget class="QLabel" name="label_13">
              <property name="text">
-              <string>Max. Depth</string>
+              <string>Excluded Dirs:</string>
              </property>
             </widget>
            </item>
-           <item row="2" column="3">
-            <widget class="QComboBox" name="comboBoxMaxDepth">
+           <item row="2" column="1" colspan="3">
+            <widget class="QComboBox" name="comboBoxExcludedDirs">
              <property name="editable">
               <bool>true</bool>
              </property>
             </widget>
            </item>
+           <item row="2" column="4" colspan="2">
+            <widget class="QPushButton" name="pushButtonSearch2">
+             <property name="text">
+              <string>Search</string>
+             </property>
+            </widget>
+           </item>
           </layout>
          </widget>
         </widget>
         </column>
         <column>
          <property name="text">
-          <string>Size</string>
+          <string>Ext</string>
+         </property>
+        </column>
+        <column>
+         <property name="text">
+          <string>Size (MByte)</string>
          </property>
          <property name="textAlignment">
           <set>AlignRight|AlignVCenter</set>
           <string>Modified</string>
          </property>
         </column>
+        <column>
+         <property name="text">
+          <string>Type</string>
+         </property>
+        </column>
         <column>
          <property name="text">
           <string>Path</string>
        </widget>
       </item>
       <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_2">
-        <item>
-         <widget class="QLabel" name="label_8">
-          <property name="text">
-           <string>Files:</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QLineEdit" name="lineEditCountFiles">
-          <property name="maximumSize">
-           <size>
-            <width>100</width>
-            <height>16777215</height>
-           </size>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QLabel" name="label_9">
-          <property name="text">
-           <string>Size:</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QLineEdit" name="lineEditSize">
-          <property name="maximumSize">
-           <size>
-            <width>100</width>
-            <height>16777215</height>
-           </size>
-          </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>
-       </layout>
+       <layout class="QHBoxLayout" name="horizontalLayout_2"/>
       </item>
      </layout>
     </item>
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>1134</width>
+     <width>888</width>
      <height>23</height>
     </rect>
    </property>
   </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
+ <tabstops>
+  <tabstop>tabWidget</tabstop>
+  <tabstop>comboBoxDirectory</tabstop>
+  <tabstop>pushButtonUp</tabstop>
+  <tabstop>pushButtonDirectory</tabstop>
+  <tabstop>comboBoxFilePatterns</tabstop>
+  <tabstop>checkBox_2</tabstop>
+  <tabstop>checkBox</tabstop>
+  <tabstop>checkBox_4</tabstop>
+  <tabstop>checkBox_3</tabstop>
+  <tabstop>checkBox_5</tabstop>
+  <tabstop>comboBoxTextPattern</tabstop>
+  <tabstop>checkBoxTextIgnoreCase</tabstop>
+  <tabstop>checkBoxRegExpr</tabstop>
+  <tabstop>checkBoxBinaryFiles</tabstop>
+  <tabstop>pushButtonSearch</tabstop>
+  <tabstop>tableWidget</tabstop>
+  <tabstop>comboBoxMinSize</tabstop>
+  <tabstop>comboBoxMaxSize</tabstop>
+  <tabstop>comboBoxYounger</tabstop>
+  <tabstop>comboBoxOlder</tabstop>
+  <tabstop>comboBoxMinDepth</tabstop>
+  <tabstop>comboBoxMaxDepth</tabstop>
+  <tabstop>comboBoxExcludedDirs</tabstop>
+ </tabstops>
  <resources/>
  <connections>
   <connection>
index 2f85a64de6656b2d3c2fdc34823624a1c4f41b27..70825238b9d17fd6dd6b3991e031c92c4694694b 100644 (file)
@@ -103,15 +103,15 @@ int ReQStringUtil::lengthOfUInt(const ReString& text, int start, int radix,
  *                  otherwise: the length is incremented
  */
 void ReQStringUtil::skipExpected(const ReString& text, QChar expected,
-    int& index, int& length){
-    if (length == 0){
-        // error state, do nothing
-    } else if (index >= text.length() || text[index] != expected){
-        length = 0;
-    } else {
-        index++;
-        length++;
-    }
+   int& index, int& length){
+   if (length == 0){
+      // error state, do nothing
+   }else if (index >= text.length() || text[index] != expected){
+      length = 0;
+   }else{
+      index++;
+      length++;
+   }
 }
 
 /**
@@ -126,59 +126,59 @@ void ReQStringUtil::skipExpected(const ReString& text, QChar expected,
  * @return      0: no date found<br>
  *              otherwise: the length of the date in the string
  */
-int ReQStringUtil::lengthOfDate(const ReString& text, int start, QDate* value)
-{
-    uint day = 0;
-    uint month = 0;
-    uint year = 0;
-    int length = lengthOfUInt(text, start, 10, &year);
-    switch(length){
-    case 1:
-    case 2:
-        day = year;
-        year = 0;
-        break;
-    case 4:
-        break;
-    default:
-        length = 0;
-        break;
-    }
-    int length2;
-    start += length;
-    skipExpected(text, '.', start, length);
-    if (length > 0){
-        length2 = lengthOfUInt(text, start, 10, &month);
-        if (length2 < 1 || length2 > 2)
-            length = 0;
-        else {
-            start += length2;
-            length += length2;
-        }
-    }
-    skipExpected(text, '.', start, length);
-    if (year > 0){
-        length2 = lengthOfUInt(text, start, 10, &day);
-        if (length2 < 1 || length2 > 2)
-            length = 0;
-        else {
-            start += length2;
-            length += length2;
-        }
-    } else{
-        length2 = lengthOfUInt(text, start, 10, &year);
-        if (length2 != 4)
-            length = 0;
-        else {
-            start += length2;
-            length += length2;
-        }
-    }
-    if (day < 1 || day > 31 || month < 1 || month > 12 || year < 1970 || year > 2100)
-        length = 0;
-    if (length != 0 && value != NULL)
-        *value = QDate(year, month, day);
-    return length;
+int ReQStringUtil::lengthOfDate(const ReString& text, int start, QDate* value){
+   uint day = 0;
+   uint month = 0;
+   uint year = 0;
+   int length = lengthOfUInt(text, start, 10, &year);
+   switch (length) {
+   case 1:
+   case 2:
+      day = year;
+      year = 0;
+      break;
+   case 4:
+      break;
+   default:
+      length = 0;
+      break;
+   }
+   int length2;
+   start += length;
+   skipExpected(text, '.', start, length);
+   if (length > 0){
+      length2 = lengthOfUInt(text, start, 10, &month);
+      if (length2 < 1 || length2 > 2)
+         length = 0;
+      else{
+         start += length2;
+         length += length2;
+      }
+   }
+   skipExpected(text, '.', start, length);
+   if (year > 0){
+      length2 = lengthOfUInt(text, start, 10, &day);
+      if (length2 < 1 || length2 > 2)
+         length = 0;
+      else{
+         start += length2;
+         length += length2;
+      }
+   }else{
+      length2 = lengthOfUInt(text, start, 10, &year);
+      if (length2 != 4)
+         length = 0;
+      else{
+         start += length2;
+         length += length2;
+      }
+   }
+   if (day < 1 || day > 31 || month < 1 || month > 12 || year < 1970
+      || year > 2100)
+      length = 0;
+   if (length != 0 && value != NULL)
+      *value = QDate(year, month, day);
+   return length;
 }
 
 /**
@@ -196,35 +196,34 @@ int ReQStringUtil::lengthOfDate(const ReString& text, int start, QDate* value)
  *                      otherwise: the length of the date in the string
  */
 int ReQStringUtil::lengthOfDateTime(const ReString& text, int start,
-    bool allowDateOnly, bool allowTimeOnly, QDateTime* value)
-{
-    QDate date;
-    QTime time;
-    int length = lengthOfDate(text, start, &date);
-    if (length == 0){
-        if (allowTimeOnly){
-            date = QDate::currentDate();
-            length = lengthOfTime(text, start, &time);
-        }
-    } else {
-        if (start + length + 1 + 3 <= text.length()) {
-            start += length;
-            int length2 = 0;
-            if (! text[start].isDigit()){
-                QTime time2;
-                length2 = lengthOfTime(text, start + 1, &time2);
-                if (length2 == 0 && ! allowDateOnly)
-                    length = 0;
-                else if (length2 > 0){
-                    length += 1 + length2;
-                    time = time2;
-                }
+   bool allowDateOnly, bool allowTimeOnly, QDateTime* value){
+   QDate date;
+   QTime time;
+   int length = lengthOfDate(text, start, &date);
+   if (length == 0){
+      if (allowTimeOnly){
+         date = QDate::currentDate();
+         length = lengthOfTime(text, start, &time);
+      }
+   }else{
+      if (start + length + 1 + 3 <= text.length()){
+         start += length;
+         int length2 = 0;
+         if (!text[start].isDigit()){
+            QTime time2;
+            length2 = lengthOfTime(text, start + 1, &time2);
+            if (length2 == 0 && !allowDateOnly)
+               length = 0;
+            else if (length2 > 0){
+               length += 1 + length2;
+               time = time2;
             }
-        }
-    }
-    if (length > 0 && value != NULL)
-        *value = QDateTime(date, time);
-    return length;
+         }
+      }
+   }
+   if (length > 0 && value != NULL)
+      *value = QDateTime(date, time);
+   return length;
 }
 /**
  * Returns the length of a time in a string.
@@ -238,38 +237,37 @@ int ReQStringUtil::lengthOfDateTime(const ReString& text, int start,
  * @return  0: no date found<br>
  *          otherwise: the length of the date in the string
  */
-int ReQStringUtil::lengthOfTime(const ReString& text, int start, QTime* value)
-{
-    uint hour = 0;
-    uint minute = 0;
-    uint sec = 0;
-    int length = lengthOfUInt(text, start, 10, &hour);
-    if (length > 0 && hour > 23)
-        length = 0;
-    if (length > 0){
-        start += length;
-    }
-    int length2;
-    skipExpected(text, ':', start, length);
-    if (length > 0){
-        length2 = lengthOfUInt(text, start, 10, &minute);
-        if (length2 < 1 || length2 > 2 || minute >= 60)
-            length = 0;
-        else
-            start += length2, length += length2;
-    }
-    if (length > 0 && start < text.length() && text[start] == ':'){
-        length++;
-        start++;
-        length2 = lengthOfUInt(text, start, 10, &sec);
-        if (length2 < 1 || length2 > 2 || sec >= 60)
-            length = 0;
-        else
-            start += length2, length += length2;
-    }
-    if (length != 0 && value != NULL)
-        *value = QTime(hour, minute, sec);
-    return length;
+int ReQStringUtil::lengthOfTime(const ReString& text, int start, QTime* value){
+   uint hour = 0;
+   uint minute = 0;
+   uint sec = 0;
+   int length = lengthOfUInt(text, start, 10, &hour);
+   if (length > 0 && hour > 23)
+      length = 0;
+   if (length > 0){
+      start += length;
+   }
+   int length2;
+   skipExpected(text, ':', start, length);
+   if (length > 0){
+      length2 = lengthOfUInt(text, start, 10, &minute);
+      if (length2 < 1 || length2 > 2 || minute >= 60)
+         length = 0;
+      else
+         start += length2, length += length2;
+   }
+   if (length > 0 && start < text.length() && text[start] == ':'){
+      length++;
+      start++;
+      length2 = lengthOfUInt(text, start, 10, &sec);
+      if (length2 < 1 || length2 > 2 || sec >= 60)
+         length = 0;
+      else
+         start += length2, length += length2;
+   }
+   if (length != 0 && value != NULL)
+      *value = QTime(hour, minute, sec);
+   return length;
 }
 
 /**
@@ -362,11 +360,10 @@ char*ReQStringUtil::utf8(const ReString& source, char buffer[],
    return buffer;
 }
 
-class ReParserException : public ReException {
+class ReParserException: public ReException {
 public:
    ReParserException(const QString& message) :
-      ReException(),
-      m_message(message){
+            ReException(), m_message(message){
    }
 public:
    QString m_message;
@@ -378,11 +375,12 @@ public:
  * @param unitList   description of the allowed units with its factor<br>
  *                   example: "kibyte:1024;kbyte:1000;mibyte:1048576;mbyte:1000000"
  */
-ReUnitParser::ReUnitParser(const QString& expr, const char* unitList, bool parseAtOnce) :
+ReUnitParser::ReUnitParser(const QString& expr, const char* unitList,
+   bool parseAtOnce) :
          m_result(0), m_expr(expr), m_message(), m_unitList(unitList){
-    normalize();
-    if (parseAtOnce)
-        parse();
+   normalize();
+   if (parseAtOnce)
+      parse();
 }
 
 /**
@@ -439,18 +437,18 @@ bool ReUnitParser::isValid() const{
  * @brief Normalizes the internal stored unit expression.
  */
 void ReUnitParser::normalize(){
-    // Remove the blanks:
-    for (int ii = m_expr.length() - 1; ii >= 0; ii--){
-        if (m_expr[ii].isSpace())
-            m_expr.remove(ii, 1);
-    }
-    // Replace the '-' operator by '+' as operator and '-' as sign:
-    // This makes the syntax easier to parse: only one sum operator ('+').
-    for (int ii = m_expr.length() - 1; ii > 0; ii--){
-        if (m_expr[ii] == '-' && m_expr[ii -1] != '+' && m_expr[ii - 1] != '*'){
-            m_expr.insert(ii, '+');
-        }
-    }
+   // Remove the blanks:
+   for (int ii = m_expr.length() - 1; ii >= 0; ii--){
+      if (m_expr[ii].isSpace())
+         m_expr.remove(ii, 1);
+   }
+   // Replace the '-' operator by '+' as operator and '-' as sign:
+   // This makes the syntax easier to parse: only one sum operator ('+').
+   for (int ii = m_expr.length() - 1; ii > 0; ii--){
+      if (m_expr[ii] == '-' && m_expr[ii - 1] != '+' && m_expr[ii - 1] != '*'){
+         m_expr.insert(ii, '+');
+      }
+   }
 }
 
 /**
@@ -468,7 +466,8 @@ void ReUnitParser::parse(){
          for (it2 = factors.begin(); it2 != factors.end(); ++it2){
             QStringList powerOperands = it2->split("^");
             if (powerOperands.count() > 2)
-               throw ReParserException(QObject::tr("more than 2 power operators, e.g. '2^3^4'"));
+               throw ReParserException(
+                  QObject::tr("more than 2 power operators, e.g. '2^3^4'"));
             QStringList::const_iterator it3 = powerOperands.begin();
             QString op = *it3;
             bool isNeg = op.startsWith("-");
@@ -479,7 +478,8 @@ void ReUnitParser::parse(){
                uint64_t fac = value;
                uint64_t exponent = valueOf(*++it3);
                if (qLn(value) * qLn(exponent) >= qLn(qPow(2.0, 64)))
-                  throw ReParserException(QObject::tr("number overflow while power operation"));
+                  throw ReParserException(
+                     QObject::tr("number overflow while power operation"));
                for (int ii = 1; ii < (int) exponent; ii++)
                   value = value * fac;
             }
@@ -510,30 +510,35 @@ uint64_t ReUnitParser::valueOf(const QString& value) const{
    if (ix == 0)
       throw ReParserException(QObject::tr("number expected: ") + value);
    QString unit = value.mid(ix);
-   if (! unit.isEmpty()){
+   if (!unit.isEmpty()){
       QStringList units = QString(m_unitList).split(";");
       QStringList::const_iterator it;
       bool found = false;
       for (it = units.begin(); it != units.end(); ++it){
          QStringList pair = it->split(":");
          if (pair.count() == 0)
-            throw ReParserException(QObject::tr("missing ':' in unit definition, e.g. 'k:1000': ") + *it);
+            throw ReParserException(
+               QObject::tr("missing ':' in unit definition, e.g. 'k:1000': ")
+                  + *it);
          if (pair.count() > 2)
-            throw ReParserException(QObject::tr("too many  ':' in unit definition: ") + *it);
+            throw ReParserException(
+               QObject::tr("too many  ':' in unit definition: ") + *it);
          bool ok = false;
          QString unit2 = *pair.begin();
          QString factor = *++pair.begin();
          uint64_t nFactor = factor.toLongLong(&ok);
-         if (! ok)
+         if (!ok)
             throw ReParserException(QObject::tr("not a number: ") + factor);
-         if (unit2.startsWith(unit)){
+         if (unit2.startsWith(unit, Qt::CaseInsensitive)){
             rc *= nFactor;
             found = true;
             break;
          }
       }
-      if (! found)
-         throw ReParserException(QObject::tr("unknown unit, allowed: ") + QString(m_unitList));
+      if (!found)
+         throw ReParserException(
+            QObject::tr("unknown unit '$1'. Allowed: ").arg(unit)
+               + QString(m_unitList));
    }
    return rc;
 }
@@ -544,10 +549,10 @@ uint64_t ReUnitParser::valueOf(const QString& value) const{
  * @param expr       an expression, e.g. "10*1024kByte+5MiByte"
  */
 ReSizeParser::ReSizeParser(const QString& expr) :
-    ReUnitParser(expr, "byte:1;kbyte:1000;kibyte:1024;"
-             "mbyte:1000000;mibyte:1048576;"
-             "gbyte:1000000000;gibyte:1073741824;"
-                   "tbyte:1000000000000;tibyte:1099511627776"){
+         ReUnitParser(expr, "byte:1;kbyte:1000;kibyte:1024;"
+            "mbyte:1000000;mibyte:1048576;"
+            "gbyte:1000000000;gibyte:1073741824;"
+            "tbyte:1000000000000;tibyte:1099511627776"){
 }
 /**
  * Constructor.
@@ -555,8 +560,9 @@ ReSizeParser::ReSizeParser(const QString& expr) :
  * @param expr     an expression, e.g. "3*3days-5min+3weeks"
  */
 ReDateTimeParser::ReDateTimeParser(const QString& expr) :
-    ReUnitParser("", "minutes:60;hours:3600;days:86400;weeks:604800", false){
-    parseDateTime(expr);
+            ReUnitParser("", "minutes:60;hours:3600;days:86400;weeks:604800",
+               false){
+   parseDateTime(expr);
 }
 
 /**
@@ -564,9 +570,8 @@ ReDateTimeParser::ReDateTimeParser(const QString& expr) :
  *
  * @return the parse result. If invalid input the result is the begin of the epoche
  */
-QDateTime ReDateTimeParser::asDateTime() const
-{
-    return m_dateTime;
+QDateTime ReDateTimeParser::asDateTime() const{
+   return m_dateTime;
 }
 
 /**
@@ -579,40 +584,41 @@ QDateTime ReDateTimeParser::asDateTime() const
  *              othewise: the calculated date/time
  */
 QDateTime ReDateTimeParser::parseDateTime(const QString& expr){
-    m_expr = expr;
-    normalize();
-    QDateTime rc = QDateTime::currentDateTime();
-    int64_t relativeSeconds = 0;
-    if (m_expr.isEmpty())
-        m_message = QObject::tr("empty string is not a date/time");
-    else {
-        QDateTime dateTime;
-        int length2 = 0;
-        bool checkSum = true;
-        if (m_expr.startsWith("now", Qt::CaseInsensitive)){
-            m_expr.remove(0, 3);
-        } else if ( (length2 = ReQStringUtil::lengthOfDateTime(m_expr, 0, true,
-                 true, &dateTime)) > 0){
-            rc = dateTime;
-            m_expr.remove(0, length2);
-        } else {
-            checkSum = false;
+   m_expr = expr;
+   normalize();
+   QDateTime rc = QDateTime::currentDateTime();
+   int64_t relativeSeconds = 0;
+   if (m_expr.isEmpty())
+      m_message = QObject::tr("empty string is not a date/time");
+   else{
+      QDateTime dateTime;
+      int length2 = 0;
+      bool checkSum = true;
+      if (m_expr.startsWith("now", Qt::CaseInsensitive)){
+         m_expr.remove(0, 3);
+      }else if ((length2 = ReQStringUtil::lengthOfDateTime(m_expr, 0, true,
+         true, &dateTime)) > 0){
+         rc = dateTime;
+         m_expr.remove(0, length2);
+      }else{
+         checkSum = false;
+         parse();
+         // meaning is "older than x seconds"
+         relativeSeconds = m_result = -m_result;
+      }
+      if (checkSum){
+         if (m_expr.startsWith("+")){
+            m_expr.remove(0, 1);
+         }
+         if (!m_expr.isEmpty()){
             parse();
-            // meaning is "older than x seconds"
-            relativeSeconds = m_result = - m_result;
-        }
-        if (checkSum){
-            if (m_expr.startsWith("+")){
-                m_expr.remove(0, 1);
-            }
-            if (! m_expr.isEmpty()){
-                parse();
-                relativeSeconds = m_result;
-            }
-        }
-    }
-    rc.setMSecsSinceEpoch(isValid() ? rc.toMSecsSinceEpoch() + 1000 * relativeSeconds : 0);
-    m_dateTime = rc;
-    return rc;
+            relativeSeconds = m_result;
+         }
+      }
+   }
+   rc.setMSecsSinceEpoch(
+      isValid() ? rc.toMSecsSinceEpoch() + 1000 * relativeSeconds : 0);
+   m_dateTime = rc;
+   return rc;
 }