change onscreenapp
[apps/onscreenapp.git] / app / main.cpp
index 67a6e9e..7dbd13c 100644 (file)
 #include <QtGui/QGuiApplication>
 #include <QtQml/QQmlApplicationEngine>
 #include <QtQml/QQmlContext>
+#include <QtQml/qqml.h>
 #include <QQuickWindow>
 #include <QtQuickControls2/QQuickStyle>
 
 #include "eventhandler.h"
+#include "onscreenmodel.h"
 
 
 int main(int argc, char *argv[])
@@ -58,6 +60,7 @@ int main(int argc, char *argv[])
     EventHandler *eventHandler = new EventHandler();
     eventHandler->init(port, token.toStdString().c_str());
     engine.rootContext()->setContextProperty("eventHandler", eventHandler);
+    qmlRegisterType<OnScreenModel>("OnScreenModel", 1, 0, "OnScreenModel");
     engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
     if (engine.rootObjects().isEmpty()) {
         HMI_DEBUG(APP_ID, "Fatal Error, rootObject is empty!");
@@ -66,10 +69,11 @@ int main(int argc, char *argv[])
 
     QObject *root = engine.rootObjects().first();
     QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
-    QObject::connect(eventHandler, SIGNAL(signalLoader(QVariant)), window, SLOT(qmlLoader(QVariant)));
-    QObject::connect(eventHandler, SIGNAL(signalOnScreenParameter(QVariant)), window, SLOT(qmlOnScreenParameter(QVariant)));
+    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()));
 
-    HMI_DEBUG(APP_ID, "Launched!");
+    HMI_DEBUG(APP_ID, "onscreenapp started!");
     return app.exec();
 }