diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-08-19 19:18:40 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-08-19 19:18:40 +0200 |
commit | 6df11eb1581441e45d18728baf066aa5136042ae (patch) | |
tree | 5672071de8a2ca680495b12f330bc8b3e093fbd4 /qmapwatchlet/compass-metawatch-digital.qml | |
parent | 26b8b909570bca66882c68f1c6f578f2aeef1e7e (diff) | |
download | sowatch-6df11eb1581441e45d18728baf066aa5136042ae.tar.gz sowatch-6df11eb1581441e45d18728baf066aa5136042ae.zip |
testin compass watchlet
Diffstat (limited to 'qmapwatchlet/compass-metawatch-digital.qml')
-rw-r--r-- | qmapwatchlet/compass-metawatch-digital.qml | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/qmapwatchlet/compass-metawatch-digital.qml b/qmapwatchlet/compass-metawatch-digital.qml index 9268435..c465e20 100644 --- a/qmapwatchlet/compass-metawatch-digital.qml +++ b/qmapwatchlet/compass-metawatch-digital.qml @@ -4,44 +4,39 @@ import com.javispedro.sowatch.metawatch 1.0 import com.javispedro.sowatch.qmap 1.0 MWPage { - MWTitle { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - text: qsTr("Trip computer") - icon.source: "trip-icon.png" - } - - PositionSource { - id: gps - active: watch.active - updateInterval: 2000 - } function formatSpeed(speed) { - if (speed < 10) { - return speed.toFixed(1); + var kmh = speed * 3.6; + if (kmh < 0) { + return ""; + } else if (kmh < 10) { + return kmh.toFixed(1) + " km/h"; } else { - return speed.toFixed(0); + return kmh.toFixed(0) + " km/h"; } } Column { - anchors.verticalCenter: parent.verticalCenter - MWLabel { - text: qsTr("Speed") - } - MWLabel { - id: speedLabel - text: gps.position.speedValid ? formatSpeed(gps.position.speed) : "" - } + anchors.top: parent.top + width: parent.width - MWLabel { - text: qsTr("Altitude") + CompassView { + anchors.horizontalCenter: parent.horizontalCenter + id: compass + updateEnabled: watch.active + updateInterval: 3000 + width: 48 + height: 48 } - } - - Column { + Row { + MWLabel { + text: qsTr("Speed") + " " + } + MWLabel { + id: speedLabel + text: formatSpeed(compass.currentSpeed) + } + } } } |