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 | |
| parent | d6d10c69ba454a6e555733815680acdfc0ee5402 (diff) | |
| download | sowatch-3e5440a3e1d4f23180b8e6795ae1c29f9964379d.tar.gz sowatch-3e5440a3e1d4f23180b8e6795ae1c29f9964379d.zip  | |
bumping to 0.4.2sowatch_0_4_2
| -rw-r--r-- | qmapwatchlet/compass-metawatch-digital.qml | 75 | ||||
| -rw-r--r-- | qmapwatchlet/compassview.cpp | 16 | ||||
| -rw-r--r-- | qmapwatchlet/qmapwatchlet.cpp | 1 | ||||
| -rw-r--r-- | qtc_packaging/debian_fremantle/changelog | 8 | ||||
| -rw-r--r-- | qtc_packaging/debian_harmattan/changelog | 8 | 
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.  | 
