From 1adf7f1bcde493ccaacedb0d9778911ad69ff335 Mon Sep 17 00:00:00 2001 From: Javier Date: Thu, 4 Sep 2014 01:55:14 +0200 Subject: Initial import --- src/salmeta.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/salmeta.cpp (limited to 'src/salmeta.cpp') diff --git a/src/salmeta.cpp b/src/salmeta.cpp new file mode 100644 index 0000000..c4bcb0c --- /dev/null +++ b/src/salmeta.cpp @@ -0,0 +1,43 @@ +#include +#include + +#include "controller.h" + +static bool launch_daemon = false; +static QString settings_key_prefix; + +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; + } + + if (launch_daemon) { + if (settings_key_prefix.isEmpty()) { + settings_key_prefix = "/apps/salmeta/watch0"; + } + + qDebug() << "Starting salmeta (daemon) with settings from" << settings_key_prefix; + + new Controller(settings_key_prefix, SailfishApp::createView()); + } else { + QQuickView *view = SailfishApp::createView(); + view->setSource(SailfishApp::pathTo("qml/salmeta.qml")); + view->show(); + } + + return app->exec(); +} + -- cgit v1.2.3