From 73ccc498819462d7de5f549037c3847e1cf0088d Mon Sep 17 00:00:00 2001 From: Loïc Collignon Date: Thu, 13 Dec 2018 09:46:10 +0100 Subject: Handle the volume_changed event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 4A's High Level API now raises event when volume of a role is changed. This handles it by subscribing to the event and update the corresponding slider. Bug: SPEC-2054 Change-Id: I137eaa461f0baa9206ee714c91e3ac998b9b2bf2 Signed-off-by: Loïc Collignon --- app/main.cpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'app/main.cpp') diff --git a/app/main.cpp b/app/main.cpp index ac5fb24..dd30e2d 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) parser.process(app); QStringList positionalArguments = parser.positionalArguments(); - qmlRegisterType("Mixer", 1, 0, "Mixer"); + qmlRegisterType("Mixer", 1, 0, "Mixer"); QQmlApplicationEngine engine; if (positionalArguments.length() == 2) { @@ -87,11 +87,11 @@ int main(int argc, char *argv[]) if (qwm->requestSurface(myname) != 0) { exit(EXIT_FAILURE); } - // Create an event callbnewack against an event type. Here a lambda is called when SyncDraw event occurs - qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm, myname](json_object*) { - fprintf(stderr, "Surface got syncDraw!\n"); - qwm->endDraw(myname); - }); + // Create an event callbnewack against an event type. Here a lambda is called when SyncDraw event occurs + qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm, myname](json_object*) { + fprintf(stderr, "Surface got syncDraw!\n"); + qwm->endDraw(myname); + }); // HomeScreen std::string token = secret.toStdString(); @@ -110,29 +110,30 @@ int main(int argc, char *argv[]) } }); #endif + engine.load(QUrl(QStringLiteral("qrc:/Mixer.qml"))); // Find the instantiated model QObject and connect the signals/slots QList mobjs = engine.rootObjects(); - if (mobjs.empty()) - { - qDebug() << "[ERROR] Failed to load QML!"; - return -1; - } + if (mobjs.empty()) + { + qDebug() << "[ERROR] Failed to load QML!"; + return -1; + } - QQuickWindow *window = qobject_cast(mobjs.first()); + QQuickWindow *window = qobject_cast(mobjs.first()); #ifdef NATIVE_BUILD - window->setFlags(window->flags() & ~Qt::FramelessWindowHint); // Remove the borderless flag - window->setHeight(QGuiApplication::primaryScreen()->geometry().height()); + window->setFlags(window->flags() & ~Qt::FramelessWindowHint); // Remove the borderless flag + window->setHeight(QGuiApplication::primaryScreen()->geometry().height()); #else QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface())); #endif } - else - { - qDebug() << "[ERROR] No port and token specified!"; - return -1; - } + else + { + qDebug() << "[ERROR] No port and token specified!"; + return -1; + } return app.exec(); } -- cgit 1.2.3-korg