summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-05-15 19:22:35 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-06-24 17:55:05 +0300
commitb4b22f3269ff177b96ed366333c8d4c2debb8554 (patch)
tree215cca54e461643c1112c950db539fdf2292e832 /app/main.cpp
parent9a7b9670a5dc4af79c8637803888dfdcea033476 (diff)
Remove windowmanager depends
Bug-AGL: SPEC-3447 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I0530e4a89a24cb1cf730dde4e25675d2d4a01f7a
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp35
1 files changed, 1 insertions, 34 deletions
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 <QtQml/QQmlContext>
#include <QtQuickControls2/QQuickStyle>
#include <QQuickWindow>
-#include <libhomescreen.hpp>
-#include <qlibwindowmanager.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -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<QQuickWindow *>(root);
- QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateWindow()
- ));
}
return app.exec();
}