From 0000f6cf632c21b0990aa9f8024b3c94fc1a0356 Mon Sep 17 00:00:00 2001 From: ElTh0r0 Date: Sat, 19 Oct 2019 14:52:09 +0200 Subject: [PATCH] Use command line parser --- Doxyfile | 2 +- appveyor.yml | 2 +- iqpuzzle.cpp | 3 ++- main.cpp | 17 ++++++++++------- res/Info.plist | 4 ++-- res/iqpuzzle_win.rc | 8 ++++---- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Doxyfile b/Doxyfile index 6a20bf3..10ed5c7 100644 --- a/Doxyfile +++ b/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = iQPuzzle # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.1.3 +PROJECT_NUMBER = 1.1.4 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/appveyor.yml b/appveyor.yml index 6fc12e8..7ddff3f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: '1.1.3-{build}' +version: '1.1.4-{build}' environment: matrix: diff --git a/iqpuzzle.cpp b/iqpuzzle.cpp index e1d119e..8529e76 100644 --- a/iqpuzzle.cpp +++ b/iqpuzzle.cpp @@ -408,7 +408,8 @@ void IQPuzzle::generateFileLists() { QDirIterator::Subdirectories); while (it.hasNext()) { it.next(); - if (!it.filePath().contains(QStringLiteral("freestyle"))) { // Filter freestyle boards + // Filter freestyle boards + if (!it.filePath().contains(QStringLiteral("freestyle"))) { QString sName = it.filePath().remove(m_sSharePath + "/boards/"); // qDebug() << sName; diff --git a/main.cpp b/main.cpp index 0c982ec..d5c7286 100644 --- a/main.cpp +++ b/main.cpp @@ -51,19 +51,22 @@ int main(int argc, char *argv[]) { app.setApplicationName(APP_NAME); app.setApplicationVersion(APP_VERSION); - if (app.arguments().contains(QStringLiteral("-v")) || - app.arguments().contains(QStringLiteral("--version"))) { - qDebug() << app.arguments().at(0) << "\t" << - app.applicationVersion() << "\n"; - exit(0); - } + QCommandLineParser cmdparser; + cmdparser.setApplicationDescription(APP_DESC); + cmdparser.addHelpOption(); + cmdparser.addVersionOption(); + QCommandLineOption enableDebug("debug", "Enable debug mode"); + cmdparser.addOption(enableDebug); + cmdparser.addPositionalArgument("file", "Board file to be opened (*.conf) " + "or savegame (*.iqsav)"); + cmdparser.process(app); // Default share data path (Windows and debugging) QString sSharePath = app.applicationDirPath(); // Standard installation path (Linux) QDir tmpDir(app.applicationDirPath() + "/../share/" + app.applicationName().toLower()); - if (!app.arguments().contains(QStringLiteral("--debug")) && tmpDir.exists()) { + if (!cmdparser.isSet(enableDebug) && tmpDir.exists()) { sSharePath = app.applicationDirPath() + "/../share/" + app.applicationName().toLower(); } diff --git a/res/Info.plist b/res/Info.plist index 4abe2ec..12ace42 100644 --- a/res/Info.plist +++ b/res/Info.plist @@ -19,9 +19,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1.3 + 1.1.4 CFBundleVersion - 1.1.3 + 1.1.4 NSHumanReadableCopyright (c) 2012-2019, Thorsten Roth diff --git a/res/iqpuzzle_win.rc b/res/iqpuzzle_win.rc index 3aee394..676007d 100644 --- a/res/iqpuzzle_win.rc +++ b/res/iqpuzzle_win.rc @@ -6,20 +6,20 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US IDI_ICON1 ICON DISCARDABLE "images/iqpuzzle.ico" VS_VERSION_INFO VERSIONINFO -FILEVERSION 1,1,3,0 -PRODUCTVERSION 1,1,3,0 +FILEVERSION 1,1,4,0 +PRODUCTVERSION 1,1,4,0 BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904E4" BEGIN VALUE "FileDescription", "A diverting I.Q. challenging pentomino puzzle\0" - VALUE "FileVersion", "1.1.3\0" + VALUE "FileVersion", "1.1.4\0" VALUE "InternalName", "iQPuzzle\0" VALUE "LegalCopyright", "Copyright (c) 2012-2019 Thorsten Roth\0" VALUE "OriginalFilename", "iQPuzzle.exe\0" VALUE "ProductName", "iQPuzzle\0" - VALUE "ProductVersion", "1.1.3\0" + VALUE "ProductVersion", "1.1.4\0" END END