diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-05-17 03:08:54 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-05-17 03:08:54 -0500 |
commit | 6eba782291a999e4577bc8d3386f0dcb6945e6a4 (patch) | |
tree | 1c3d48203bc6d335df0b284c5a6f692c3fcbc5eb /ui/qt5 | |
parent | a6b3b0f6cbaeb90995f5aa14eca7e27d9ff218e2 (diff) | |
download | horizon-6eba782291a999e4577bc8d3386f0dcb6945e6a4.tar.gz horizon-6eba782291a999e4577bc8d3386f0dcb6945e6a4.tar.bz2 horizon-6eba782291a999e4577bc8d3386f0dcb6945e6a4.tar.xz horizon-6eba782291a999e4577bc8d3386f0dcb6945e6a4.zip |
all: Add --version and --help support and unify output formats
Diffstat (limited to 'ui/qt5')
-rw-r--r-- | ui/qt5/CMakeLists.txt | 2 | ||||
-rw-r--r-- | ui/qt5/main.cc | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ui/qt5/CMakeLists.txt b/ui/qt5/CMakeLists.txt index 8dbf4a8..f8bdb56 100644 --- a/ui/qt5/CMakeLists.txt +++ b/ui/qt5/CMakeLists.txt @@ -84,6 +84,6 @@ IF(INSTALL) ENDIF() install(TARGETS horizon-run-qt5 DESTINATION bin) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/horizon-run-qt5.8 DESTINATION share/man/man8) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect DESTINATION bin) + install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect DESTINATION bin) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect.1 DESTINATION share/man/man1) ENDIF(INSTALL) diff --git a/ui/qt5/main.cc b/ui/qt5/main.cc index 330311f..22ef39e 100644 --- a/ui/qt5/main.cc +++ b/ui/qt5/main.cc @@ -11,6 +11,7 @@ */ #include <QApplication> +#include <QCommandLineParser> #include <QDialog> #include <QIcon> #include <QLabel> @@ -44,6 +45,9 @@ void WaitDialog::reject() { return; } int main(int argc, char *argv[]) { QApplication app(argc, argv); + app.setOrganizationName("Adélie Linux"); + app.setApplicationName("Horizon Qt UI"); + app.setApplicationVersion(VERSTR); QString translatorFileName = QLatin1String("qt_"); translatorFileName += QLocale::system().name(); @@ -62,6 +66,26 @@ int main(int argc, char *argv[]) { app.setWindowIcon(QIcon(":/horizon-256.png")); + QCommandLineParser parser; + parser.setApplicationDescription(app.tr("Guides the user through creation of a HorizonScript.")); + QCommandLineOption help = parser.addHelpOption(); + QCommandLineOption version = parser.addVersionOption(); + + if(!parser.parse(app.arguments())) { + parser.showHelp(1); + return 1; + } + + if(parser.isSet(help)) { + parser.showHelp(); + return 0; + } + + if(parser.isSet(version)) { + parser.showVersion(); + return 0; + } + HorizonWizard wizard; d.hide(); app.restoreOverrideCursor(); |