From 9e061170b3834845910749c55eda63f03d982bbf Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Fri, 3 May 2013 21:13:31 +0200 Subject: add a small status bar to metawatch watchlets --- libsowatch/declarativewatchwrapper.cpp | 4 --- libsowatch/declarativewatchwrapper.h | 1 - libsowatch/watch.h | 4 ++- .../com/javispedro/sowatch/metawatch/MWLabel.qml | 2 +- .../com/javispedro/sowatch/metawatch/MWTitle.qml | 42 ++++++++++++++++++---- qmapwatchlet/compass-metawatch-digital.qml | 4 +-- qmapwatchlet/map-metawatch-digital.qml | 7 +++- qtc_packaging/debian_harmattan/postinst | 2 +- sysinfowatchlet/metawatch-digital.qml | 4 +-- testnotification/testnotification.cpp | 2 +- 10 files changed, 51 insertions(+), 21 deletions(-) diff --git a/libsowatch/declarativewatchwrapper.cpp b/libsowatch/declarativewatchwrapper.cpp index 968c3e2..d06ef3b 100644 --- a/libsowatch/declarativewatchwrapper.cpp +++ b/libsowatch/declarativewatchwrapper.cpp @@ -41,10 +41,6 @@ void DeclarativeWatchWrapper::activate() // Emit the active signal emit activeChanged(); - - // Since a notification currently causes the active watchlet to be deactivated, - // we can assume the notifications list only changes when we are deactivated. - emit notificationsChanged(); } } diff --git a/libsowatch/declarativewatchwrapper.h b/libsowatch/declarativewatchwrapper.h index 74f569c..4cc0bf4 100644 --- a/libsowatch/declarativewatchwrapper.h +++ b/libsowatch/declarativewatchwrapper.h @@ -32,7 +32,6 @@ signals: void buttonReleased(int button); void activeChanged(); - void notificationsChanged(); private: WatchServer *_server; diff --git a/libsowatch/watch.h b/libsowatch/watch.h index 60a66bd..5e0233b 100644 --- a/libsowatch/watch.h +++ b/libsowatch/watch.h @@ -41,7 +41,9 @@ public: virtual void setDateTime(const QDateTime& dateTime) = 0; /** Asynchronously queries battery date/time from the watch; once the * query is finished, dateTimeChanged() will be signaled and dateTime() - * will return the updated value. */ + * will return the updated value. + * This is not mandatory and returning currentDateTime() is just fine. + */ virtual void queryDateTime() = 0; /** Gets the current date/time as last fetched from the watch. */ virtual QDateTime dateTime() const = 0; diff --git a/metawatch/qml/com/javispedro/sowatch/metawatch/MWLabel.qml b/metawatch/qml/com/javispedro/sowatch/metawatch/MWLabel.qml index 3ce64ca..5bf8ff1 100644 --- a/metawatch/qml/com/javispedro/sowatch/metawatch/MWLabel.qml +++ b/metawatch/qml/com/javispedro/sowatch/metawatch/MWLabel.qml @@ -2,5 +2,5 @@ import Qt 4.7 Text { font.family: "MetaWatch Large 16pt" - font.pointSize: 10.5 + font.pixelSize: 14 } diff --git a/metawatch/qml/com/javispedro/sowatch/metawatch/MWTitle.qml b/metawatch/qml/com/javispedro/sowatch/metawatch/MWTitle.qml index b87d535..b5ad787 100644 --- a/metawatch/qml/com/javispedro/sowatch/metawatch/MWTitle.qml +++ b/metawatch/qml/com/javispedro/sowatch/metawatch/MWTitle.qml @@ -1,24 +1,52 @@ import Qt 4.7 +import com.javispedro.sowatch 1.0 Rectangle { width: 96 - height: 16 + height: time.height + (title.visible ? 16 : 0) - property alias text: label.text - property alias font: label.font + property alias text: title.text + property alias font: title.font property alias icon: image + clip: true + Image { id: image + anchors.top: time.bottom anchors.left: parent.left - anchors.top: parent.top } MWLabel { - id: label + id: title + anchors.top: time.bottom anchors.left: image.right anchors.leftMargin: 2 - anchors.verticalCenter: parent.verticalCenter - font.pointSize: 12 + font.pixelSize: 16 + visible: text != "" + } + + MWLabel { + id: time + anchors.right: parent.right + anchors.rightMargin: 1 + anchors.top: parent.top + height: 8 + font.family: "MetaWatch Large caps 8pt" + font.pixelSize: 8 + text: " : " + } + + function updateStatusBar() { + var now = new Date + time.text = Qt.formatDate(now, "ddd") + " " + Qt.formatTime(now) + } + + Timer { + triggeredOnStart: true + interval: 100000 + repeat: true + running: watch.active + onTriggered: updateStatusBar() } } diff --git a/qmapwatchlet/compass-metawatch-digital.qml b/qmapwatchlet/compass-metawatch-digital.qml index 37d6e11..9c3131b 100644 --- a/qmapwatchlet/compass-metawatch-digital.qml +++ b/qmapwatchlet/compass-metawatch-digital.qml @@ -41,8 +41,8 @@ MWPage { id: compass updateEnabled: watch.active updateInterval: 3000 - width: 48 - height: 48 + width: 36 + height: 36 } Row { diff --git a/qmapwatchlet/map-metawatch-digital.qml b/qmapwatchlet/map-metawatch-digital.qml index 9c054a4..a0732ed 100644 --- a/qmapwatchlet/map-metawatch-digital.qml +++ b/qmapwatchlet/map-metawatch-digital.qml @@ -4,9 +4,14 @@ import com.javispedro.sowatch.metawatch 1.0 import com.javispedro.sowatch.qmap 1.0 MWPage { + MWTitle { + id: title + z: 1 + } + MapView { id: map - anchors.fill: parent; + anchors.fill: parent updateEnabled: watch.active updateInterval: 5000; } diff --git a/qtc_packaging/debian_harmattan/postinst b/qtc_packaging/debian_harmattan/postinst index c0a1855..e7bfb0a 100644 --- a/qtc_packaging/debian_harmattan/postinst +++ b/qtc_packaging/debian_harmattan/postinst @@ -6,7 +6,7 @@ set -e case "$1" in configure) - start -v apps/sowatchd || : + #start -v apps/sowatchd || : ;; esac diff --git a/sysinfowatchlet/metawatch-digital.qml b/sysinfowatchlet/metawatch-digital.qml index 6e26174..2b3cf66 100644 --- a/sysinfowatchlet/metawatch-digital.qml +++ b/sysinfowatchlet/metawatch-digital.qml @@ -9,7 +9,7 @@ Rectangle { Column { anchors.fill: parent - spacing: 4 + spacing: 2 MWTitle { id: title @@ -23,7 +23,7 @@ Rectangle { Rectangle { id: battery - x: 12 + anchors.horizontalCenter: parent.horizontalCenter width: 72 height: 16 diff --git a/testnotification/testnotification.cpp b/testnotification/testnotification.cpp index c07111f..d5fe985 100644 --- a/testnotification/testnotification.cpp +++ b/testnotification/testnotification.cpp @@ -8,7 +8,7 @@ TestNotification::TestNotification(Type type, const QString &title, const QStrin _time(QDateTime::currentDateTime()), _title(title), _body(body) { - const int high = 5000, low = 1000; + const int high = 10000, low = 5000; int rand = qrand() % ((high + 1) - low) + low; QTimer::singleShot(rand, this, SIGNAL(dismissed())); } -- cgit v1.2.3