diff options
-rw-r--r-- | config.tests/libhomescreen/libhomescreen.cpp | 8 | ||||
-rw-r--r-- | config.tests/libhomescreen/libhomescreen.pro | 2 | ||||
-rw-r--r-- | config.tests/qlibwindowmanager/qlibwindowmanager.cpp | 8 | ||||
-rw-r--r-- | config.tests/qlibwindowmanager/qlibwindowmanager.pro | 2 | ||||
-rw-r--r-- | configure.json | 5 | ||||
-rw-r--r-- | qtaglextras.pro | 2 | ||||
-rw-r--r-- | src/aglextras/aglextras.pro | 10 | ||||
-rw-r--r-- | src/aglextras/configure.json | 65 | ||||
-rw-r--r-- | src/aglextras/hmi/aglwindow.cpp | 46 | ||||
-rw-r--r-- | src/aglextras/hmi/aglwindow.h | 9 |
10 files changed, 134 insertions, 23 deletions
diff --git a/config.tests/libhomescreen/libhomescreen.cpp b/config.tests/libhomescreen/libhomescreen.cpp new file mode 100644 index 0000000..d698b05 --- /dev/null +++ b/config.tests/libhomescreen/libhomescreen.cpp @@ -0,0 +1,8 @@ +#include <libhomescreen.hpp> + +int main(int argc,char **argv) +{ + LibHomeScreen libHomeScreen; + return 0; +} + diff --git a/config.tests/libhomescreen/libhomescreen.pro b/config.tests/libhomescreen/libhomescreen.pro new file mode 100644 index 0000000..76aa2ae --- /dev/null +++ b/config.tests/libhomescreen/libhomescreen.pro @@ -0,0 +1,2 @@ +SOURCES = libhomescreen.cpp +CONFIG -= qt diff --git a/config.tests/qlibwindowmanager/qlibwindowmanager.cpp b/config.tests/qlibwindowmanager/qlibwindowmanager.cpp new file mode 100644 index 0000000..bb95c93 --- /dev/null +++ b/config.tests/qlibwindowmanager/qlibwindowmanager.cpp @@ -0,0 +1,8 @@ +#include <qlibwindowmanager.h> + +int main(int argc,char **argv) +{ + QLibWindowmanager qwm; + return 0; +} + diff --git a/config.tests/qlibwindowmanager/qlibwindowmanager.pro b/config.tests/qlibwindowmanager/qlibwindowmanager.pro new file mode 100644 index 0000000..26e1611 --- /dev/null +++ b/config.tests/qlibwindowmanager/qlibwindowmanager.pro @@ -0,0 +1,2 @@ +SOURCES = qlibwindowmanager.cpp +CONFIG += qt diff --git a/configure.json b/configure.json new file mode 100644 index 0000000..e81e219 --- /dev/null +++ b/configure.json @@ -0,0 +1,5 @@ +{ + "subconfigs": [ + "src/aglextras" + ] +} diff --git a/qtaglextras.pro b/qtaglextras.pro index 2e29e90..58c33f2 100644 --- a/qtaglextras.pro +++ b/qtaglextras.pro @@ -1,3 +1 @@ -load(configure) - load(qt_parts) diff --git a/src/aglextras/aglextras.pro b/src/aglextras/aglextras.pro index 4b013fb..1a4d2ac 100644 --- a/src/aglextras/aglextras.pro +++ b/src/aglextras/aglextras.pro @@ -1,13 +1,13 @@ TARGET = QtAGLExtras -CONFIG += link_pkgconfig -PKGCONFIG += libhomescreen qlibwindowmanager - QT += quick QT += core-private include(hmi/hmi.pri) -load(qt_module) +qtConfig(agl_hmi_framework) { + DEFINES += USE_AGL_HMI_FRAMEWORK + QMAKE_USE += libhomescreen qlibwindowmanager +} -CONFIG-=create_cmake +load(qt_module) diff --git a/src/aglextras/configure.json b/src/aglextras/configure.json new file mode 100644 index 0000000..1940e3d --- /dev/null +++ b/src/aglextras/configure.json @@ -0,0 +1,65 @@ +{ + "module": "aglextras", + "depends" : [ + "core" + ], + "testDir": "../../config.tests", + + "commandline": { + "options": { + "libhomescreen": "boolean", + "qlibwindowmanager": "boolean" + } + }, + + "libraries": { + "libhomescreen": { + "label": "LibHomescreen", + "test": "libhomescreen", + "sources": [ + { "type": "pkgConfig", + "args": "libhomescreen" } + ] + }, + "qlibwindowmanager": { + "label": "QLibWindowManager", + "test": "qlibwindowmanager", + "sources": [ + { "type": "pkgConfig", + "args": "qlibwindowmanager" } + ] + } + }, + + "features": { + "libhomescreen": { + "label": "LibHomeScreen", + "condition": "libs.libhomescreen", + "output": [ "feature", "privateFeature" ] + }, + "qlibwindowmanager": { + "label": "QLibWindowManager", + "condition": "libs.qlibwindowmanager", + "output": [ "feature", "privateFeature" ] + }, + "agl_hmi_framework": { + "label": "AGL HMI Framework", + "condition": "features.libhomescreen && features.qlibwindowmanager", + "output": [ "feature", "privateFeature" ] + } + }, + + "report" : [ + ], + + "summary": [ + { + "section": "Qt AGLExtras", + "entries": [ + "libhomescreen", + "qlibwindowmanager", + "agl_hmi_framework" + ] + } + ] +} 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 diff --git a/src/aglextras/hmi/aglwindow.h b/src/aglextras/hmi/aglwindow.h index 4c5261b..7c7773a 100644 --- a/src/aglextras/hmi/aglwindow.h +++ b/src/aglextras/hmi/aglwindow.h @@ -21,13 +21,12 @@ #include <QtAGLExtras/aglextrasglobal.h> #include <QSharedPointer> -#include <libhomescreen.hpp> -#include <qlibwindowmanager.h> - QT_BEGIN_NAMESPACE +class LibHomeScreen; +class QLibWindowmanager; class QQmlApplicationEngine; class AGLWindowPrivate; -class AGLEXTRAS_EXPORT AGLWindow : public QLibWindowmanager, public LibHomeScreen +class AGLEXTRAS_EXPORT AGLWindow : public QObject { Q_OBJECT @@ -41,6 +40,8 @@ public slots: private: friend class AGLWindowPrivate; QSharedPointer<AGLWindowPrivate> d_ptr; + QSharedPointer<LibHomeScreen> h_ptr; + QSharedPointer<QLibWindowmanager> w_ptr; }; QT_END_NAMESPACE |