diff options
Diffstat (limited to 'common/notifier.cpp')
-rw-r--r-- | common/notifier.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/common/notifier.cpp b/common/notifier.cpp index e4248df..25d0b85 100644 --- a/common/notifier.cpp +++ b/common/notifier.cpp | |||
@@ -27,20 +27,18 @@ | |||
27 | 27 | ||
28 | using namespace Sink; | 28 | using namespace Sink; |
29 | 29 | ||
30 | class Sink::Notifier::Private { | 30 | class Sink::Notifier::Private |
31 | { | ||
31 | public: | 32 | public: |
32 | Private() | 33 | Private() : context(new QObject) |
33 | : context(new QObject) | ||
34 | { | 34 | { |
35 | |||
36 | } | 35 | } |
37 | QList<QSharedPointer<ResourceAccess> > resourceAccess; | 36 | QList<QSharedPointer<ResourceAccess>> resourceAccess; |
38 | QList<std::function<void(const Notification &)> > handler; | 37 | QList<std::function<void(const Notification &)>> handler; |
39 | QSharedPointer<QObject> context; | 38 | QSharedPointer<QObject> context; |
40 | }; | 39 | }; |
41 | 40 | ||
42 | Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess) | 41 | Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess) : d(new Sink::Notifier::Private) |
43 | : d(new Sink::Notifier::Private) | ||
44 | { | 42 | { |
45 | QObject::connect(resourceAccess.data(), &ResourceAccess::notification, d->context.data(), [this](const Notification ¬ification) { | 43 | QObject::connect(resourceAccess.data(), &ResourceAccess::notification, d->context.data(), [this](const Notification ¬ification) { |
46 | for (const auto &handler : d->handler) { | 44 | for (const auto &handler : d->handler) { |
@@ -50,8 +48,7 @@ Notifier::Notifier(const QSharedPointer<ResourceAccess> &resourceAccess) | |||
50 | d->resourceAccess << resourceAccess; | 48 | d->resourceAccess << resourceAccess; |
51 | } | 49 | } |
52 | 50 | ||
53 | Notifier::Notifier(const QByteArray &instanceIdentifier) | 51 | Notifier::Notifier(const QByteArray &instanceIdentifier) : d(new Sink::Notifier::Private) |
54 | : d(new Sink::Notifier::Private) | ||
55 | { | 52 | { |
56 | auto resourceAccess = Sink::ResourceAccess::Ptr::create(instanceIdentifier); | 53 | auto resourceAccess = Sink::ResourceAccess::Ptr::create(instanceIdentifier); |
57 | resourceAccess->open(); | 54 | resourceAccess->open(); |