summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/main.cpp b/app/main.cpp
index 43e8586..5ef2e7a 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -9,7 +9,9 @@
#include <QtQuick/QQuickWindow>
#include <qlibwindowmanager.h>
#include <qlibhomescreen.h>
+#include <navigation.h>
+#include "navigation_client.h"
#include "qcheapruler.hpp"
#include "file_operation.h"
@@ -30,12 +32,17 @@ int main(int argc, char *argv[])
parser.addVersionOption();
parser.process(app);
QStringList positionalArguments = parser.positionalArguments();
+ QUrl bindingAddress;
int port = 0;
QString token;
if (positionalArguments.length() == 2) {
port = positionalArguments.takeFirst().toInt();
token = positionalArguments.takeFirst();
+ bindingAddress.setScheme(QStringLiteral("ws"));
+ bindingAddress.setHost(QStringLiteral("localhost"));
+ bindingAddress.setPort(port);
+ bindingAddress.setPath(QStringLiteral("/api"));
}
fprintf(stderr, "[tbtnavi] app_name: %s, port: %d, token: %s.\n",
graphic_role.toStdString().c_str(),
@@ -72,8 +79,13 @@ int main(int argc, char *argv[])
qmlRegisterType<QCheapRuler>("com.mapbox.cheap_ruler", 1, 0, "CheapRuler");
+ QQmlContext *context = engine.rootContext();
+
File_Operation file;
- engine.rootContext()->setContextProperty("fileOperation", &file);
+ context->setContextProperty("fileOperation", &file);
+
+ Navigation *navigation = new Navigation(bindingAddress, context);
+ new navigation_client(navigation);
engine.load(QUrl(QStringLiteral("qrc:qml/Main.qml")));
QObject *root = engine.rootObjects().first();