src/main.cpp

changeset 6
f8474f2c5db9
parent 2
a1e435907f3a
child 14
8a304c898a75
--- a/src/main.cpp	Fri Feb 11 16:00:06 2022 +0100
+++ b/src/main.cpp	Sat Feb 12 21:24:43 2022 +0100
@@ -46,13 +46,10 @@
     /* Setup commandline parser */
     QCommandLineParser parser;
     parser.setApplicationDescription("Brewery Management System Application.");
-    parser.addOptions({
-        // A boolean option with multiple names (-f, --force)
-        {{"c", "config"},
-            QCoreApplication::translate("main", "Start the configuration editor.")},
-	{{"d", "develop"},
-	    QCoreApplication::translate("main", "Use the development database.")},
-    });
+    QCommandLineOption const startConfigOption({"c", "config"}, "Start the configuration editor.");
+    parser.addOption(startConfigOption);
+    QCommandLineOption const useDevelopOption({"d", "develop"}, "Use the development database.");
+    parser.addOption(useDevelopOption);
     parser.addHelpOption();
     parser.addVersionOption();
     parser.process(app);
@@ -60,7 +57,7 @@
     qDebug().noquote() << "Starting" << app.applicationName() << app.applicationVersion() << QDateTime::currentDateTime().toString();
 
     try {
-	auto mainAppReturnValue = Bmsapp::run();
+	auto mainAppReturnValue = Bmsapp::run(parser.isSet(useDevelopOption), parser.isSet(startConfigOption));
 	qDebug().noquote() << "Finished" << app.applicationName() << app.applicationVersion() << QDateTime::currentDateTime().toString();
 	return mainAppReturnValue;
     }

mercurial