aboutsummaryrefslogtreecommitdiffstats
path: root/src/aglextras/hmi/aglwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/aglextras/hmi/aglwindow.cpp')
-rw-r--r--src/aglextras/hmi/aglwindow.cpp46
1 files changed, 34 insertions, 12 deletions
diff --git a/src/aglextras/hmi/aglwindow.cpp b/src/aglextras/hmi/aglwindow.cpp
index f1f55e6..e0c3fd8 100644
--- a/src/aglextras/hmi/aglwindow.cpp
+++ b/src/aglextras/hmi/aglwindow.cpp
@@ -21,6 +21,11 @@
#include <QtQuick/QQuickWindow>
#include <QtQml/QQmlApplicationEngine>
+#ifdef USE_AGL_HMI_FRAMEWORK
+#include <libhomescreen.hpp>
+#include <qlibwindowmanager.h>
+#endif // USE_AGL_HMI_FRAMEWORK
+
QT_BEGIN_NAMESPACE
AGLWindowPrivate::AGLWindowPrivate (AGLWindow*)
@@ -35,12 +40,15 @@ AGLWindowPrivate::~AGLWindowPrivate (void)
void AGLWindow::activate_surface (void)
{
+#ifdef USE_AGL_HMI_FRAMEWORK
qDebug("Disconnect!! SLOT activate_surface()");
QLibWindowmanager::disconnect(d_ptr->loading);
- activateSurface(QString(d_ptr->layout));
+ w_ptr->activateSurface(QString(d_ptr->layout));
+#endif // USE_AGL_HMI_FRAMEWORK
}
+#ifdef USE_AGL_HMI_FRAMEWORK
void AGLWindow::attach (QQmlApplicationEngine* engine)
{
if (d_ptr->binding) {
@@ -51,19 +59,32 @@ void AGLWindow::attach (QQmlApplicationEngine* engine)
this, SLOT(activate_surface()));
}
}
+#else
+void AGLWindow::attach (QQmlApplicationEngine*)
+{
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(engine->rootObjects().first());
+ window->resize(1080, 1920 - 218 - 215);
+ window->setVisible(true);
+}
+#endif // USE_AGL_HMI_FRAMEWORK
+#ifdef USE_AGL_HMI_FRAMEWORK
AGLWindow::AGLWindow (const QString& layout, int port, QString secret)
- : QLibWindowmanager(nullptr),
- d_ptr(new AGLWindowPrivate(this))
-
+ : d_ptr(new AGLWindowPrivate(this)),
+ h_ptr(new LibHomeScreen()),
+ w_ptr(new QLibWindowmanager(nullptr))
+#else
+AGLWindow::AGLWindow (const QString&, int port, QString)
+ : d_ptr(new AGLWindowPrivate(this))
+#endif // USE_AGL_HMI_FRAMEWORK
{
if (port == -1) {
qDebug("This is not AGL binding application");
return;
}
-
- if (QLibWindowmanager::init(port, secret) != 0 ||
- LibHomeScreen::init(port, secret.toStdString().c_str()) != 0) {
+#ifdef USE_AGL_HMI_FRAMEWORK
+ if (w_ptr->init(port, secret) != 0 ||
+ h_ptr->init(port, secret.toStdString().c_str()) != 0) {
qDebug("Cannot get binding API");
return;
}
@@ -71,7 +92,7 @@ AGLWindow::AGLWindow (const QString& layout, int port, QString secret)
d_ptr->layout = layout;
// Request a surface as described in layers.json windowmanager’s file
- if (requestSurface(d_ptr->layout) != 0) {
+ if (w_ptr->requestSurface(d_ptr->layout) != 0) {
qDebug("Cannot get surface for %s", qPrintable(d_ptr->layout));
return;
}
@@ -79,16 +100,16 @@ AGLWindow::AGLWindow (const QString& layout, int port, QString secret)
d_ptr->binding = true;
// Create an event callback against an event type. Here a lambda is called when SyncDraw event occurs
- QLibWindowmanager::set_event_handler (
+ w_ptr->set_event_handler (
QLibWindowmanager::Event_SyncDraw,
[this](json_object*) {
qDebug("Surface got syncDraw!\n");
- endDraw(d_ptr->layout);
+ w_ptr->endDraw(d_ptr->layout);
}
);
// Set the event handler for Event_TapShortcut which will activate the surface for windowmanager
- LibHomeScreen::set_event_handler (
+ h_ptr->set_event_handler (
LibHomeScreen::Event_TapShortcut,
[this](json_object* object) {
json_object *jo_app_name = nullptr;
@@ -96,11 +117,12 @@ AGLWindow::AGLWindow (const QString& layout, int port, QString secret)
QString name(QLatin1String(json_object_get_string(jo_app_name)));
if(d_ptr->layout == name) {
qDebug("Surface %s got tapShortcut\n", qPrintable(name));
- activateSurface(d_ptr->layout);
+ w_ptr->activateSurface(d_ptr->layout);
}
}
}
);
+#endif // USE_AGL_HMI_FRAMEWORK
}
QT_END_NAMESPACE