From 928dd96f5225769d4af7354e75d4d245ae586884 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Thu, 8 Feb 2018 17:27:17 -0800 Subject: 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 --- homescreen/qml/StatusArea.qml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'homescreen/qml/StatusArea.qml') 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' -- cgit 1.2.3-korg