if (! ReFileUtils::isDirectory(targetDir, &isFile)){
if (isFile){
if (_unlink(I18N::s2b(targetDir).constData()) != 0)
- error(QObject::tr("cannot remove file (for making a directory (%1): %2")
+ error(QObject::tr("cannot remove file (for making a directory (%1): %2")
.arg(errno).arg(targetDir));
}
if (! ReFileUtils::makeDirWithParents(targetDir))
- error(QObject::tr("cannot make directory (%1): %2").arg(errno).arg(targetDir));
+ error(QObject::tr("cannot make directory (%1): %2").arg(errno).arg(targetDir));
}
QFileInfo info(source);
if (m_verboseLevel >= VerboseStandard)
QString relPath, node;
QString info;
QDateTime start = QDateTime::currentDateTime();
- int hotFiles, processedFiles;
- qint64 processedBytes, hotBytes;
+ 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;
+ 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 = processedBytes / max(1.0, (double) hotBytes);
- if (factor > 1.0)
- factor = 1;
+ double factor = processedBytes / max(1.0, (double) hotBytes);
+ if (factor > 1.0)
+ factor = 1;
m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
- QObject::tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
- .arg(processedFiles).arg(hotFiles)
- .arg(ReQStringUtils::readableSize(processedBytes))
- .arg(ReQStringUtils::readableSize(hotBytes))
- .arg(processedBytes / 1024.0 / 1024 * 1000 / max(1LL, duration), 0, 'f', 3)
+ QObject::tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
+ .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_mainWindow->externalTaskFinished(QObject::tr("backup complete after %1. Errors: %2")
+ m_mainWindow->externalTaskFinished(QObject::tr("backup complete after %1. Errors: %2")
.arg(ReQStringUtils::readableDuration(
QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
.arg(m_mainWindow->errors()));
}
m_sourceProcessingReady = true;
qint64 now = QDateTime::currentMSecsSinceEpoch();
- m_mainWindow->externalTaskFinished(QObject::tr("Building source checksum complete after %1. Processed: %2")
+ m_mainWindow->externalTaskFinished(QObject::tr("Building source checksum complete after %1. Processed: %2")
.arg(ReQStringUtils::readableDuration(now - start))
.arg(count));
}
m_mutex.unlock();
now = QDateTime::currentMSecsSinceEpoch();
qint64 duration = (now - start.toMSecsSinceEpoch());
- double factor = processedBytes / max(1.0, (double) hotBytes);
- if (factor > 1)
- factor = 1;
+ double factor = processedBytes / max(1.0, (double) hotBytes);
+ if (factor > 1)
+ factor = 1;
m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
- QObject::tr("%1 of %2 (%3 of %4) %5 MB/sec runtime: %6")
+ QObject::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))
}
}
now = QDateTime::currentMSecsSinceEpoch();
- m_mainWindow->externalTaskFinished(QObject::tr("Building target checksums complete after %1. Processed: %2 Errors: %3")
+ m_mainWindow->externalTaskFinished(QObject::tr("Building target checksums complete after %1. Processed: %2 Errors: %3")
.arg(ReQStringUtils::readableDuration(now - start.toMSecsSinceEpoch()))
.arg(count)
.arg(m_mainWindow->errors()));
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));
}
}
double factor = double(processedFiles) / max(1, hotFiles);
qint64 duration = QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch();
m_mainWindow->externalAppend(ReGuiQueueItem::StatusLine, NULL,
- QObject::tr("%1 of %2 files %3 files/sec runtime: %6")
+ QObject::tr("%1 of %2 files %3 files/sec runtime: %6")
.arg(processedFiles)
.arg(hotFiles)
.arg(processedFiles * 1000.0 / max(1.0, (double) duration), 0, 'f', 3)
}
}
}
- m_mainWindow->externalTaskFinished(QObject::tr("clean complete after %1. Errors: %2")
+ m_mainWindow->externalTaskFinished(QObject::tr("clean complete after %1. Errors: %2")
.arg(ReQStringUtils::readableDuration(
QDateTime::currentMSecsSinceEpoch() - start.toMSecsSinceEpoch()))
.arg(m_mainWindow->errors()));
searchOneDirectory(sourceDir, targetDir, ix);
}
m_searchReady = true;
- m_mainWindow->externalLog(QObject::tr(
+ m_mainWindow->externalLog(QObject::tr(
"Search finished: to process: %1 with %2 matching: %3 total: %4 "
"subdirs: %5 runtime: %6")
.arg(m_hotFiles)
const QFileInfo src = it.fileInfo();
if (trg.size() != src.size())
doTransfer = true;
- else if ((diff = src.lastModified().toMSecsSinceEpoch()
- - trg.lastModified().toMSecsSinceEpoch()) > 2000)
+ else if ((diff = abs(src.lastModified().toMSecsSinceEpoch()
+ - trg.lastModified().toMSecsSinceEpoch())) >= 2000)
doTransfer = true;
}
}
if (doTransfer){
info = prefix + it.fileName();
}
- m_mutex.lock();
+ m_mutex.lock();
if (doTransfer){
m_files.append(info);
m_hotFiles++;
else
subTarget += OS_SEPARATOR_STR;
}
- searchOneDirectory(ReFileUtils::nativePath(it2.filePath()), subTarget, index);
+ searchOneDirectory(ReFileUtils::nativePath(it2.filePath()), subTarget, index);
}
}
}
node = it.fileName();
if (it.fileInfo().isDir()){
if (node != "." && node != ".."){
- if (! removeOlder(ReFileUtils::nativePath(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("% " + ReFileUtils::nativePath(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) + ReFileUtils::nativePath(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;
- }
- }
+ }else {
+ isEmpty = false;
+ }
+ }
if (isEmpty){
if (m_verboseLevel >= VerboseChatty)
m_mainWindow->addToFileList("x " + directory);
info = QChar(MAX_INDEX) + directory + m_separatorString
+ QChar(CmdRemoveDir);
- m_mutex.lock();
+ m_mutex.lock();
m_files.append(info);
m_matchedFiles++;
m_hotFiles++;
m_mutex.lock();
m_totalDirs++;
m_mutex.unlock();
- if (target.length() > lengthBase){
- relPath = ReFileUtils::nativePath(target.mid(lengthBase)) + OS_SEPARATOR_STR;
- prefix = QChar(1 + index) + relPath + 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) + ReFileUtils::nativePath(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();
}
}
- m_mutex.lock();
+ m_mutex.lock();
if (command != CmdUndef){
m_files.append(info);
m_hotFiles++;
QString newSource = source + it2.fileName();
QFileInfo src(newSource);
if (src.exists() && src.isDir())
- searchOneDirectory(ReFileUtils::nativePath(it2.filePath()),
- newSource + OS_SEPARATOR_STR, index);
+ searchOneDirectory(ReFileUtils::nativePath(it2.filePath()),
+ newSource + OS_SEPARATOR_STR, index);
else{
- moveToShadow(ReFileUtils::nativePath(it2.filePath()), relPath, index);
+ moveToShadow(ReFileUtils::nativePath(it2.filePath()), relPath, index);
}
}
}
*/
void SearchTargetTask::moveToShadow(const QString& target, const QString& relPath, int index){
QString shadowDir = m_shadowDirs.at(index) + relPath;
- ReQStringUtils::chomp(shadowDir, OS_SEPARATOR);
- if (! ReFileUtils::makeDirWithParents(shadowDir)){
+ ReQStringUtils::chomp(shadowDir, OS_SEPARATOR);
+ if (! ReFileUtils::makeDirWithParents(shadowDir)){
error(QObject::tr("cannot create shadow directory (%1): %2")
.arg(errno).arg(shadowDir));
- } else {
+ } else {
QString shadow = shadowDir + ReFileUtils::nodeOf(target);
if (rename(I18N::s2b(target).constData(), I18N::s2b(shadow).constData()) != 0){
error(QObject::tr("cannot move to shadow directory (%1): %2 -> %3")
targetDir = m_targetDirs.at(ix);
searchOneDirectory(targetDir, sourceDir, ix);
}
- if (! m_shouldStop){
+ if (! m_shouldStop && ReFileUtils::isDirectory(m_shadowBaseDir)){
removeOlder(m_shadowBaseDir, m_maxAge);
}
m_searchReady = true;
- m_mainWindow->externalLog(QObject::tr(
+ m_mainWindow->externalLog(QObject::tr(
"Search in target finished: to process: %1 with %2 dirs to delete: %3 total: %4 "
"subdirs: %5 runtime: %6")
.arg(m_hotFiles)
bool rc = false;
QString target = BackupUtils::findTarget(item, m_mainWindow->logger());
if (! target.isEmpty()){
- item.m_active = true;
QString name = BackupUtils::nameOfTargetDescription(target);
ReConfig config(I18N::s2b(name).constData());
rc = item.m_active = config.exists();
.arg(filename));
}
fclose(fp);
+ m_mainWindow->setStatusMessage(LOG_INFO, QObject::tr("configuration saved: %1")
+ .arg(filename));
}
}
#include "aboutdialog.hpp"
#include <QFileDialog>
-const QString VERSION("2016.02.20");
+const QString VERSION("2016.02.24");
/**
* Constructor.
initializeGui();
}
-/**
- * Initializes the Graphical User Interface.
- */
-void MainWindow::initializeGui(){
- ui->setupUi(this);
- initializeGuiElements();
- initializeGuiLanguage(ui->actionEnglish, ui->actionGerman);
- startStop(false);
- connect(ui->actionStart, SIGNAL(triggered()), this,
- SLOT(onStart()));
- connect(ui->actionChecksums, SIGNAL(triggered()), this,
- SLOT(onChecksums()));
- connect(ui->actionClean, SIGNAL(triggered()), this,
- SLOT(onClean()));
- connect(ui->actionStop, SIGNAL(triggered()), this,
- SLOT(onStop()));
- connect(ui->pushButtonBackup, SIGNAL(clicked()), this, SLOT(onStart()));
- connect(ui->pushButtonChecksum, SIGNAL(clicked()), this, SLOT(onChecksums()));
- connect(ui->pushButtonStop, SIGNAL(clicked()), this, SLOT(onStop()));
- connect(ui->pushButtonAddItem, SIGNAL(clicked()), this, SLOT(onAddItem()));
- connect(ui->pushButtonDeleteItem, SIGNAL(clicked()), this, SLOT(onDeleteItem()));
- connect(ui->pushButtonAddSource, SIGNAL(clicked()), this, SLOT(onAddSource()));
- connect(ui->pushButtonDeleteSource, SIGNAL(clicked()), this, SLOT(onDeleteSource()));
- connect(ui->pushButtonSelectTarget, SIGNAL(clicked()), this, SLOT(onSelectTarget()));
- connect(ui->pushButtonSaveConfig, SIGNAL(clicked()), this, SLOT(onSaveConfig()));
- connect(ui->pushButtonUpdate, SIGNAL(clicked()), this, SLOT(onUpdate()));
- connect(ui->actionLoadConfig, SIGNAL(triggered()), this,
- SLOT(onLoadConfig()));
- connect(ui->actionSaveConfig, SIGNAL(triggered()), this,
- SLOT(onSaveConfig()));
- connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
- connect(ui->tableWidgetConfiguration->selectionModel(),
- SIGNAL( selectionChanged(const QItemSelection&, const QItemSelection&)),
- this, SLOT( onSelectionChanged(const QItemSelection&, const QItemSelection&) ));
- connect(ui->tableWidgetConfiguration->selectionModel(),
- SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
- this,
- SLOT(onCurrentChanged(const QModelIndex&, const QModelIndex&)));
- connect(ui->pushButtonClearFileList, SIGNAL(clicked()), this, SLOT(onClearFileList()));
- 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)));
- //connect(m_defaultLanguage, SIGNAL(triggered()), this,
- // SLOT(onDefault()));
- connect(ui->actionEnglish, SIGNAL(triggered()), this, SLOT(onEnglish()));
- connect(ui->actionGerman, SIGNAL(triggered()), this, SLOT(onGerman()));
- m_configuration.load("");
- ui->tableWidgetConfiguration->selectRow(0);
- updateTable();
- updateItem(0);
- if (m_currentTranslator == NULL)
- ui->actionEnglish->setChecked(true);
- else
- ui->actionGerman->setChecked(true);
-}
-
/**
* Destructor.
*/
{
int count = m_guiQueue.count();
QListWidget* list;
- QString statusMessage;
- int countStatusMessage = 0;
- clock_t start = clock();
- clock_t diff;
- while(count-- > 0 || (diff = clock() - start) > CLOCKS_PER_SEC){
+ QString statusMessage;
+ int countStatusMessage = 0;
+ clock_t start = clock();
+ clock_t diff;
+ while(count-- > 0 || (diff = clock() - start) > CLOCKS_PER_SEC){
m_mutexGuiQueue.lock();
ReGuiQueueItem item = m_guiQueue.popFront();
m_mutexGuiQueue.unlock();
say(LOG_ERROR, item.m_value);
break;
case ReGuiQueueItem::StatusLine:
- if (++countStatusMessage % 200 != 0)
- statusMessage = item.m_value;
- else {
- setStatusMessage(LOG_INFO, item.m_value);
- statusMessage.clear();
- }
+ if (++countStatusMessage % 200 != 0)
+ statusMessage = item.m_value;
+ else {
+ setStatusMessage(LOG_INFO, item.m_value);
+ statusMessage.clear();
+ }
break;
default:
say(LOG_ERROR, "unknown item type: " + QString::number(item.m_type)
}
}
}
- if (!statusMessage.isEmpty())
- setStatusMessage(LOG_INFO, statusMessage);
+ if (!statusMessage.isEmpty())
+ setStatusMessage(LOG_INFO, statusMessage);
}
+/**
+ * Initializes the Graphical User Interface.
+ */
+void MainWindow::initializeGui(){
+ ui->setupUi(this);
+ initializeGuiElements();
+ m_guiIsInitialized = false;
+ initializeGuiLanguage(ui->actionEnglish, ui->actionGerman);
+ startStop(false);
+ ui->actionAutosave->setChecked(true);
+ connect(ui->actionStart, SIGNAL(triggered()), this,
+ SLOT(onStart()));
+ connect(ui->actionChecksums, SIGNAL(triggered()), this,
+ SLOT(onChecksums()));
+ connect(ui->actionClean, SIGNAL(triggered()), this,
+ SLOT(onClean()));
+ connect(ui->actionStop, SIGNAL(triggered()), this,
+ SLOT(onStop()));
+ connect(ui->pushButtonBackup, SIGNAL(clicked()), this, SLOT(onStart()));
+ connect(ui->pushButtonChecksum, SIGNAL(clicked()), this, SLOT(onChecksums()));
+ connect(ui->pushButtonStop, SIGNAL(clicked()), this, SLOT(onStop()));
+ connect(ui->pushButtonAddItem, SIGNAL(clicked()), this, SLOT(onAddItem()));
+ connect(ui->pushButtonDeleteItem, SIGNAL(clicked()), this, SLOT(onDeleteItem()));
+ connect(ui->pushButtonAddSource, SIGNAL(clicked()), this, SLOT(onAddSource()));
+ connect(ui->pushButtonDeleteSource, SIGNAL(clicked()), this, SLOT(onDeleteSource()));
+ connect(ui->pushButtonSelectTarget, SIGNAL(clicked()), this, SLOT(onSelectTarget()));
+ connect(ui->pushButtonSaveConfig, SIGNAL(clicked()), this, SLOT(onSaveConfig()));
+ connect(ui->actionAutosave, SIGNAL(toggled(bool)), this, SLOT(onAutosaveToggled(bool)));
+ connect(ui->checkBoxAutoSave, SIGNAL(stateChanged(int)), this, SLOT(onAutosaveChanged(int)));
+ connect(ui->actionLoadConfig, SIGNAL(triggered()), this,
+ SLOT(onLoadConfig()));
+ connect(ui->actionSaveConfig, SIGNAL(triggered()), this,
+ SLOT(onSaveConfig()));
+ connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
+ connect(ui->tableWidgetConfiguration->selectionModel(),
+ SIGNAL( selectionChanged(const QItemSelection&, const QItemSelection&)),
+ this, SLOT( onSelectionChanged(const QItemSelection&, const QItemSelection&) ));
+ connect(ui->tableWidgetConfiguration->selectionModel(),
+ SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
+ this,
+ SLOT(onCurrentChanged(const QModelIndex&, const QModelIndex&)));
+ connect(ui->pushButtonClearFileList, SIGNAL(clicked()), this, SLOT(onClearFileList()));
+ 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)));
+ //connect(m_defaultLanguage, SIGNAL(triggered()), this,
+ // SLOT(onDefault()));
+ connect(ui->actionEnglish, SIGNAL(triggered()), this, SLOT(onEnglish()));
+ connect(ui->actionGerman, SIGNAL(triggered()), this, SLOT(onGerman()));
+ connect(ui->lineEditName, SIGNAL(editingFinished()), this, SLOT(onUpdateConfig()));
+ connect(ui->comboBoxDirPatterns, SIGNAL(editTextChanged(const QString&)), this, SLOT(onDirPatternTextChanged(const QString&)));
+ connect(ui->comboBoxFilePatterns, SIGNAL(editTextChanged(const QString&)), this, SLOT(onFilePatternTextChanged(const QString&)));
+ connect(ui->tabWidget, SIGNAL(currentChanged(int)), this,
+ SLOT(onCurrentTabChanged(int)));
+ m_configuration.load("");
+ ui->tableWidgetConfiguration->selectRow(0);
+ updateTable();
+ updateItem(0);
+ if (m_currentTranslator == NULL)
+ ui->actionEnglish->setChecked(true);
+ else
+ ui->actionGerman->setChecked(true);
+ m_guiIsInitialized = true;
+ // Active Name Target Last Sources
+ ui->tableWidget->setColumnWidth(0, 50);
+ ui->tableWidget->setColumnWidth(1, 125);
+ ui->tableWidget->setColumnWidth(2, 175);
+ ui->tableWidget->setColumnWidth(3, 160);
+
+ ui->tableWidgetConfiguration->setColumnWidth(0, 125);
+ ui->tableWidgetConfiguration->setColumnWidth(1, 175);
+ ui->tableWidgetConfiguration->setColumnWidth(2, 160);
+ ui->tableWidgetConfiguration->selectRow(0);
+}
+
/**
* Common initializations for all task starts.
*
BackupEngine::m_totalFiles = 0;
BackupEngine::m_processedFiles = 0;
BackupEngine::m_processedBytes = 0;
- BackupEngine::m_files.clear();
+ BackupEngine::m_files.clear();
ChecksumTask::m_sourceProcessingReady = false;
if ( (m_maxListSize = comboInt(ui->comboBoxMaxListLength, -999)) == -999){
rc = false;
{
m_configuration.appendNew();
updateTable();
+ if (ui->checkBoxAutoSave->isChecked())
+ onSaveConfig();
}
+
/**
- * Adds a new backup item.
+ * Handles the push of the button "select directory".
*/
-void MainWindow::onDeleteItem()
-{
- int row = ui->tableWidgetConfiguration->selectionModel()->currentIndex().row();
- if (row >= 0){
- m_configuration.items().removeAt(row);
- for (int ix = row; ix < m_configuration.items().size(); ix++)
- m_configuration.items()[ix].m_no = ix;
+void MainWindow::onAddSource(){
+QStringList dirs = ReGuiUtils::selectDirectories(tr("Select Source Directory"),
+ ReFileUtils::parentOf(m_lastSource));
+ m_lastSource = ReFileUtils::nativePath(dirs.at(0));
+ for (int ix = 0; ix < dirs.size(); ix++){
+ QString newEntry = ReFileUtils::nativePath(dirs.at(ix));
+ bool found = false;
+ for (int ix2 = 0; ! found && ix2 < ui->listWidgetSource->count(); ix2++){
+ QString oldEntry = ui->listWidgetSource->item(ix2)->text();
+ if (oldEntry.isEmpty()){
+ ui->listWidgetSource->takeItem(ix2);
+ ix2--;
+ }
+ found = oldEntry == newEntry;
+ }
+ if (! found)
+ ui->listWidgetSource->addItem(newEntry);
}
- m_configuration.check();
- updateTable();
- updateItem(row);
+ onUpdateConfig();
}
/**
- * Delete the selected source directory from the current backup item.
+ * The state of "Autosave" has been changed.
*/
-void MainWindow::onDeleteSource()
-{
- int row = ui->listWidgetSource->selectionModel()->currentIndex().row();
- if (row >= 0){
- ui->listWidgetSource->takeItem(row);
+void MainWindow::onAutosaveChanged(int newState){
+
+ // Avoid recursion:
+ if (m_guiIsInitialized){
+ m_guiIsInitialized = false;
+ bool nowChecked = newState == Qt::Checked;
+ ui->pushButtonSaveConfig->setEnabled(! nowChecked);
+ ui->actionAutosave->setChecked(nowChecked);
+ ui->checkBoxAutoSave->setChecked(nowChecked);
+ m_guiIsInitialized = true;
}
}
-/**
- * Action "switch to English".
- */
-void MainWindow::onEnglish(){
- ReGuiApplication::onEnglish();
-}
-/**
- * Action "switch to German".
- */
-void MainWindow::onGerman(){
- ReGuiApplication::onGerman();
-}
/**
- * @brief MainWindow::onSelectionChanged
- * @param selected
- * @param deselected
+ * The state of the menu item "Autosave" has been changed.
*/
-void MainWindow::onSelectionChanged(const QItemSelection& selected,
- const QItemSelection& deselected){
- UNUSED_VAR(deselected);
- int count = selected.indexes().size();
- if (count > 0){
- int ix = selected.indexes().at(0).row();
- updateItem(ix);
+void MainWindow::onAutosaveToggled(bool newState){
+ if (m_guiIsInitialized){
+ m_guiIsInitialized = false;
+ ui->pushButtonSaveConfig->setEnabled(! newState);
+ ui->checkBoxAutoSave->setChecked(newState);
+ ui->actionAutosave->setChecked(newState);
+ m_guiIsInitialized = true;
}
-
}
-/**
- * The language has been changed.
- */
-void MainWindow::onLanguageChange()
-{
- initializeGui();
-}
/**
* Starts the backup.
*/
}
}
-/**
- * Handles the push of the button "select directory".
- */
-void MainWindow::onAddSource(){
-QStringList dirs = ReGuiUtils::selectDirectories(tr("Select Source Directory"),
- ReFileUtils::parentOf(m_lastSource));
- m_lastSource = ReFileUtils::nativePath(dirs.at(0));
- for (int ix = 0; ix < dirs.size(); ix++){
- QString newEntry = ReFileUtils::nativePath(dirs.at(ix));
- bool found = false;
- for (int ix2 = 0; ! found && ix2 < ui->listWidgetSource->count(); ix2++){
- QString oldEntry = ui->listWidgetSource->item(ix2)->text();
- if (oldEntry.isEmpty()){
- ui->listWidgetSource->takeItem(ix2);
- ix2--;
- }
- found = oldEntry == newEntry;
- }
- if (! found)
- ui->listWidgetSource->addItem(newEntry);
- }
-}
-
/**
* Remove the lines of the log list.
*/
ui->listWidgetFile->clear();
}
-/**
- * Handles the push of the button "select directory".
- */
-void MainWindow::onSelectTarget(){
- QString dir = ui->lineEditTarget->text();
- int pos = dir.indexOf(';');
- if (pos < 0){
- dir.clear();
- } else {
- dir.remove(0, pos + 1);
- if (! ReFileUtils::isAbsolutPath(dir))
- dir.clear();
- }
- dir = ReGuiUtils::selectDirectory(tr("Select Target Directory"), dir);
- if (!dir.isEmpty()){
- dir = ReFileUtils::nativePath(dir);
- extractTarget(dir);
- BackupItem& item = m_configuration.items()[m_currentRowConfiguration];
- if (! BackupUtils::prepareTarget(dir, item, &m_logger))
- say(LOG_INFO, tr("target initialized with %1")
- .arg(BackupUtils::nameOfTargetDescription(dir)));
- }
-}
/**
* The current row has been changed.
*
updateItem(row);
}
+/**
+ * Adds a new backup item.
+ */
+void MainWindow::onDeleteItem()
+{
+ int row = ui->tableWidgetConfiguration->selectionModel()->currentIndex().row();
+ if (row >= 0){
+ m_configuration.items().removeAt(row);
+ for (int ix = row; ix < m_configuration.items().size(); ix++)
+ m_configuration.items()[ix].m_no = ix;
+ }
+ m_configuration.check();
+ updateTable();
+ updateItem(row);
+ if (ui->checkBoxAutoSave->isChecked())
+ onSaveConfig();
+}
+
+/**
+ * Delete the selected source directory from the current backup item.
+ */
+void MainWindow::onDeleteSource()
+{
+ int row = ui->listWidgetSource->selectionModel()->currentIndex().row();
+ if (row >= 0){
+ ui->listWidgetSource->takeItem(row);
+ }
+ onUpdateConfig();
+}
+
+/**
+ * The directory patterns has been changed.
+ *
+ * @param newText the new text of the dir pattern
+ */
+void MainWindow::onDirPatternTextChanged(const QString& newText){
+ UNUSED_VAR(newText);
+ onUpdateConfig();
+}
+
+/**
+ * Action "switch to English".
+ */
+void MainWindow::onEnglish(){
+ ReGuiApplication::onEnglish();
+}
+
+/**
+ * The filename patterns has been changed.
+ *
+ * @param newText the new text of the dir pattern
+ */
+void MainWindow::onFilePatternTextChanged(const QString& newText){
+ UNUSED_VAR(newText);
+ onUpdateConfig();
+}
+
+/**
+ * Action "switch to German".
+ */
+void MainWindow::onGerman(){
+ ReGuiApplication::onGerman();
+}
+/**
+ * The language has been changed.
+ */
+void MainWindow::onLanguageChange()
+{
+ initializeGui();
+}
+
/**
* Loads the configuration file.
*/
m_configuration.save("");
}
+/**
+ * @brief MainWindow::onSelectionChanged
+ * @param selected
+ * @param deselected
+ */
+void MainWindow::onSelectionChanged(const QItemSelection& selected,
+ const QItemSelection& deselected){
+ UNUSED_VAR(deselected);
+ int count = selected.indexes().size();
+ if (count > 0){
+ int ix = selected.indexes().at(0).row();
+ updateItem(ix);
+ }
+ onUpdateConfig();
+}
+
+/**
+ * Handles the push of the button "select directory".
+ */
+void MainWindow::onSelectTarget(){
+ QString dir = ui->lineEditTarget->text();
+ int pos = dir.indexOf(';');
+ if (pos < 0){
+ dir.clear();
+ } else {
+ dir.remove(0, pos + 1);
+ if (! ReFileUtils::isAbsolutPath(dir))
+ dir.clear();
+ }
+ dir = ReGuiUtils::selectDirectory(tr("Select Target Directory"), dir);
+ if (!dir.isEmpty()){
+ dir = ReFileUtils::nativePath(dir);
+ extractTarget(dir);
+ BackupItem& item = m_configuration.items()[m_currentRowConfiguration];
+ if (! BackupUtils::prepareTarget(dir, item, &m_logger))
+ say(LOG_INFO, tr("target initialized with %1")
+ .arg(BackupUtils::nameOfTargetDescription(dir)));
+ }
+}
+
/**
* Starts the backup.
*/
}
/**
- * Stores the GUI elements into the current backup item.
+ * The tab has been changed.
+ * @param index
*/
-void MainWindow::onUpdate(){
- BackupItem& item = m_configuration.items()[m_currentRowConfiguration];
- item.m_name = ui->lineEditName->text();
- item.m_target = ui->lineEditTarget->text();
- item.m_filePatterns = comboText(ui->comboBoxFilePatterns);
- item.m_dirPatterns = comboText(ui->comboBoxDirPatterns);
- item.m_sources.clear();
- for (int ix = 0; ix < ui->listWidgetSource->count(); ix++){
- item.m_sources.append(ui->listWidgetSource->item(ix)->text());
+void MainWindow::onCurrentTabChanged(int index){
+ if (m_guiIsInitialized && index == 0){
+ for (int ix = m_configuration.items().count() - 1; ix >= 0; ix--){
+ BackupItem& item = m_configuration.items()[ix];
+ m_configuration.readBackupDate(item);
+ }
}
- updateTable();
- saveState();
+ updateTable(ui->tableWidget);
}
/**
BackupEngine::m_verboseLevel = (ReVerbose_t) ui->comboBoxVerbose->currentIndex();
}
+/**
+ * Stores the GUI elements into the current backup item and save int to the file.
+ */
+void MainWindow::onUpdateConfig(){
+ if (m_guiIsInitialized){
+ BackupItem& item = m_configuration.items()[m_currentRowConfiguration];
+ item.m_name = ui->lineEditName->text();
+ item.m_target = ui->lineEditTarget->text();
+ item.m_filePatterns = comboText(ui->comboBoxFilePatterns);
+ item.m_dirPatterns = comboText(ui->comboBoxDirPatterns);
+ item.m_sources.clear();
+ for (int ix = 0; ix < ui->listWidgetSource->count(); ix++){
+ item.m_sources.append(ui->listWidgetSource->item(ix)->text());
+ }
+ updateTable();
+ if (ui->checkBoxAutoSave->isChecked())
+ onSaveConfig();
+ }
+}
/**
* Shows the data of a given backup item in the gui elements.
m_currentRowConfiguration = index;
if (index < m_configuration.items().size()){
BackupItem& item = m_configuration.items()[index];
- ui->lineEditName->setText(item.m_name);
ui->lineEditTarget->setText(item.m_target);
ui->listWidgetSource->clear();
+ // Avoid implicite configuration saving:
+ bool oldValue = m_guiIsInitialized;
+ m_guiIsInitialized = false;
+ ui->lineEditName->setText(item.m_name);
ui->comboBoxFilePatterns->setEditText(item.m_filePatterns);
ui->comboBoxDirPatterns->setEditText(item.m_dirPatterns);
+ m_guiIsInitialized = oldValue;
for (int ix = 0; ix < item.m_sources.size(); ix++){
ui->listWidgetSource->insertItem(ix, m_lastSource = item.m_sources.at(ix));
}
void startStop(bool isStart);
void restoreState();
void saveState();
-
+protected slots:
private:
QString extractTarget(const QString& dir);
void initializeGui();
virtual void onAboutToQuit();
void onAddItem();
void onAddSource();
+ void onAutosaveChanged(int newState);
+ void onAutosaveToggled(bool newState);
void onChecksums();
void onClean();
void onClearFileList();
void onClearErrorList();
void onClearLog();
void onCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
+ void onCurrentTabChanged(int index);
void onDeleteItem();
void onDeleteSource();
+ void onDirPatternTextChanged(const QString& newText);
void onEnglish();
+ void onFilePatternTextChanged(const QString& newText);
void onGerman();
virtual void onGuiTimerUpdate();
+ virtual void onLanguageChange();
void onSaveConfig();
void onStart();
void onSelectionChanged(const QItemSelection& prior, const QItemSelection& later);
void onSelectTarget();
void onStop();
void onLoadConfig();
- void onUpdate();
- void onVerboseIndexChanged(int index);
+ void onUpdateConfig();
void updateItem(int index);
void updateTable(QTableWidget* target = NULL);
void updateTableRow(int row, BackupItem& item, QTableWidget* target = NULL);
+ void onVerboseIndexChanged(int index);
private:
Ui::MainWindow *ui;
Configuration m_configuration;
CleanTask* m_cleanTask;
int m_errors;
int m_maxListSize;
-protected slots:
- virtual void onLanguageChange();
};
#endif // MAINWINDOW_HPP
</property>
</spacer>
</item>
+ <item>
+ <widget class="QCheckBox" name="checkBoxAutoSave">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Configuration will be saved after each change of a property</string>
+ </property>
+ <property name="text">
+ <string>Autosave</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QPushButton" name="pushButtonSaveConfig">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="minimumSize">
<size>
<width>125</width>
</property>
</spacer>
</item>
- <item>
- <widget class="QPushButton" name="pushButtonUpdate">
- <property name="minimumSize">
- <size>
- <width>125</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Update</string>
- </property>
- </widget>
- </item>
</layout>
</item>
<item>
<addaction name="actionLoadConfig"/>
<addaction name="actionSaveConfig"/>
<addaction name="separator"/>
+ <addaction name="actionAutosave"/>
+ <addaction name="separator"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuEdit">
</property>
<addaction name="actionAbout"/>
<addaction name="separator"/>
- <addaction name="actionDefault"/>
<addaction name="actionEnglish"/>
<addaction name="actionGerman"/>
</widget>
<string>German</string>
</property>
</action>
- <action name="actionDefault">
+ <action name="actionAutosave">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
- <string>Default</string>
+ <string>Autosave</string>
</property>
</action>
</widget>
</message>
<message>
<location filename="mainwindow.ui" line="25"/>
- <location filename="mainwindow.ui" line="808"/>
+ <location filename="mainwindow.ui" line="818"/>
<source>Action</source>
<translation>Aktion</translation>
</message>
</message>
<message>
<location filename="mainwindow.ui" line="226"/>
- <location filename="mainwindow.ui" line="851"/>
+ <location filename="mainwindow.ui" line="861"/>
<source>Stop</source>
<translation>Beenden</translation>
</message>
<message>
<location filename="mainwindow.ui" line="252"/>
- <location filename="mainwindow.ui" line="864"/>
+ <location filename="mainwindow.ui" line="874"/>
<source>Calculates checksums for source and target files and reports differences</source>
<translation>Berechnet Prüfsummen für Quell- und Zieldateien und meldet Unterschiede</translation>
</message>
<message>
<location filename="mainwindow.ui" line="255"/>
- <location filename="mainwindow.ui" line="861"/>
+ <location filename="mainwindow.ui" line="871"/>
<source>Checksums</source>
<translation>Prüfsummen</translation>
</message>
</message>
<message>
<location filename="mainwindow.ui" line="271"/>
- <location filename="mainwindow.ui" line="869"/>
+ <location filename="mainwindow.ui" line="879"/>
<source>Clean</source>
<translatorcomment>Protokoll:</translatorcomment>
<translation>Bereinigen</translation>
</message>
<message>
<location filename="mainwindow.ui" line="305"/>
- <location filename="mainwindow.ui" line="692"/>
- <location filename="mainwindow.ui" line="745"/>
+ <location filename="mainwindow.ui" line="701"/>
+ <location filename="mainwindow.ui" line="754"/>
<source>Clear</source>
<translation>Löschen</translation>
</message>
</message>
<message>
<location filename="mainwindow.ui" line="459"/>
+ <source>Configuration will be saved after each change of a property</source>
+ <translation>Die Konfiguration wird nach jedem Wechsel einer Eigenschaft gespeichert</translation>
+ </message>
+ <message>
+ <location filename="mainwindow.ui" line="462"/>
+ <location filename="mainwindow.ui" line="903"/>
+ <source>Autosave</source>
+ <translation>Autom. Speichern</translation>
+ </message>
+ <message>
+ <location filename="mainwindow.ui" line="481"/>
<source>Save config</source>
<translation>Konf. speichern</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="480"/>
+ <location filename="mainwindow.ui" line="502"/>
<source>Name:</source>
<translation>Name:</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="509"/>
<source>Update</source>
- <translation>Aktualisieren</translation>
+ <translation type="vanished">Aktualisieren</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="526"/>
+ <location filename="mainwindow.ui" line="535"/>
<source>Target:</source>
<translation>Ziel:</translation>
</message>
<translation type="vanished">Wähle Ziel</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="559"/>
+ <location filename="mainwindow.ui" line="568"/>
<source>File patterns:</source>
<translation>Dateimuster:</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="566"/>
+ <location filename="mainwindow.ui" line="575"/>
<source><html><head/><body><p>A comma (',') separated list of filename patterns. A prefix of '-' means inversion: if a filename matches it will not be found.</p><p>Example: *.txt,*.odt</p></body></html></source>
<translation><html><head/><body><p>Eine Liste von Dateinamensmustern, getrennt mit Komma (',') . Ein Präfix '-' bedeuted Umkehrung: Wenn ein Dateiname passt, wird er nicht gefunden.</p><p>Beispiel: *.txt,*.odt</p></body></html></translation>
</message>
<message>
- <location filename="mainwindow.ui" line="582"/>
+ <location filename="mainwindow.ui" line="591"/>
<source>Dir patterns:</source>
<translation>Verzeichnismuster:</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="589"/>
+ <location filename="mainwindow.ui" line="598"/>
<source><html><head/><body><p>A comma (',') separated list of directory name patterns. A prefix of '-' means inversion: if a directory name matches it will not be found.</p><p>Example: *,-.git,-*cache*</p></body></html></source>
<translation><html><head/><body><p>Eine Liste von Verzeichnisnamensmustern, getrennt mit Komma (',') . Ein Präfix '-' bedeuted Umkehrung: Wenn ein Verzeichnisname passt, wird er nicht gefunden.</p><p>Beispiel: *,-.git,-*cache*</p></body></html></translation>
</message>
<message>
- <location filename="mainwindow.ui" line="609"/>
+ <location filename="mainwindow.ui" line="618"/>
<source>Source dirs:</source>
<translation>Quelldateien:</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="635"/>
+ <location filename="mainwindow.ui" line="644"/>
<source>Add source</source>
<translation>Hinzufügen</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="648"/>
+ <location filename="mainwindow.ui" line="657"/>
<source>Delete source</source>
<translation>Löschen</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="665"/>
+ <location filename="mainwindow.ui" line="674"/>
<source>Files</source>
<translation>Dateien</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="679"/>
+ <location filename="mainwindow.ui" line="688"/>
<source>File log:</source>
<translation>Dateiliste:</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="718"/>
+ <location filename="mainwindow.ui" line="727"/>
<source>Errors</source>
<translation>Fehler</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="732"/>
+ <location filename="mainwindow.ui" line="741"/>
<source>Error log:</source>
<translation>Fehlerprotokoll:</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="784"/>
+ <location filename="mainwindow.ui" line="793"/>
<source>File</source>
<translatorcomment>Bearbeiten</translatorcomment>
<translation>Datei</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="793"/>
+ <location filename="mainwindow.ui" line="804"/>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="798"/>
+ <location filename="mainwindow.ui" line="809"/>
<source>Help</source>
<translation>Hilfe</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="831"/>
+ <location filename="mainwindow.ui" line="841"/>
<source>Load Config</source>
<translation>Konfiguration laden</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="836"/>
+ <location filename="mainwindow.ui" line="846"/>
<source>Save Config</source>
<translation>Konfiguration sichern</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="841"/>
+ <location filename="mainwindow.ui" line="851"/>
<source>Exit</source>
<translation>Beenden</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="846"/>
+ <location filename="mainwindow.ui" line="856"/>
<source>Start backup</source>
<translation>Sicherung starten</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="856"/>
+ <location filename="mainwindow.ui" line="866"/>
<source>About</source>
<translation>Über</translation>
</message>
<message>
- <location filename="mainwindow.ui" line="877"/>
+ <location filename="mainwindow.ui" line="887"/>
<source>English</source>
<translation></translation>
</message>
<message>
- <location filename="mainwindow.ui" line="885"/>
+ <location filename="mainwindow.ui" line="895"/>
<source>German</source>
<translation></translation>
</message>
<message>
- <location filename="mainwindow.ui" line="893"/>
- <source>Default</source>
- <translation></translation>
- </message>
- <message>
- <location filename="mainwindow.cpp" line="348"/>
- <location filename="mainwindow.cpp" line="405"/>
- <location filename="mainwindow.cpp" line="507"/>
+ <location filename="mainwindow.cpp" line="359"/>
+ <location filename="mainwindow.cpp" line="393"/>
+ <location filename="mainwindow.cpp" line="583"/>
<source>no backup item selected</source>
<translation>Kein Sicherungselement ausgewählt</translation>
</message>
<message>
- <location filename="mainwindow.cpp" line="353"/>
- <location filename="mainwindow.cpp" line="410"/>
- <location filename="mainwindow.cpp" line="512"/>
+ <location filename="mainwindow.cpp" line="364"/>
+ <location filename="mainwindow.cpp" line="398"/>
+ <location filename="mainwindow.cpp" line="588"/>
<source>Target not available</source>
<translation>Ziel nicht vorhanden</translation>
</message>
<message>
- <location filename="mainwindow.cpp" line="379"/>
+ <location filename="mainwindow.cpp" line="303"/>
<source>Select Source Directory</source>
<translation>Quellverzeichnis auswählen</translation>
</message>
<message>
- <location filename="mainwindow.cpp" line="464"/>
+ <location filename="mainwindow.cpp" line="566"/>
<source>Select Target Directory</source>
<translation>Zielverzeichnis auswählen</translation>
</message>
<message>
- <location filename="mainwindow.cpp" line="470"/>
+ <location filename="mainwindow.cpp" line="572"/>
<source>target initialized with %1</source>
<translation>Ziel mit %1 vorbelegt</translation>
</message>
<translation>Kann nicht schreiben (%1): %2</translation>
</message>
<message>
- <location filename="mainwindow.cpp" line="225"/>
+ <location filename="Configuration.cpp" line="231"/>
+ <source>configuration saved: %1</source>
+ <oldsource>configuration changed: %1</oldsource>
+ <translation>Konfiguration gespeichert: %1</translation>
+ </message>
+ <message>
+ <location filename="mainwindow.cpp" line="242"/>
<source>Search started...</source>
<translation>Suche gestartet...</translation>
</message>
<message>
- <location filename="mainwindow.cpp" line="681"/>
+ <location filename="mainwindow.cpp" line="763"/>
<source>yes</source>
<translation>Ja</translation>
</message>
<message>
- <location filename="mainwindow.cpp" line="681"/>
+ <location filename="mainwindow.cpp" line="763"/>
<source>no</source>
<translation>nein</translation>
</message>
<name>ReGuiApplication</name>
<message>
<source>Welcome!</source>
+ <translatorcomment>Alternative:
+xxx
+yyy</translatorcomment>
<translation>Willkommen!</translation>
</message>
</context>
if (logger == NULL) {
initLogger();
}
- if (file != NULL)
+ if (file != NULL && QFileInfo(file).exists())
read(file);
}
m_languages(languages),
m_installPath(),
m_english(NULL),
- m_german(NULL)
+ m_german(NULL),
+ m_guiIsInitialized(false)
{
m_installPath = QDir(ReFileUtils::parentOf(m_application.arguments().at(0)))
connect(m_guiTimer, SIGNAL(timeout()), this, SLOT(onGuiTimerUpdate()));
m_guiTimer->start(100);
statusBar()->addWidget(m_statusMessage);
+ m_guiIsInitialized = true;
}
/**
QString m_installPath;
QAction* m_english;
QAction* m_german;
+ bool m_guiIsInitialized;
};
#endif /* REGUIAPPLICATION_HPP_ */
if (value != combo->itemText(0)) {
combo->insertItem(0, value);
}
- for (int ii = 1; ii < combo->count(); ii++) {
+ int count = combo->count();
+ for (int ii = count - 1; ii > 0; ii--) {
if (value == combo->itemText(ii)) {
combo->removeItem(ii);
}