]> gitweb.hamatoma.de Git - reqt/commitdiff
+ ReFileSearch, ReComboBox works, + appl/research
authorHamatoma <hamatoma@gmx.de>
Sun, 20 Nov 2016 23:13:15 +0000 (00:13 +0100)
committerHamatoma <hamatoma@gmx.de>
Sun, 20 Nov 2016 23:13:15 +0000 (00:13 +0100)
43 files changed:
appl/rebackgui/BackupEngine.cpp
appl/rebackgui/BackupEngine.hpp
appl/rebackgui/Configuration.cpp
appl/rebackgui/mainwindow.cpp
appl/rebackgui/mainwindow.hpp
appl/recommand/CommandProcessor.cpp
appl/recommand/CommandProcessor.hpp
appl/recommand/cuCommandProcessor.cpp [new file with mode: 0644]
appl/recommand/main.cpp
appl/recommand/recommand.pro
appl/reide/SearchEngine.cpp [new file with mode: 0644]
appl/reide/SearchEngine.hpp [new file with mode: 0644]
appl/reide/filesearch.ui
appl/reide/mainwindow.cpp
appl/reide/mainwindow.ui
appl/reide/reide.pro
appl/reide/workspace.cpp
appl/reprime/reprime.pro
appl/research/aboutdialog.cpp [new file with mode: 0644]
appl/research/aboutdialog.hpp [new file with mode: 0644]
appl/research/aboutdialog.ui [new file with mode: 0644]
appl/research/main.cpp [new file with mode: 0644]
appl/research/mainwindow.cpp [new file with mode: 0644]
appl/research/mainwindow.hpp [new file with mode: 0644]
appl/research/mainwindow.ui [new file with mode: 0644]
appl/research/research.hpp [new file with mode: 0644]
appl/research/research.pro [new file with mode: 0644]
base/ReFile.cpp
base/ReFileSearch.cpp [new file with mode: 0644]
base/ReFileSearch.hpp [new file with mode: 0644]
base/ReFileUtils.cpp
base/ReFileUtils.hpp
base/ReRandomizer.cpp
base/rebase.hpp
base/retrace.hpp
cunit/allTests.cpp
cunit/cuReFileSearch.cpp [new file with mode: 0644]
cunit/cunit.pro
gui/ReComboBox.cpp
gui/ReComboBox.hpp
gui/ReSettings.hpp
gui/regui.hpp
os/ReCryptFileSystem.cpp

index 639cda283ae6cee5ed6a301c597ecb21aa32cbea..fe3c4e7aa84be4c99591b7a4a3fba045a5aaedc6 100644 (file)
 #include "backupgui.hpp"
 //#define WITH_TRACE
 #include "base/retrace.hpp"
-DECLARE_TRACER(s_traceSearch, "/tmp/bup_search.log");
-DECLARE_TRACER(s_traceBackup, "/tmp/bup_backup.log");
-DECLARE_TRACER(s_traceChecksum, "/tmp/bup_sum.log");
-DECLARE_TRACER(s_traceClean, "/tmp/bup_clean.log");
+DECLARE_TRACER(s_traceSearch, "/tmp/bup_search.log")
+DECLARE_TRACER(s_traceBackup, "/tmp/bup_backup.log")
+DECLARE_TRACER(s_traceChecksum, "/tmp/bup_sum.log")
+DECLARE_TRACER(s_traceClean, "/tmp/bup_clean.log")
 
+#ifdef USE_MUTEX
+#define MUTEX_LOCK(mutex) mutex.lock()
+#define MUTEX_UNLOCK(mutex) m_mutex.release()
+#else
+#define MUTEX_LOCK(mutex)
+#define MUTEX_UNLOCK(mutex)
+#endif
 ReVerbose_t BackupEngine::m_verboseLevel = VerboseStandard;
 bool BackupEngine::m_shouldStop = false;
 QStringList BackupEngine::m_files;
-qint64 BackupEngine::m_hotBytes = 0;
-qint64 BackupEngine::m_processedBytes = 0;
-int BackupEngine::m_processedFiles = 0;
-int BackupEngine::m_matchedFiles = 0;
-int BackupEngine::m_hotFiles = 0;
-int BackupEngine::m_totalFiles = 0;
-int BackupEngine::m_totalDirs = 0;
 bool BackupEngine::m_searchReady = false;
 QMutex BackupEngine::m_mutex;
 QChar BackupEngine::m_separator = '\t';
@@ -45,7 +45,7 @@ static const int MAX_INDEX = 0x7fff;
  */
 BackupEngine::BackupEngine(const QString& name,
                                                   const QStringList& sourceDirs, const QString& targetDir,
-                                                  MainWindow* mainWindow) :
+                                                  ReFileTreeStatistic& statistic, MainWindow* mainWindow) :
        QThread(),
        m_sourceDirs(sourceDirs),
        m_targetBaseDir(targetDir),
@@ -53,8 +53,10 @@ BackupEngine::BackupEngine(const QString& name,
        m_shadowBaseDir(),
        m_shadowDirs(),
        m_mainWindow(mainWindow),
+       m_statistic(statistic),
        m_name(name)
 {
+       m_statistic.clear();
        ReQStringUtils::ensureLastChar(m_targetBaseDir, OS_SEPARATOR);
        for (int ix = 0; ix < sourceDirs.size(); ix++){
                ReQStringUtils::ensureLastChar(m_sourceDirs[ix], OS_SEPARATOR);
@@ -132,8 +134,8 @@ bool BackupEngine::log(const QString& message){
  */
 BackupTask::BackupTask(const QString& name,
                                           const QStringList& sourceDirs, const QString& targetDir,
-                                          MainWindow* mainWindow) :
-       BackupEngine(name, sourceDirs, targetDir, mainWindow),
+                                          ReFileTreeStatistic& statistic, MainWindow* mainWindow) :
+       BackupEngine(name, sourceDirs, targetDir, statistic, mainWindow),
        m_lastRelPath(),
        m_buffer()
 {
@@ -175,10 +177,9 @@ void BackupTask::copyFile(int index, const QString& relPath,
        QFileInfo sourceInfo(source);
        if (m_verboseLevel >= VerboseStandard)
                m_mainWindow->addToFileList(target + " " + ReQStringUtils::readableSize(sourceInfo.size()));
-       m_mutex.lock();
-       m_processedFiles++;
-       m_processedBytes += sourceInfo.size();
-       m_mutex.unlock();
+       MUTEX_LOCK(m_mutex);
+       m_statistic.m_processed.addFile(sourceInfo.size());
+       MUTEX_UNLOCK(m_mutex);
 
        QString errorMsg = ReFileUtils::copy(source, target, &sourceInfo, m_buffer);
        if (! errorMsg.isEmpty()){
@@ -207,18 +208,18 @@ void BackupTask::run()
        qint64 processedBytes, hotBytes;
        int lastIndex = -1;
        while (! m_shouldStop){
-               m_mutex.lock();
+               MUTEX_LOCK(m_mutex);
                if (m_files.size() == 0)
                        info.clear();
                else{
                        info = m_files.first();
                        m_files.removeFirst();
                }
-               hotBytes = m_hotBytes;
-               processedBytes = m_processedBytes;
-               hotFiles = m_hotFiles;
-               processedFiles = m_processedFiles;
-               m_mutex.unlock();
+               hotBytes = m_statistic.m_hot.bytes();
+               processedBytes = m_statistic.m_processed.bytes();
+               hotFiles = m_statistic.m_hot.files();
+               processedFiles = m_statistic.m_processed.files();;
+               MUTEX_UNLOCK(m_mutex);
                if (info.isEmpty()){
                        if (m_searchReady)
                                break;
@@ -257,10 +258,9 @@ void BackupTask::run()
        }
        FILETRACE_IT(s_traceBackup, (s_traceBackup.m_fp,
                "=== backup ready\n"));
-       m_mainWindow->externalTaskFinished(QObject::tr("backup complete after %1. Errors: %2")
-                               .arg(ReQStringUtils::readableDuration(
-                                       QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
-                                                                          .arg(m_mainWindow->errors()));
+       m_mainWindow->taskFinished(tr("Backup"),
+                       QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch());
+
 }
 
 /**
@@ -273,8 +273,8 @@ void BackupTask::run()
  */
 ChecksumTask::ChecksumTask(const QString& name,
                                           const QStringList& sourceDirs, const QString& targetDir,
-                                          MainWindow* mainWindow) :
-       BackupEngine(name, sourceDirs, targetDir, mainWindow),
+                                          ReFileTreeStatistic& statistic, MainWindow* mainWindow) :
+       BackupEngine(name, sourceDirs, targetDir, statistic, mainWindow),
        m_lastRelPath(),
        m_buffer()
 {
@@ -302,10 +302,9 @@ QByteArray ChecksumTask::buildChecksum(bool isSource, int index,
                filename = m_targetDirs.at(index) + relpath + node;
        qint64 size = 0;
        QByteArray rc = ReFileUtils::buildChecksum(filename, m_buffer, &size).toHex();
-       m_mutex.lock();
-       m_processedFiles++;
-       m_processedBytes += size;
-       m_mutex.unlock();
+       MUTEX_LOCK(m_mutex);
+       m_statistic.m_processed.addFile(size);
+       MUTEX_UNLOCK(m_mutex);
        if (rc.isEmpty()){
                error(QObject::tr("cannot build checksum: %1").arg(filename) );
        } if (m_verboseLevel >= VerboseStandard){
@@ -324,8 +323,8 @@ QByteArray ChecksumTask::buildChecksum(bool isSource, int index,
  */
 ChecksumOfSourceTask::ChecksumOfSourceTask(const QString& name,
                                           const QStringList& sourceDirs, const QString& targetDir,
-                                          MainWindow* mainWindow) :
-       ChecksumTask(name, sourceDirs, targetDir, mainWindow)
+                                          ReFileTreeStatistic& statistic, MainWindow* mainWindow) :
+       ChecksumTask(name, sourceDirs, targetDir, statistic, mainWindow)
 {
 }
 
@@ -339,14 +338,14 @@ void ChecksumOfSourceTask::run()
        QString info;
        int count = 0;
        while (! m_shouldStop){
-               m_mutex.lock();
+               MUTEX_LOCK(m_mutex);
                if (m_files.size() == 0)
                        info.clear();
                else{
                        info = m_files.first();
                        m_files.removeFirst();
                }
-               m_mutex.unlock();
+               MUTEX_UNLOCK(m_mutex);
                if (info.isEmpty()){
                        if (m_searchReady)
                                break;
@@ -365,9 +364,9 @@ void ChecksumOfSourceTask::run()
                        if (! checksum.isEmpty()){
                                QString info = QChar(1 + index) + relPath + m_separator
                                                + node + m_separatorString + checksum;
-                               m_mutex.lock();
+                               MUTEX_LOCK(m_mutex);
                                m_checksumInfo.append(info);
-                               m_mutex.unlock();
+                               MUTEX_UNLOCK(m_mutex);
                        }
                }
        }
@@ -388,8 +387,8 @@ void ChecksumOfSourceTask::run()
  */
 ChecksumOfTargetTask::ChecksumOfTargetTask(const QString& name,
                                           const QStringList& sourceDirs, const QString& targetDir,
-                                          MainWindow* mainWindow) :
-       ChecksumTask(name, sourceDirs, targetDir, mainWindow)
+                                          ReFileTreeStatistic& statistic, MainWindow* mainWindow) :
+       ChecksumTask(name, sourceDirs, targetDir, statistic, mainWindow)
 {
 
 }
@@ -405,14 +404,14 @@ void ChecksumOfTargetTask::run()
        QString info;
        int count = 0;
        while (! m_shouldStop){
-               m_mutex.lock();
+               MUTEX_LOCK(m_mutex);
                if (m_checksumInfo.size() == 0)
                        info.clear();
                else{
                        info = m_checksumInfo.first();
                        m_checksumInfo.removeFirst();
                }
-               m_mutex.unlock();
+               MUTEX_UNLOCK(m_mutex);
                if (info.isEmpty()){
                        if (m_sourceProcessingReady)
                                break;
@@ -442,12 +441,14 @@ void ChecksumOfTargetTask::run()
                        if (m_verboseLevel > VerboseQuiet){
                                qint64 processedBytes, hotBytes;
                                int hotFiles, processedFiles;
-                               m_mutex.lock();
-                               hotFiles = m_hotFiles;
-                               hotBytes = m_hotBytes * 2;
-                               processedBytes = m_processedBytes;
-                               processedFiles = m_processedFiles;
-                               m_mutex.unlock();
+                               MUTEX_LOCK(m_mutex);
+                               hotFiles = m_statistic.m_hot.files();
+                               // We must read pairs of source/target files which have mostly
+                               // the same size:
+                               hotBytes = m_statistic.m_hot.bytes() * 2;
+                               processedBytes =  m_statistic.m_processed.bytes();
+                               processedFiles =  m_statistic.m_processed.files();
+                               MUTEX_UNLOCK(m_mutex);
                                now = QDateTime::currentMSecsSinceEpoch();
                                qint64 duration = (now - start.toMSecsSinceEpoch());
                                double factor = processedBytes / max(1.0, (double) hotBytes);
@@ -483,8 +484,9 @@ void ChecksumOfTargetTask::run()
  */
 
 CleanTask::CleanTask(const QString& name, const QStringList& sourceDirs,
-                                        const QString& targetDir, MainWindow* mainWindow) :
-       BackupEngine(name, sourceDirs, targetDir, mainWindow)
+                                        const QString& targetDir, ReFileTreeStatistic& statistic,
+                                        MainWindow* mainWindow) :
+       BackupEngine(name, sourceDirs, targetDir, statistic, mainWindow)
 {
        initializeShadowDir();
 }
@@ -499,17 +501,20 @@ void CleanTask::run()
        QDateTime start = QDateTime::currentDateTime();
        int processedFiles = 0, hotFiles = 0;
        while (! m_shouldStop){
-               m_mutex.lock();
+               MUTEX_LOCK(m_mutex);
                if (m_files.size() == 0)
                        info.clear();
                else{
                        info = m_files.first();
                        m_files.removeFirst();
                }
-               hotFiles = m_hotFiles;
-               if (! info.isEmpty())
-                       processedFiles = ++m_processedFiles;
-               m_mutex.unlock();
+               hotFiles =  m_statistic.m_hot.files();
+               if (! info.isEmpty()){
+                       //@ToDo: 0???????????
+                       m_statistic.m_processed.addFile(0);
+                       processedFiles =  m_statistic.m_processed.files();
+               }
+               MUTEX_UNLOCK(m_mutex);
                if (info.isEmpty()){
                        if (m_searchReady)
                                break;
@@ -610,8 +615,8 @@ void CleanTask::run()
 SearchTask::SearchTask(bool compareWithTarget, const QString& name,
                const QString& filePatterns, const QString& dirPatterns,
                const QStringList& sourceDirs, const QString& targetDir,
-               MainWindow* mainWindow) :
-       BackupEngine(name, sourceDirs, targetDir, mainWindow),
+               ReFileTreeStatistic& statistic, MainWindow* mainWindow) :
+       BackupEngine(name, sourceDirs, targetDir, statistic, mainWindow),
        m_fileMatcher(filePatterns),
        m_dirMatcher(dirPatterns),
        m_compareWithTarget(compareWithTarget)
@@ -641,10 +646,10 @@ void SearchTask::run()
        m_mainWindow->externalLog(QObject::tr(
                "Search finished: to process: %1 with %2 matching: %3 total: %4 "
                "subdirs: %5 runtime: %6")
-               .arg(m_hotFiles)
-               .arg(ReQStringUtils::readableSize(m_hotBytes))
-               .arg(m_matchedFiles).arg(m_totalFiles)
-                 .arg(m_totalDirs)
+               .arg( m_statistic.m_hot.files())
+               .arg(ReQStringUtils::readableSize(m_statistic.m_hot.bytes()))
+               .arg(m_statistic.m_matched.files()).arg(m_statistic.m_total.files())
+                 .arg(m_statistic.m_total.directories())
                  .arg(ReQStringUtils::readableDuration(
                                   QDateTime::currentMSecsSinceEpoch() - start)));
 }
@@ -669,9 +674,9 @@ void SearchTask::searchOneDirectory(const QString& source,
        int lengthBase = m_sourceDirs.at(index).length();
        assert(index < MAX_INDEX);
        QString prefix;
-       m_mutex.lock();
-       m_totalDirs++;
-       m_mutex.unlock();
+       MUTEX_LOCK(m_mutex);
+       m_statistic.m_total.addDir();
+       MUTEX_UNLOCK(m_mutex);
        if (source.length() > lengthBase){
                prefix = QChar(1 + index)
                                + ReFileUtils::nativePath(source.mid(lengthBase)) + OS_SEPARATOR_STR
@@ -694,9 +699,9 @@ void SearchTask::searchOneDirectory(const QString& source,
           if (! fileInfo.isSymLink() && fileInfo.isDir()){
                   // nothing to do
           } else if (! m_fileMatcher.matches(node)){
-                  m_mutex.lock();
-                  m_totalFiles++;
-                  m_mutex.unlock();
+                  MUTEX_LOCK(m_mutex);
+                  m_statistic.m_total.addFile(fileInfo.size());
+                  MUTEX_UNLOCK(m_mutex);
           } else {
                   qint64 diff = 0;
                   bool doTransfer = false;
@@ -722,15 +727,15 @@ void SearchTask::searchOneDirectory(const QString& source,
                   }
                   FILETRACE_IT(s_traceSearch, (s_traceSearch.m_fp, ">%s\n",
                                        node.toLocal8Bit().constData()));
-                  m_mutex.lock();
+                  qint64 size = it.fileInfo().size();
+                  MUTEX_LOCK(m_mutex);
                   if (doTransfer){
                           m_files.append(info);
-                          m_hotFiles++;
-                          m_hotBytes += it.fileInfo().size();
+                          m_statistic.m_hot.addFile(size);
                   }
-                  m_totalFiles++;
-                  m_matchedFiles++;
-                  m_mutex.unlock();
+                  m_statistic.m_total.addFile(size);
+                  m_statistic.m_matched.addFile(size);
+                  MUTEX_UNLOCK(m_mutex);
           }
        }
        if (! m_shouldStop){
@@ -773,8 +778,9 @@ void SearchTask::searchOneDirectory(const QString& source,
  */
 
 SearchTargetTask::SearchTargetTask(const QString& name, const QStringList& sourceDirs,
-                                        const QString& targetDir, qint64 maxAgeSec, MainWindow* mainWindow) :
-       BackupEngine(name, sourceDirs, targetDir, mainWindow),
+                                        const QString& targetDir, qint64 maxAgeSec,
+                                       ReFileTreeStatistic& statistic, MainWindow* mainWindow) :
+       BackupEngine(name, sourceDirs, targetDir, statistic, mainWindow),
        m_maxAge(QDateTime::currentDateTime().addSecs(- maxAgeSec))
 {
        initializeShadowDir();
@@ -793,12 +799,13 @@ bool SearchTargetTask::removeOlder(const QString& directory, const QDateTime& ti
        QDirIterator it(directory);
        QString info, node;
        IF_TRACE(QByteArray directory2(directory.toLocal8Bit()));
-       m_mutex.lock();
-       m_totalDirs++;
-       m_mutex.unlock();
+       MUTEX_LOCK(m_mutex);
+       m_statistic.m_total.addDir();
+       MUTEX_UNLOCK(m_mutex);
        FILETRACE_IT(s_traceSearch, (s_traceSearch.m_fp, "=removeOlder: %s\n",
                        directory2.constData()));
        bool isEmpty = true;
+       qint64 size = 0;
        while (it.hasNext()){
           if (m_shouldStop){
                  break;
@@ -818,12 +825,11 @@ bool SearchTargetTask::removeOlder(const QString& directory, const QDateTime& ti
                   isEmpty = false;
                   info = QChar(MAX_INDEX) + ReFileUtils::nativePath(it.filePath()) + m_separatorString
                                   + QChar(CmdRemove);
-                  m_mutex.lock();
+                  MUTEX_LOCK(m_mutex);
                   m_files.append(info);
-                  m_hotFiles++;
-                  m_hotBytes += it.fileInfo().size();
-                  m_totalFiles++;
-                  m_mutex.unlock();
+                  size = it.fileInfo().size();
+                  m_statistic.m_hot.addFile(size);
+                  MUTEX_UNLOCK(m_mutex);
                   FILETRACE_IT(s_traceSearch, (s_traceSearch.m_fp, "-%s/%s\n",
                                directory2.constData(),
                                fileInfo.baseName().toLocal8Bit().constData()));
@@ -836,11 +842,11 @@ bool SearchTargetTask::removeOlder(const QString& directory, const QDateTime& ti
                        m_mainWindow->addToFileList("x " + directory);
                info = QChar(MAX_INDEX) + directory + m_separatorString
                                + QChar(CmdRemoveDir);
-               m_mutex.lock();
+               MUTEX_LOCK(m_mutex);
                m_files.append(info);
-               m_matchedFiles++;
-               m_hotFiles++;
-               m_mutex.unlock();
+               m_statistic.m_matched.addFile(size);
+               m_statistic.m_total.addFile(size);
+               MUTEX_UNLOCK(m_mutex);
                FILETRACE_IT(s_traceSearch, (s_traceSearch.m_fp, "-%s\n",
                         directory2.constData()));
        }
@@ -863,9 +869,9 @@ void SearchTargetTask::searchOneDirectory(const QString& target,
        int lengthBase = m_targetDirs.at(index).length();
        assert(index < MAX_INDEX);
        QString prefix;
-       m_mutex.lock();
-       m_totalDirs++;
-       m_mutex.unlock();
+       MUTEX_LOCK(m_mutex);
+       m_statistic.m_total.addDir();
+       MUTEX_UNLOCK(m_mutex);
        if (target.length() > lengthBase){
                relPath = ReFileUtils::nativePath(target.mid(lengthBase)) + OS_SEPARATOR_STR;
                prefix = QChar(1 + index) + relPath + m_separator;
@@ -901,14 +907,14 @@ void SearchTargetTask::searchOneDirectory(const QString& target,
                                   info = prefix + QChar(command) + it.fileName();
                           }
                   }
-                  m_mutex.lock();
+                  qint64 size = it.fileInfo().size();
+                  MUTEX_LOCK(m_mutex);
                   if (command != CmdUndef){
                           m_files.append(info);
-                          m_hotFiles++;
-                          m_hotBytes += it.fileInfo().size();
+                          m_statistic.m_hot.addFile(size);
                   }
-                  m_totalFiles++;
-                  m_mutex.unlock();
+                  m_statistic.m_total.addFile(size);
+                  MUTEX_UNLOCK(m_mutex);
           }
        }
        if (! m_shouldStop){
@@ -1033,10 +1039,10 @@ void SearchTargetTask::run()
        m_mainWindow->externalLog(QObject::tr(
                "Search in target finished: to process: %1 with %2 dirs to delete: %3 total: %4 "
                "subdirs: %5 runtime: %6")
-               .arg(m_hotFiles)
-               .arg(ReQStringUtils::readableSize(m_hotBytes))
-               .arg(m_matchedFiles).arg(m_totalFiles)
-                 .arg(m_totalDirs)
+               .arg(m_statistic.m_hot.files())
+               .arg(ReQStringUtils::readableSize(m_statistic.m_hot.files()))
+               .arg(m_statistic.m_matched.files()).arg(m_statistic.m_total.files())
+                 .arg(m_statistic.m_total.directories())
                  .arg(ReQStringUtils::readableDuration(
                                   QDateTime::currentMSecsSinceEpoch() - start)));
 }
index 5b68fc249ab54c66fe4530eefa289b6688206640..6d85ce310052a72ea9871b167482b0c2c396dde7 100644 (file)
@@ -29,7 +29,7 @@ public:
 public:
        BackupEngine(const QString& name,
                                 const QStringList& sourceDirs, const QString& targetDir,
-                                MainWindow* mainWindow);
+                                ReFileTreeStatistic& statistic, MainWindow* mainWindow);
 public:
    bool error(const QString& message);
    bool log(const QString& message);
@@ -48,19 +48,13 @@ protected:
    // list of shadow dirs.
    QStringList m_shadowDirs;
    MainWindow* m_mainWindow;
+   ReFileTreeStatistic& m_statistic;
    QString m_name;
 public:
    static ReVerbose_t m_verboseLevel;
    static bool m_shouldStop;
    /// Entry: <index_of_source_dir><relative_path>TAB<node>
    static QStringList m_files;
-   static qint64 m_hotBytes;
-   static int m_processedFiles;
-   static qint64 m_processedBytes;
-   static int m_hotFiles;
-   static int m_matchedFiles;
-   static int m_totalFiles;
-   static int m_totalDirs;
    static bool m_searchReady;
    static QMutex m_mutex;
    static QChar m_separator;
@@ -73,8 +67,9 @@ public:
 class BackupTask : public BackupEngine
 {
 public:
-       BackupTask(const QString& name, const QStringList& sourceDirs, const QString& targetDir,
-                          MainWindow* mainWindow);
+       BackupTask(const QString& name, const QStringList& sourceDirs,
+                          const QString& targetDir,
+                          ReFileTreeStatistic& statistic, MainWindow* mainWindow);
 public:
        virtual void run();
 protected:
@@ -91,8 +86,9 @@ private:
 class ChecksumTask : public BackupEngine
 {
 public:
-       ChecksumTask(const QString& name, const QStringList& sourceDirs, const QString& targetDir,
-                          MainWindow* mainWindow);
+       ChecksumTask(const QString& name, const QStringList& sourceDirs,
+                                const QString& targetDir,
+                          ReFileTreeStatistic& statistic, MainWindow* mainWindow);
 public:
        virtual void run() = 0;
 protected:
@@ -117,7 +113,8 @@ public:
 class ChecksumOfSourceTask : public ChecksumTask
 {
 public:
-       ChecksumOfSourceTask(const QString& name, const QStringList& sourceDirs, const QString& targetDir,
+       ChecksumOfSourceTask(const QString& name, const QStringList& sourceDirs,
+                       const QString& targetDir, ReFileTreeStatistic& statistic,
                           MainWindow* mainWindow);
 public:
        virtual void run();
@@ -132,7 +129,8 @@ public:
 class ChecksumOfTargetTask : public ChecksumTask
 {
 public:
-       ChecksumOfTargetTask(const QString& name, const QStringList& sourceDirs, const QString& targetDir,
+       ChecksumOfTargetTask(const QString& name, const QStringList& sourceDirs,
+                               const QString& targetDir, ReFileTreeStatistic& statistic,
                           MainWindow* mainWindow);
 public:
        virtual void run();
@@ -151,7 +149,7 @@ class CleanTask : public BackupEngine
 {
 public:
        CleanTask(const QString& name, const QStringList& sourceDirs, const QString& targetDir,
-                       MainWindow* mainWindow);
+                       ReFileTreeStatistic& statistic, MainWindow* mainWindow);
 public:
        virtual void run();
 };
@@ -165,7 +163,7 @@ public:
        SearchTask(bool compareWithTarget, const QString& name,
                           const QString& filePatterns, const QString& dirPatterns,
                           const QStringList& sourceDirs, const QString& targetDir,
-                          MainWindow* mainWindow);
+                          ReFileTreeStatistic& statistic, MainWindow* mainWindow);
 public:
        virtual void run();
 private:
@@ -187,7 +185,8 @@ class SearchTargetTask : public BackupEngine
 public:
        SearchTargetTask(const QString& name,
                           const QStringList& sourceDirs, const QString& targetDir,
-                          qint64 maxAgeSec, MainWindow* mainWindow);
+                          qint64 maxAgeSec, ReFileTreeStatistic& statistic,
+                                        MainWindow* mainWindow);
 public:
        virtual void run();
 private:
index ae2de1384febacfaf678ac3bf8d9e21da4e83117..ec0da50a87fe6d322a07a7bcb5900ada2d4f067c 100644 (file)
@@ -10,9 +10,9 @@
  */
 
 #include "backupgui.hpp"
-#define WITH_TRACE
+//#define WITH_TRACE
 #include "base/retrace.hpp"
-DECLARE_TRACER(s_traceConfig, "/tmp/bup_conf.log");
+DECLARE_TRACER(s_traceConfig, "/tmp/bup_conf.log")
 
 /**
  * Constructor.
index da6b02f9309e697b9dc6afa8afec9a527e1f481f..eda42f13ac50bc746e013ffb47c21639b1c6b07d 100644 (file)
 #include "backupgui.hpp"
 #include "aboutdialog.hpp"
 #include <QFileDialog>
-#define WITH_TRACE
+//#define WITH_TRACE
 #include "base/retrace.hpp"
-DECLARE_TRACER(s_traceMain, "/tmp/bup_main.log");
+DECLARE_TRACER(s_traceMain, "/tmp/bup_main.log")
 
-const QString VERSION("2016.10.01");
+const QString VERSION("2016.10.05");
 
 /**
  * Constructor.
@@ -46,7 +46,9 @@ MainWindow::MainWindow(QApplication& application, const QString& homeDir,
        m_lastDirectory(""),
        m_lastTarget(""),
        m_textChangeLocked(false),
-       m_temporaryMounted("")
+       m_temporaryMounted(""),
+       m_statisticSearch(),
+       m_statisticTask()
 {
        initializeGui();
 }
@@ -210,7 +212,7 @@ void MainWindow::initializeGui(){
        initializeGuiLanguage(ui->actionEnglish, ui->actionGerman);
        startStop(false);
        ui->actionAutosave->setChecked(true);
-       connect(ui->actionStart, SIGNAL(triggered()), this,
+    connect(ui->actionStart, SIGNAL(triggered()), this,
           SLOT(onStart()));
        connect(ui->actionChecksums, SIGNAL(triggered()), this,
           SLOT(onChecksums()));
@@ -294,13 +296,6 @@ ReSuccess_t MainWindow::initializeStart(){
        ReSuccess_t rc = true;
        BackupEngine::m_shouldStop = false;
        BackupEngine::m_searchReady = false;
-       BackupEngine::m_hotBytes = 0;
-       BackupEngine::m_hotFiles = 0;
-       BackupEngine::m_matchedFiles = 0;
-       BackupEngine::m_totalDirs = 0;
-       BackupEngine::m_totalFiles = 0;
-       BackupEngine::m_processedFiles = 0;
-       BackupEngine::m_processedBytes = 0;
        BackupEngine::m_files.clear();
        ChecksumTask::m_sourceProcessingReady = false;
        if ( (m_maxListSize = comboInt(ui->comboBoxMaxListLength, -999)) == -999){
@@ -433,15 +428,16 @@ void MainWindow::onChecksums(){
                        delete m_searchTask;
                        m_searchTask = new SearchTask(false, item.m_name,
                                                                                  item.m_filePatterns, item.m_dirPatterns,
-                                                                                 item.m_sources, target, this);
+                                                                                 item.m_sources, target,
+                                                                                 m_statisticSearch, this);
                        m_searchTask->start();
                        delete m_checksumOfSourceTask;
                        m_checksumOfSourceTask = new ChecksumOfSourceTask(item.m_name,
-                                       item.m_sources, target, this);
+                                       item.m_sources, target, m_statisticTask, this);
                        m_checksumOfSourceTask->start();
                        delete m_checksumOfTargetTask;
                        m_checksumOfTargetTask = new ChecksumOfTargetTask(item.m_name,
-                                       item.m_sources, target, this);
+                                       item.m_sources, target, m_statisticTask2, this);
                        m_checksumOfTargetTask->start();
                }
        }
@@ -468,11 +464,12 @@ void MainWindow::onClean()
                        initializeStart();
                        delete m_searchTargetTask;
                        m_searchTargetTask = new SearchTargetTask(item.m_name,
-                                                       item.m_sources, target, 14*24*3600, this);
+                                                       item.m_sources, target, 14*24*3600,
+                                                       m_statisticSearch, this);
                        m_searchTargetTask->start();
                        delete m_cleanTask;
                        m_cleanTask = new CleanTask(item.m_name, item.m_sources, target,
-                                                       this);
+                                                       m_statisticTask, this);
                        m_cleanTask->start();
                }
        }
@@ -719,11 +716,12 @@ void MainWindow::onStart(){
                        delete m_searchTask;
                        m_searchTask = new SearchTask(true, item.m_name,
                                                                                  item.m_filePatterns, item.m_dirPatterns,
-                                                                                 item.m_sources, target, this);
+                                                                                 item.m_sources, target,
+                                                                                 m_statisticSearch, this);
                        m_searchTask->start();
                        delete m_backupTask;
                        m_backupTask = new BackupTask(item.m_name, item.m_sources, target,
-                                                                                 this);
+                                                                                 m_statisticTask, this);
                        m_backupTask->start();
                }
        }
@@ -795,6 +793,23 @@ void MainWindow::saveState(){
        storage.close();
 }
 
+/**
+ * Logs a message about the end of a task.
+ *
+ * Note: This method is called from other threads.
+ *
+ * @param taskName     the name of the task (translated)
+ * @param duration     the duration in milliseconds
+ */
+void MainWindow::taskFinished(const QString& taskName, qint64 duration)
+{
+       externalTaskFinished(QObject::tr("%1 complete after %1. Errors: %2 File(s): %3 of %4")
+                               .arg(taskName)
+                               .arg(ReQStringUtils::readableDuration(duration))
+                                                                          .arg(errors()));
+
+}
+
 /**
  * Writes a message.
  *
index e86a9a07b78bc7c0300021604021dcd2e2c094a6..e6f504ff0cf5155873e68f0b4aeb5513e06d0af5 100644 (file)
@@ -38,6 +38,7 @@ public:
    void setLastFile(const QString& lastFile);
    void setLastFile(const QString& lastDir, const QString& lastFile);
    void saveState();
+   void taskFinished(const QString& taskName, qint64 duration);
 #ifdef __linux__
    void unmount(const QString& device);
 #endif
@@ -105,6 +106,9 @@ private:
        QString m_lastTarget;
        bool m_textChangeLocked;
        QString m_temporaryMounted;
+       ReFileTreeStatistic m_statisticSearch;
+       ReFileTreeStatistic m_statisticTask;
+       ReFileTreeStatistic m_statisticTask2;
 };
 
 #endif // MAINWINDOW_HPP
index f702b9f550010060245a7a17a2ec14afaded8d20..a0a5115707ded7ef9165f2d76b77ef715e892087 100644 (file)
  */
 CommandProcessor::CommandProcessor(MainWindow* mainWindow) :
        m_mainWindow(mainWindow),
-       m_random()
+       m_random(),
+       m_variables(),
+       m_regExprVariables("\\$(\\w+)|\\$\\{(\\w+)\\}")
 {
        m_random.modifySeed(ReRandomizer::nearTrueRandom());
-
 }
 
 /**
@@ -54,6 +55,17 @@ void CommandProcessor::out(const QString& message)
        m_mainWindow->say(LOG_INFO, message);
 }
 
+/**
+ * Sets a variable to a given value.
+ *
+ * @param name name of the variable
+ * @param value        value of the variable
+ */
+void CommandProcessor::setVariable(const QString& name, const QString& value)
+{
+       m_variables[name] = value;
+}
+
 /**
  * @brief CommandProcessor::tail
  * @param args
@@ -221,6 +233,41 @@ void CommandProcessor::euroJackpot(const QStringList& args){
        }
 }
 
+/**
+ * Replaces the variables by the value of their values.
+ *
+ * @param text the text to process
+ * @return             all variables are replaced
+ */
+QString CommandProcessor::expandVariables(const QString& text)
+{
+       QString rc = text;
+       bool found = true;
+       int differenceOfLength = 0;
+       while (found){
+               found = false;
+               QRegularExpressionMatchIterator i = m_regExprVariables.globalMatch(rc);
+               QString variable;
+               while(i.hasNext()){
+                       QRegularExpressionMatch match = i.next();
+                       variable = match.captured(1);
+                       if (variable.isEmpty())
+                               variable = match.captured(2);
+
+                       if (m_variables.contains(variable)){
+                               found = true;
+                               QString value = m_variables.value(variable);
+                               int varLength = match.capturedLength(0);
+                               int ixStart = match.capturedStart(0);
+                               rc = rc.mid(0, ixStart + differenceOfLength) + value
+                                               + rc.mid(ixStart + varLength);
+                               differenceOfLength += value.length() - varLength;
+                       }
+               }
+       }
+       return rc;
+}
+
 /**
  * Displays an error message.
  *
index 5c32dd8cd4563835d37e91629476119f44fc4925..6e7f38d3e4e1404959aa399c04df5c19a1d9d244 100644 (file)
@@ -28,12 +28,17 @@ public:
        void lotto(const QStringList& args);
        void nOfM(const QStringList& args);
        void out(const QString& message);
+       void setVariable(const QString& name, const QString& value);
        void tail(const QStringList& args);
        void time(const QStringList& args);
        void statement(int lineNo, const QString& text);
+protected:
+       QString expandVariables(const QString& text);
 protected:
        MainWindow* m_mainWindow;
        ReKISSRandomizer m_random;
+       QMap<QString, QString> m_variables;
+       QRegularExpression m_regExprVariables;
 };
 
 #endif // COMMANDPROCESSOR_HPP
diff --git a/appl/recommand/cuCommandProcessor.cpp b/appl/recommand/cuCommandProcessor.cpp
new file mode 100644 (file)
index 0000000..ee0ce81
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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 "base/rebase.hpp"
+#include "CommandProcessor.hpp"
+
+/**
+ * @brief Unit test for <code>CommandProcessor</code>
+ */
+class TestCommandProcessor: public ReTest, public CommandProcessor {
+public:
+       TestCommandProcessor() :
+                       ReTest("CommandProcessor"),
+                       CommandProcessor(NULL){
+               doIt();
+       }
+
+public:
+       void shouldExpandVariables() {
+               setVariable("x", "y");
+               setVariable("y", "1234");
+               checkEqu("abcy...", expandVariables("abc$x..."));
+               checkEqu("abc123...", expandVariables("abc$$x..."));
+               checkEqu("y", expandVariables("${x}"));
+       }
+
+       virtual void runTests() {
+               shouldExpandVariables();
+       }
+};
+
+void testCommandProcessor() {
+       TestCommandProcessor test;
+}
+
index 35b3e8958bd7f6ca083da68002f587c7990bd875..27a57d2a5e2d8f73c730e28174824bc939e1ae95 100644 (file)
 #include <QApplication>
 char** g_argv;
 int main(int argc, char *argv[]){
-   g_argv = argv;
-   QString homeDir = argc > 1 ? argv[1] : "";
-   QApplication a(argc, argv);
-   MainWindow w(a, homeDir);
-       w.show();
-       return a.exec();
+       if (argc >= 2 && strcmp(argv[1], "--test") == 0){
+               extern void testCommandProcessor();
+               testCommandProcessor();
+               return 0;
+       } else {
+               g_argv = argv;
+               QString homeDir = argc > 1 ? argv[1] : "";
+               QApplication a(argc, argv);
+               MainWindow w(a, homeDir);
+               w.show();
+               return a.exec();
+       }
 }
index 318b324bd92b3be3f77525f760d83da0acb52cc3..a3d2647daad06536714416dc2aa1935c254dab9a 100644 (file)
@@ -23,6 +23,7 @@ SOURCES += main.cpp\
         ../../base/ReRandomizer.cpp \
         ../../base/ReStringUtils.cpp \
         ../../base/ReProgramArgs.cpp \
+        ../../base/ReTest.cpp \
         ../../gui/ReStateStorage.cpp \
         ../../gui/ReGuiApplication.cpp \
         ../../gui/ReGuiValidator.cpp \
@@ -30,7 +31,8 @@ SOURCES += main.cpp\
        ../../gui/ReGuiUtils.cpp \
                mainwindow.cpp \
        CommandProcessor.cpp \
-    ../../base/ReProcess.cpp
+       ../../base/ReProcess.cpp \
+    cuCommandProcessor.cpp
 
 HEADERS  += mainwindow.hpp \
        CommandProcessor.hpp \
diff --git a/appl/reide/SearchEngine.cpp b/appl/reide/SearchEngine.cpp
new file mode 100644 (file)
index 0000000..188c104
--- /dev/null
@@ -0,0 +1,48 @@
+#include "SearchEngine.hpp"
+#include <QStringList>
+#include <QTextStream>
+#include <QFile>
+
+/**
+ * Constructor.
+ *
+ * @param fullName  filename with path
+ */
+FileBuffer::FileBuffer(const QString &fullName)
+{
+    read(fullName);
+}
+
+/**
+ * Reads a file into the internal line list.
+ *
+ * @param fullName  filename with path
+ */
+void FileBuffer::read(const QString &fullName)
+{
+    QFile textFile(fullName);
+    if (textFile.exists()){
+        QString line;
+        OpenMode mode;
+        if (textFile.open(QIODevice::ReadOnly)){
+            QTextStream textStream(&textFile);
+            while (true)
+            {
+                line = textStream.readLine();
+                if (line.isNull())
+                    break;
+                else
+                    m_lines.append(line);
+            }
+        }
+        textFile.close();
+    }
+}
+
+/**
+ * Constructor.
+ */
+SearchEngine::SearchEngine()
+{
+
+}
diff --git a/appl/reide/SearchEngine.hpp b/appl/reide/SearchEngine.hpp
new file mode 100644 (file)
index 0000000..9baf1a3
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef SEARCHENGINE_H
+#define SEARCHENGINE_H
+
+class FileBuffer {
+public:
+    FileBuffer(const QString& fullName);
+    ~FileBuffer();
+public:
+    void read(const QString& fullName);
+
+private:
+    QString m_node;
+    QString m_path;
+    QList<QString> m_lines;
+};
+
+class SearchEngine
+{
+public:
+    SearchEngine();
+public:
+private:
+
+};
+
+#endif // SEARCHENGINE_H
index daed0c2cce8d9a1873c46e31d3334cbf59461e84..5f4dd7b3680598cdff664f4be64bcc57af8ac152 100644 (file)
@@ -20,7 +20,7 @@
       <enum>QTabWidget::North</enum>
      </property>
      <property name="currentIndex">
-      <number>0</number>
+      <number>3</number>
      </property>
      <property name="tabsClosable">
       <bool>false</bool>
index f1cae7443456af51e01c01dcc6da53127f2e4171..0fb37a6c1526f2b8178a1fa3602fd313acb96975 100644 (file)
@@ -53,7 +53,8 @@ MainWindow::MainWindow(const char* workspace, const char* project,
        m_perspectives.addPerspective(mainPerspective);
        m_perspectives.change(mainPerspective->name());
        m_perspectives.addPerspective(new ProjectPerspective(proj, this));
-       m_delayedStorage = new ReDelayedStorage(m_workspace->historyFile())
+       m_delayedStorage = new ReDelayedStorage(m_workspace->fileHistory(),
+                                                                                       m_logger);
 }
 
 /**
index 332e777474d1e296d42ed1b4fd410702a7257040..633db190084b87d0baaa89f0cd3de0d233bcf402 100644 (file)
@@ -20,7 +20,7 @@
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
-      <widget class="QWidget" name="">
+      <widget class="QWidget" name="layoutWidget">
        <layout class="QVBoxLayout" name="verticalLayout">
         <item>
          <layout class="QHBoxLayout" name="horizontalLayout">
@@ -81,7 +81,7 @@
            <bool>true</bool>
           </attribute>
           <attribute name="verticalHeaderVisible">
-           <bool>true</bool>
+           <bool>false</bool>
           </attribute>
           <column>
            <property name="text">
            <bool>true</bool>
           </attribute>
           <attribute name="verticalHeaderVisible">
-           <bool>true</bool>
+           <bool>false</bool>
           </attribute>
           <column>
            <property name="text">
      <x>0</x>
      <y>0</y>
      <width>803</width>
-     <height>35</height>
+     <height>31</height>
     </rect>
    </property>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>Fi&amp;le</string>
+    </property>
+    <addaction name="actionOpen_2"/>
+    <addaction name="separator"/>
+    <addaction name="actionExit"/>
+   </widget>
+   <widget class="QMenu" name="menuEdit">
+    <property name="title">
+     <string>Edi&amp;t</string>
+    </property>
+   </widget>
+   <widget class="QMenu" name="menuAction">
+    <property name="title">
+     <string>A&amp;ction</string>
+    </property>
+    <addaction name="actionFile_search"/>
+   </widget>
+   <widget class="QMenu" name="menuHelp">
+    <property name="title">
+     <string>Help</string>
+    </property>
+    <addaction name="actionAbout"/>
+   </widget>
+   <addaction name="menuFile"/>
+   <addaction name="menuEdit"/>
+   <addaction name="menuAction"/>
+   <addaction name="menuHelp"/>
   </widget>
   <widget class="QToolBar" name="mainToolBar">
    <attribute name="toolBarArea">
     <string>Ctrl+S</string>
    </property>
   </action>
+  <action name="actionOpen_2">
+   <property name="text">
+    <string>Open</string>
+   </property>
+  </action>
+  <action name="actionExit">
+   <property name="text">
+    <string>Exit</string>
+   </property>
+  </action>
+  <action name="actionFile_search">
+   <property name="text">
+    <string>File search</string>
+   </property>
+  </action>
+  <action name="actionAbout">
+   <property name="text">
+    <string>About</string>
+   </property>
+  </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <resources>
index 7f65b9d5b61686d99d30a047d42c4ccd7e1c0868..c1385171afcddeba059594a66cba1cdbc978524d 100644 (file)
@@ -18,6 +18,9 @@ SOURCES += \
         ../../gui/ReStateStorage.cpp \
         ../../gui/ReSettings.cpp \
         ../../base/ReFile.cpp \
+        ../../base/ReProcess.cpp \
+        ../../base/ReStringUtils.cpp \
+        ../../base/ReMatcher.cpp \
         ../../gui/ReFileTree.cpp \
        mainwindow.cpp \
        ../../base/ReLogger.cpp \
@@ -37,7 +40,8 @@ SOURCES += \
        views/ProjectPerspective.cpp \
        views/StartPerspective.cpp \
        views/StartView.cpp \
-       main.cpp
+       main.cpp \
+    SearchEngine.cpp
 
 
 HEADERS  += mainwindow.hpp \
@@ -54,7 +58,8 @@ HEADERS  += mainwindow.hpp \
        project.hpp \
        reide.hpp \
        filesearch.hpp \
-       views/StartView.hpp
+       views/StartView.hpp \
+    SearchEngine.hpp
 
 FORMS    += mainwindow.ui \
        projectselection.ui \
index 0aa6de566b987c9f0c793f156fd52ed213d46d09..feea5fa043ede2022ac041cde22b6633c86531a1 100644 (file)
@@ -21,20 +21,21 @@ const char* Workspace::KEY_HISTORY_PROJECTS = "projecs";
  * @param logger       the logger
  */
 Workspace::Workspace(const QString& path, ReLogger* logger) :
-           ReSettings(path, ".reditor.ws", logger) {
+       ReSettings(path, ".reditor.ws", logger)
+{
        insertProperty(
-           new ReProperty("editor.tabwidth", QObject::tr("Tabulator width"),
-               QObject::tr("Maximal length of the gap displaying a tabulator"),
-               "4", PT_INT, "[1,16]"));
+               new ReProperty("editor.tabwidth", QObject::tr("Tabulator width"),
+                       QObject::tr("Maximal length of the gap displaying a tabulator"),
+                       "4", PT_INT, "[1,16]"));
        insertProperty(
-           new ReProperty("history.max_projects",
-               QObject::tr("Maximal project entries"),
-               QObject::tr(
-                   "Maximal number of projects in the 'last opened projects'"),
-               "20", PT_INT, "[1,100]"));
+               new ReProperty("history.max_projects",
+                       QObject::tr("Maximal project entries"),
+                       QObject::tr(
+                               "Maximal number of projects in the 'last opened projects'"),
+                       "20", PT_INT, "[1,100]"));
        insertProperty(
-           new ReProperty("history.max_files", QObject::tr("Maximal file entries"),
-               QObject::tr("Maximal number of files in the 'last opened files'"),
-               "20", PT_INT, "[1,100]"));
+               new ReProperty("history.max_files", QObject::tr("Maximal file entries"),
+                       QObject::tr("Maximal number of files in the 'last opened files'"),
+                                          "20", PT_INT, "[1,100]"));
 }
 
index 3e275a8107252115d610315ea4882816ddce697d..d2ac6e4dc3b16453706f548147e46fe823be4402 100644 (file)
@@ -14,6 +14,7 @@ SOURCES += main.cpp \
        ../../base/ReLogger.cpp \
        ../../base/ReRandomizer.cpp \
        ../../base/ReStringUtils.cpp \
+        ../../base/ReQStringUtils.cpp \
        ../../base/ReException.cpp \
        Prime.cpp
 
diff --git a/appl/research/aboutdialog.cpp b/appl/research/aboutdialog.cpp
new file mode 100644 (file)
index 0000000..7af1b0f
--- /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/research/aboutdialog.hpp b/appl/research/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/research/aboutdialog.ui b/appl/research/aboutdialog.ui
new file mode 100644 (file)
index 0000000..0aeded1
--- /dev/null
@@ -0,0 +1,113 @@
+<?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>276</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QTextEdit" name="textEdit">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>20</y>
+     <width>381</width>
+     <height>181</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:'Noto Sans'; font-size:10pt; 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-family:'Sans Serif'; font-size:9pt; font-weight:600;&quot;&gt;ReSearch&lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt; for text searching/filtering in files&lt;/span&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;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;This is a program of the project&lt;/span&gt;&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-family:'Sans Serif'; font-size:9pt; font-weight:600;&quot;&gt;Re&lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;al &lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:600;&quot;&gt;Pub&lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;lic &lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:600;&quot;&gt;Lib&lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;rary (RePubLib)&lt;/span&gt;&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;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;Sources are public domain and available under&lt;/span&gt;&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; font-family:'Sans Serif'; font-size:9pt; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/republib&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt; &lt;/span&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;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;Implemented in QT (C++) 5.x&lt;/span&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>220</y>
+     <width>381</width>
+     <height>35</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;Close</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>357</x>
+     <y>237</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>211</x>
+     <y>137</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/appl/research/main.cpp b/appl/research/main.cpp
new file mode 100644 (file)
index 0000000..8e26a2f
--- /dev/null
@@ -0,0 +1,11 @@
+#include "research.hpp"
+#include "mainwindow.hpp"
+char** g_argv;
+int main(int argc, char* argv[]) {
+       g_argv = argv;
+       QString homeDir = argc > 1 ? argv[1] : "";
+       QApplication a(argc, argv);
+       MainWindow w(a, homeDir);
+       w.show();
+       return a.exec();
+}
diff --git a/appl/research/mainwindow.cpp b/appl/research/mainwindow.cpp
new file mode 100644 (file)
index 0000000..6818f0b
--- /dev/null
@@ -0,0 +1,92 @@
+#include "research.hpp"
+#include "mainwindow.hpp"
+#include "ui_mainwindow.h"
+#include "aboutdialog.hpp"
+
+static const char* VERSION = "2016.11.16";
+
+MainWindow::MainWindow(QApplication& application, const QString& homeDir,
+                                          QWidget *parent) :
+       ReGuiApplication(application, "rsearch", homeDir, 2, 10100100, "de", parent),
+       ReGuiValidator(),
+       ui(new Ui::MainWindow)
+{
+       ReComboBox::setDefaultHistorySize(20);
+       initializeGui();
+}
+
+MainWindow::~MainWindow()
+{
+       delete ui;
+}
+
+/**
+ * Initializes the Graphical User Interface.
+ */
+void MainWindow::initializeGui(){
+       ui->setupUi(this);
+       initializeGuiElements();
+       // restoreState();
+       m_guiIsInitialized = false;
+       connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
+       connect(ui->comboBoxBaseDirectory, SIGNAL(textEdited(const QString&, const QString&)),
+                       this, SLOT(textEdited(const QString&, const QString&)));
+
+}
+
+/**
+ * Shows the "about" window.
+ */
+void MainWindow::onAbout()
+{
+       AboutDialog dialog(VERSION);
+       dialog.exec();
+}
+/**
+ * Called at the program's end.
+ */
+void MainWindow::onAboutToQuit()
+{
+       saveState();
+       ReGuiApplication::onAboutToQuit();
+}
+
+/**
+ * Set GUI elements from the queue when the GUI timer is triggered.
+ */
+void MainWindow::onGuiTimerUpdate()
+{
+}
+
+
+/**
+ * The language has been changed.
+ */
+void MainWindow::onLanguageChange()
+{
+       initializeGui();
+}
+
+/**
+ * Writes a message.
+ *
+ * @param level                mode of the message, e.g. LOG_ERROR
+ * @param message      the message
+ * @return                     <code>false</code>level is error or warning
+ */
+bool MainWindow::say(ReLoggerLevel level, const QString& message){
+       setStatusMessage(level, message);
+       return level >= LOG_INFO;
+}
+
+/**
+ * Event
+ * @param oldString
+ * @param newString
+ */
+void MainWindow::textEdited(const QString& oldString, const QString& newString)
+{
+       ReUseParameter(oldString);
+       ReUseParameter(newString);
+}
+
diff --git a/appl/research/mainwindow.hpp b/appl/research/mainwindow.hpp
new file mode 100644 (file)
index 0000000..700799a
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#ifndef REBASE_HPP
+#include "base/rebase.hpp"
+#endif
+#ifndef REGUI_HPP
+#include "gui/regui.hpp"
+#endif
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow :  public ReGuiApplication, public ReGuiValidator
+{
+       Q_OBJECT
+
+public:
+       explicit MainWindow(QApplication& application, const QString& homeDir,
+                                               QWidget *parent = 0);
+       ~MainWindow();
+public:
+       virtual bool say(ReLoggerLevel level, const QString& message);
+
+private:
+       void initializeGui();
+
+private slots:
+   void onAbout();
+   virtual void onAboutToQuit();
+   virtual void onGuiTimerUpdate();
+   virtual void onLanguageChange();
+   void textEdited(const QString& oldString, const QString& newString);
+
+private:
+   Ui::MainWindow *ui;
+};
+#endif // MAINWINDOW_H
diff --git a/appl/research/mainwindow.ui b/appl/research/mainwindow.ui
new file mode 100644 (file)
index 0000000..c35be51
--- /dev/null
@@ -0,0 +1,531 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>869</width>
+    <height>627</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <layout class="QVBoxLayout" name="verticalLayout_4">
+    <item>
+     <widget class="QTabWidget" name="tabWidget">
+      <property name="currentIndex">
+       <number>0</number>
+      </property>
+      <widget class="QWidget" name="tabFiles">
+       <attribute name="title">
+        <string>Files</string>
+       </attribute>
+       <layout class="QHBoxLayout" name="horizontalLayout_4">
+        <item>
+         <layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="5,1">
+            <item>
+             <widget class="QTabWidget" name="tabWidgetFileSearch">
+              <property name="maximumSize">
+               <size>
+                <width>16777215</width>
+                <height>175</height>
+               </size>
+              </property>
+              <property name="currentIndex">
+               <number>0</number>
+              </property>
+              <widget class="QWidget" name="tabDirectorySearch">
+               <attribute name="title">
+                <string>Directory search</string>
+               </attribute>
+               <layout class="QFormLayout" name="formLayout_3">
+                <item row="0" column="0">
+                 <widget class="QLabel" name="label">
+                  <property name="text">
+                   <string>Base directory:</string>
+                  </property>
+                 </widget>
+                </item>
+                <item row="0" column="1">
+                 <layout class="QHBoxLayout" name="horizontalLayout_2">
+                  <item>
+                   <widget class="ReComboBox" name="comboBoxBaseDirectory">
+                    <property name="maximumSize">
+                     <size>
+                      <width>16777215</width>
+                      <height>16777215</height>
+                     </size>
+                    </property>
+                    <property name="toolTip">
+                     <string>The files will be searched in this directory or its subdirectories</string>
+                    </property>
+                    <property name="editable">
+                     <bool>true</bool>
+                    </property>
+                    <property name="currentText">
+                     <string notr="true"/>
+                    </property>
+                    <property name="sizeAdjustPolicy">
+                     <enum>QComboBox::AdjustToContents</enum>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <widget class="QPushButton" name="pushButtonSelectBase">
+                    <property name="maximumSize">
+                     <size>
+                      <width>50</width>
+                      <height>16777215</height>
+                     </size>
+                    </property>
+                    <property name="text">
+                     <string notr="true">...</string>
+                    </property>
+                   </widget>
+                  </item>
+                 </layout>
+                </item>
+                <item row="1" column="1">
+                 <layout class="QHBoxLayout" name="horizontalLayout">
+                  <item>
+                   <widget class="QCheckBox" name="checkBoxRecursive">
+                    <property name="text">
+                     <string>Recursive</string>
+                    </property>
+                    <property name="checked">
+                     <bool>true</bool>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <spacer name="horizontalSpacer">
+                    <property name="orientation">
+                     <enum>Qt::Horizontal</enum>
+                    </property>
+                    <property name="sizeHint" stdset="0">
+                     <size>
+                      <width>188</width>
+                      <height>17</height>
+                     </size>
+                    </property>
+                   </spacer>
+                  </item>
+                  <item>
+                   <widget class="QLabel" name="label_3">
+                    <property name="text">
+                     <string>Max. depth:</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <widget class="QLineEdit" name="lineEditMaxDepth">
+                    <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>99</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <widget class="QLabel" name="label_5">
+                    <property name="text">
+                     <string>Min. depth:</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <widget class="QLineEdit" name="lineEditMinDepth">
+                    <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>0</string>
+                    </property>
+                   </widget>
+                  </item>
+                 </layout>
+                </item>
+                <item row="2" column="0">
+                 <widget class="QLabel" name="label_12">
+                  <property name="text">
+                   <string>Patterns:</string>
+                  </property>
+                 </widget>
+                </item>
+                <item row="2" column="1">
+                 <widget class="ReComboBox" name="comboBoxFilePatterns">
+                  <property name="editable">
+                   <bool>true</bool>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </widget>
+              <widget class="QWidget" name="tabSingleFiles">
+               <attribute name="title">
+                <string>Single files</string>
+               </attribute>
+              </widget>
+             </widget>
+            </item>
+            <item>
+             <widget class="QGroupBox" name="groupBox">
+              <property name="maximumSize">
+               <size>
+                <width>16777215</width>
+                <height>175</height>
+               </size>
+              </property>
+              <property name="title">
+               <string>Activity</string>
+              </property>
+              <widget class="QPushButton" name="pushButtonAdd">
+               <property name="geometry">
+                <rect>
+                 <x>19</x>
+                 <y>27</y>
+                 <width>85</width>
+                 <height>33</height>
+                </rect>
+               </property>
+               <property name="text">
+                <string>&amp;Add</string>
+               </property>
+              </widget>
+              <widget class="QPushButton" name="pushButtonClear">
+               <property name="geometry">
+                <rect>
+                 <x>19</x>
+                 <y>67</y>
+                 <width>85</width>
+                 <height>33</height>
+                </rect>
+               </property>
+               <property name="text">
+                <string>&amp;Clear</string>
+               </property>
+              </widget>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <widget class="QTableWidget" name="tableWidget">
+            <attribute name="horizontalHeaderStretchLastSection">
+             <bool>true</bool>
+            </attribute>
+            <column>
+             <property name="text">
+              <string>Name</string>
+             </property>
+            </column>
+            <column>
+             <property name="text">
+              <string>Size</string>
+             </property>
+             <property name="textAlignment">
+              <set>AlignTrailing|AlignVCenter</set>
+             </property>
+            </column>
+            <column>
+             <property name="text">
+              <string>Date</string>
+             </property>
+             <property name="textAlignment">
+              <set>AlignLeading|AlignVCenter</set>
+             </property>
+            </column>
+            <column>
+             <property name="text">
+              <string>Directory</string>
+             </property>
+            </column>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tabText">
+       <attribute name="title">
+        <string>Text</string>
+       </attribute>
+       <layout class="QVBoxLayout" name="verticalLayout_3">
+        <item>
+         <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1">
+          <item>
+           <widget class="QTabWidget" name="tabWidgetText">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>16777215</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="currentIndex">
+             <number>1</number>
+            </property>
+            <widget class="QWidget" name="tabFileFilterPatterns">
+             <attribute name="title">
+              <string>Filter patterns</string>
+             </attribute>
+             <layout class="QFormLayout" name="formLayout_2">
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_6">
+                <property name="text">
+                 <string>Including pattern:</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="ReComboBox" name="comboBoxIncludingPattern">
+                <property name="editable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_7">
+                <property name="text">
+                 <string>Exluding pattern:</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="ReComboBox" name="comboBoxExcludingPattern">
+                <property name="editable">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+            <widget class="QWidget" name="tabOptions">
+             <attribute name="title">
+              <string>Options</string>
+             </attribute>
+             <widget class="QWidget" name="">
+              <property name="geometry">
+               <rect>
+                <x>175</x>
+                <y>10</y>
+                <width>321</width>
+                <height>35</height>
+               </rect>
+              </property>
+              <layout class="QHBoxLayout" name="horizontalLayout_6">
+               <item>
+                <widget class="QLabel" name="label_8">
+                 <property name="text">
+                  <string>Lines above:</string>
+                 </property>
+                </widget>
+               </item>
+               <item>
+                <widget class="ReComboBox" name="comboBoxLinesAbove">
+                 <property name="maximumSize">
+                  <size>
+                   <width>50</width>
+                   <height>16777215</height>
+                  </size>
+                 </property>
+                 <property name="editable">
+                  <bool>true</bool>
+                 </property>
+                 <property name="currentText">
+                  <string>0</string>
+                 </property>
+                </widget>
+               </item>
+               <item>
+                <widget class="QLabel" name="label_9">
+                 <property name="text">
+                  <string>Lines below:</string>
+                 </property>
+                </widget>
+               </item>
+               <item>
+                <widget class="ReComboBox" name="comboBoxLinesBelow">
+                 <property name="maximumSize">
+                  <size>
+                   <width>50</width>
+                   <height>16777215</height>
+                  </size>
+                 </property>
+                 <property name="editable">
+                  <bool>true</bool>
+                 </property>
+                 <property name="currentText">
+                  <string notr="true">0</string>
+                 </property>
+                </widget>
+               </item>
+              </layout>
+             </widget>
+            </widget>
+           </widget>
+          </item>
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout_5">
+            <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>
+            <item>
+             <widget class="QLabel" name="label_10">
+              <property name="text">
+               <string>From hit:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="ReComboBox" name="comboBoxFromHit">
+              <property name="maximumSize">
+               <size>
+                <width>100</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+              <property name="currentText">
+               <string>0</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="label_11">
+              <property name="text">
+               <string>To hit:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="ReComboBox" name="comboBoxToHit">
+              <property name="maximumSize">
+               <size>
+                <width>100</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+              <property name="currentText">
+               <string>100</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <widget class="QListWidget" name="listWidgetHits"/>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tabBlock">
+       <attribute name="title">
+        <string>Block</string>
+       </attribute>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>869</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>Fi&amp;le</string>
+    </property>
+    <addaction name="actionExit"/>
+   </widget>
+   <widget class="QMenu" name="menuHilfe">
+    <property name="title">
+     <string>Hel&amp;p</string>
+    </property>
+    <addaction name="actionAbout"/>
+   </widget>
+   <addaction name="menuFile"/>
+   <addaction name="menuHilfe"/>
+  </widget>
+  <widget class="QToolBar" name="mainToolBar">
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+  <action name="actionExit">
+   <property name="text">
+    <string>&amp;Exit</string>
+   </property>
+  </action>
+  <action name="actionAbout">
+   <property name="text">
+    <string>&amp;About</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+  <customwidget>
+   <class>ReComboBox</class>
+   <extends>QComboBox</extends>
+   <header>gui/ReComboBox.hpp</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/appl/research/research.hpp b/appl/research/research.hpp
new file mode 100644 (file)
index 0000000..eaa4d76
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * 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 RESEARCH_HPP
+#define RESEARCH_HPP
+#include "base/rebase.hpp"
+#include "gui/regui.hpp"
+#include <QMainWindow>
+#endif // RESEARCH_HPP
diff --git a/appl/research/research.pro b/appl/research/research.pro
new file mode 100644 (file)
index 0000000..d4d26ba
--- /dev/null
@@ -0,0 +1,49 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2016-11-15T23:03:11
+#
+#-------------------------------------------------
+
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = research
+TEMPLATE = app
+INCLUDEPATH = ../..
+
+
+SOURCES += main.cpp \
+        ../../base/ReException.cpp \
+        ../../base/ReConfig.cpp \
+        ../../base/ReProcess.cpp \
+        ../../base/ReQStringUtils.cpp \
+        ../../base/ReFileUtils.cpp \
+        ../../base/ReMatcher.cpp \
+        ../../base/ReLogger.cpp \
+        ../../base/ReRandomizer.cpp \
+        ../../base/ReStringUtils.cpp \
+        ../../gui/ReComboBox.cpp \
+        ../../gui/ReStateStorage.cpp \
+        ../../gui/ReGuiApplication.cpp \
+        ../../gui/ReGuiValidator.cpp \
+        ../../gui/ReGuiQueue.cpp \
+       ../../gui/ReGuiUtils.cpp \
+               mainwindow.cpp \
+       aboutdialog.cpp \
+    ../../base/ReFileSearch.cpp
+
+HEADERS  += mainwindow.hpp \
+        ../../base/rebase.hpp \
+        ../../base/ReQStringUtils.hpp \
+        ../../gui/ReComboBox.hpp \
+        ../../gui/ReStateStorage.hpp \
+        ../../gui/ReGuiValidator.hpp \
+        ../../gui/regui.hpp \
+       ../../gui/ReGuiUtils.hpp \
+       aboutdialog.hpp \
+       research.hpp \
+    ../../base/ReFileSearch.hpp
+
+FORMS    += mainwindow.ui \
+       aboutdialog.ui
index ae1bad8afb9b81fd63a1bfc3a8b196c037ce178d..71bcc97b35dff86d3ef10d98a2a762fa92d877d6 100644 (file)
@@ -535,6 +535,11 @@ bool ReFile::findLine(const QString& includePattern, bool includeIsRegExpr,
        bool includeIgnoreCase, const QString& excludePattern,
        bool excludeIsRegExpr, bool excludeIgnoreCase, int& lineNo, QString* line) {
        bool rc = false;
+       ReUseParameter(includeIgnoreCase);
+       ReUseParameter(includeIsRegExpr);
+       ReUseParameter(excludeIsRegExpr);
+       ReUseParameter(excludeIgnoreCase);
+       ReUseParameter(excludePattern);
        if (line != NULL)
                *line = "";
        lineNo = 0;
diff --git a/base/ReFileSearch.cpp b/base/ReFileSearch.cpp
new file mode 100644 (file)
index 0000000..bfd947e
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * 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 "base/rebase.hpp"
+
+/**
+ * Constructor.
+ */
+ReFileSearch::ReFileSearch() :
+       m_minDepth(0),
+       m_maxDepth(9999),
+       m_searchMode(smFilesAndDirs),
+       m_matcher()
+{
+}
+
+/**
+ * Returns the current maximal depth.
+ *
+ * @return the current maximal depth
+ */
+int ReFileSearch::maxDepth() const
+{
+       return m_maxDepth;
+}
+
+/**
+ * Returns the current minimal depth.
+ *
+ * @return the current minimal depth
+ */
+int ReFileSearch::minDepth() const
+{
+       return m_minDepth;
+}
+
+void ReFileSearch::oneDirectory(const QString& directory, int depth)
+{
+       QDir dir(directory);
+       QStringList files = dir.entryList();
+       QString node;
+       QString full;
+       QStringList dirs;
+       for (int ix = 0; ix < files.size(); ix++){
+               node = files[ix];
+        if (node == "." || node == "..")
+            continue;
+               full = directory;
+               full += OS_SEPARATOR;
+               full += node;
+               QFileInfo info(full);
+               if (! info.isDir()){
+                       if (m_searchMode == smDirs || depth < m_minDepth){
+                               continue;
+                       }
+               } else {
+                       if (depth < m_maxDepth)
+                               dirs += full;
+
+                       if (m_searchMode == smFiles || depth < m_minDepth){
+                               continue;
+                       }
+               }
+               if (m_matcher.matches(node))
+                       handleFile(full, directory, node);
+       }
+       ++depth;
+       for (int ix = 0; ix < dirs.size(); ix++){
+               oneDirectory(directory + OS_SEPARATOR_STR + dirs[ix], depth);
+       }
+}
+
+/**
+ * Returns the current search mode.
+ *
+ * @return the current search mode, e.g. <i>smFilesAndDirs</i>
+ */
+ReFileSearch::SearchMode ReFileSearch::searchMode() const
+{
+       return m_searchMode;
+}
+
+/**
+ * Sets the file search mode.
+ *
+ * @param searchMode   the new mode, e.g. <i>smFilesAndDirs</i>
+ */
+void ReFileSearch::setSearchMode(const SearchMode& searchMode)
+{
+       m_searchMode = searchMode;
+}
+
+/**
+ * Sets the maximal depth.
+ *
+ * @param maxDepth     the maximal depth
+ */
+void ReFileSearch::setMaxDepth(int maxDepth)
+{
+       m_maxDepth = maxDepth;
+}
+
+/**
+ * Sets the minimal depth.
+ *
+ * @param maxDepth     the minimal depth
+ */
+void ReFileSearch::setMinDepth(int minDepth)
+{
+       m_minDepth = minDepth;
+}
+
+/**
+ * Sets the search patterns.
+ *
+ * @param includeExcludePatterns       a list of patterns, separated by ','.
+ *                                                                     Exclude patterns start with '-'
+ */
+void ReFileSearch::setPatterns(const QString& includeExcludePatterns)
+{
+       m_matcher.setPatterns(includeExcludePatterns, ',', '-');
+}
diff --git a/base/ReFileSearch.hpp b/base/ReFileSearch.hpp
new file mode 100644 (file)
index 0000000..cd777d1
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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 REFILESEARCH_HPP
+#define REFILESEARCH_HPP
+
+/**
+ * An abstract class to search files in a directory tree.
+ *
+ *
+ */
+class ReFileSearch
+{
+public:
+       enum SearchMode {
+               smUndef,
+               smFiles,
+               smDirs,
+               smFilesAndDirs
+       };
+
+public:
+       ReFileSearch();
+public:
+       virtual void handleFile(const QString& full, const QString& path, const QString& node) = 0;
+       int maxDepth() const;
+       int minDepth() const;
+       void oneDirectory(const QString& directory, int depth);
+       SearchMode searchMode() const;
+       void setMaxDepth(int maxDepth);
+       void setMinDepth(int minDepth);
+       void setPatterns(const QString& includeExcludePattern);
+       void setSearchMode(const SearchMode& searchMode);
+public:
+       int m_minDepth;
+       int m_maxDepth;
+       SearchMode m_searchMode;
+       ReIncludeExcludeMatcher m_matcher;
+};
+
+#endif // REFILESEARCH_HPP
index 0bfafe8b6bd48189444ae9866e6f2785460e03ef..8b53943b6838e2d04cab5c6dc7467f611e6b1765 100644 (file)
@@ -29,14 +29,6 @@ QDateTime ReFileUtils::m_undefinedTime;
 ReMountInfo* ReMountInfo::m_instance = NULL;
 ReBlockDevices* ReBlockDevices::m_instance = NULL;
 #endif
-/**
- * Constructor.
- */
-ReTreeStatistic::ReTreeStatistic() :
-               m_files(0),
-               m_directories(0),
-               m_fileSizes(0L) {
-}
 
 /**
  * Builds a checksum of the given file.
@@ -668,7 +660,7 @@ ReSuccess_t ReFileUtils::makeDirWithParents(const char* path, ReLogger* logger)
                        }
                }
        }
-       if (! rc)
+       if (! rc && logger != NULL)
                logger->log(LOG_ERROR, LOC_MAKE_DIR_WITH_PARENT_1,
                                        QObject::tr("can't create directory (%1): %2").arg(errno)
                                        .arg(path));
index 3ffb5aaa34f440f8a246a831295e9141c91f619a..0d5309885d0bf74eb5394d22be0e383301d15cc2 100644 (file)
 #define REFILEUTILS_HPP
 
 /**
- * Statistic of a directory tree.
+ * Simple counters of a directory tree.
  */
-class ReTreeStatistic {
-       ReTreeStatistic();
+class ReFileTreeCounter
+{
 public:
+       /**
+        * Constructor.
+        */
+       ReFileTreeCounter() :
+               m_bytes(0),
+               m_files(0),
+               m_directories(0LL)
+       {}
+       /**
+        * Copy Constructor.
+        * @param source        instance to copy
+        */
+       ReFileTreeCounter(const ReFileTreeCounter& source) :
+               m_bytes(source.m_bytes),
+               m_files(source.m_files),
+               m_directories(source.m_directories)
+       {
+       }
+       /**
+        * Assignment operator.
+        * @param source
+        * @return
+        */
+       ReFileTreeCounter& operator =(const ReFileTreeCounter& source){
+               m_bytes = source.m_bytes;
+               m_files = source.m_files;
+               m_directories = source.m_directories;
+               return *this;
+       }
+public:
+       /**
+        * Sets the counters to 0.
+        */
+       inline void clear(){
+               m_files = m_directories = 0;
+               m_bytes = 0;
+       }
+       /**
+        * Add a file to the statistic.
+        *
+        * @param size  the file's size
+        */
+       inline void addFile(qint64 size){
+               m_bytes += size;
+               ++m_files;
+       }
+       /**
+        * Increments the count of directories.
+        */
+       inline void addDir(){
+               ++m_directories;
+       }
+       /**
+        * Returns the sum of file sizes.
+        * @return the sum of file sizes
+        */
+       qint64 bytes() const {
+               return m_bytes;
+       }
+       /**
+        * Returns the number of files.
+        * @return the number of files
+        */
+       int files() const {
+               return m_files;
+       }
+       /**
+        * Returns the number of files.
+        * @return the number of files
+        */
+       int directories() const {
+               return m_directories;
+       }
+protected:
+       qint64 m_bytes;
        int m_files;
        int m_directories;
-       int64_t m_fileSizes;
+};
+
+/**
+ * Statistic of a directory tree.
+ */
+class ReFileTreeStatistic
+{
+public:
+       /**
+        * Constructor.
+        */
+       ReFileTreeStatistic() :
+               m_hot(),
+               m_processed(),
+               m_matched(),
+               m_total()
+       {}
+public:
+       /**
+        * Sets all counters to 0.
+        */
+       inline void clear(){
+               m_hot.clear();
+               m_processed.clear();
+               m_matched.clear();
+               m_total.clear();
+       }
+public:
+       ReFileTreeCounter m_hot;
+       ReFileTreeCounter m_processed;
+       ReFileTreeCounter m_matched;
+       ReFileTreeCounter m_total;
 };
 
 /**
index 6904efded5bdd676921da668ce6b0077832894e4..2352993cc243d694fb85ae475ed4a133a36d8fae 100644 (file)
@@ -291,10 +291,11 @@ ReRandomizer::~ReRandomizer() {
 inline int abs(int x) {
        return x < 0 ? -x : x;
 }
+#ifndef _GLIBCXX_CSTDLIB
 inline int64_t abs(int64_t x){
        return x < 0 ? -x : x;
 }
-
+#endif
 #endif
 
 /**
index 2f93a66435cb22cc7eeaac96485d171f6676a133..e431e735b545edbac5561c6959d2eb59b2b09679 100644 (file)
@@ -220,6 +220,7 @@ public:
 #include "base/ReFile.hpp"
 #include "base/ReDiff.hpp"
 #include "base/ReMatcher.hpp"
+#include "base/ReFileSearch.hpp"
 #include "base/ReTest.hpp"
 #include "base/ReRandomizer.hpp"
 #endif // REBASE_HPP
index e631b20fa2e480284de4aaf3ce46e9cf1241fcc8..b46f410df09953a7c5926dc48dafcbbf259fae54 100644 (file)
@@ -19,7 +19,7 @@
 #define TRACE2(format, a1, a2) printf(format, a1, a2)
 #define TRACE_IT(args) printf args
 #define IF_TRACE(statem) statem
-#define DECLARE_TRACER(varName, fileName) static ReTracer varName(fileName)
+#define DECLARE_TRACER(varName, fileName) static ReTracer varName(fileName);
 // Example: FILETRACE_IT(s_tracerLoop, (s_tracerLoop.m_fp, "value: %d", 33));
 #define FILETRACE_IT(varName, args) do { if (varName.m_fp != NULL) { \
        fprintf args; fflush(varName.m_fp); } } while(false)
index cc5dc8119a48e8ad5cd8ebf11df62b0d2aaddb43..b6dff3bfee40a833f5c691642927dcdc71203305 100644 (file)
@@ -18,6 +18,7 @@
 static bool s_allTest = false;
 
 static void testBase() {
+       void testReFileSearch();
        void testReProgArgs();
        void testReProcess();
        void testReRandomizer();
@@ -32,6 +33,7 @@ static void testBase() {
        void testReWriter();
        void testReFile();
        void testReMatcher();
+       testReFileSearch();
        testReFileUtils();
        testReQStringUtil();
        testReProgArgs();
diff --git a/cunit/cuReFileSearch.cpp b/cunit/cuReFileSearch.cpp
new file mode 100644 (file)
index 0000000..32b4d2c
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * cuReFileSearch.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 "base/rebase.hpp"
+#include <QMap>
+
+/** @file
+ * @brief Unit test of the basic exceptions.
+ */
+
+class TestReFileSearch: public ReTest, public ReFileSearch {
+public:
+       TestReFileSearch() :
+                       ReTest("ReFileSearch") {
+               doIt();
+       }
+
+public:
+       void testBasic() {
+        m_found.clear();
+        setPatterns("test3.txt");
+        setSearchMode(smFiles);
+        oneDirectory(m_baseDir, 0);
+        checkEqu(5, m_found.size());
+        checkT(m_found.contains("file3.txt"));
+        checkT(m_found.contains("dir1/file3.txt"));
+        checkT(m_found.contains("dir1/dir2/file3.txt"));
+        checkT(m_found.contains("dir1/dir2/dir3/file3.txt"));
+        checkT(m_found.contains("dir1/dir2/dir3/dir4/file3.txt"));
+    }
+       virtual void handleFile(const QString& full, const QString& path, const QString& node){
+        checkEqu(full, path + OS_SEPARATOR_STR + node);
+        QString relPath = full.mid(m_baseDir.length() + 1);
+        relPath.replace(OS_SEPARATOR, "/");
+        m_found.insert(relPath, 0);
+       }
+private:
+    void makeFile(const QString& name){
+        ReFileUtils::writeToFile(name.toUtf8().data(), name.toUtf8().data());
+    }
+
+    void makeTree(){
+        m_baseDir = ReFileUtils::tempDir("ReFileSearch", NULL, false);
+        QString path = m_baseDir;
+        for (int depth = 0; depth < 5; depth++){
+            if (depth > 0)
+                path += OS_SEPARATOR_STR + QString("dir") + QString::number(depth);
+            ReFileUtils::makeDirWithParents(path);
+            for (int ix = 1; ix <= 5; ix++){
+                QString name = path + OS_SEPARATOR_STR + "file" + QString::number(ix) + ".txt";
+                makeFile(name);
+            }
+        }
+    }
+
+       virtual void runTests() {
+        makeTree();
+               testBasic();
+       }
+private:
+    QString m_baseDir;
+    QMap<QString, int> m_found;
+};
+void testReFileSearch() {
+       TestReFileSearch test;
+}
+
index e510dc247107f45741dabd587df5ab5c409477f2..797d02d311cfe517841d53d97d5073afec269710 100644 (file)
@@ -26,6 +26,7 @@ SOURCES += main.cpp \
         ../base/ReContainer.cpp \
         ../base/ReException.cpp \
         ../base/ReFile.cpp \
+        ../base/ReFileSearch.cpp \
         ../base/ReFileUtils.cpp \
         ../base/ReQStringUtils.cpp \
         ../base/ReLogger.cpp \
@@ -56,7 +57,9 @@ SOURCES += main.cpp \
         cuReByteStorage.cpp \
        cuReProgArgs.cpp \
        ../base/ReProcess.cpp \
-       ../base/ReProgramArgs.cpp
+       ../base/ReProgramArgs.cpp \
+       ../cunit/cuReFileSearch.cpp
+
 
 RESERVE =      \
        cuReEdit.cpp \
@@ -67,7 +70,7 @@ RESERVE =     \
         cuReCryptFileSystem.cpp \
 
 HEADERS += \
-        ../base/ReFile.hpp \
+        ../base/ReFileSearch.hpp \
         ../base/rebase.hpp \
        ../gui/ReEdit.hpp \
        ../math/ReMatrix.hpp \
index 2eea037dbb128a2f5014aa04766a1ffa9203032a..87435f46a2e0e86d6fbdb8091044e98d1dada096 100644 (file)
@@ -7,6 +7,9 @@
 */
 #include "base/rebase.hpp"
 #include "gui/regui.hpp"
+#include "gui/ReComboBox.hpp"
+
+int ReComboBox::m_defaultHistorySize = 20;
 
 /**
  * Constructor.
 ReComboBox::ReComboBox(QWidget *parent) :
        QComboBox(parent),
        m_oldString(),
-       m_historySize(0)
+       m_historySize(m_defaultHistorySize)
+{
+}
+
+/**
+ * Destructor.
+ */
+ReComboBox::~ReComboBox()
 {
 }
 
@@ -51,7 +61,7 @@ void ReComboBox::focusOutEvent(QFocusEvent* event)
                                        removeItem(m_historySize);
 
                        }
-                       comboTextEdited(m_oldString, current);
+                       emit textEdited(m_oldString, current);
                }
        }
        QComboBox::focusOutEvent(event);
@@ -69,10 +79,21 @@ int ReComboBox::historySize() const
 }
 
 /**
- * @brief ReComboBox::setHistorySize
- * @param size
+ * Sets the history size of the instance.
+ *
+ * @param size  the new size
  */
 void ReComboBox::setHistorySize(int size)
 {
        m_historySize = size;
 }
+
+/**
+ * Sets the default history size used at the initialization of a <i>ReComboBox</i>.
+ *
+ * @param size  the new size
+ */
+void ReComboBox::setDefaultHistorySize(int size)
+{
+       m_defaultHistorySize = size;
+}
index 5cfa16c87dd5b69a64dec67d0f4901418b0abb78..6304d1c2962f8270717f5472f5e5217db95f7c4d 100644 (file)
@@ -17,18 +17,28 @@ class ReComboBox : public QComboBox
        Q_OBJECT
 public:
        explicit ReComboBox(QWidget *parent = 0);
+       virtual ~ReComboBox();
 public:
        int historySize() const;
        void setHistorySize(int size);
-
+public:
+       static void setDefaultHistorySize(int size);
 signals:
-       void comboTextEdited(const QString& oldText, const QString& newText);
+       /**
+        * Signal if the text of the combobox has changed after loosing the focus.
+        *
+        * @param oldText       the old text (while got the focus)
+        * @param newText       the current text
+        */
+       void textEdited(const QString&, const QString&);
 private:
-       virtual void focusInEvent(QFocusEvent* event);
-       virtual void focusOutEvent(QFocusEvent* event);
+       void focusInEvent(QFocusEvent* event);
+       void focusOutEvent(QFocusEvent* event);
 private:
        QString m_oldString;
        int m_historySize;
+private:
+       static int m_defaultHistorySize;
 };
 
 #endif // RECOMBOBOX_HPP
index 57341376ef6199023644c4dc56c28985d6f01612..135d639801f14f19e71a5d425908427697f1bc51 100644 (file)
@@ -71,8 +71,8 @@ typedef QMap<QByteArray, QList<ReProperty*>*> ReChapterMap;
 
 class ReSettings {
 public:
-       static QString sTRUE;
-       static QString sFALSE;
+       static QString TRUE;
+       static QString FALSE;
 public:
        ReSettings(const QString& path, const QString& prefix, ReLogger* logger);
        ~ReSettings();
index 566e3c609927c6380b2fe9cc2bd64f074577c308..19210930e39adacc5465dd80c9c33ef9ef185d4b 100644 (file)
@@ -18,6 +18,7 @@
 #include <QListWidget>
 #include <QAction>
 #include <QApplication>
+#include "gui/ReComboBox.hpp"
 #include "gui/ReGuiUtils.hpp"
 #include "gui/ReGuiQueue.hpp"
 #include "gui/ReStateStorage.hpp"
@@ -26,7 +27,6 @@
 #include "gui/ReEdit.hpp"
 #include "gui/ReSettings.hpp"
 #include "gui/ReFileTree.hpp"
-#include "gui/ReComboBox.hpp"
 
 /**
  * Tests whether a point is inside the rectangle (including border).
index 7a5c2f9eace6537c8f64c9517426ac4081a17aee..74daacbb47bfbbece925b53049d3ca41d7e972b6 100644 (file)
@@ -251,6 +251,10 @@ ReFileSystem::ErrorCode ReCryptFileSystem::makeDir(const QString& node) {
  */
 ReFileSystem::ErrorCode ReCryptFileSystem::read(const ReFileMetaData& source,
        int64_t offset, int size, QByteArray& buffer) {
+       ReUseParameter(source);
+       ReUseParameter(offset);
+       ReUseParameter(size);
+       ReUseParameter(buffer);
        return EC_SUCCESS;
 }
 
@@ -260,6 +264,7 @@ ReFileSystem::ErrorCode ReCryptFileSystem::read(const ReFileMetaData& source,
  */
 ReFileSystem::ErrorCode ReCryptFileSystem::remove(const ReFileMetaData& node)
 {
+       ReUseParameter(node);
        return EC_SUCCESS;
 }
 
@@ -272,6 +277,7 @@ ReFileSystem::ErrorCode ReCryptFileSystem::remove(const ReFileMetaData& node)
  */
 ReFileSystem::ErrorCode ReCryptFileSystem::setDirectory(const QString& path)
 {
+       ReUseParameter(path);
        return EC_SUCCESS;
 }
 
@@ -288,6 +294,9 @@ ReFileSystem::ErrorCode ReCryptFileSystem::setDirectory(const QString& path)
 ReFileSystem::ErrorCode ReCryptFileSystem::setProperties(const ReFileMetaData& source,
                                                                                   ReFileMetaData& target, bool force)
 {
+       ReUseParameter(source);
+       ReUseParameter(target);
+       ReUseParameter(force);
        return EC_SUCCESS;
 }
 
@@ -473,7 +482,7 @@ bool ReCryptDirectory::removeEntry(const QString& node)
                rc = ! m_logger->logv(LOG_ERROR, LOC_REMOVE_ENTRY_1, "cannot remove file %s: not found",
                                                          I18N::s2b(node).constData());
        else {
-               ReFileMetaData& entry2 = *(ReFileMetaData*) entry;
+               //ReFileMetaData& entry2 = *(ReFileMetaData*) entry;
                //@ToDo:
                //m_list.removeOne(entry2);
                assert(false);
@@ -899,6 +908,8 @@ ReFileSystem::ErrorCode ReCryptLeafFile::close()
  */
 ReFileSystem::ErrorCode ReCryptLeafFile::read(int size, QByteArray& buffer)
 {
+       ReUseParameter(size);
+       ReUseParameter(buffer);
        ReFileSystem::ErrorCode rc = ReFileSystem::EC_SUCCESS;
 
        return rc;