From 0a656b75f3fc80f13424db0e7ec403dff28a366e Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 2 Oct 2011 16:39:40 +0200 Subject: new notifications list, time syncing --- notificationswatchlet/metawatch-digital.qml | 39 ++++++++++++++ notificationswatchlet/notificationswatchlet.cpp | 10 ++++ notificationswatchlet/notificationswatchlet.h | 18 +++++++ notificationswatchlet/notificationswatchlet.pro | 60 ++++++++++++++++++++++ notificationswatchlet/notificationswatchlet.qrc | 5 ++ .../notificationswatchletplugin.cpp | 29 +++++++++++ .../notificationswatchletplugin.h | 24 +++++++++ 7 files changed, 185 insertions(+) create mode 100644 notificationswatchlet/metawatch-digital.qml create mode 100644 notificationswatchlet/notificationswatchlet.cpp create mode 100644 notificationswatchlet/notificationswatchlet.h create mode 100644 notificationswatchlet/notificationswatchlet.pro create mode 100644 notificationswatchlet/notificationswatchlet.qrc create mode 100644 notificationswatchlet/notificationswatchletplugin.cpp create mode 100644 notificationswatchlet/notificationswatchletplugin.h (limited to 'notificationswatchlet') 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 + +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 @@ + + + metawatch-digital.qml + + 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 + +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 -- cgit v1.2.3