summaryrefslogtreecommitdiff
path: root/liveviewwatchlets
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-07-07 13:50:28 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-07-07 13:50:28 +0200
commitf61dfc6557303a8bba5301927f42e5b2a7ffcac6 (patch)
treefdba31b412015684d46c7a3cb070b8a57ff37ef4 /liveviewwatchlets
parent92475d094cfddf7dd3036f5f1a9d6845a83ee350 (diff)
downloadsowatch-f61dfc6557303a8bba5301927f42e5b2a7ffcac6.tar.gz
sowatch-f61dfc6557303a8bba5301927f42e5b2a7ffcac6.zip
add some notification support to liveview
Diffstat (limited to 'liveviewwatchlets')
-rw-r--r--liveviewwatchlets/liveview-notification.qml41
-rw-r--r--liveviewwatchlets/liveviewnotificationwatchlet.cpp11
-rw-r--r--liveviewwatchlets/liveviewnotificationwatchlet.h20
-rw-r--r--liveviewwatchlets/liveviewwatchlets.pro32
-rw-r--r--liveviewwatchlets/liveviewwatchletsplugin.cpp44
-rw-r--r--liveviewwatchlets/liveviewwatchletsplugin.h25
6 files changed, 173 insertions, 0 deletions
diff --git a/liveviewwatchlets/liveview-notification.qml b/liveviewwatchlets/liveview-notification.qml
new file mode 100644
index 0000000..364b596
--- /dev/null
+++ b/liveviewwatchlets/liveview-notification.qml
@@ -0,0 +1,41 @@
+import Qt 4.7
+import com.javispedro.sowatch.liveview 1.0
+
+LVPage {
+ id: page
+
+ property QtObject curNotification: null;
+
+ Column {
+ id: container
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: 1
+ anchors.rightMargin: 1
+
+ LVLabel {
+ text: curNotification ? curNotification.title : ""
+ anchors.left: parent.left
+ anchors.right: parent.right
+ font.pixelSize: 22
+ wrapMode: Text.WordWrap
+ }
+
+ LVLabel {
+ text: curNotification ? curNotification.body : ""
+ anchors.left: parent.left
+ anchors.right: parent.right
+ wrapMode: Text.WordWrap
+ }
+ }
+
+ function handlesNotification(notification) {
+ return false;
+ }
+
+ function openNotification(notification) {
+ //scrollable.scrollTop();
+ curNotification = notification;
+ }
+}
diff --git a/liveviewwatchlets/liveviewnotificationwatchlet.cpp b/liveviewwatchlets/liveviewnotificationwatchlet.cpp
new file mode 100644
index 0000000..eecc485
--- /dev/null
+++ b/liveviewwatchlets/liveviewnotificationwatchlet.cpp
@@ -0,0 +1,11 @@
+#include "liveviewnotificationwatchlet.h"
+
+using namespace sowatch;
+
+const QLatin1String LiveViewNotificationWatchlet::myId("com.javispedro.sowatch.liveview.notification");
+
+LiveViewNotificationWatchlet::LiveViewNotificationWatchlet(Watch *watch) :
+ DeclarativeWatchlet(watch, myId)
+{
+ setSource(QUrl(SOWATCH_QML_DIR "/liveviewwatchlets/" + watch->model() + "-notification.qml"));
+}
diff --git a/liveviewwatchlets/liveviewnotificationwatchlet.h b/liveviewwatchlets/liveviewnotificationwatchlet.h
new file mode 100644
index 0000000..6598d04
--- /dev/null
+++ b/liveviewwatchlets/liveviewnotificationwatchlet.h
@@ -0,0 +1,20 @@
+#ifndef LIVEVIEWNOTIFICATIONWATCHLET_H
+#define LIVEVIEWNOTIFICATIONWATCHLET_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class LiveViewNotificationWatchlet : public DeclarativeWatchlet
+{
+ Q_OBJECT
+public:
+ explicit LiveViewNotificationWatchlet(Watch* watch);
+
+ static const QLatin1String myId;
+};
+
+}
+
+#endif // LIVEVIEWNOTIFICATIONWATCHLET_H
diff --git a/liveviewwatchlets/liveviewwatchlets.pro b/liveviewwatchlets/liveviewwatchlets.pro
new file mode 100644
index 0000000..5af74e2
--- /dev/null
+++ b/liveviewwatchlets/liveviewwatchlets.pro
@@ -0,0 +1,32 @@
+TARGET = liveviewwatchlets
+TEMPLATE = lib
+CONFIG += plugin
+
+SOURCES += liveviewwatchletsplugin.cpp \
+ liveviewnotificationwatchlet.cpp
+
+HEADERS += liveviewwatchletsplugin.h \
+ liveviewnotificationwatchlet.h \
+ liveviewnotificationwatchlet.h
+
+qml_files.files = liveview-notification.qml
+
+LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch
+INCLUDEPATH += $$PWD/../libsowatch
+DEPENDPATH += $$PWD/../libsowatch
+QML_IMPORT_PATH += $$PWD/../liveview/qml
+
+unix:!symbian {
+ !isEmpty(MEEGO_VERSION_MAJOR)|maemo5 {
+ QMAKE_RPATHDIR += /opt/sowatch/lib
+ target.path = /opt/sowatch/lib/watchlets
+ qml_files.path = /opt/sowatch/qml/$$TARGET
+ } else {
+ target.path = /usr/lib/sowatch/watchlets
+ qml_files.path = /usr/share/sowatch/qml/$$TARGET
+ }
+ INSTALLS += target qml_files
+}
+
+OTHER_FILES += \
+ liveview-notification.qml
diff --git a/liveviewwatchlets/liveviewwatchletsplugin.cpp b/liveviewwatchlets/liveviewwatchletsplugin.cpp
new file mode 100644
index 0000000..cf93ec5
--- /dev/null
+++ b/liveviewwatchlets/liveviewwatchletsplugin.cpp
@@ -0,0 +1,44 @@
+#include "liveviewnotificationwatchlet.h"
+#include "liveviewwatchletsplugin.h"
+
+using namespace sowatch;
+
+LiveViewWatchletsPlugin::LiveViewWatchletsPlugin(QObject *parent) :
+ QObject(parent)
+{
+}
+
+LiveViewWatchletsPlugin::~LiveViewWatchletsPlugin()
+{
+}
+
+QStringList LiveViewWatchletsPlugin::watchlets()
+{
+ QStringList l;
+ l << LiveViewNotificationWatchlet::myId;
+ return l;
+}
+
+WatchletPluginInterface::WatchletInfo LiveViewWatchletsPlugin::describeWatchlet(const QString &id, const QString& watchModel)
+{
+ WatchletInfo info;
+ if (id == LiveViewNotificationWatchlet::myId) {
+ if (watchModel == "metawatch-digital") {
+ info.name = "MetaWatch Notification Watchlet";
+ // Keep non visible
+ }
+ }
+ return info;
+}
+
+Watchlet* LiveViewWatchletsPlugin::getWatchlet(const QString& id, ConfigKey *settings, Watch *watch)
+{
+ Q_UNUSED(settings);
+ if (id == LiveViewNotificationWatchlet::myId) {
+ return new LiveViewNotificationWatchlet(watch);
+ } else {
+ return 0;
+ }
+}
+
+Q_EXPORT_PLUGIN2(liveviewwatchlets, LiveViewWatchletsPlugin)
diff --git a/liveviewwatchlets/liveviewwatchletsplugin.h b/liveviewwatchlets/liveviewwatchletsplugin.h
new file mode 100644
index 0000000..eae923d
--- /dev/null
+++ b/liveviewwatchlets/liveviewwatchletsplugin.h
@@ -0,0 +1,25 @@
+#ifndef LIVEVIEWWATCHLETSPLUGIN_H
+#define LIVEVIEWWATCHLETSPLUGIN_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class LiveViewWatchletsPlugin : public QObject, public WatchletPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(sowatch::WatchletPluginInterface)
+
+public:
+ explicit LiveViewWatchletsPlugin(QObject *parent = 0);
+ ~LiveViewWatchletsPlugin();
+
+ QStringList watchlets();
+ WatchletInfo describeWatchlet(const QString &id, const QString& watchModel);
+ Watchlet* getWatchlet(const QString& id, ConfigKey *settings, Watch* watch);
+};
+
+}
+
+#endif // LIVEVIEWWATCHLETSPLUGIN_H