diff options
Diffstat (limited to 'src/salmeta.cpp')
-rw-r--r-- | src/salmeta.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/salmeta.cpp b/src/salmeta.cpp index 7bc14ae..f782b83 100644 --- a/src/salmeta.cpp +++ b/src/salmeta.cpp @@ -1,4 +1,5 @@ #include <QtCore/QDebug> +#include <QtCore/QCommandLineParser> #include <QtGui/QGuiApplication> #include <QtGui/QFontDatabase> #include <QtQml/QQmlComponent> @@ -17,19 +18,18 @@ int main(int argc, char *argv[]) { QGuiApplication *app = SailfishApp::application(argc, argv); - // TODO: Rudimentary command line parser ahead. Move to QCommandLineParser when it's ready. - const QStringList args = app->arguments(); - auto it = args.begin(); - while (it != args.end()) { - if (*it == "--daemon") { - launch_daemon = true; - } else if (*it == "--root") { - ++it; - settings_key_prefix = *it; - } - - ++it; - } + QCommandLineParser parser; + parser.setApplicationDescription("MetaWatch client application"); + parser.addHelpOption(); + + QCommandLineOption opt_daemon("daemon", "start background daemon instead of settings UI"); + QCommandLineOption opt_root("root", "dconf path to the settings to use", "/apps/salmeta/watchX", "/apps/salmeta/watch0"); + parser.addOption(opt_daemon); + + parser.process(*app); + + launch_daemon = parser.isSet(opt_daemon); + settings_key_prefix = parser.value(opt_root); qmlRegisterUncreatableType<WidgetInfo>("com.javispedro.salmeta", 1, 0, "WidgetInfo", "Use the models, not this"); |