--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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
--- /dev/null
+<?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>289</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <widget class="QTextEdit" name="textEdit">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>20</y>
+ <width>381</width>
+ <height>221</height>
+ </rect>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="html">
+ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Droid Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600;">ReBackupGui</span><span style=" font-family:'Sans Serif'; font-size:9pt;"> for backup of directories to external media.</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">This is a program of the project</span></p>
+<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600;">Re</span><span style=" font-family:'Sans Serif'; font-size:9pt;">al </span><span style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600;">Pub</span><span style=" font-family:'Sans Serif'; font-size:9pt;">lic </span><span style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600;">Lib</span><span style=" font-family:'Sans Serif'; font-size:9pt;">rary (RePubLib)</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Sources are public domain and available under</span></p>
+<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/republib"><span style=" font-family:'Sans Serif'; font-size:9pt; text-decoration: underline; color:#0000ff;">https://github.com/republib</span></a><span style=" font-family:'Sans Serif'; font-size:9pt;"> </span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Implemented in QT (C++) 5.x</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Icons: Mark James, </span><a href="http://famfamfam.com"><span style=" font-family:'Sans Serif'; font-size:9pt; text-decoration: underline; color:#0000ff;">http://famfamfam.com</span></a><span style=" font-family:'Sans Serif'; font-size:9pt;"> </span></p></body></html></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>250</y>
+ <width>381</width>
+ <height>32</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>&OK</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>196</x>
+ <y>183</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>199</x>
+ <y>108</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
--- /dev/null
+/*
+ * backupgui.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 BACKUPGUI_HPP
+#define BACKUPGUI_HPP
+#include "base/rebase.hpp"
+#include "gui/regui.hpp"
+#include "mainwindow.hpp"
+#include "ui_mainwindow.h"
+
+#endif // BACKUPGUI_HPP
--- /dev/null
+#-------------------------------------------------
+#
+# Project created by QtCreator 2016-01-18T00:51:17
+#
+#-------------------------------------------------
+
+QT += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = rebackgui
+TEMPLATE = app
+INCLUDEPATH = ../..
+
+SOURCES += main.cpp\
+ ../../base/ReException.cpp \
+ ../../base/ReConfig.cpp \
+ ../../base/ReQStringUtils.cpp \
+ ../../base/ReFileUtils.cpp \
+ ../../base/ReMatcher.cpp \
+ ../../base/ReLogger.cpp \
+ ../../base/ReRandomizer.cpp \
+ ../../base/ReStringUtils.cpp \
+ ../../gui/ReStateStorage.cpp \
+ ../../gui/ReGuiApplication.cpp \
+ ../../gui/ReGuiValidator.cpp \
+ ../../gui/ReGuiQueue.cpp \
+ ../../gui/ReGuiUtils.cpp \
+ mainwindow.cpp \
+ aboutdialog.cpp
+
+HEADERS += mainwindow.hpp \
+ ../../base/rebase.hpp \
+ ../../base/ReQStringUtils.hpp \
+ ../../gui/ReStateStorage.hpp \
+ ../../gui/ReGuiValidator.hpp \
+ ../../gui/regui.hpp \
+ ../../gui/ReGuiUtils.hpp \
+ aboutdialog.hpp
+
+FORMS += mainwindow.ui \
+ aboutdialog.ui
+
+DISTFILES += \
+ ReBackGui.html \
+ osconnect.pl
+
--- /dev/null
+/*
+ * main.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 "gui/regui.hpp"
+#include "mainwindow.hpp"
+#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(homeDir);
+ w.show();
+ return a.exec();
+}
--- /dev/null
+/*
+ * mainwindow.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 "example.hpp"
+#include "aboutdialog.hpp"
+#include <QFileDialog>
+
+const QString VERSION("2016.02.14");
+
+/**
+ * Constructor.
+ *
+ * @param homeDir the home directory. If "": usage of the user's homedir
+ * @param parent QT parent or NULL
+ */
+MainWindow::MainWindow(const QString& homeDir, QWidget *parent) :
+ ReGuiApplication("rebackupgui", homeDir, 2, 100100100, parent),
+ ReGuiValidator(),
+ ui(new Ui::MainWindow),
+ m_errors(0)
+{
+ ui->setupUi(this);
+ initializeGuiElements();
+ startStop(false);
+ connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
+ connect(ui->pushButtonStart, SIGNAL(clicked()), this, SLOT(onStart()));
+}
+
+/**
+ * Destructor.
+ */
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+/**
+ * Appends a line to the filelist.
+ *
+ * Note: this method is called by a non main thread.
+ *
+ * @param info info to add
+ */
+void MainWindow::addToFileList(const QString info){
+ // externalAppend(ReGuiQueueItem::ListEnd, ui->listWidgetFile, info);
+}
+
+/**
+ * Returns the error count.
+ * @return the error count
+ */
+int MainWindow::errors() const
+{
+ return m_errors;
+}
+
+
+/**
+ * Set GUI elements from the queue when the GUI timer is triggered.
+ */
+void MainWindow::onGuiTimerUpdate()
+{
+ int count = m_guiQueue.count();
+ QListWidget* list;
+ while(count-- > 0){
+ m_mutexGuiQueue.lock();
+ ReGuiQueueItem item = m_guiQueue.popFront();
+ m_mutexGuiQueue.unlock();
+ int m_maxListSize = 0x7fffffff;
+ 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()){
+ switch (item.m_type){
+ case ReGuiQueueItem::ListEnd:
+ // todo
+ break;
+ case ReGuiQueueItem::ReadyMessage:
+ say(LOG_INFO, item.m_value);
+ startStop(false);
+ break;
+ case ReGuiQueueItem::LogMessage:
+ say(LOG_INFO, item.m_value);
+ break;
+ case ReGuiQueueItem::LogError:
+ say(LOG_ERROR, item.m_value);
+ break;
+ case ReGuiQueueItem::StatusLine:
+ setStatusMessage(LOG_INFO, item.m_value);
+ break;
+ default:
+ say(LOG_ERROR, "unknown item type: " + QString::number(item.m_type)
+ + " " + item.m_value);
+ break;
+ }
+ }
+ }
+}
+
+/**
+ * Common initializations for all task starts.
+ *
+ * @return <code>true</code>: success<br>
+ * otherwise: error occurred
+ */
+bool MainWindow::initializeStart(){
+ bool rc = true;
+ startStop(true);
+ // ToDo
+ return rc;
+}
+
+/**
+ * Called at the program's end.
+ */
+void MainWindow::onAboutToQuit()
+{
+ ReGuiApplication::onAboutToQuit();
+}
+
+/**
+ * Shows the "about" window.
+ */
+void MainWindow::onAbout()
+{
+ AboutDialog dialog(VERSION);
+ dialog.exec();
+}
+
+
+/**
+ * Starts the backup.
+ */
+void MainWindow::onStart(){
+ // ToDo
+}
+
+/**
+ * Reads the history of the widget values and other parameters and set it.
+ */
+void MainWindow::restoreState(){
+ ReStateStorage storage(m_storageFile, &m_logger);
+ storage.setForm("main");
+ //storage.restore(ui->comboBoxFilePatterns, "comboBoxFilePatterns", false);
+ //storage.restore(ui->comboBoxDirPatterns, "comboBoxDirPatterns", false);
+ storage.close();
+}
+
+/**
+ * Stores the history of the widget values and other parameters.
+ */
+void MainWindow::saveState(){
+ ReStateStorage storage(m_storageFile, &m_logger);
+ storage.setForm("main");
+ //storage.store(ui->comboBoxFilePatterns, "comboBoxFilePatterns");
+ //storage.store(ui->comboBoxDirPatterns, "comboBoxDirPatterns");
+ storage.close();
+}
+
+/**
+ * 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){
+ switch(level){
+ case LOG_ERROR:
+ case LOG_WARNING:
+ // todo
+ setStatusMessage(LOG_ERROR, message);
+ m_errors++;
+ break;
+ default:
+ case LOG_INFO:
+ //ui->listWidgetLog->addItem(message);
+ //ui->listWidgetLog->setCurrentRow(ui->listWidgetLog->count() - 1);
+ break;
+ }
+ return level >= LOG_INFO;
+}
+
+/**
+ * Starts or stops the backup.
+ *
+ * @param start <code>true</code>: the search should start
+ */
+void MainWindow::startStop(bool isStart){
+ ReUseParameter(isStart);
+ // ui->actionStart->setEnabled(!isStart);
+ // todo
+}
+
+
+
+
--- /dev/null
+/*
+ * mainwindow.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 MAINWINDOW_HPP
+#define MAINWINDOW_HPP
+#ifndef BACKUPGUI_HPP
+#include "example.hpp"
+#endif
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public ReGuiApplication, public ReGuiValidator
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindow(const QString& homeDir, QWidget *parent = 0);
+ ~MainWindow();
+public:
+ int errors() const;
+ void expandFileList(const QString info);
+ virtual bool say(ReLoggerLevel level, const QString& message);
+ void startStop(bool isStart);
+ void restoreState();
+ void saveState();
+
+ void addToFileList(const QString info);
+private:
+ bool initializeStart();
+private slots:
+ void onAbout();
+ virtual void onAboutToQuit();
+ virtual void onGuiTimerUpdate();
+ void onStart();
+private:
+ Ui::MainWindow *ui;
+ int m_errors;
+};
+
+#endif // MAINWINDOW_HPP
--- /dev/null
+<?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>535</width>
+ <height>405</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <widget class="QPushButton" name="pushButtonStart">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>155</y>
+ <width>106</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>535</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>File</string>
+ </property>
+ <addaction name="separator"/>
+ </widget>
+ <widget class="QMenu" name="menuEdit">
+ <property name="title">
+ <string>Edit</string>
+ </property>
+ </widget>
+ <widget class="QMenu" name="menuHelp">
+ <property name="title">
+ <string>Help</string>
+ </property>
+ <addaction name="actionAbout"/>
+ </widget>
+ <widget class="QMenu" name="menuAction">
+ <property name="title">
+ <string>Action</string>
+ </property>
+ </widget>
+ <addaction name="menuFile"/>
+ <addaction name="menuEdit"/>
+ <addaction name="menuAction"/>
+ <addaction name="menuHelp"/>
+ </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="actionAbout">
+ <property name="text">
+ <string>About</string>
+ </property>
+ </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
node = info.mid(pos + 1);
copyFile(index, relPath, node);
if (m_verboseLevel > VerboseQuiet){
- qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
- double factor = double(m_processedBytes) / max(1LL, m_hotBytes);
+ qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
+ double factor = double(m_processedBytes) / max(1LL, m_hotBytes);
m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
.arg(m_processedFiles).arg(m_hotFiles)
}
m_mainWindow->externalTaskFinished(tr("backup complete after %1. Errors: %2")
.arg(ReQStringUtils::readableDuration(
- QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
+ QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
.arg(m_mainWindow->errors()));
}
+ " [" + sourceChecksum + "/" + checksum + "]");
}
if (m_verboseLevel > VerboseQuiet){
- 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.toMSecsSinceEpoch());
- double factor = m_processedBytes / double(max(1LL, m_hotBytes * 2));
+ qint64 processedBytes, hotBytes;
+ int hotFiles, processedFiles;
+ m_mutex.lock();
+ hotFiles = m_hotFiles * 2;
+ hotBytes = m_hotBytes * 2;
+ processedBytes = m_processedBytes;
+ processedFiles = m_processedFiles;
+ m_mutex.unlock();
+ now = QDateTime::currentMSecsSinceEpoch();
+ qint64 duration = (now - start.toMSecsSinceEpoch());
+ double factor = processedBytes / double(max(1LL, hotBytes));
m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
.arg(processedFiles).arg(hotFiles * 2)
.arg(ReQStringUtils::readableSize(processedBytes))
- .arg(ReQStringUtils::readableSize(hotBytes * 2))
+ .arg(ReQStringUtils::readableSize(hotBytes))
.arg(processedBytes / 1024.0 / 1024 / max(1LL, duration) * 1000.0, 0, 'f', 3)
.arg(ReQStringUtils::runtimeEstimation(start, factor)));
}
}
now = QDateTime::currentMSecsSinceEpoch();
m_mainWindow->externalTaskFinished(tr("Building target checksums complete after %1. Processed: %2 Errors: %3")
- .arg(ReQStringUtils::readableDuration(now - start.toMSecsSinceEpoch()))
+ .arg(ReQStringUtils::readableDuration(now - start.toMSecsSinceEpoch()))
.arg(count)
.arg(m_mainWindow->errors()));
}
break;
}
if (m_verboseLevel > VerboseQuiet){
- double factor = double(m_processedFiles) / max(1, m_hotFiles);
- qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
+ double factor = double(m_processedFiles) / max(1, m_hotFiles);
+ qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
.arg(m_processedFiles)
}
m_mainWindow->externalTaskFinished(tr("backup complete after %1. Errors: %2")
.arg(ReQStringUtils::readableDuration(
- QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
+ QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
.arg(m_mainWindow->errors()));
}
m_mutex.unlock();
} else {
qint64 diff = 0;
- bool doTransfer = false;
+ bool doTransfer = false;
if (! m_compareWithTarget)
- doTransfer = true;
+ doTransfer = true;
else if (target.isEmpty())
- doTransfer = true;
+ doTransfer = true;
else {
QFileInfo trg(target + it.fileName());
if (! trg.exists())
- doTransfer = true;
+ doTransfer = true;
else {
const QFileInfo src = it.fileInfo();
if (trg.size() != src.size())
- doTransfer = true;
+ doTransfer = true;
else if ((diff = src.lastModified().toMSecsSinceEpoch()
- trg.lastModified().toMSecsSinceEpoch()) > 2000)
- doTransfer = true;
+ doTransfer = true;
}
}
- if (doTransfer){
+ if (doTransfer){
info = prefix + it.fileName();
}
m_mutex.lock();
- if (doTransfer){
+ if (doTransfer){
m_files.append(info);
m_hotFiles++;
m_hotBytes += it.fileInfo().size();
if (! m_shouldStop){
QDirIterator it2(target);
QString node;
- QString source;
while (it2.hasNext()){
if (m_shouldStop){
break;
if (rename(I18N::s2b(target).constData(), I18N::s2b(shadow).constData()) != 0){
error(QObject::tr("cannot move to shadow directory (%1): %2 -> %3")
.arg(errno).arg(target).arg(shadow));
+ } else if (m_verboseLevel >= VerboseStandard){
+ m_mainWindow->addToFileList("~ " + target);
}
}
}
delete ui;
}
-/**
- * Calles at the program's end.
- */
-void MainWindow::onAboutToQuit()
-{
-
-}
-
/**
* Appends a line to the filelist.
*
return rc;
}
+/**
+ * Called at the program's end.
+ */
+void MainWindow::onAboutToQuit()
+{
+ saveState();
+ ReGuiApplication::onAboutToQuit();
+}
+
/**
* Shows the "about" window.
*/
*/
QString ReQStringUtils::runtimeEstimation(const QDateTime& start,
double factor){
- qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
+ qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
if (factor < 1)
factor = 1;
else if (factor <= 0.001)
factor = 0.001;
qint64 estimated = qint64((double) duration / factor);
- QString rc = QObject::tr("%1 of %2").arg(readableDuration(duration))
- .arg(readableDuration(estimated));
+ QString rc = QObject::tr("%1 of %2 (%3 %)").arg(readableDuration(duration))
+ .arg(readableDuration(estimated))
+ .arg(min(100, int (factor * 100)));
return rc;
}
/**
*/
void ReGuiApplication::initializeGuiElements(){
QCoreApplication* app = QCoreApplication::instance();
- QObject::connect(app, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
+ QObject::connect(app, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit()));
connect(m_guiTimer, SIGNAL(timeout()), this, SLOT(onGuiTimerUpdate()));
m_guiTimer->start(100);
statusBar()->addWidget(m_statusMessage);
void ReGuiApplication::setStatusMessage(ReLoggerLevel level, const QString& message){
switch(level){
case LOG_ERROR:
- m_statusMessage->setText("! " + message);
+ m_statusMessage->setText("+ " + message);
break;
case LOG_WARNING:
- m_statusMessage->setText("+ " + message);
+ m_statusMessage->setText("! " + message);
break;
default:
m_statusMessage->setText(message);
ReGuiApplication(const char* applicationName,
const QString& homeDir, int maxLogFiles, int maxLogSize,
QWidget *parent);
-public slots:
- /**
- * Callback method called when the application is closed.
- */
- virtual void onAboutToQuit();
public:
const QByteArray& applicationName() const;
QString fileOfHome(const QString& node);
* Reads the <code>m_guiQueue</code>.
*/
virtual void onGuiTimerUpdate() = 0;
+ virtual void onAboutToQuit();
protected:
QByteArray m_applicationName;
/// the base directory for resources of the program like configuration file.
#include <QPushButton>
#include <QLabel>
#include <QTableWidget>
+#include <QListWidget>
#include "gui/ReGuiUtils.hpp"
#include "gui/ReGuiQueue.hpp"
#include "gui/ReStateStorage.hpp"