From 6eba782291a999e4577bc8d3386f0dcb6945e6a4 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 17 May 2020 03:08:54 -0500 Subject: all: Add --version and --help support and unify output formats --- ui/qt5/main.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ui/qt5/main.cc') 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 +#include #include #include #include @@ -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(); -- cgit v1.2.3-60-g2f50