diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-08-25 21:56:47 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-08-25 21:56:47 +0200 |
commit | 3e5440a3e1d4f23180b8e6795ae1c29f9964379d (patch) | |
tree | f77d23238d25b4b9fda4b2e65d4777e964150d9d /qmapwatchlet/compass-metawatch-digital.qml | |
parent | d6d10c69ba454a6e555733815680acdfc0ee5402 (diff) | |
download | sowatch-3e5440a3e1d4f23180b8e6795ae1c29f9964379d.tar.gz sowatch-3e5440a3e1d4f23180b8e6795ae1c29f9964379d.zip |
bumping to 0.4.2sowatch_0_4_2
Diffstat (limited to 'qmapwatchlet/compass-metawatch-digital.qml')
-rw-r--r-- | qmapwatchlet/compass-metawatch-digital.qml | 75 |
1 files changed, 67 insertions, 8 deletions
diff --git a/qmapwatchlet/compass-metawatch-digital.qml b/qmapwatchlet/compass-metawatch-digital.qml index c465e20..37d6e11 100644 --- a/qmapwatchlet/compass-metawatch-digital.qml +++ b/qmapwatchlet/compass-metawatch-digital.qml @@ -4,15 +4,24 @@ import com.javispedro.sowatch.metawatch 1.0 import com.javispedro.sowatch.qmap 1.0 MWPage { + id: page function formatSpeed(speed) { var kmh = speed * 3.6; - if (kmh < 0) { + if (kmh < 0 || isNaN(kmh)) { return ""; } else if (kmh < 10) { - return kmh.toFixed(1) + " km/h"; + return kmh.toFixed(1); } else { - return kmh.toFixed(0) + " km/h"; + return kmh.toFixed(0); + } + } + + function formatAltitude(alt) { + if (isNaN(alt)) { + return ""; + } else { + return alt.toFixed(0); } } @@ -20,6 +29,13 @@ MWPage { anchors.top: parent.top width: parent.width + spacing: 2 + + MWTitle { + text: qsTr("Compass") + icon.source: "compass-icon.png" + } + CompassView { anchors.horizontalCenter: parent.horizontalCenter id: compass @@ -30,12 +46,55 @@ MWPage { } Row { - MWLabel { - text: qsTr("Speed") + " " + Column { + width: page.width / 2 + id: speedColumn + + MWLabel { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Speed") + } + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 2 + MWLabel { + id: speedLabel + anchors.top: parent.top + text: formatSpeed(compass.currentSpeed) + font.pointSize: 12 + } + MWLabel { + anchors.top: parent.top + text: altitudeLabel.text ? qsTr("km<br>h") : ""; + font.family: "MetaWatch Small caps 8pt" + font.pointSize: 6 + } + } } - MWLabel { - id: speedLabel - text: formatSpeed(compass.currentSpeed) + Column { + width: page.width / 2 + id: altitudeColumn + + MWLabel { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Altitude") + } + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 2 + MWLabel { + id: altitudeLabel + anchors.top: parent.top + text: formatAltitude(compass.currentAltitude) + font.pointSize: 12 + } + MWLabel { + anchors.top: parent.top + text: altitudeLabel.text ? qsTr("m") : ""; + font.family: "MetaWatch Small caps 8pt" + font.pointSize: 6 + } + } } } } |