From: hama Date: Tue, 24 May 2016 22:38:08 +0000 (+0200) Subject: full target path in "last file" X-Git-Url: https://gitweb.hamatoma.de/?a=commitdiff_plain;h=1062f8fb6d1b8a01dd966ecd3f87b6c7d3b0fb64;p=reqt full target path in "last file" --- diff --git a/appl/rebackgui/BackupEngine.cpp b/appl/rebackgui/BackupEngine.cpp index eb4f80f..4a4cb32 100644 --- a/appl/rebackgui/BackupEngine.cpp +++ b/appl/rebackgui/BackupEngine.cpp @@ -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)){ diff --git a/appl/rebackgui/mainwindow.cpp b/appl/rebackgui/mainwindow.cpp index da223e2..903063f 100644 --- a/appl/rebackgui/mainwindow.cpp +++ b/appl/rebackgui/mainwindow.cpp @@ -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. */ diff --git a/appl/rebackgui/mainwindow.hpp b/appl/rebackgui/mainwindow.hpp index 366c3e9..6714d7d 100644 --- a/appl/rebackgui/mainwindow.hpp +++ b/appl/rebackgui/mainwindow.hpp @@ -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; }; diff --git a/appl/rebackgui/mainwindow.ui b/appl/rebackgui/mainwindow.ui index 4beba49..6c4bdf1 100644 --- a/appl/rebackgui/mainwindow.ui +++ b/appl/rebackgui/mainwindow.ui @@ -577,6 +577,16 @@ true + + + *,*~,*.bak + + + + + * + + @@ -600,6 +610,16 @@ true + + + *,-*cache*,*thumbnails* + + + + + * + + diff --git a/base/ReFileUtils.cpp b/base/ReFileUtils.cpp index 4a86676..5ba8580 100644 --- a/base/ReFileUtils.cpp +++ b/base/ReFileUtils.cpp @@ -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::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 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::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; }