← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~vthompson/ubuntu-weather-app/reboot-location-qml into lp:ubuntu-weather-app/reboot

 

Victor Thompson has proposed merging lp:~vthompson/ubuntu-weather-app/reboot-location-qml into lp:ubuntu-weather-app/reboot.

Commit message:
* Implement QtLocation reverse geocoding
* Use Open Street Map plugin
* Update apparmor

Requested reviews:
  Ubuntu Weather Developers (ubuntu-weather-dev)

For more details, see:
https://code.launchpad.net/~vthompson/ubuntu-weather-app/reboot-location-qml/+merge/259462

* Implement QtLocation reverse geocoding
* Use Open Street Map plugin
* Update apparmor

This simply displays the reverse geocoded city name in the LocationsPage at the first item. This uses the QtLocations QML API for Location models and utilizes the OSM plugin for reverse geocoding. The Nokia HERE plugin did not appear to support reverse geocoding and also required an API key. It may take a bit for the "Undefined" text to change to your current GPS location.
-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~vthompson/ubuntu-weather-app/reboot-location-qml into lp:ubuntu-weather-app/reboot.
=== added file 'app/components/CurrentLocation.qml'
--- app/components/CurrentLocation.qml	1970-01-01 00:00:00 +0000
+++ app/components/CurrentLocation.qml	2015-05-19 03:24:43 +0000
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd
+ *
+ * This file is part of Ubuntu Weather App
+ *
+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Ubuntu Weather App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtLocation 5.3
+import QtPositioning 5.2
+import QtQuick 2.3
+import Ubuntu.Components 1.1
+
+
+Item {
+    id: currentLocation
+
+    property string string: "Undefined"
+
+    PositionSource {
+        id: currentPosition
+        updateInterval: 1000
+        active: true
+
+        onPositionChanged: {
+            var coord = currentPosition.position.coordinate
+            if (coord.isValid) {
+                geocodeModel.query = coord
+                geocodeModel.update()
+                refreshData(false, true)
+            }
+        }
+    }
+
+    Plugin {
+        id: osmPlugin
+        name: "osm"
+    }
+
+    GeocodeModel {
+        id: geocodeModel
+        autoUpdate: false
+        plugin: osmPlugin
+
+        onCountChanged: {
+            if (count > 0) {
+                currentLocation.string = geocodeModel.get(0).address.city
+            }
+        }
+    }
+}

=== modified file 'app/ubuntu-weather-app.qml'
--- app/ubuntu-weather-app.qml	2015-05-08 19:44:49 +0000
+++ app/ubuntu-weather-app.qml	2015-05-19 03:24:43 +0000
@@ -129,6 +129,10 @@
         }
     }
 
+    CurrentLocation {
+        id: currentLocation
+    }
+
     Settings {
         id: settings
         category: "weatherSettings"

=== modified file 'app/ui/LocationsPage.qml'
--- app/ui/LocationsPage.qml	2015-04-09 22:22:55 +0000
+++ app/ui/LocationsPage.qml	2015-05-19 03:24:43 +0000
@@ -138,6 +138,7 @@
         locationsModel.clear()
         var loc = {}, data = {},
             tempUnits = settings.tempScale === "°C" ? "metric" : "imperial";
+        locationsModel.append({ "name": currentLocation.string, "temp": "0", "icon": "weather-clear-symbolic" })
         for (var i=0; i < weatherApp.locationsList.length; i++) {
             data = weatherApp.locationsList[i];
             loc = {

=== modified file 'ubuntu-weather-app.apparmor'
--- ubuntu-weather-app.apparmor	2015-01-23 23:26:58 +0000
+++ ubuntu-weather-app.apparmor	2015-05-19 03:24:43 +0000
@@ -1,6 +1,8 @@
 {
     "policy_groups": [
-    	"networking"
+    	"location",
+    	"networking",
+    	"sensors"
     ], 
     "policy_version": 1.2
 }


Follow ups