diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-02-08 17:27:17 -0800 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-02-13 23:37:07 -0800 |
commit | 928dd96f5225769d4af7354e75d4d245ae586884 (patch) | |
tree | 9ccb83cda12928a652455d8bf67a6dd1d7cd254e /homescreen/qml | |
parent | db9f41d75fb4460f668117c69be05c4d4d4c7c7c (diff) |
homescreen: add OpenWeatherMap data to homescreen
Use agl-service-weather weather data via libqtappfw framework on homescreen
interface.
Bug-AGL: SPEC-1273
Change-Id: If591b74c1e6a912384abf6289128ec9a4a1101b4
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'homescreen/qml')
-rw-r--r-- | homescreen/qml/StatusArea.qml | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/homescreen/qml/StatusArea.qml b/homescreen/qml/StatusArea.qml index 4dbe0ba..e464980 100644 --- a/homescreen/qml/StatusArea.qml +++ b/homescreen/qml/StatusArea.qml @@ -30,6 +30,31 @@ Item { onTriggered: root.now = new Date } + Connections { + target: weather + + onConditionChanged: { + var current_condition = weather.condition + var icon = '' + + if (current_condition.indexOf("clouds") != -1) { + icon = "WeatherIcons_Cloudy-01.png" + } else if (current_condition.indexOf("thunderstorm") != -1) { + icon = "WeatherIcons_Thunderstorm-01.png" + } else if (current_condition.indexOf("snow") != -1) { + icon = "WeatherIcons_Snow-01.png" + } else if (current_condition.indexOf("rain") != -1) { + icon = "WeatherIcons_Rain-01.png" + } + + condition.source = icon ? './images/Weather/' + icon : '' + } + + onTemperatureChanged: { + temperature.text = weather.temperature.split(".")[0] + '°F' + } + } + RowLayout { anchors.fill: parent spacing: 0 @@ -73,9 +98,11 @@ Item { Layout.fillHeight: true Layout.preferredHeight: 20 Image { + id: condition source: './images/Weather/WeatherIcons_Rain-01.png' } Text { + id: temperature text: '64°F' color: 'white' font.family: 'Helvetica' |