From be8837e88e987349270941d6beb45f3e03baec8c Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Fri, 15 May 2020 19:22:35 +0300 Subject: Remove windowmanager depends Signed-off-by: Marius Vlad --- app/Radio.qml | 9 ++++++--- app/app.pro | 2 +- app/main.cpp | 35 +---------------------------------- package/config.xml | 1 - 4 files changed, 8 insertions(+), 39 deletions(-) diff --git a/app/Radio.qml b/app/Radio.qml index 6b7c951..e981219 100644 --- a/app/Radio.qml +++ b/app/Radio.qml @@ -20,6 +20,8 @@ import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import AGL.Demo.Controls 1.0 +import QtQuick.Window 2.13 + ApplicationWindow { id: root @@ -39,9 +41,10 @@ ApplicationWindow { Item { id: container anchors.centerIn: parent - width: 1080 - height: 1487 - scale: screenInfo.scale_factor() + width: Screen.width + height: Screen.height + //scale: screenInfo.scale_factor() + scale: 1 ColumnLayout { anchors.fill: parent diff --git a/app/app.pro b/app/app.pro index 958614f..9e8f93d 100644 --- a/app/app.pro +++ b/app/app.pro @@ -5,7 +5,7 @@ HEADERS = PresetDataObject.h SOURCES = main.cpp PresetDataObject.cpp CONFIG += link_pkgconfig -PKGCONFIG += libhomescreen qlibwindowmanager qtappfw-radio +PKGCONFIG += libhomescreen qtappfw-radio RESOURCES += \ radio.qrc \ diff --git a/app/main.cpp b/app/main.cpp index 7cc7a10..a4cf1ee 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include #include #include @@ -39,6 +37,7 @@ int main(int argc, char *argv[]) QString graphic_role = QString("radio"); QGuiApplication app(argc, argv); + app.setDesktopFileName(graphic_role); QQuickStyle::setStyle("AGL"); @@ -104,41 +103,9 @@ int main(int argc, char *argv[]) bindingAddress.setQuery(query); context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress); - std::string token = secret.toStdString(); - LibHomeScreen* hs = new LibHomeScreen(); - QLibWindowmanager* qwm = new QLibWindowmanager(); - - // WindowManager - if(qwm->init(port,secret) != 0){ - exit(EXIT_FAILURE); - } - AGLScreenInfo screenInfo(qwm->get_scale_factor()); - engine.rootContext()->setContextProperty(QStringLiteral("screenInfo"), &screenInfo); - // Request a surface as described in layers.json windowmanager’s file - if (qwm->requestSurface(graphic_role) != 0) { - exit(EXIT_FAILURE); - } - // Create an event callback against an event type. Here a lambda is called when SyncDraw event occurs - qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm, &graphic_role](json_object *object) { - fprintf(stderr, "Surface got syncDraw!\n"); - qwm->endDraw(graphic_role); - }); - - // HomeScreen - hs->init(port, token.c_str()); - // Set the event handler for Event_ShowWindow which will activate the surface for windowmanager - hs->set_event_handler(LibHomeScreen::Event_ShowWindow, [qwm, &graphic_role](json_object *object){ - qDebug("Surface %s got showWindow\n", graphic_role.toStdString().c_str()); - qwm->activateWindow(graphic_role); - }); context->setContextProperty("radio", new Radio(bindingAddress, context)); - engine.load(QUrl(QStringLiteral("qrc:/Radio.qml"))); - QObject *root = engine.rootObjects().first(); - QQuickWindow *window = qobject_cast(root); - QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateWindow() - )); } return app.exec(); } diff --git a/package/config.xml b/package/config.xml index efbb5ec..4b14246 100644 --- a/package/config.xml +++ b/package/config.xml @@ -7,7 +7,6 @@ Qt APL 2.0 - -- cgit 1.2.3-korg