From: hama Date: Thu, 21 Jan 2016 23:28:17 +0000 (+0100) Subject: dayly work X-Git-Url: https://gitweb.hamatoma.de/?a=commitdiff_plain;h=26f30fd457ff2002298dec72815f0253089f8b05;p=reqt dayly work --- diff --git a/appl/rebackgui/Configuration.cpp b/appl/rebackgui/Configuration.cpp new file mode 100644 index 0000000..0c0aec2 --- /dev/null +++ b/appl/rebackgui/Configuration.cpp @@ -0,0 +1,40 @@ +/* + * Licence: + * You can use and modify this file without any restriction. + * There is no warranty. + * You also can use the licence from http://www.wtfpl.net/. + * The original sources can be found on https://github.com/republib. +*/ + +#include "backupgui.hpp" + +/** + * Constructor. + * + * @param mainWindow the GUI actor + */ +Configuration::Configuration(MainWindow* mainWindow) : + m_filename(), + m_mainWindow(mainWindow) +{ +} + +/** + * Loads the configuration file. + * + * @param filename the file to load. If "": take the default filename + */ +void Configuration::load(const QString& filename) +{ + +} + +/** + * Saves the configuration file. + * + * @param filename the file to save. If "": take the default filename + */ +void Configuration::save(const QString& filename) +{ + +} diff --git a/appl/rebackgui/Configuration.hpp b/appl/rebackgui/Configuration.hpp new file mode 100644 index 0000000..ed99dc0 --- /dev/null +++ b/appl/rebackgui/Configuration.hpp @@ -0,0 +1,34 @@ +/* + * Licence: + * You can use and modify this file without any restriction. + * There is no warranty. + * You also can use the licence from http://www.wtfpl.net/. + * The original sources can be found on https://github.com/republib. +*/ + +#ifndef CONFIGURATION_HPP +#define CONFIGURATION_HPP + +class BackupItem{ +public: + QString m_name; + QStringList m_sources; + QString m_target; + QDateTime m_lastBackup; +}; + +class Configuration +{ +public: + Configuration(MainWindow* mainWindow); +public: + void load(const QString& filename); + void save(const QString& filename); + +private: + QString m_filename; + MainWindow* m_mainWindow; + QList m_items; +}; + +#endif // CONFIGURATION_HPP diff --git a/appl/rebackgui/backupgui.hpp b/appl/rebackgui/backupgui.hpp new file mode 100644 index 0000000..4df436c --- /dev/null +++ b/appl/rebackgui/backupgui.hpp @@ -0,0 +1,17 @@ +/* + * Licence: + * You can use and modify this file without any restriction. + * There is no warranty. + * You also can use the licence from http://www.wtfpl.net/. + * The original sources can be found on https://github.com/republib. +*/ + +#ifndef BACKUPGUI_HPP +#define BACKUPGUI_HPP +#include "base/rebase.hpp" +#include "gui/regui.hpp" +#include "Configuration.hpp" +#include "mainwindow.hpp" +#include "ui_mainwindow.h" + +#endif // BACKUPGUI_HPP diff --git a/appl/rebackgui/main.cpp b/appl/rebackgui/main.cpp index b5e8a18..ab553b2 100644 --- a/appl/rebackgui/main.cpp +++ b/appl/rebackgui/main.cpp @@ -6,14 +6,16 @@ * The original sources can be found on https://github.com/republib. */ +#include "base/rebase.hpp" +#include "gui/regui.hpp" #include "mainwindow.hpp" #include - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; +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(); } diff --git a/appl/rebackgui/mainwindow.cpp b/appl/rebackgui/mainwindow.cpp index 5ef22d6..35c95fd 100644 --- a/appl/rebackgui/mainwindow.cpp +++ b/appl/rebackgui/mainwindow.cpp @@ -6,17 +6,64 @@ * The original sources can be found on https://github.com/republib. */ -#include "mainwindow.hpp" -#include "ui_mainwindow.h" +#include "backupgui.hpp" +#include "aboutdialog.hpp" -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), +const QString VERSION("2016.01.20"); + +MainWindow::MainWindow(const QString& homeDir, QWidget *parent) : + ReGuiApplication("reimgconvert", homeDir, 2, 100100100, parent), ui(new Ui::MainWindow) { ui->setupUi(this); + initializeGuiElements(); + startStop(false); + connect(ui->actionStart, SIGNAL(triggered()), this, + SLOT(onStart())); + connect(ui->actionStop, SIGNAL(triggered()), this, + SLOT(onStop())); + connect(ui->actionSelectTarget, SIGNAL(triggered()), this, + SLOT(selectTarget())); + connect(ui->actionClear, SIGNAL(triggered()), this, SLOT(clear())); + connect(ui->pushButtonStart, SIGNAL(clicked()), this, SLOT(onStart())); + connect(ui->pushButtonStop, SIGNAL(clicked()), this, SLOT(onStop())); + connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); + loadConfig(); } MainWindow::~MainWindow() { delete ui; } + +/** + * Starts or stops the backup. + * + * @param start true: the search should start + */ +void MainWindow::startStop(bool isStart){ + ui->actionStart->setEnabled(!isStart); + ui->pushButtonBackup->setEnabled(! isStart); + ui->actionStop->setEnabled(isStart); + ui->pushButtonBackup->setEnabled(! isStart); + ui->pushButtonStop->setEnabled(isStart); +} + +/** + * Loads the configuration file. + */ +void MainWindow::loadConfig(){ + +} + +/** + * @brief Handles the button click on "convert". + */ +void MainWindow::onStart(){ +} +/** + * @brief Handles the button click on "convert". + */ +void MainWindow::onStop(){ +} + diff --git a/appl/rebackgui/mainwindow.hpp b/appl/rebackgui/mainwindow.hpp index 754b001..3f8409d 100644 --- a/appl/rebackgui/mainwindow.hpp +++ b/appl/rebackgui/mainwindow.hpp @@ -15,13 +15,22 @@ namespace Ui { class MainWindow; } -class MainWindow : public ReHomeApplication +class MainWindow : public ReGuiApplication { Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); + explicit MainWindow(const QString& homeDir, QWidget *parent = 0); ~MainWindow(); +public: + bool error(const QString& message); + bool log(const QString& message); + void setStatusMessage(bool error, const QString& message); +private: + virtual void aboutToQuit(); + void loadConfig(); +private slots: + void about(); private: Ui::MainWindow *ui; diff --git a/appl/rebackgui/mainwindow.ui b/appl/rebackgui/mainwindow.ui index 6050363..52df1ae 100644 --- a/appl/rebackgui/mainwindow.ui +++ b/appl/rebackgui/mainwindow.ui @@ -1,24 +1,618 @@ + MainWindow - - + + 0 0 - 400 - 300 + 820 + 654 - + MainWindow - - - - + + + + + + 0 + + + + Action + + + + + + Qt::Vertical + + + + + + + true + + + + Name + + + + + Target + + + + + Last backup + + + + + Source(s) + + + + + + + + + + + 125 + 0 + + + + Start + + + + + + + false + + + + 125 + 0 + + + + Stop + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + 125 + 0 + + + + Log: + + + + + + + + 125 + 0 + + + + Clear + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 5 + + + + + + + + + + + + Configuration + + + + + + Qt::Vertical + + + + + + + + + Backup elements: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + + Name + + + + + Target + + + + + Source(s) + + + + + + + + + + + 125 + 0 + + + + New entry + + + + + + + + 125 + 0 + + + + Delete entry + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 125 + 0 + + + + Save config + + + + + + + + + + + + + + + + 125 + 0 + + + + Name: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 125 + 0 + + + + Update + + + + + + + + + + + + 125 + 0 + + + + Target: + + + + + + + + + + + 125 + 0 + + + + ... + + + + + + + + + + + Source directories: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 125 + 0 + + + + Add source + + + + + + + + 125 + 0 + + + + Delete source + + + + + + + + + + + + + + + + + Files + + + + + + + + + 125 + 0 + + + + File log: + + + + + + + + 125 + 0 + + + + Clear + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + Errors + + + + + + + + + 125 + 0 + + + + Error log: + + + + + + + + 125 + 0 + + + + Clear + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + + + 0 + 0 + 820 + 26 + + + + + File + + + + + + + + + Edit + + + + + Help + + + + + + Action + + + + + + + + + + + + TopToolBarArea + + + false + + + + + + Load Config + + + + + Save Config + + + + + Exit + + + + + Start backup + + + + + Stop backup + + + + + About + + - - + diff --git a/appl/rebackgui/rebackgui.pro b/appl/rebackgui/rebackgui.pro index ae124c7..ee9478d 100644 --- a/appl/rebackgui/rebackgui.pro +++ b/appl/rebackgui/rebackgui.pro @@ -21,7 +21,8 @@ SOURCES += main.cpp\ ../../gui/ReGuiValidator.cpp \ ../../gui/ReGuiQueue.cpp \ mainwindow.cpp \ - aboutdialog.cpp + aboutdialog.cpp \ + Configuration.cpp HEADERS += mainwindow.hpp \ ../../base/rebase.hpp \ @@ -29,7 +30,9 @@ HEADERS += mainwindow.hpp \ ../../gui/ReStateStorage.hpp \ ../../gui/ReGuiValidator.hpp \ ../../gui/regui.hpp \ - aboutdialog.hpp + aboutdialog.hpp \ + Configuration.hpp \ + backupgui.hpp FORMS += mainwindow.ui \ aboutdialog.ui diff --git a/appl/reimgconvert/mainwindow.cpp b/appl/reimgconvert/mainwindow.cpp index b3de701..66fc4f2 100644 --- a/appl/reimgconvert/mainwindow.cpp +++ b/appl/reimgconvert/mainwindow.cpp @@ -41,7 +41,6 @@ MainWindow::MainWindow(const QString& homeDir, QWidget *parent) : ui->setupUi(this); initializeGuiElements(); startStop(false); - statusBar()->addWidget(m_statusMessage); connect(ui->actionStart, SIGNAL(triggered()), this, SLOT(onConvert())); connect(ui->actionStop, SIGNAL(triggered()), this, diff --git a/base/ReFileUtils.cpp b/base/ReFileUtils.cpp index 411a39c..12041a9 100644 --- a/base/ReFileUtils.cpp +++ b/base/ReFileUtils.cpp @@ -12,12 +12,12 @@ #include "base/rebase.hpp" enum { - LOC_DELETE_TREE_1 = LOC_FIRST_OF(LOC_FILE_UTILS), // 11801 - LOC_DELETE_TREE_2, // 11802 - LOC_DELETE_TREE_3, // 11803 - LOC_SET_TIMES_1, // 11804 - LOC_MAKE_DIR_1, // 11805 - LOC_MAKE_DIR_2, // 11806 + LOC_DELETE_TREE_1 = LOC_FIRST_OF(LOC_FILE_UTILS), // 12501 + LOC_DELETE_TREE_2, // 12502 + LOC_DELETE_TREE_3, // 12503 + LOC_SET_TIMES_1, // 12504 + LOC_MAKE_DIR_1, // 12505 + LOC_MAKE_DIR_2, // 12506 }; QDateTime ReFileUtils::m_undefinedTime; diff --git a/base/ReFileUtils.hpp b/base/ReFileUtils.hpp index a2f0f80..bd5aace 100644 --- a/base/ReFileUtils.hpp +++ b/base/ReFileUtils.hpp @@ -29,7 +29,7 @@ public: class ReFileUtils { public: static bool deleteTree(const QString& path, bool withBase, - ReLogger* logger); + ReLogger* logger = NULL); static QByteArray cleanPath(const char* path); static QString cleanPath(const QString& path); static QString extensionOf(const QString& filename); @@ -63,10 +63,10 @@ public: return path.replace(OS_2nd_SEPARATOR, OS_SEPARATOR); #endif } - static bool makeDir(const char* path, ReLogger* logger); - static bool makeDir(const QString& path, ReLogger* logger); - static bool makeDirWithParents(const char* path, ReLogger* logger); - static bool makeDirWithParents(const QString& path, ReLogger* logger); + static bool makeDir(const char* path, ReLogger* logger = NULL); + static bool makeDir(const QString& path, ReLogger* logger = NULL); + static bool makeDirWithParents(const char* path, ReLogger* logger = NULL); + static bool makeDirWithParents(const QString& path, ReLogger* logger = NULL); static QString nodeOf(const QString& filename); static QByteArray nodeOf(const char* filename); static QString parentOf(const QString& filename); diff --git a/base/ReQStringUtils.cpp b/base/ReQStringUtils.cpp index 789edc7..3cc636a 100644 --- a/base/ReQStringUtils.cpp +++ b/base/ReQStringUtils.cpp @@ -36,12 +36,13 @@ ReString& ReQStringUtils::chomp(ReString& text, char cc) { int last = text.length() - 1; if (last >= 0){ if (cc != '\n'){ + if (text.at(last) == cc) text.resize(last); } else { while (last >= 0 && (text[last] == '\n' || text[last] == '\r')) { last--; } - text.resize(last); + text.resize(last + 1); } } return text; diff --git a/base/ReTest.cpp b/base/ReTest.cpp index 860914b..1b5dbb4 100644 --- a/base/ReTest.cpp +++ b/base/ReTest.cpp @@ -322,35 +322,35 @@ bool ReTest::assertEquals(const QTime& expected, const QTime& current, } /** - * @brief Tests whether a value is true. + * @brief Tests whether a value is false. * - * A value of false will be logged. + * A value of true will be logged. * * @param condition value to test * @param file the file containing the test * @param lineNo the line number containing the test - * @return condition + * @return ! condition */ -bool ReTest::assertTrue(bool condition, const char* file, int lineNo) { - if (!condition) - error("%s-%d: not TRUE", file, lineNo); - return condition; +bool ReTest::assertFalse(bool condition, const char* file, int lineNo) { + if (condition) + error("%s-%d: not FALSE", file, lineNo); + return !condition; } /** - * @brief Tests whether a value is false. + * @brief Tests whether a value is not NULL. * - * A value of true will be logged. + * A value of NULL will be logged. * - * @param condition value to test + * @param ptr value to test * @param file the file containing the test * @param lineNo the line number containing the test - * @return ! condition + * @return true: ptr is not NULL */ -bool ReTest::assertFalse(bool condition, const char* file, int lineNo) { - if (condition) - error("%s-%d: not FALSE", file, lineNo); - return !condition; +bool ReTest::assertNotNull(const void* ptr, const char* file, int lineNo) { + if (ptr == NULL) + error("%s-%d: is NULL", file, lineNo); + return ptr != NULL; } /** @@ -370,19 +370,19 @@ bool ReTest::assertNull(const void* ptr, const char* file, int lineNo) { } /** - * @brief Tests whether a value is not NULL. + * @brief Tests whether a value is true. * - * A value of NULL will be logged. + * A value of false will be logged. * - * @param ptr value to test + * @param condition value to test * @param file the file containing the test * @param lineNo the line number containing the test - * @return true: ptr is not NULL + * @return condition */ -bool ReTest::assertNotNull(const void* ptr, const char* file, int lineNo) { - if (ptr == NULL) - error("%s-%d: is NULL", file, lineNo); - return ptr != NULL; +bool ReTest::assertTrue(bool condition, const char* file, int lineNo) { + if (!condition) + error("%s-%d: not TRUE", file, lineNo); + return condition; } /** @@ -418,6 +418,42 @@ bool ReTest::assertEqualFiles(const char* expected, const char* current, return rc; } +/** + * Tests whether the memory logger contains a message matching a given pattern. + * + * @param pattern pattern to search + * @param isRegExpr truepattern is a regular expression + * @param file the source file of the test + * @param lineNo the line number of the test + */ +void ReTest::assertLogContains(const char* pattern, bool isRegExpr, + const char* file, int lineNo) +{ + if (! logContains(pattern, isRegExpr)){ + error("%s-%d: not found: %s", file, lineNo, pattern); + } +} + + +/** + * Tests whether the memory logger contains given location. + * + * @param location location to identify a specific logging error + * @param file the source file of the test + * @param lineNo the line number of the test + */ +void ReTest::assertLogContainsLocation(int location, const char* file, int lineNo) +{ + QByteArray pattern("^.20[\\d:. ]+\\("); + pattern += location; + pattern += "\\)"; + if (! logContains(pattern, true)){ + error("%s-%d: not found: location %d\n", file, lineNo, location, + m_memoryAppender.getLines().join().constData()); + + } +} + /** * Ensures that the file (or the directory) does not exist. * @@ -464,54 +500,6 @@ bool ReTest::exists(const char* fullname, bool isDir) return rc; } -/** - * @brief Writes an info. - * - * @param message message to show - * @return true (for expressions) - */ -bool ReTest::log(const char* message) { - m_logger.log(LOG_INFO, 0, message); - return true; -} -/** - * @brief Writes a message with arguments. - * - * @param format message to show. With placeholders like std::printf() - * @param ... the values for the placeholders in format - * @return true (for expressions) - */ -bool ReTest::logv(const char* format, ...) { - va_list ap; - va_start(ap, format); - m_logger.log(LOG_INFO, 0, format, ap); - va_end(ap); - return true; -} - - -/** - * @brief Tests whether the m_memoryLogger has a message containing a given pattern. - * - * @param pattern regular expression to search - * @return true: pattern has been found
- * false: otherwise - */ -bool ReTest::logContains(const char* pattern) { - const QList& lines = m_memoryAppender.getLines(); - QRegularExpression rexpr(pattern); - bool rc = false; - QRegularExpressionMatch match; - for (int ii = 0; ii < lines.size(); ii++) { - const QByteArray& line = lines.at(ii); - match = rexpr.match(line); - if (match.hasMatch()) { - rc = true; - break; - } - } - return rc; -} /** * @brief Returns the name of a directory in the temp dir. @@ -574,3 +562,52 @@ QByteArray ReTest::getTempFile(const char* node, const char* parent, unlink(rc.constData()); return rc; } +/** + * @brief Writes an info. + * + * @param message message to show + * @return true (for expressions) + */ +bool ReTest::log(const char* message) { + m_logger.log(LOG_INFO, 0, message); + return true; +} + +/** + * @brief Tests whether the m_memoryLogger has a message containing a given pattern. + * + * @param pattern regular expression to search + * @return true: pattern has been found
+ * false: otherwise + */ +bool ReTest::logContains(const char* pattern, bool isRegExpr) { + const QList& lines = m_memoryAppender.getLines(); + QRegularExpression rexpr(pattern); + bool rc = false; + QRegularExpressionMatch match; + for (int ii = 0; ii < lines.size(); ii++) { + const QByteArray& line = lines.at(ii); + match = rexpr.match(line); + if ( (isRegExpr && match.hasMatch()) + || (! isRegExpr && line.indexOf(pattern) >= 0)) { + rc = true; + break; + } + } + return rc; +} + +/** + * @brief Writes a message with arguments. + * + * @param format message to show. With placeholders like std::printf() + * @param ... the values for the placeholders in format + * @return true (for expressions) + */ +bool ReTest::logv(const char* format, ...) { + va_list ap; + va_start(ap, format); + m_logger.log(LOG_INFO, 0, format, ap); + va_end(ap); + return true; +} diff --git a/base/ReTest.hpp b/base/ReTest.hpp index cb96c22..9825370 100644 --- a/base/ReTest.hpp +++ b/base/ReTest.hpp @@ -53,6 +53,9 @@ public: bool assertNotNull(const void* ptr, const char* file, int lineNo); bool assertEqualFiles(const char* expected, const char* current, const char* file, int lineNo); + void assertLogContains(const char* pattern, bool isRegExpr, + const char* file, int lineNo); + void assertLogContainsLocation(int location, const char* file, int lineNo); void ensureNotExist(const char* fullname); bool error(const char* message, ...); bool exists(const char* fullname, bool isDir = false); @@ -62,7 +65,7 @@ public: bool withSeparator = true); QByteArray getTempFile(const char* node, const char* parent = NULL, bool deleteIfExists = true); - bool logContains(const char* pattern); + bool logContains(const char* pattern, bool isRegExpr = true); virtual void runTests(void) = 0; public: inline static char printChar(char cc){ @@ -84,4 +87,6 @@ protected: #define checkN(current) assertNull(current, __FILE__, __LINE__) #define checkNN(current) assertNotNull(current, __FILE__, __LINE__) #define checkFiles(expected, current) assertEqualFiles(expected, current, __FILE__, __LINE__) +#define checkLogContains(pattern, isReg) assertLogContains(pattern, isReg, __FILE__, __LINE__) +#define checkLogContainsLocation(location) assertLogContainsLocation(location, __FILE__, __LINE__) #endif // RETEST_HPP diff --git a/base/rebase.hpp b/base/rebase.hpp index 355b277..a80380e 100644 --- a/base/rebase.hpp +++ b/base/rebase.hpp @@ -72,7 +72,7 @@ typedef QString ReString; #define _mkdir(path) mkdir(path, ALLPERMS) #define _rmdir rmdir #define _unlink unlink -typedef qint64 uint64_t; +//typedef qint64 uint64_t; #else #define _strcasecmp _stricmp #define OS_SEPARATOR '\\' diff --git a/cunit/allTests.cpp b/cunit/allTests.cpp index 0bc2b41..d539467 100644 --- a/cunit/allTests.cpp +++ b/cunit/allTests.cpp @@ -44,11 +44,11 @@ static void testBase() { void testReWriter(); void testReFile(); void testReMatcher(); + testReFileUtils(); testReQStringUtil(); testReProgArgs(); testReProcess(); testReRandomizer(); - testReFileUtils(); testReMatcher(); testReFile(); if (s_allTest) { diff --git a/cunit/cuReFileUtils.cpp b/cunit/cuReFileUtils.cpp index c4c25d3..8db20b2 100644 --- a/cunit/cuReFileUtils.cpp +++ b/cunit/cuReFileUtils.cpp @@ -323,8 +323,41 @@ public: checkUrl("http:index.htm", "http:", "", "", "index.htm", ""); } + void testMakeDirectoryWithParents(){ + QByteArray base(ReFileUtils::tempDir("s4711")); + QByteArray dir(base); + dir += "d1"; + dir += OS_SEPARATOR; + dir += "d2"; + ReFileUtils::deleteTree(QString::fromUtf8(base), true); + struct stat info; + checkF(0 == stat(base.constData(), &info)); + // create 3 directories, not ending with a separator: + checkT(ReFileUtils::makeDirWithParents(dir.constData())); + checkEqu(0, stat(dir.constData(), &info)); + checkEqu(0, _rmdir(dir.constData())); + checkF(0 == stat(dir.constData(), &info)); + dir.append(OS_SEPARATOR); + // create the last directory, with an ending separator + checkT(ReFileUtils::makeDirWithParents(dir.constData())); + checkEqu(0, stat(dir.constData(), &info)); + + // Error: a node is a normal file + // Remove trailing separator + dir.resize(dir.length() - 1); + checkEqu(0, _rmdir(dir.constData())); + checkF(0 == stat(dir.constData(), &info)); + ReFileUtils::writeToFile(dir.constData(), "x"); + checkEqu(0, stat(dir.constData(), &info)); + checkF(S_ISDIR(info.st_mode)); + checkF(ReFileUtils::makeDirWithParents(dir.constData(), &m_memoryLogger)); + checkLogContainsLocation(51003); + checkLogContains(dir.constData(), false); + } virtual void runTests() { + testMakeDirectoryWithParents(); + testSplitUrl(); testParentOf(); testCleanPath(); diff --git a/cunit/cuReQStringUtils.cpp b/cunit/cuReQStringUtils.cpp index 35e523d..ed9c3bb 100644 --- a/cunit/cuReQStringUtils.cpp +++ b/cunit/cuReQStringUtils.cpp @@ -232,8 +232,19 @@ public: checkEqu("23:59:59", ReQStringUtils::readableDuration(clf(24*3600-0.1))); checkEqu("1:02:03:04", ReQStringUtils::readableDuration(clf(24*3600+2*3600+3*60+4.0))); } + void testChomp(){ + QString s = "abc\r\n"; + checkEqu("abc", ReQStringUtils::chomp(s)); + checkEqu("abc", s); + s = "/a/b/c/"; + checkEqu("/a/b/c", ReQStringUtils::chomp(s, '/')); + checkEqu("/a/b/c", s); + checkEqu("/a/b/c", ReQStringUtils::chomp(s, 'b')); + checkEqu("/a/b/c", s); + } virtual void runTests(void) { + testChomp(); testReadableSize(); testReadableDuration(); testLongestPrefix(); diff --git a/gui/ReGuiApplication.cpp b/gui/ReGuiApplication.cpp index 249f7bb..6c37303 100644 --- a/gui/ReGuiApplication.cpp +++ b/gui/ReGuiApplication.cpp @@ -106,6 +106,7 @@ void ReGuiApplication::initializeGuiElements(){ QObject::connect(app, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit())); connect(m_guiTimer, SIGNAL(timeout()), this, SLOT(guiTimerUpdate())); m_guiTimer->start(100); + statusBar()->addWidget(m_statusMessage); } /** diff --git a/remodules.hpp b/remodules.hpp index 19e6c2b..6953b4d 100644 --- a/remodules.hpp +++ b/remodules.hpp @@ -29,13 +29,14 @@ enum { LOC_MFPARSER, // 115 LOC_TRAVERSER, LOC_SETTINGS, - LOC_FILE_UTILS, + LOC_FILE, LOC_FILETREE, LOC_STATESTORAGE, // 120 LOC_FILESYSTEM, LOC_RANDOMIZER, LOC_CRYPTFILESYSTEM, LOC_GUI_APPLICATION, + LOC_FILE_UTILS, // 125 // Applications: LOC_RECFORM_CPPPARSER = 201,