QString relPath, node;
QString info;
QDateTime start = QDateTime::currentDateTime();
+ int hotFiles, processedFiles;
+ qint64 processedBytes, hotBytes;
while (! m_shouldStop){
m_mutex.lock();
if (m_files.size() == 0)
info = m_files.first();
m_files.removeFirst();
}
+ hotBytes = m_hotBytes;
+ processedBytes = m_processedBytes;
+ hotFiles = m_hotFiles;
+ processedFiles = m_processedFiles;
m_mutex.unlock();
if (info.isEmpty()){
if (m_searchReady)
copyFile(index, relPath, node);
if (m_verboseLevel > VerboseQuiet){
qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
- double factor = double(m_processedBytes) / max(1LL, m_hotBytes);
+ double factor = processedBytes / max(1.0, (double) hotBytes);
+ if (factor > 1.0)
+ factor = 1;
m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
- .arg(m_processedFiles).arg(m_hotFiles)
- .arg(ReQStringUtils::readableSize(m_processedBytes))
- .arg(ReQStringUtils::readableSize(m_hotBytes))
- .arg(m_processedBytes / 1024.0 / 1024 * 1000 / max(1LL, duration), 0, 'f', 3)
+ .arg(processedFiles).arg(hotFiles)
+ .arg(ReQStringUtils::readableSize(processedBytes))
+ .arg(ReQStringUtils::readableSize(hotBytes))
+ .arg(processedBytes / 1024.0 / 1024 * 1000 / max(1LL, duration), 0, 'f', 3)
.arg(ReQStringUtils::runtimeEstimation(start, factor)));
}
}
m_mutex.unlock();
now = QDateTime::currentMSecsSinceEpoch();
qint64 duration = (now - start.toMSecsSinceEpoch());
- double factor = processedBytes / double(max(1LL, hotBytes));
+ double factor = processedBytes / max(1.0, (double) hotBytes);
+ if (factor > 1)
+ factor = 1;
m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
.arg(processedFiles).arg(hotFiles * 2)
node = info.mid(pos + 2);
switch(command){
case CmdRemove:
- if (unlink(I18N::s2b(relPath)) != 0){
+ if (_unlink(I18N::s2b(relPath)) != 0){
int errNo = errno;
if (stat(I18N::s2b(relPath), &info2) == 0)
error(QObject::tr("cannot delete (%1): %2").arg(errNo)
QByteArray shadow2 = I18N::s2b(shadow);
struct stat info;
if (stat(shadow2.constData(), &info) == 0){
- if (unlink(shadow2.constData()) != 0){
+ if (_unlink(shadow2.constData()) != 0){
error(QObject::tr("cannot delete shadow file (%1): %2").arg(errno).arg(shadow));
}
}
}
}
}
- m_mainWindow->externalTaskFinished(tr("backup complete after %1. Errors: %2")
+ m_mainWindow->externalTaskFinished(tr("clean complete after %1. Errors: %2")
.arg(ReQStringUtils::readableDuration(
QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
.arg(m_mainWindow->errors()));
else
subTarget += OS_SEPARATOR_STR;
}
- searchOneDirectory(it2.filePath(), subTarget, index);
+ searchOneDirectory(ReFileUtils::nativePath(it2.filePath()), subTarget, index);
}
}
}
node = it.fileName();
if (it.fileInfo().isDir()){
if (node != "." && node != ".."){
- if (! removeOlder(it.filePath(), time))
+ if (! removeOlder(ReFileUtils::nativePath(it.filePath()), time))
isEmpty = false;
}
} else if (it.fileInfo().lastModified() < time){
if (m_verboseLevel >= VerboseChatty)
- m_mainWindow->addToFileList("% " + it.filePath() + " "
+ m_mainWindow->addToFileList("% " + ReFileUtils::nativePath(it.filePath()) + " "
+ it.fileInfo().lastModified().toString("yyyy.MM.dd/hh:mm:ss"));
isEmpty = false;
- info = QChar(MAX_INDEX) + it.filePath() + m_separatorString
+ info = QChar(MAX_INDEX) + ReFileUtils::nativePath(it.filePath()) + m_separatorString
+ QChar(CmdRemove);
m_mutex.lock();
m_files.append(info);
m_hotBytes += it.fileInfo().size();
m_totalFiles++;
m_mutex.unlock();
- }
- }
+ }else {
+ isEmpty = false;
+ }
+ }
if (isEmpty){
if (m_verboseLevel >= VerboseChatty)
m_mainWindow->addToFileList("x " + directory);
m_mutex.lock();
m_totalDirs++;
m_mutex.unlock();
- if (source.length() > lengthBase){
- relPath = ReFileUtils::nativePath(source.mid(lengthBase));
- prefix = QChar(1 + index) + relPath + OS_SEPARATOR_STR + m_separator;
+ if (target.length() > lengthBase){
+ relPath = ReFileUtils::nativePath(target.mid(lengthBase)) + OS_SEPARATOR_STR;
+ prefix = QChar(1 + index) + relPath + m_separator;
} else {
prefix = QChar(1 + index) + m_separatorString;
}
QDateTime trgTime = trg.lastModified();
if (trgTime < m_maxAge){
command = CmdRemove;
- info = QChar(1 + index) + it.filePath() + "\t" + QChar(command);
+ info = QChar(1 + index) + ReFileUtils::nativePath(it.filePath())
+ + "\t" + QChar(command);
} else {
command = CmdMove;
info = prefix + QChar(command) + it.fileName();
QString newSource = source + it2.fileName();
QFileInfo src(newSource);
if (src.exists() && src.isDir())
- searchOneDirectory(it2.filePath(), newSource + OS_SEPARATOR_STR, index);
+ searchOneDirectory(ReFileUtils::nativePath(it2.filePath()),
+ newSource + OS_SEPARATOR_STR, index);
else{
- moveToShadow(it2.filePath(), relPath, index);
+ moveToShadow(ReFileUtils::nativePath(it2.filePath()), relPath, index);
}
}
}
#include "aboutdialog.hpp"
#include <QFileDialog>
-const QString VERSION("2016.02.13");
+const QString VERSION("2016.02.14");
/**
* Constructor.
connect(ui->pushButtonClearErrorList, SIGNAL(clicked()), this, SLOT(onClearErrorList()));
connect(ui->pushButtonClear, SIGNAL(clicked()), this, SLOT(onClearLog()));
connect(ui->pushButtonClean, SIGNAL(clicked()), this, SLOT(onClean()));
+ connect(ui->comboBoxVerbose, SIGNAL(currentIndexChanged(int)), this, SLOT(onVerboseIndexChanged(int)));
m_configuration.load("");
ui->tableWidgetConfiguration->selectRow(0);
updateTable();
* otherwise: error occurred
*/
bool MainWindow::initializeStart(){
+ setStatusMessage(LOG_INFO, QObject::tr("Search started..."));
bool rc = true;
- BackupEngine::m_searchReady = false;
- BackupEngine::m_hotBytes = 0;
+ BackupEngine::m_shouldStop = false;
+ BackupEngine::m_searchReady = false;
+ BackupEngine::m_hotBytes = 0;
BackupEngine::m_hotFiles = 0;
BackupEngine::m_matchedFiles = 0;
BackupEngine::m_totalDirs = 0;
item.m_sources.append(ui->listWidgetSource->item(ix)->text());
}
updateTable();
- saveState();
+ saveState();
+}
+
+/**
+ * The verbose level has been changed.
+ * @param index the new current index of the combobox
+ */
+void MainWindow::onVerboseIndexChanged(int index)
+{
+ BackupEngine::m_verboseLevel = (ReVerbose_t) index;
}
/**
ui->actionStop->setEnabled(isStart);
ui->pushButtonBackup->setEnabled(! isStart);
ui->pushButtonStop->setEnabled(isStart);
- ui->pushButtonChecksum->setEnabled(! isStart);
- ui->actionChecksums->setEnabled(! isStart);
+ ui->pushButtonChecksum->setEnabled(! isStart);
+ ui->pushButtonClean->setEnabled(! isStart);
+ ui->actionChecksums->setEnabled(! isStart);
if (isStart)
BackupEngine::m_verboseLevel = (ReVerbose_t) ui->comboBoxVerbose->currentIndex();
}