From 53b4a69018d80f4ee4ab2d4480b34753f639be11 Mon Sep 17 00:00:00 2001 From: SeeLook <seelook@gmail.com> Date: Fri, 19 Feb 2021 19:18:56 +0100 Subject: [PATCH] Use Qt cammandline parser to interpret debug options - 'nootini' for now --- src/main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 6efeb1073..d457f86d0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,6 +34,7 @@ #include "mobile/tmobilemenu.h" #else #include "nootini/taudioanalyzeitem.h" + #include <QtCore/qcommandlineparser.h> #endif #include <QtWidgets/qapplication.h> @@ -243,7 +244,16 @@ int main(int argc, char *argv[]) nooObj->openFile(androidArg); #else if (argc > 1) { - if (QString::fromLocal8Bit(argv[argc - 1]).contains(QLatin1String("--nootini"))) { + QCommandLineParser cmd; + auto helpOpt = cmd.addHelpOption(); + QCommandLineOption nootiniOpt(QStringLiteral("nootini"), QStringLiteral("launch audio analyzer")); + cmd.addOption(nootiniOpt); + cmd.parse(a->arguments()); + + if (cmd.isSet(helpOpt)) + cmd.showHelp(); + + if (cmd.isSet(nootiniOpt)) { qmlRegisterType<TaudioAnalyzeItem>("Nootka.Main", 1, 0, "TaudioAnalyzeItem"); QMetaObject::invokeMethod(e->rootObjects().first(), "audioAnalyze"); } else -- GitLab