X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=app%2Fmain.cpp;h=7dbd13c8592055fca669050569cc71b1ae80898b;hb=a102c3aac7cf2ec721d5a5039febdd05e303638a;hp=ea727c609f7a77c2a623b0de1091688a443c1693;hpb=e79d82c88e350e6b882158624363b82fe3e2d91a;p=apps%2Fonscreenapp.git diff --git a/app/main.cpp b/app/main.cpp index ea727c6..7dbd13c 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -25,10 +24,8 @@ #include #include "eventhandler.h" +#include "onscreenmodel.h" -using namespace std; - -static EventHandler* eventHandler; int main(int argc, char *argv[]) { @@ -59,11 +56,11 @@ int main(int argc, char *argv[]) HMI_DEBUG(APP_ID, "port = %d, token = %s", port, token.toStdString().c_str()); - eventHandler = new EventHandler(); - eventHandler->init(port, token.toStdString().c_str()); - QQmlApplicationEngine engine; + EventHandler *eventHandler = new EventHandler(); + eventHandler->init(port, token.toStdString().c_str()); engine.rootContext()->setContextProperty("eventHandler", eventHandler); + qmlRegisterType("OnScreenModel", 1, 0, "OnScreenModel"); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) { HMI_DEBUG(APP_ID, "Fatal Error, rootObject is empty!"); @@ -72,13 +69,11 @@ int main(int argc, char *argv[]) QObject *root = engine.rootObjects().first(); QQuickWindow *window = qobject_cast(root); + QObject::connect(eventHandler, SIGNAL(updateModel(QVariant)), window, SLOT(setOnScreenModel(QVariant))); + QObject::connect(eventHandler, SIGNAL(showOnScreen()), window, SLOT(showOnScreen())); + QObject::connect(eventHandler, SIGNAL(hideOnScreen()), window, SLOT(hideOnScreen())); - eventHandler->setQuickWindow(window); - QObject::connect(eventHandler, SIGNAL(signalLoader(QVariant)), window, SLOT(qmlLoader(QVariant))); - QObject::connect(eventHandler, SIGNAL(signalOnScreenParameter(QVariant)), window, SLOT(qmlOnScreenParameter(QVariant))); - - HMI_DEBUG(APP_ID, "Launched!"); - + HMI_DEBUG(APP_ID, "onscreenapp started!"); return app.exec(); }