summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-05-15 15:02:35 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-06-24 17:53:49 +0300
commit4605f4c6d9d2e06ceea1bd1515bd67e8f75887c8 (patch)
tree8fa3c1c59267e234568c4f5180a30850aeaa6916
parent921fc99dbd966e2e5cdf34d3710a600e4aee8f26 (diff)
Remove windowmanager depends
Bug-AGL: SPEC-3447 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ifb4dfb9c9956ce9ec2fb8599c4fb327b080118f5
-rw-r--r--app/Phone.qml9
-rw-r--r--app/app.pro2
-rw-r--r--app/main.cpp41
-rw-r--r--package/config.xml1
4 files changed, 14 insertions, 39 deletions
diff --git a/app/Phone.qml b/app/Phone.qml
index 6ce503c..9ef99af 100644
--- a/app/Phone.qml
+++ b/app/Phone.qml
@@ -19,6 +19,8 @@ import QtQuick 2.6
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.0
+import QtQuick.Window 2.13
+
ApplicationWindow {
id: root
@@ -28,9 +30,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
TabBar {
id: bar
diff --git a/app/app.pro b/app/app.pro
index 70add20..b7b9570 100644
--- a/app/app.pro
+++ b/app/app.pro
@@ -5,7 +5,7 @@ SOURCES = main.cpp phone.cpp fileplayer.cpp
HEADERS = phone.h numbertype.h fileplayer.h
CONFIG += link_pkgconfig
-PKGCONFIG += libhomescreen qlibwindowmanager qtappfw-phone qtappfw-bt-pbap gstreamer-1.0
+PKGCONFIG += libhomescreen qtappfw-phone qtappfw-bt-pbap gstreamer-1.0
CONFIG(release, debug|release) {
QMAKE_POST_LINK = $(STRIP) --strip-unneeded $(TARGET)
diff --git a/app/main.cpp b/app/main.cpp
index 6423844..a12b8ae 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -24,7 +24,6 @@
#include <QtQuickControls2/QQuickStyle>
#include <QQuickWindow>
#include <libhomescreen.hpp>
-#include <qlibwindowmanager.h>
#include <pbap.h>
#include <telephony.h>
@@ -37,6 +36,7 @@ int main(int argc, char *argv[])
QString graphic_role = QString("phone");
QGuiApplication app(argc, argv);
+ app.setDesktopFileName(graphic_role);
QQuickStyle::setStyle("AGL");
@@ -49,64 +49,37 @@ int main(int argc, char *argv[])
parser.addVersionOption();
parser.process(app);
QStringList positionalArguments = parser.positionalArguments();
+
if (positionalArguments.length() == 2) {
int port = positionalArguments.takeFirst().toInt();
QString secret = positionalArguments.takeFirst();
QUrl bindingAddress;
+
bindingAddress.setScheme(QStringLiteral("ws"));
bindingAddress.setHost(QStringLiteral("localhost"));
bindingAddress.setPort(port);
bindingAddress.setPath(QStringLiteral("/api"));
QUrlQuery query;
+
query.addQueryItem(QStringLiteral("token"), secret);
bindingAddress.setQuery(query);
QQmlContext *context = engine.rootContext();
context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
Telephony *telephony = new Telephony(bindingAddress);
context->setContextProperty("telephony", telephony);
+
std::string token = secret.toStdString();
std::string install_dir = getenv("AFM_APP_INSTALL_DIR");
+
FilePlayer *player = new FilePlayer(install_dir + "/bin/Phone.wav", std::string("phone"));
Phone *phone = new Phone(telephony, player);
context->setContextProperty("phone", phone);
+
QObject::connect(telephony, &Telephony::callStateChanged, phone, &Phone::onCallStateChanged);
context->setContextProperty("pbap", new Pbap(bindingAddress, context));
- LibHomeScreen* hs = new LibHomeScreen();
- QLibWindowmanager* qwm = new QLibWindowmanager();
-
- // WindowManager
- if(qwm->init(port,secret) != 0){
- exit(EXIT_FAILURE);
- }
-
- AGLScreenInfo screenInfo(qwm->get_scale_factor());
-
- // 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) {
- Q_UNUSED(object);
- 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);
- });
qmlRegisterUncreatableType<NumberType>("NumberType", 1, 0, "NumberType", "Not creatable as it is an enum type");
-
- engine.rootContext()->setContextProperty("screenInfo", &screenInfo);
engine.load(QUrl(QStringLiteral("qrc:/Phone.qml")));
- QObject *root = engine.rootObjects().first();
- QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
- QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateWindow()
- ));
}
return app.exec();
}
diff --git a/package/config.xml b/package/config.xml
index a392f9c..02f021b 100644
--- a/package/config.xml
+++ b/package/config.xml
@@ -7,7 +7,6 @@
<author>Qt</author>
<license>APL 2.0</license>
<feature name="urn:AGL:widget:required-api">
- <param name="windowmanager" value="ws" />
<param name="homescreen" value="ws" />
<param name="telephony" value="ws" />
<param name="bluetooth-pbap" value="ws" />