diff options
Diffstat (limited to 'notificationswatchlet')
-rw-r--r-- | notificationswatchlet/metawatch-digital.qml | 39 | ||||
-rw-r--r-- | notificationswatchlet/notificationswatchlet.cpp | 10 | ||||
-rw-r--r-- | notificationswatchlet/notificationswatchlet.h | 18 | ||||
-rw-r--r-- | notificationswatchlet/notificationswatchlet.pro | 60 | ||||
-rw-r--r-- | notificationswatchlet/notificationswatchlet.qrc | 5 | ||||
-rw-r--r-- | notificationswatchlet/notificationswatchletplugin.cpp | 29 | ||||
-rw-r--r-- | notificationswatchlet/notificationswatchletplugin.h | 24 |
7 files changed, 185 insertions, 0 deletions
diff --git a/notificationswatchlet/metawatch-digital.qml b/notificationswatchlet/metawatch-digital.qml new file mode 100644 index 0000000..4a69a0d --- /dev/null +++ b/notificationswatchlet/metawatch-digital.qml @@ -0,0 +1,39 @@ +import QtQuick 1.0 +import QtMobility.location 1.2 + +Rectangle { + width: 96 + height: 96 + + color: "white" + + ListView { + id: notifs + anchors.fill: parent + model: watch.notifications + delegate: Column { + Text { text: model.modelData.title } + Text { text: model.modelData.body } + } + visible: count > 0; + } + Text { + anchors.fill: parent + text: "No notifications" + visible: notifs.count == 0; + } + + Connections { + target: watch + onButtonPressed : { + switch(button) { + case 1: + notifs.decrementCurrentIndex(); + break; + case 2: + notifs.incrementCurrentIndex(); + break; + } + } + } +} diff --git a/notificationswatchlet/notificationswatchlet.cpp b/notificationswatchlet/notificationswatchlet.cpp new file mode 100644 index 0000000..01110e9 --- /dev/null +++ b/notificationswatchlet/notificationswatchlet.cpp @@ -0,0 +1,10 @@ +#include "notificationswatchlet.h" + +using namespace sowatch; + +NotificationsWatchlet::NotificationsWatchlet(WatchServer* server) : + DeclarativeWatchlet(server, "com.javispedro.sowatch.notifications") +{ + setSource(QUrl("qrc:/notificationswatchlet/" + server->watch()->model() + ".qml")); +} + diff --git a/notificationswatchlet/notificationswatchlet.h b/notificationswatchlet/notificationswatchlet.h new file mode 100644 index 0000000..fe49f97 --- /dev/null +++ b/notificationswatchlet/notificationswatchlet.h @@ -0,0 +1,18 @@ +#ifndef NOTIFICATIONSWATCHLET_H +#define NOTIFICATIONSWATCHLET_H + +#include <sowatch.h> + +namespace sowatch +{ + +class NotificationsWatchlet : public DeclarativeWatchlet +{ + Q_OBJECT +public: + explicit NotificationsWatchlet(WatchServer* server); +}; + +} + +#endif // NOTIFICATIONSWATCHLET_H diff --git a/notificationswatchlet/notificationswatchlet.pro b/notificationswatchlet/notificationswatchlet.pro new file mode 100644 index 0000000..f5e4ce8 --- /dev/null +++ b/notificationswatchlet/notificationswatchlet.pro @@ -0,0 +1,60 @@ + +TARGET = notificationswatchlet +TEMPLATE = lib +# CONFIG += plugin +CONFIG += mobility + +SOURCES += notificationswatchletplugin.cpp notificationswatchlet.cpp + +HEADERS += notificationswatchletplugin.h notificationswatchlet.h + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/release/ -lsowatch +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/debug/ -lsowatch +else:symbian: LIBS += -lsowatch +else:unix: LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch + +INCLUDEPATH += $$PWD/../libsowatch +DEPENDPATH += $$PWD/../libsowatch + +unix:!symbian { + maemo5 { + target.path = /opt/sowatch/watchlets + } else { + target.path = /usr/lib/sowatch/watchlets + } + INSTALLS += target +} + +OTHER_FILES += \ + metawatch-digital.qml + +RESOURCES += \ + notificationswatchlet.qrc + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/notificationswatchlet/notificationswatchlet.qrc b/notificationswatchlet/notificationswatchlet.qrc new file mode 100644 index 0000000..a1f217d --- /dev/null +++ b/notificationswatchlet/notificationswatchlet.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/notificationswatchlet"> + <file>metawatch-digital.qml</file> + </qresource> +</RCC> diff --git a/notificationswatchlet/notificationswatchletplugin.cpp b/notificationswatchlet/notificationswatchletplugin.cpp new file mode 100644 index 0000000..a3ebbd7 --- /dev/null +++ b/notificationswatchlet/notificationswatchletplugin.cpp @@ -0,0 +1,29 @@ +#include "notificationswatchlet.h" +#include "notificationswatchletplugin.h" + +using namespace sowatch; + +NotificationsWatchletPlugin::NotificationsWatchletPlugin(QObject *parent) : + QObject(parent) +{ +} + +NotificationsWatchletPlugin::~NotificationsWatchletPlugin() +{ +} + +QStringList NotificationsWatchletPlugin::watchlets() +{ + QStringList l; + l << "com.javispedro.sowatch.notifications"; + return l; +} + +Watchlet* NotificationsWatchletPlugin::getWatchlet(const QString& driver, QSettings& settings, WatchServer *server) +{ + Q_UNUSED(driver); + Q_UNUSED(settings); + return new NotificationsWatchlet(server); +} + +Q_EXPORT_PLUGIN2(notificationswatchlet, NotificationsWatchletPlugin) diff --git a/notificationswatchlet/notificationswatchletplugin.h b/notificationswatchlet/notificationswatchletplugin.h new file mode 100644 index 0000000..e417aea --- /dev/null +++ b/notificationswatchlet/notificationswatchletplugin.h @@ -0,0 +1,24 @@ +#ifndef NOTIFICATIONSWATCHLETPLUGIN_H +#define NOTIFICATIONSWATCHLETPLUGIN_H + +#include <sowatch.h> + +namespace sowatch +{ + +class NotificationsWatchletPlugin : public QObject, public WatchletPluginInterface +{ + Q_OBJECT + Q_INTERFACES(sowatch::WatchletPluginInterface) + +public: + explicit NotificationsWatchletPlugin(QObject *parent = 0); + ~NotificationsWatchletPlugin(); + + QStringList watchlets(); + Watchlet* getWatchlet(const QString& driver, QSettings& settings, WatchServer* server); +}; + +} + +#endif // NOTIFICATIONSWATCHLETPLUGIN_H |