diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-11-10 23:46:39 -0800 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-11-11 20:36:36 -0800 |
commit | 8e070480a38956be76339cc6b81f3b0cb665cef5 (patch) | |
tree | 4730aff310062a120bd95802c0c07b477a8e7df3 /app/main.cpp | |
parent | d01ce33b26daf332d4b8bd9e389e0877c1c38b88 (diff) |
tbtnavi: add interface to agl-service-navigation
Add interface to agl-service-navigation via libqtappfw to replace
navicore DBus completely.
Bug-AGL: SPEC-2880
Change-Id: Idf3afcdd3c7424b8adb91a9aaf14df662d7fe107
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'app/main.cpp')
-rw-r--r-- | app/main.cpp | 14 |
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(); |