X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=homescreen%2Fsrc%2Fmain.cpp;h=b92ff607da2ad2b5836800c11c4deb8b5eed6864;hb=3f99bee502be1f49801797a50c041c3f177535c5;hp=620c869d9c52a065efd707c537a1c1cbe772b97d;hpb=58ecf2c3229ab677ca39095b52ab88b1a41861bd;p=apps%2Fhomescreen.git diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index 620c869..b92ff60 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -28,41 +29,15 @@ #include #include "applicationlauncher.h" #include "statusbarmodel.h" -#include "afm_user_daemon_proxy.h" #include "mastervolume.h" #include "homescreenhandler.h" #include "hmi-debug.h" - -// XXX: We want this DBus connection to be shared across the different -// QML objects, is there another way to do this, a nice way, perhaps? -org::AGL::afm::user *afm_user_daemon_proxy; - -namespace { - -struct Cleanup { - static inline void cleanup(org::AGL::afm::user *p) { - delete p; - afm_user_daemon_proxy = Q_NULLPTR; - } -}; - -void noOutput(QtMsgType, const QMessageLogContext &, const QString &) -{ -} - -} +#include "chromecontroller.h" int main(int argc, char *argv[]) { QGuiApplication a(argc, argv); - // use launch process - QScopedPointer afm_user_daemon_proxy(new org::AGL::afm::user("org.AGL.afm.user", - "/org/AGL/afm/user", - QDBusConnection::sessionBus(), - 0)); - ::afm_user_daemon_proxy = afm_user_daemon_proxy.data(); - QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("HomeScreen"); @@ -78,6 +53,7 @@ int main(int argc, char *argv[]) int port = 1700; QString token = "wm"; + QString graphic_role = "homescreen"; // defined in layers.json in Window Manager if (positionalArguments.length() == 2) { port = positionalArguments.takeFirst().toInt(); @@ -90,6 +66,8 @@ int main(int argc, char *argv[]) // qmlRegisterType("HomeScreen", 1, 0, "ApplicationLauncher"); qmlRegisterType("HomeScreen", 1, 0, "StatusBarModel"); qmlRegisterType("MasterVolume", 1, 0, "MasterVolume"); + qmlRegisterUncreatableType("SpeechChrome", 1, 0, "SpeechChromeController", + QLatin1String("SpeechChromeController is uncreatable.")); ApplicationLauncher *launcher = new ApplicationLauncher(); QLibWindowmanager* layoutHandler = new QLibWindowmanager(); @@ -99,12 +77,12 @@ int main(int argc, char *argv[]) AGLScreenInfo screenInfo(layoutHandler->get_scale_factor()); - if (layoutHandler->requestSurface(QString("HomeScreen")) != 0) { + if (layoutHandler->requestSurface(graphic_role) != 0) { exit(EXIT_FAILURE); } - layoutHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, [layoutHandler](json_object *object) { - layoutHandler->endDraw(QString("HomeScreen")); + layoutHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, [layoutHandler, &graphic_role](json_object *object) { + layoutHandler->endDraw(graphic_role); }); layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher](json_object *object) { @@ -133,11 +111,13 @@ int main(int argc, char *argv[]) // mail.qml loading QQmlApplicationEngine engine; + engine.rootContext()->setContextProperty("bindingAddress", bindingAddress); engine.rootContext()->setContextProperty("layoutHandler", layoutHandler); engine.rootContext()->setContextProperty("homescreenHandler", homescreenHandler); engine.rootContext()->setContextProperty("launcher", launcher); engine.rootContext()->setContextProperty("weather", new Weather(bindingAddress)); - engine.rootContext()->setContextProperty("bluetooth", new Bluetooth(bindingAddress)); + engine.rootContext()->setContextProperty("bluetooth", new Bluetooth(bindingAddress, engine.rootContext())); + engine.rootContext()->setContextProperty("speechChromeController", new ChromeController(bindingAddress, &engine)); engine.rootContext()->setContextProperty("screenInfo", &screenInfo); engine.load(QUrl(QStringLiteral("qrc:/main.qml")));