From d83093df7602aa2896de71292b47948540c22a44 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 6 May 2013 01:11:40 +0200 Subject: metawatch watchface in QML still a work in progress --- metawatchwatchlets/metawatch-digital-watchface.qml | 123 ++++++++++++++++++++- 1 file changed, 119 insertions(+), 4 deletions(-) (limited to 'metawatchwatchlets') diff --git a/metawatchwatchlets/metawatch-digital-watchface.qml b/metawatchwatchlets/metawatch-digital-watchface.qml index 712dbeb..23236a6 100644 --- a/metawatchwatchlets/metawatch-digital-watchface.qml +++ b/metawatchwatchlets/metawatch-digital-watchface.qml @@ -1,8 +1,9 @@ import QtQuick 1.0 +import com.javispedro.sowatch 1.0 import com.javispedro.sowatch.metawatch 1.0 MWPage { - // Remember that firmware draws top 30 lines + id: page Connections { target: watch @@ -11,8 +12,122 @@ MWPage { } } - MWLabel { - anchors.centerIn: parent - text: "This is a test" + Column { + Item { + id: systemArea + // Firmware draws top 30 lines; + // ensure we do not draw anything on top + width: page.width + height: 30 + } + + Image { + width: page.width + height: 2 + source: "idle_border.png" + } + + Item { + width: page.width + height: 30 + } + + Image { + width: page.width + height: 2 + source: "idle_border.png" + } + + Item { + width: page.width + height: 2 + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter + height: 30 + spacing: 8 + Column { + spacing: 4 + Image { + width: 24 + height: 18 + source: "idle_call.png" + } + Text { + id: labelCalls + anchors.horizontalCenter: parent.horizontalCenter + font.family: "MetaWatch Large caps 8pt" + font.pixelSize: 8 + text: "0" + } + } + Column { + spacing: 2 + Image { + width: 24 + height: 18 + source: "idle_msg.png" + } + Text { + id: labelMsgs + anchors.horizontalCenter: parent.horizontalCenter + font.family: "MetaWatch Large caps 8pt" + font.pixelSize: 8 + text: "0" + } + } + Column { + spacing: 2 + Image { + width: 24 + height: 18 + source: "idle_mail.png" + } + Text { + id: labelMails + anchors.horizontalCenter: parent.horizontalCenter + font.family: "MetaWatch Large caps 8pt" + font.pixelSize: 8 + text: "0" + } + } + } + } + + function updateUnreadCounts() { + labelCalls.text = notifications.fullCountByType(Notification.MissedCallNotification); + labelMsgs.text = notifications.fullCountByType(Notification.SmsNotification) + + notifications.fullCountByType(Notification.MmsNotification) + + notifications.fullCountByType(Notification.ImNotification); + labelMails.text = notifications.fullCountByType(Notification.EmailNotification); + console.log("unread mails = " + labelMails.text); + } + + function updateWeather() { + var weather = notifications.getMostRecentByType(Notification.WeatherNotification); + if (typeof weather !== "undefined") { + // TODO + } + } + + function update() { + updateUnreadCounts(); + updateWeather(); + } + + Connections { + target: watch + onActiveChanged: { + if (watch.active) { + console.log("watchface active"); + //updateUnreadCounts(); + } + } + } + + Connections { + target: notifications + onModelChanged: update(); } } -- cgit v1.2.3