diff options
Diffstat (limited to 'libsowatch/declarativewatchwrapper.cpp')
-rw-r--r-- | libsowatch/declarativewatchwrapper.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/libsowatch/declarativewatchwrapper.cpp b/libsowatch/declarativewatchwrapper.cpp index f7914f8..d972d86 100644 --- a/libsowatch/declarativewatchwrapper.cpp +++ b/libsowatch/declarativewatchwrapper.cpp @@ -1,11 +1,14 @@ #include <QtCore/QDebug> +#include "watchserver.h" #include "watch.h" +#include "notification.h" #include "declarativewatchwrapper.h" using namespace sowatch; -DeclarativeWatchWrapper::DeclarativeWatchWrapper(Watch* watch, QObject *parent) : - QObject(parent), _watch(watch), _active(false) +DeclarativeWatchWrapper::DeclarativeWatchWrapper(WatchServer* server, Watch* watch, QObject* parent) : + QObject(parent), _server(server), _watch(watch), + _active(false) { } @@ -20,6 +23,19 @@ bool DeclarativeWatchWrapper::active() const return _active; } +QList<QObject*> DeclarativeWatchWrapper::notifications() const +{ + // TODO: Figure a better way for this; QAbstractListModel, etc. + QList<Notification*> nl = _server->liveNotifications(); + QList<QObject*> ol; + foreach (Notification* n, nl) { + QObject * o = n; + ol.append(o); + } + qDebug() << "notifications declarative: " << ol; + return ol; +} + void DeclarativeWatchWrapper::vibrate(int msecs) { if (_active) { @@ -34,6 +50,9 @@ void DeclarativeWatchWrapper::activate() connect(_watch, SIGNAL(buttonReleased(int)), this, SIGNAL(buttonReleased(int))); _active = true; emit activeChanged(); + // Since a notification currently causes the active watchlet to be deactivated, + // we can assume notifications only change when we are deactivated. + emit notificationsChanged(); } } |