modify display/hide onscreen sequence
[apps/onscreenapp.git] / app / main.cpp
index ea727c6..67a6e9e 100644 (file)
 
 #include <QGuiApplication>
 #include <QCommandLineParser>
-#include <QtGui/QBitmap>
 #include <QtGui/QGuiApplication>
 #include <QtQml/QQmlApplicationEngine>
 #include <QtQml/QQmlContext>
-#include <QtQml/qqml.h>
 #include <QQuickWindow>
 #include <QtQuickControls2/QQuickStyle>
 
 #include "eventhandler.h"
 
-using namespace std;
-
-static EventHandler* eventHandler;
 
 int main(int argc, char *argv[])
 {
@@ -59,10 +54,9 @@ 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);
     engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
     if (engine.rootObjects().isEmpty()) {
@@ -72,13 +66,10 @@ int main(int argc, char *argv[])
 
     QObject *root = engine.rootObjects().first();
     QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
-
-    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!");
-
     return app.exec();
 }