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 --- .../com/javispedro/sowatch/metawatch/MWLabel.qml | 2 +- .../com/javispedro/sowatch/metawatch/MWTitle.qml | 42 ++++++++++++++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) (limited to 'metawatch') 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() } } -- cgit v1.2.3