summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qmapwatchlet/compass-metawatch-digital.qml75
-rw-r--r--qmapwatchlet/compassview.cpp16
-rw-r--r--qmapwatchlet/qmapwatchlet.cpp1
-rw-r--r--qtc_packaging/debian_fremantle/changelog8
-rw-r--r--qtc_packaging/debian_harmattan/changelog8
5 files changed, 97 insertions, 11 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
+ }
+ }
}
}
}
diff --git a/qmapwatchlet/compassview.cpp b/qmapwatchlet/compassview.cpp
index 5de44a5..7ee2853 100644
--- a/qmapwatchlet/compassview.cpp
+++ b/qmapwatchlet/compassview.cpp
@@ -1,3 +1,5 @@
+#include <math.h>
+
#include "qmapwatchletplugin.h"
#include "compassview.h"
@@ -9,7 +11,7 @@ CompassView::CompassView(QDeclarativeItem *parent) :
_enabled(false),
_image(SOWATCH_QML_DIR "/qmapwatchlet/compass.png"),
_posSource(QGeoPositionInfoSource::createDefaultSource(this)),
- _direction(-1.0), _speed(-1.0), _altitude(-1.0)
+ _direction(-1.0), _speed(NAN), _altitude(NAN)
{
if (_posSource) {
connect(_posSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
@@ -106,7 +108,7 @@ void CompassView::handlePositionUpdate(const QGeoPositionInfo &info)
update();
}
- qreal newSpeed = -1.0;
+ qreal newSpeed = NAN;
if (info.hasAttribute(QGeoPositionInfo::GroundSpeed)) {
newSpeed = info.attribute(QGeoPositionInfo::GroundSpeed);
}
@@ -115,4 +117,14 @@ void CompassView::handlePositionUpdate(const QGeoPositionInfo &info)
_speed = newSpeed;
emit currentSpeedChanged();
}
+
+ qreal newAlt = NAN;
+ if (info.hasAttribute(QGeoPositionInfo::VerticalAccuracy)) {
+ newAlt = info.coordinate().altitude();
+ }
+ qDebug() << "New altitude" << newAlt;
+ if (newAlt != _altitude) {
+ _altitude = newAlt;
+ emit currentAltitudeChanged();
+ }
}
diff --git a/qmapwatchlet/qmapwatchlet.cpp b/qmapwatchlet/qmapwatchlet.cpp
index efc478e..d262c2c 100644
--- a/qmapwatchlet/qmapwatchlet.cpp
+++ b/qmapwatchlet/qmapwatchlet.cpp
@@ -10,4 +10,3 @@ QMapWatchlet::QMapWatchlet(WatchServer* server) :
setFullUpdateMode(true);
setSource(QUrl(SOWATCH_QML_DIR "/qmapwatchlet/map-" + server->watch()->model() + ".qml"));
}
-
diff --git a/qtc_packaging/debian_fremantle/changelog b/qtc_packaging/debian_fremantle/changelog
index afdf903..199330c 100644
--- a/qtc_packaging/debian_fremantle/changelog
+++ b/qtc_packaging/debian_fremantle/changelog
@@ -1,3 +1,11 @@
+sowatch (0.4.2) unstable; urgency=low
+
+ * Add an arrow pointer to the map watchlet.
+ * New Compass watchlet.
+ * Fix temperature conversion in MeeCast plugin.
+
+ -- Javier S. Pedro <maemo@javispedro.com> Sat, 25 Aug 2012 20:23:44 +0200
+
sowatch (0.4.1) unstable; urgency=low
* Minor changes to MetaWatch icons.
diff --git a/qtc_packaging/debian_harmattan/changelog b/qtc_packaging/debian_harmattan/changelog
index afdf903..199330c 100644
--- a/qtc_packaging/debian_harmattan/changelog
+++ b/qtc_packaging/debian_harmattan/changelog
@@ -1,3 +1,11 @@
+sowatch (0.4.2) unstable; urgency=low
+
+ * Add an arrow pointer to the map watchlet.
+ * New Compass watchlet.
+ * Fix temperature conversion in MeeCast plugin.
+
+ -- Javier S. Pedro <maemo@javispedro.com> Sat, 25 Aug 2012 20:23:44 +0200
+
sowatch (0.4.1) unstable; urgency=low
* Minor changes to MetaWatch icons.