summaryrefslogtreecommitdiffstats
path: root/common/clientapi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/clientapi.cpp')
-rw-r--r--common/clientapi.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp
index 413abd3..5eb4b55 100644
--- a/common/clientapi.cpp
+++ b/common/clientapi.cpp
@@ -353,6 +353,19 @@ Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess)
353 d->resourceAccess << resourceAccess; 353 d->resourceAccess << resourceAccess;
354} 354}
355 355
356Notifier::Notifier(const QByteArray &instanceIdentifier)
357 : d(new Sink::Notifier::Private)
358{
359 auto resourceAccess = Sink::ResourceAccess::Ptr::create(instanceIdentifier);
360 resourceAccess->open();
361 QObject::connect(resourceAccess.data(), &ResourceAccess::notification, d->context.data(), [this](const Notification &notification) {
362 for (const auto &handler : d->handler) {
363 handler(notification);
364 }
365 });
366 d->resourceAccess << resourceAccess;
367}
368
356void Notifier::registerHandler(std::function<void(const Notification &)> handler) 369void Notifier::registerHandler(std::function<void(const Notification &)> handler)
357{ 370{
358 d->handler << handler; 371 d->handler << handler;