From 610b74915ddfea0e8fd76525bef3ac9a282f4ba7 Mon Sep 17 00:00:00 2001 From: hama Date: Sat, 19 Dec 2015 22:07:44 +0100 Subject: [PATCH] dayly work --- appl/prime/.gitignore | 1 + appl/reidos/maincmdline.cpp | 79 ++++++++++++++++++----------------- appl/reidos/reidoscmdline.pro | 5 ++- gui/regui.hpp | 7 ++-- 4 files changed, 50 insertions(+), 42 deletions(-) create mode 100644 appl/prime/.gitignore diff --git a/appl/prime/.gitignore b/appl/prime/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/appl/prime/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/appl/reidos/maincmdline.cpp b/appl/reidos/maincmdline.cpp index ec98aad..e38fa70 100644 --- a/appl/reidos/maincmdline.cpp +++ b/appl/reidos/maincmdline.cpp @@ -26,33 +26,38 @@ SyncHandler::SyncHandler(ReProgramArgs* globalArgs) : m_globalArgs(globalArgs), m_syncArgs(NULL){ m_syncArgs = new ReProgramArgs( - I18N::s2b(QObject::tr( - "usage: $0 sy(nchronize) \n" - "Copies newer and missing files from to \n" - ": the source directory. This directory is never changed\n" - "If ends with the path separator the files of will be copied directly to \n" - "Otherwise the node of will be a subdirectory of \n" - "Examples:\n" - ": /home/ : /trg /home/abc.txt will be copied to /trg/abc.txt\n" - ": /home : /trg /home/abc.txt will be copied to /trg/home/abc.txt" - ": the target directory" - )), + I18N::s2b( + QObject::tr("usage:") + "$0 sy(nchronize) \n" + + QObject::tr("Copies newer and missing files from to ") + "\n" + + QObject::tr(": the source directory. This directory is never changed") + "\n" + + QObject::tr("If ends with the path separator the files of will be copied directly to ") + "\n" + + QObject::tr("Otherwise the node of will be a subdirectory of ") + "\n" + + QObject::tr("Examples:") + "\n" + + ": /home/ : " + + QObject::tr("/trg /home/abc.txt will be copied to /trg/abc.txt") + "\n" + + ": /home :" + + QObject::tr("/trg /home/abc.txt will be copied to /trg/home/abc.txt") + "\n" + + ": " + + QObject::tr("the target directory") + ), "$0 sy -p *,*.txt,*.odt --dir-patterns=*,.git,.* /home /backup\n" "$0 sync --file-pattern=*,-*.bak,-*~ -P *,-*cache* /work crypt:/media/nas" ); - m_syncArgs->addString("filePattern", I18N::s2b(QObject::tr( - "a comma separated list of file patterns to include/exclude files to copy.\n" - "An exclude pattern begins with '-'. Placeholder is '*' (for any string)\n" - "Examples:\n" + m_syncArgs->addString("filePattern", I18N::s2b( + QObject::tr("a comma separated list of file patterns to include/exclude files to copy.") + "\n" + + QObject::tr("An exclude pattern begins with '-'. Placeholder is '*' (for any string)") + "\n" + + QObject::tr("Examples:") + ) + "\n" "--file-pattern=*,-*.bak\n" - "-p *.txt,*.doc,*.odt")), + "-p *.txt,*.doc,*.odt", 'p', "file-pattern", false, "*"); - m_syncArgs->addString("dirPattern", I18N::s2b(QObject::tr( - "a comma separated list of directory patterns to include/exclude directories from processing.\n" - "An exclude pattern begins with '-'. Placeholder is '*' (for any string)\n" - "Examples:\n" - "--dir-pattern=;*;-.cache\n" - "-P *,-.git,.*")), + m_syncArgs->addString("dirPattern", I18N::s2b( + QObject::tr("a comma separated list of directory patterns to include/exclude directories from processing.") + + "\n" + + QObject::tr("An exclude pattern begins with '-'. Placeholder is '*' (for any string)") + "\n" + + QObject::tr("Examples:") + "\n" + + "--dir-pattern=;*;-.cache\n" + + "-P *,-.git,.*"), 'P', "dir-pattern", false, "*"); } @@ -60,21 +65,19 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); ReProgramArgs args( - QObject::tr( - "Usage: $0 \n" - ":\n" - "co(mpare) compares two directories\n" - "sm(ooth) superflous files on target will be removed\n" - "sy(nchronize) newer or missing files will be copied from source to target" - ), - QObject::tr( - "reidoscmdline help sync\n" - "reidoscmdline -v sync --dir-pattern=;*;-cache --file-pattern=;*.txt;*.doc /x /y" - )); - - - QString startDir = argc > 1 ? argv[1] : ""; - QString homeDir = argc > 2 ? argv[2] : ""; - + QObject::tr("Usage:") + " $0 \n" + + ":\n" + + "co(mpare) " + QObject::tr("compares two directories") + "\n" + + "sm(ooth) " + QObject::tr("superflous files on target will be removed") + "\n" + + "sy(nchronize) " + QObject::tr("newer or missing files will be copied from source to target"), + "$0 help sync\n" + "$0 -v sync --dir-pattern=;*;-cache --file-pattern=;*.txt;*.doc /x /y" + ); + try { + args.init(argc, argv); + args.help(NULL, false, stdout); + } catch( ReOptionException e){ + args.help(NULL, true, stdout); + } return a.exec(); } diff --git a/appl/reidos/reidoscmdline.pro b/appl/reidos/reidoscmdline.pro index b134310..f695952 100644 --- a/appl/reidos/reidoscmdline.pro +++ b/appl/reidos/reidoscmdline.pro @@ -8,7 +8,10 @@ QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -TARGET = reidos +TARGET = reidoscmdline +CONFIG += console +CONFIG -= app_bundle + TEMPLATE = app INCLUDEPATH += . ../.. diff --git a/gui/regui.hpp b/gui/regui.hpp index 9d32a31..134bd06 100644 --- a/gui/regui.hpp +++ b/gui/regui.hpp @@ -12,6 +12,7 @@ #ifndef REGUI_HPP #define REGUI_HPP +#include #include "gui/ReStateStorage.hpp" #include "gui/ReGuiValidator.hpp" #include "gui/ReEdit.hpp" @@ -25,12 +26,12 @@ * @return true: the point lays inside the rectangle */ inline bool rectContains(const QRect& rect, const QPoint& point, - const char* what = "") { + const char* what = "") { #if 1 ReUseParameter(what); return point.x() >= rect.x() && point.y() >= rect.y() - && point.x() < rect.x() + rect.width() - && point.y() < rect.y() + rect.height(); + && point.x() < rect.x() + rect.width() + && point.y() < rect.y() + rect.height(); #else bool rc = point.x() >= rect.x(); char reason = ' '; -- 2.39.5