summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/app/main.cpp b/app/main.cpp
index 23966ca..7c967c2 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -27,8 +27,10 @@
#include <QQuickWindow>
#include "PresetDataObject.h"
#include "qlibwindowmanager.h"
+#include "qlibsoundmanager.h"
static QLibWindowmanager* qwm;
+static QLibSoundmanager* smw;
static std::string myname = std::string("Radio");
int main(int argc, char *argv[])
@@ -91,6 +93,8 @@ int main(int argc, char *argv[])
context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
qwm = new QLibWindowmanager();
+ smw = new QLibSoundmanager();
+
// WindowManager
if(qwm->init(port,secret) != 0){
exit(EXIT_FAILURE);
@@ -102,16 +106,28 @@ int main(int argc, char *argv[])
fprintf(stderr, "Surface got syncDraw!\n");
qwm->endDraw(myname.c_str());
});
- qwm->set_event_handler(QLibWindowmanager::Event_FlushDraw, [](json_object *object) {
- fprintf(stderr, "Surface got flushDraw!\n");;
+ qwm->set_event_handler(QLibWindowmanager::Event_FlushDraw, [&engine, smw](json_object *object) {
+ fprintf(stderr, "Surface got flushDraw!\n");
+ QObject *root = engine.rootObjects().first();
+ int sourceID = root->property("sourceID").toInt();
+ smw->connect(sourceID, "default");
});
+ // SoundManager, event handler is set inside smw
+ smw->init(port, secret);
+
+ engine.rootContext()->setContextProperty("smw",smw);
+
// Loading QML File
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(slotActivateSurface())); // This should be disconnected, but when...
+ QObject::connect(smw, SIGNAL(reply(QVariant)),
+ root, SLOT(slotReply(QVariant)));
+ QObject::connect(smw, SIGNAL(event(QVariant, QVariant)),
+ root, SLOT(slotEvent(QVariant, QVariant)));
}
return app.exec();