m_totalDirs++;
m_mutex.unlock();
if (source.length() > lengthBase){
- prefix = QChar(1 + index) + source.mid(lengthBase) + OS_SEPARATOR_STR
+ prefix = QChar(1 + index)
+ + ReFileUtils::nativePath(source.mid(lengthBase)) + OS_SEPARATOR_STR
+ m_separator;
} else {
prefix = QChar(1 + index) + m_separatorString;
error(QObject::tr("checksum differs: ") + relPath + node
+ " [" + sourceChecksum + "/" + checksum + "]");
}
- now = QDateTime::currentMSecsSinceEpoch();
- qint64 estimated = (now - start) * m_hotBytes * 2 / max(1LL, m_processedBytes);
+ qint64 processedBytes, hotBytes;
+ int hotFiles, processedFiles;
+ m_mutex.lock();
+ hotFiles = m_hotFiles;
+ hotBytes = m_hotBytes;
+ processedBytes = m_processedBytes;
+ processedFiles = m_processedFiles;
+ m_mutex.unlock();
+ now = QDateTime::currentMSecsSinceEpoch();
+ qint64 duration = (now - start);
+ qint64 estimated = qint64 ((double) duration * (double) hotBytes * 2.0
+ / (double) max(1LL, processedBytes));
+ qint64 rest = estimated - duration;
m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
tr("%1 of %2 (%3 of %4) %5 MB/sec Remaining: %6 of %7")
- .arg(m_processedFiles).arg(m_hotFiles * 2)
- .arg(ReQStringUtils::readableSize(m_processedBytes))
- .arg(ReQStringUtils::readableSize(m_hotBytes * 2))
- .arg(m_processedBytes / 1024.0 / 1024 / (now - start) * 1000, 0, 'f', 3)
- .arg(ReQStringUtils::readableDuration(estimated - (now - start)))
+ .arg(m_processedFiles).arg(hotFiles * 2)
+ .arg(ReQStringUtils::readableSize(processedBytes))
+ .arg(ReQStringUtils::readableSize(hotBytes * 2))
+ .arg(processedBytes / 1024.0 / 1024 / duration * 1000.0, 0, 'f', 3)
+ .arg(ReQStringUtils::readableDuration(rest))
.arg(ReQStringUtils::readableDuration(estimated)));
}
m_backupTask(NULL),
m_checksumOfSourceTask(NULL),
m_checksumOfTargetTask(NULL),
- m_errors(0)
+ m_errors(0),
+ m_maxListSize(1000)
{
ui->setupUi(this);
initializeGuiElements();
void MainWindow::onGuiTimerUpdate()
{
int count = m_guiQueue.count();
+ QListWidget* list;
while(count-- > 0){
m_mutexGuiQueue.lock();
ReGuiQueueItem item = m_guiQueue.popFront();
m_mutexGuiQueue.unlock();
+ if (item.m_type == ReGuiQueueItem::ListEnd
+ && (list = reinterpret_cast<QListWidget*>(item.m_widget))->count() >= m_maxListSize)
+ delete list->takeItem(0);
if (item.m_type == ReGuiQueueItem::Undef)
break;
if (! item.apply()){
/**
* Common initializations for all task starts.
+ *
+ * @return <code>true</code>: success<br>
+ * otherwise: error occurred
*/
-void MainWindow::initializeStart(){
+bool MainWindow::initializeStart(){
+ bool rc = true;
BackupEngine::m_searchReady = false;
BackupEngine::m_hotBytes = 0;
BackupEngine::m_hotFiles = 0;
BackupEngine::m_processedFiles = 0;
BackupEngine::m_processedBytes = 0;
ChecksumTask::m_sourceProcessingReady = false;
+ if ( (m_maxListSize = comboInt(ui->comboBoxMaxListLength, -999)) == -999){
+ rc = false;
+ m_maxListSize = 100;
+ ui->comboBoxMaxListLength->setEditText(QString::number(m_maxListSize));
+ }
m_errors = 0;
startStop(true);
+ if (ui->checkBoxAutoClean->isChecked()){
+ onClearFileList();
+ onClearErrorList();
+ }
+ return rc;
}
/**
public slots:
private:
QString extractTarget(const QString& dir);
- void initializeStart();
+ bool initializeStart();
void writeTargetConfiguration(BackupItem& item, const QString& target);
private slots:
void onAbout();
ChecksumOfSourceTask* m_checksumOfSourceTask;
ChecksumOfTargetTask* m_checksumOfTargetTask;
int m_errors;
+ int m_maxListSize;
};
#endif // MAINWINDOW_HPP
<x>0</x>
<y>0</y>
<width>820</width>
- <height>679</height>
+ <height>662</height>
</rect>
</property>
<property name="windowTitle">
</column>
</widget>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_11">
+ <item>
+ <widget class="QLabel" name="label_10">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Options:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_11">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Max. list length:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBoxMaxListLength">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Max. length of the file list / error list. 0: unlimited</string>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="currentText">
+ <string>100</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBoxAutoClean">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Starting a task cleans filelist and errorlist</string>
+ </property>
+ <property name="text">
+ <string>Start cleans</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
bool rc = true;
if (stat(path, &info) != 0) {
rc = _mkdir(path) == 0;
- if (!rc && logger != NULL)
- logger->log(LOG_ERROR, LOC_MAKE_DIR_1,
- QObject::tr("can't create directory (%1): %2").arg(errno).arg(path));
+ if (!rc){
+ if (logger != NULL)
+ logger->log(LOG_ERROR, LOC_MAKE_DIR_1,
+ QObject::tr("can't create directory (%1): %2").arg(errno).arg(path));
+ }
} else if (!S_ISDIR(info.st_mode)) {
rc = false;
if (logger != NULL)
m_guiQueue(),
m_guiTimer(new QTimer(this)),
m_statusMessage(new QLabel(tr("Welcome!"))),
- m_mutexGuiQueue()
+ m_mutexGuiQueue()
{
m_logger.buildStandardAppender(I18N::s2b(m_homeDir) + applicationName,
maxLogSize, maxLogFiles);
* Constructor.
*/
ReGuiQueue::ReGuiQueue() :
- QVector<ReGuiQueueItem>(),
+ QList<ReGuiQueueItem>(),
m_locker()
{
}
{
QListWidget* list = reinterpret_cast<QListWidget*>(m_widget);
list->addItem(m_value);
- list->setCurrentRow(list->count() - 1);
+ int count = list->count();
+ list->setCurrentRow(count - 1);
break;
}
case ListAppendToCurrent:
* Qt allows manipulating GUI elements only in the main thread.
* This queue allows the exchange of information from other threads.
*/
-class ReGuiQueue : protected QVector<ReGuiQueueItem>
+class ReGuiQueue : protected QList<ReGuiQueueItem>
{
public:
ReGuiQueue();