diff options
author | Javier S. Pedro <dev.git@javispedro.com> | 2014-11-25 22:56:06 +0100 |
---|---|---|
committer | Javier S. Pedro <dev.git@javispedro.com> | 2014-11-25 22:56:06 +0100 |
commit | 2d3ce285e77ec02ed6dfb92bda273fc99164f9f4 (patch) | |
tree | 5c08ffdeaa15d0df56cef9f7463cdfeb475a15a2 /src/salmeta.cpp | |
parent | 4da1532347fda7b6604c19b36ba05610aa86d4b4 (diff) | |
download | salmeta-2d3ce285e77ec02ed6dfb92bda273fc99164f9f4.tar.gz salmeta-2d3ce285e77ec02ed6dfb92bda273fc99164f9f4.zip |
port to Qt5.2/sailfish opt-in update 9
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"); |