summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/main.cpp b/app/main.cpp
index 7c967c2..ef0204a 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -26,9 +26,11 @@
#include <QtQuickControls2/QQuickStyle>
#include <QQuickWindow>
#include "PresetDataObject.h"
+#include <libhomescreen.hpp>
#include "qlibwindowmanager.h"
#include "qlibsoundmanager.h"
+static LibHomeScreen* hs;
static QLibWindowmanager* qwm;
static QLibSoundmanager* smw;
static std::string myname = std::string("Radio");
@@ -92,6 +94,9 @@ int main(int argc, char *argv[])
bindingAddress.setQuery(query);
context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
+ std::string token = secret.toStdString();
+
+ hs = new LibHomeScreen();
qwm = new QLibWindowmanager();
smw = new QLibSoundmanager();
@@ -112,6 +117,18 @@ int main(int argc, char *argv[])
int sourceID = root->property("sourceID").toInt();
smw->connect(sourceID, "default");
});
+
+ // HomeScreen
+ hs->init(port, token.c_str());
+ hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [qwm](json_object *object){
+ const char *appname = json_object_get_string(
+ json_object_object_get(object, "application_name"));
+ if(myname == appname)
+ {
+ qDebug("Surface %s got tapShortcut\n", appname);
+ qwm->activateSurface(myname.c_str());
+ }
+ });
// SoundManager, event handler is set inside smw
smw->init(port, secret);