summaryrefslogtreecommitdiff
path: root/src/salmeta.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/salmeta.cpp')
-rw-r--r--src/salmeta.cpp43
1 files changed, 43 insertions, 0 deletions
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 <QtCore/QDebug>
+#include <sailfishapp.h>
+
+#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();
+}
+