]> gitweb.hamatoma.de Git - reqt/commitdiff
full target path in "last file"
authorhama <hama@siduction.net>
Tue, 24 May 2016 22:38:08 +0000 (00:38 +0200)
committerhama <hama@siduction.net>
Tue, 24 May 2016 22:38:08 +0000 (00:38 +0200)
appl/rebackgui/BackupEngine.cpp
appl/rebackgui/mainwindow.cpp
appl/rebackgui/mainwindow.hpp
appl/rebackgui/mainwindow.ui
base/ReFileUtils.cpp

index eb4f80f8ac4b90a1223fa92d0ea9c7e0cfdcad85..4a4cb323024b33c93f0555aef2205b2c5a4e5a24 100644 (file)
@@ -174,7 +174,7 @@ void BackupTask::copyFile(int index, const QString& relPath,
        }
        QFileInfo sourceInfo(source);
        if (m_verboseLevel >= VerboseStandard)
-               m_mainWindow->addToFileList(source + " " + ReQStringUtils::readableSize(sourceInfo.size()));
+               m_mainWindow->addToFileList(target + " " + ReQStringUtils::readableSize(sourceInfo.size()));
        m_mutex.lock();
        m_processedFiles++;
        m_processedBytes += sourceInfo.size();
@@ -205,6 +205,7 @@ void BackupTask::run()
        QDateTime start = QDateTime::currentDateTime();
        int hotFiles, processedFiles;
        qint64 processedBytes, hotBytes;
+       int lastIndex = -1;
        while (! m_shouldStop){
                m_mutex.lock();
                if (m_files.size() == 0)
@@ -232,6 +233,10 @@ void BackupTask::run()
                                relPath = info.mid(1, pos - 1);
                        node = info.mid(pos + 1);
                        if (m_searchReady){
+                               if (index != lastIndex){
+                                       lastIndex = index;
+                                       m_mainWindow->setLastTarget(m_targetDirs.at(index));
+                               }
                                m_mainWindow->setLastFile(relPath, node);
                        }
                        copyFile(index, relPath, node);
@@ -985,6 +990,7 @@ void SearchTargetTask::run()
        for (int ix = 0; ! m_shouldStop && ix < m_sourceDirs.size(); ix++){
                sourceDir = m_sourceDirs.at(ix);
                targetDir = m_targetDirs.at(ix);
+               m_mainWindow->setLastTarget(targetDir);
                searchOneDirectory(targetDir, sourceDir, ix);
        }
        if (! m_shouldStop && ReFileUtils::isDirectory(m_shadowBaseDir)){
index da223e27f57270c89959412277028951bfcb7ae4..903063fa940283d6dac213bd79e235f887ab6979 100644 (file)
@@ -16,7 +16,7 @@
 #include "base/retrace.hpp"
 DECLARE_TRACER(s_traceMain, "/tmp/bup_main.log");
 
-const QString VERSION("2016.04.07");
+const QString VERSION("2016.05.17");
 
 /**
  * Constructor.
@@ -44,6 +44,7 @@ MainWindow::MainWindow(QApplication& application, const QString& homeDir,
        m_mutexLastFile(),
        m_lastFile(""),
        m_lastDirectory(""),
+       m_lastTarget(""),
        m_textChangeLocked(false),
        m_temporaryMounted("")
 {
@@ -189,7 +190,7 @@ void MainWindow::onGuiTimerUpdate()
                item.m_type = ReGuiQueueItem::Undef;
        }
        m_mutexLastFile.lock();
-       ui->labelLastFile->setText(m_lastDirectory + m_lastFile);
+       ui->labelLastFile->setText(m_lastTarget + m_lastDirectory + m_lastFile);
        m_mutexLastFile.unlock();
        if (!statusMessage.isEmpty())
                setStatusMessage(LOG_INFO, statusMessage);
@@ -714,6 +715,16 @@ void MainWindow::onVerboseIndexChanged(int index)
        BackupEngine::m_verboseLevel = (ReVerbose_t) index;
 }
 
+void MainWindow::setLastTarget(const QString& lastTarget)
+{
+       m_lastTarget = lastTarget;
+}
+
+QString MainWindow::lastDirectory() const
+{
+       return m_lastDirectory;
+}
+
 /**
  * Reads the history of the widget values and other parameters and set it.
  */
index 366c3e93e9a6a6f12766662bc1abc158c08e7901..6714d7d920311f4b8fa20a535dc46b9000980edf 100644 (file)
@@ -39,7 +39,9 @@ public:
    void setLastFile(const QString& lastDir, const QString& lastFile);
    void saveState();
    void unmount(const QString& device);
-protected slots:
+   QString lastDirectory() const;
+   void setLastTarget(const QString& lastTarget);
+
 private:
    void extractTarget(const QString& dir);
    void initializeGui();
@@ -96,6 +98,7 @@ private:
        QMutex m_mutexLastFile;
        QString m_lastFile;
        QString m_lastDirectory;
+       QString m_lastTarget;
        bool m_textChangeLocked;
        QString m_temporaryMounted;
 };
index 4beba4990058cff7e433b179df66f8eaa94196c1..6c4bdf108fb3ea0812a4c11d54e8a4034d62c40f 100644 (file)
                 <property name="editable">
                  <bool>true</bool>
                 </property>
+                <item>
+                 <property name="text">
+                  <string>*,*~,*.bak</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>*</string>
+                 </property>
+                </item>
                </widget>
               </item>
               <item>
                 <property name="editable">
                  <bool>true</bool>
                 </property>
+                <item>
+                 <property name="text">
+                  <string>*,-*cache*,*thumbnails*</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>*</string>
+                 </property>
+                </item>
                </widget>
               </item>
              </layout>
index 4a86676d5aa7cc001570f89cc74e473bc93300f7..5ba8580e19ceb533ddb5608f9e66232c216bdbcb 100644 (file)
@@ -1239,10 +1239,11 @@ void ReMountInfo::load()
        QByteArrayList lines = output.split('\n');
        QString device;
        QRegularExpression regExpr("^(.*?) on (.*) type ");
-       QString relativePath;
        QString line;
        QString directory;
        for (int ix = 0; ix < lines.size(); ix++){
+               if (lines[ix][0] != OS_SEPARATOR)
+                       continue;
                line = I18N::b2s(lines.at(ix));
                QRegularExpressionMatch match = regExpr.match(line);
                if (match.hasMatch()){
@@ -1263,11 +1264,14 @@ void ReMountInfo::load()
 QString ReMountInfo::findDevice(const QString &path)
 {
        QString rc;
-       QMap<QString, QString>::const_iterator it;
-       for (it = m_deviceOfMountPoint.cbegin(); it != m_deviceOfMountPoint.cend(); ++it){
-                       QString path2 = *it;
-                       if (path.startsWith(path2) && path2 != OS_SEPARATOR_STR)
-                               rc = m_deviceOfMountPoint.value(path2);
+       QMapIterator<QString, QString> it(m_deviceOfMountPoint);
+       while(it.hasNext()){
+               it.next();
+               QString path2 = it.key();
+               if (path.startsWith(path2) && path2 != OS_SEPARATOR_STR){
+                       rc = m_deviceOfMountPoint.value(path2);
+                       break;
+               }
        }
        return rc;
 }
@@ -1358,7 +1362,8 @@ const ReBlockDevice* ReBlockDevices::findByDevice(const QString& device) const
        const ReBlockDevice* rc = NULL;
        QList<ReBlockDevice>::const_iterator it;
        for (it = m_devices.cbegin(); it != m_devices.cend(); ++it){
-               if ((*it).m_device == device){
+               QString dev = (*it).m_device;
+               if (dev == device){
                        rc = &*it;
                        break;
                }