summaryrefslogtreecommitdiff
path: root/metawatchwatchlets
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-05-07 01:37:21 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-05-07 01:37:21 +0200
commit6003bf81107dd9be51589c074b74c5af82bfc8ab (patch)
tree502193634979c12b45c2a013668d21556e2c7050 /metawatchwatchlets
parentae37832316d905889c82706b351b3c037c9e1ab6 (diff)
downloadsowatch-6003bf81107dd9be51589c074b74c5af82bfc8ab.tar.gz
sowatch-6003bf81107dd9be51589c074b74c5af82bfc8ab.zip
testing qml notifications
Diffstat (limited to 'metawatchwatchlets')
-rw-r--r--metawatchwatchlets/metawatch-digital-notification.qml81
-rw-r--r--metawatchwatchlets/metawatch-digital-watchface.qml20
-rw-r--r--metawatchwatchlets/metawatchnotificationwatchlet.cpp11
-rw-r--r--metawatchwatchlets/metawatchnotificationwatchlet.h20
-rw-r--r--metawatchwatchlets/metawatchwatchlets.pro8
-rw-r--r--metawatchwatchlets/metawatchwatchletsplugin.cpp8
6 files changed, 126 insertions, 22 deletions
diff --git a/metawatchwatchlets/metawatch-digital-notification.qml b/metawatchwatchlets/metawatch-digital-notification.qml
new file mode 100644
index 0000000..72f7bc9
--- /dev/null
+++ b/metawatchwatchlets/metawatch-digital-notification.qml
@@ -0,0 +1,81 @@
+import QtQuick 1.0
+import com.javispedro.sowatch 1.0
+import com.javispedro.sowatch.metawatch 1.0
+
+MWPage {
+ id: page
+
+ property QtObject curNotification: null;
+
+ MWTitle {
+ id: title
+ }
+
+ Item {
+ id: container
+ anchors.top: title.bottom
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Item {
+ id: emailContainer
+ visible: curNotification.type === Notification.EmailNotification
+ anchors.fill: parent
+
+ MWLabel {
+ anchors.centerIn: parent
+ text: "Email"
+ }
+ }
+
+ Item {
+ id: chatContainer
+ visible: curNotification.type === Notification.ImNotification
+ anchors.fill: parent
+
+ MWLabel {
+ id: chatTitle
+ text: curNotification.title
+ }
+
+ Image {
+ x: 20
+ y: chatBubble.y - 8
+ source: "bubble_tip.png"
+ z: 1
+ }
+
+ BorderImage {
+ id: chatBubble
+ anchors {
+ top: chatTitle.bottom; left: parent.left; right: parent.right;
+ leftMargin: 2; topMargin: 8; rightMargin: 2; bottomMargin: 2;
+ }
+ border { left: 16; top: 16; right: 16; bottom: 16; }
+ height: childrenRect.height + 16
+ source: "bubble.png"
+
+ MWLabel {
+ anchors {
+ top: parent.top; left: parent.left; right: parent.right;
+ margins: 16 / 2
+ }
+ text: curNotification.body
+ width: parent.width
+ wrapMode: Text.Wrap
+ }
+ }
+ }
+ }
+
+
+
+ function handlesNotification(notification) {
+ return false;
+ }
+
+ function openNotification(notification) {
+ curNotification = notification;
+ }
+}
diff --git a/metawatchwatchlets/metawatch-digital-watchface.qml b/metawatchwatchlets/metawatch-digital-watchface.qml
index 23236a6..a030bdb 100644
--- a/metawatchwatchlets/metawatch-digital-watchface.qml
+++ b/metawatchwatchlets/metawatch-digital-watchface.qml
@@ -5,13 +5,6 @@ import com.javispedro.sowatch.metawatch 1.0
MWPage {
id: page
- Connections {
- target: watch
- onActiveChanged: {
- console.log("watchface is now " + (watch.active ? "active" : "inactive"))
- }
- }
-
Column {
Item {
id: systemArea
@@ -30,6 +23,7 @@ MWPage {
Item {
width: page.width
height: 30
+ // TODO Weather stuff.
}
Image {
@@ -107,7 +101,7 @@ MWPage {
function updateWeather() {
var weather = notifications.getMostRecentByType(Notification.WeatherNotification);
if (typeof weather !== "undefined") {
- // TODO
+ // TODO Weather stuff
}
}
@@ -117,16 +111,6 @@ MWPage {
}
Connections {
- target: watch
- onActiveChanged: {
- if (watch.active) {
- console.log("watchface active");
- //updateUnreadCounts();
- }
- }
- }
-
- Connections {
target: notifications
onModelChanged: update();
}
diff --git a/metawatchwatchlets/metawatchnotificationwatchlet.cpp b/metawatchwatchlets/metawatchnotificationwatchlet.cpp
new file mode 100644
index 0000000..ef9c3d5
--- /dev/null
+++ b/metawatchwatchlets/metawatchnotificationwatchlet.cpp
@@ -0,0 +1,11 @@
+#include "metawatchnotificationwatchlet.h"
+
+using namespace sowatch;
+
+const QLatin1String MetaWatchNotificationWatchlet::myId("com.javispedro.sowatch.metawatch.notification");
+
+MetaWatchNotificationWatchlet::MetaWatchNotificationWatchlet(Watch *watch) :
+ DeclarativeWatchlet(watch, myId)
+{
+ setSource(QUrl(SOWATCH_QML_DIR "/metawatchwatchlets/" + watch->model() + "-notification.qml"));
+}
diff --git a/metawatchwatchlets/metawatchnotificationwatchlet.h b/metawatchwatchlets/metawatchnotificationwatchlet.h
new file mode 100644
index 0000000..3290b0c
--- /dev/null
+++ b/metawatchwatchlets/metawatchnotificationwatchlet.h
@@ -0,0 +1,20 @@
+#ifndef METAWATCHNOTIFICATIONWATCHLET_H
+#define METAWATCHNOTIFICATIONWATCHLET_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class MetaWatchNotificationWatchlet : public DeclarativeWatchlet
+{
+ Q_OBJECT
+public:
+ explicit MetaWatchNotificationWatchlet(Watch* watch);
+
+ static const QLatin1String myId;
+};
+
+}
+
+#endif // METAWATCHNOTIFICATIONWATCHLET_H
diff --git a/metawatchwatchlets/metawatchwatchlets.pro b/metawatchwatchlets/metawatchwatchlets.pro
index f4393e4..af6dcdb 100644
--- a/metawatchwatchlets/metawatchwatchlets.pro
+++ b/metawatchwatchlets/metawatchwatchlets.pro
@@ -2,11 +2,13 @@ TARGET = metawatchwatchlets
TEMPLATE = lib
CONFIG += plugin
-SOURCES += metawatchwatchletsplugin.cpp metawatchfacewatchlet.cpp
+SOURCES += metawatchwatchletsplugin.cpp \
+ metawatchfacewatchlet.cpp metawatchnotificationwatchlet.cpp
-HEADERS += metawatchwatchletsplugin.h metawatchfacewatchlet.h
+HEADERS += metawatchwatchletsplugin.h \
+ metawatchfacewatchlet.h metawatchnotificationwatchlet.h
-qml_files.files = metawatch-digital-watchface.qml
+qml_files.files = metawatch-digital-watchface.qml metawatch-digital-notification.qml
LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch
INCLUDEPATH += $$PWD/../libsowatch
diff --git a/metawatchwatchlets/metawatchwatchletsplugin.cpp b/metawatchwatchlets/metawatchwatchletsplugin.cpp
index 31b66ab..98c1713 100644
--- a/metawatchwatchlets/metawatchwatchletsplugin.cpp
+++ b/metawatchwatchlets/metawatchwatchletsplugin.cpp
@@ -1,4 +1,5 @@
#include "metawatchfacewatchlet.h"
+#include "metawatchnotificationwatchlet.h"
#include "metawatchwatchletsplugin.h"
using namespace sowatch;
@@ -15,7 +16,7 @@ MetaWatchWatchletsPlugin::~MetaWatchWatchletsPlugin()
QStringList MetaWatchWatchletsPlugin::watchlets()
{
QStringList l;
- l << MetaWatchFaceWatchlet::myId;
+ l << MetaWatchFaceWatchlet::myId << MetaWatchNotificationWatchlet::myId;
return l;
}
@@ -25,6 +26,9 @@ WatchletPluginInterface::WatchletInfo MetaWatchWatchletsPlugin::describeWatchlet
if (id == MetaWatchFaceWatchlet::myId) {
info.name = "MetaWatch Face Watchlet";
info.hidden = true;
+ } else if (id == MetaWatchNotificationWatchlet::myId) {
+ info.name = "MetaWatch Notification Watchlet";
+ info.hidden = true;
}
return info;
}
@@ -34,6 +38,8 @@ Watchlet* MetaWatchWatchletsPlugin::getWatchlet(const QString& id, ConfigKey *se
Q_UNUSED(settings);
if (id == MetaWatchFaceWatchlet::myId) {
return new MetaWatchFaceWatchlet(watch);
+ } else if (id == MetaWatchNotificationWatchlet::myId) {
+ return new MetaWatchNotificationWatchlet(watch);
}
}