Merge lp:~ahayzen/ubuntu-weather-app/reboot-profile-homepage-001 into lp:ubuntu-weather-app
- reboot-profile-homepage-001
- Merge into reboot
Status: | Merged |
---|---|
Approved by: | Victor Thompson |
Approved revision: | 102 |
Merged at revision: | 107 |
Proposed branch: | lp:~ahayzen/ubuntu-weather-app/reboot-profile-homepage-001 |
Merge into: | lp:ubuntu-weather-app |
Diff against target: |
790 lines (+307/-276) 9 files modified
app/components/DayDelegate.qml (+24/-80) app/components/DayDelegateExtraInfo.qml (+91/-0) app/components/HomeHourly.qml (+4/-4) app/ui/HomePage.qml (+51/-84) app/ui/LocationPane.qml (+115/-92) debian/changelog (+2/-0) po/com.ubuntu.weather.pot (+12/-12) tests/autopilot/ubuntu_weather_app/__init__.py (+4/-4) tests/autopilot/ubuntu_weather_app/tests/test_home_page.py (+4/-0) |
To merge this branch: | bzr merge lp:~ahayzen/ubuntu-weather-app/reboot-profile-homepage-001 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Victor Thompson | Approve | ||
Review via email: mp+268635@code.launchpad.net |
Commit message
* Split day delegate extra info into a separate component that is loaded on demand
* Use ListView per Location Pane so that scrolling vertically only affect the currently focused pane
Description of the change
* Split day delegate extra info into a separate component that is loaded on demand
* Use ListView per Location Pane so that scrolling vertically only affect the currently focused pane
This improves the performance of scrolling up/down the homepage as it doesn't need to load the extra info for each delegate and it only scrolls the location pane in-view.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Victor Thompson (vthompson) wrote : | # |
One effect this has is that each location can now be staggered at different points scrolled down the page as you flip through. What do you think of resetting each "page" to the top when it is no longer the currentIndex? Before I'd normally scroll back up and then all pages would be scrolled up, but now that they are independent flipping through them is a bit odd when staggered.
- 100. By Andrew Hayzen
-
* Reset height when changing currentIndex
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:100
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 101. By Andrew Hayzen
-
* Animate and ensure location panes are scroll to the top
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:101
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Victor Thompson (vthompson) wrote : | # |
lgtm! The animation is kinda nice on the device. :)
- 102. By Andrew Hayzen
-
* Merge of trunk
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:102
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'app/components/DayDelegate.qml' | |||
2 | --- app/components/DayDelegate.qml 2015-08-23 18:03:23 +0000 | |||
3 | +++ app/components/DayDelegate.qml 2015-08-26 20:35:40 +0000 | |||
4 | @@ -25,21 +25,14 @@ | |||
5 | 25 | height: collapsedHeight | 25 | height: collapsedHeight |
6 | 26 | 26 | ||
7 | 27 | property int collapsedHeight: units.gu(8) | 27 | property int collapsedHeight: units.gu(8) |
9 | 28 | property int expandedHeight: collapsedHeight + units.gu(4) + extraInfoColumn.height | 28 | property int expandedHeight: collapsedHeight + units.gu(4) + (expandedInfo.item ? expandedInfo.item.height : 0) |
10 | 29 | 29 | ||
11 | 30 | property alias day: dayLabel.text | 30 | property alias day: dayLabel.text |
12 | 31 | property alias image: weatherImage.name | 31 | property alias image: weatherImage.name |
13 | 32 | property alias high: highLabel.text | 32 | property alias high: highLabel.text |
14 | 33 | property alias low: lowLabel.text | 33 | property alias low: lowLabel.text |
15 | 34 | 34 | ||
24 | 35 | property alias condition: conditionForecast.text | 35 | property alias modelData: expandedInfo.modelData |
17 | 36 | property alias chanceOfRain: chanceOfRainForecast.value | ||
18 | 37 | property alias humidity: humidityForecast.value | ||
19 | 38 | property alias pollen: pollenForecast.value | ||
20 | 39 | property alias sunrise: sunriseForecast.value | ||
21 | 40 | property alias sunset: sunsetForecast.value | ||
22 | 41 | property alias wind: windForecast.value | ||
23 | 42 | property alias uvIndex: uvIndexForecast.value | ||
25 | 43 | 36 | ||
26 | 44 | state: "normal" | 37 | state: "normal" |
27 | 45 | states: [ | 38 | states: [ |
28 | @@ -49,6 +42,10 @@ | |||
29 | 49 | target: dayDelegate | 42 | target: dayDelegate |
30 | 50 | height: collapsedHeight | 43 | height: collapsedHeight |
31 | 51 | } | 44 | } |
32 | 45 | PropertyChanges { | ||
33 | 46 | target: expandedInfo | ||
34 | 47 | opacity: 0 | ||
35 | 48 | } | ||
36 | 52 | }, | 49 | }, |
37 | 53 | State { | 50 | State { |
38 | 54 | name: "expanded" | 51 | name: "expanded" |
39 | @@ -68,9 +65,8 @@ | |||
40 | 68 | from: "normal" | 65 | from: "normal" |
41 | 69 | to: "expanded" | 66 | to: "expanded" |
42 | 70 | SequentialAnimation { | 67 | SequentialAnimation { |
46 | 71 | NumberAnimation { | 68 | ScriptAction { |
47 | 72 | easing.type: Easing.InOutQuad | 69 | script: expandedInfo.active = true |
45 | 73 | properties: "height" | ||
48 | 74 | } | 70 | } |
49 | 75 | NumberAnimation { | 71 | NumberAnimation { |
50 | 76 | easing.type: Easing.InOutQuad | 72 | easing.type: Easing.InOutQuad |
51 | @@ -86,9 +82,8 @@ | |||
52 | 86 | easing.type: Easing.InOutQuad | 82 | easing.type: Easing.InOutQuad |
53 | 87 | properties: "opacity" | 83 | properties: "opacity" |
54 | 88 | } | 84 | } |
58 | 89 | NumberAnimation { | 85 | ScriptAction { |
59 | 90 | easing.type: Easing.InOutQuad | 86 | script: expandedInfo.active = false |
57 | 91 | properties: "height" | ||
60 | 92 | } | 87 | } |
61 | 93 | } | 88 | } |
62 | 94 | } | 89 | } |
63 | @@ -165,78 +160,27 @@ | |||
64 | 165 | } | 160 | } |
65 | 166 | } | 161 | } |
66 | 167 | 162 | ||
68 | 168 | Item { | 163 | Loader { |
69 | 169 | id: expandedInfo | 164 | id: expandedInfo |
70 | 165 | active: false | ||
71 | 170 | anchors { | 166 | anchors { |
73 | 171 | bottom: parent.bottom | 167 | bottomMargin: units.gu(2) |
74 | 172 | left: parent.left | 168 | left: parent.left |
75 | 169 | leftMargin: units.gu(2) | ||
76 | 173 | right: parent.right | 170 | right: parent.right |
77 | 171 | rightMargin: units.gu(2) | ||
78 | 174 | top: mainInfo.bottom | 172 | top: mainInfo.bottom |
79 | 175 | bottomMargin: units.gu(2) | ||
80 | 176 | } | 173 | } |
81 | 174 | asynchronous: true | ||
82 | 177 | opacity: 0 | 175 | opacity: 0 |
145 | 178 | visible: opacity !== 0 | 176 | source: "DayDelegateExtraInfo.qml" |
146 | 179 | 177 | ||
147 | 180 | Column { | 178 | property var modelData |
148 | 181 | id: extraInfoColumn | 179 | } |
149 | 182 | anchors { | 180 | |
150 | 183 | centerIn: parent | 181 | Behavior on height { |
151 | 184 | } | 182 | NumberAnimation { |
152 | 185 | spacing: units.gu(2) | 183 | easing.type: Easing.InOutQuad |
91 | 186 | |||
92 | 187 | // FIXME: extended-infomation_* aren't actually on device | ||
93 | 188 | |||
94 | 189 | // Overview text | ||
95 | 190 | Label { | ||
96 | 191 | id: conditionForecast | ||
97 | 192 | color: UbuntuColors.coolGrey | ||
98 | 193 | font.capitalization: Font.Capitalize | ||
99 | 194 | fontSize: "x-large" | ||
100 | 195 | horizontalAlignment: Text.AlignHCenter | ||
101 | 196 | width: parent.width | ||
102 | 197 | } | ||
103 | 198 | |||
104 | 199 | ForecastDetailsDelegate { | ||
105 | 200 | id: chanceOfRainForecast | ||
106 | 201 | forecast: i18n.tr("Chance of rain") | ||
107 | 202 | imageSource: "../graphics/extended-information_chance-of-rain.svg" | ||
108 | 203 | } | ||
109 | 204 | |||
110 | 205 | ForecastDetailsDelegate { | ||
111 | 206 | id: windForecast | ||
112 | 207 | forecast: i18n.tr("Winds") | ||
113 | 208 | imageSource: "../graphics/extended-information_wind.svg" | ||
114 | 209 | } | ||
115 | 210 | |||
116 | 211 | ForecastDetailsDelegate { | ||
117 | 212 | id: uvIndexForecast | ||
118 | 213 | imageSource: "../graphics/extended-information_uv-level.svg" | ||
119 | 214 | forecast: i18n.tr("UV Index") | ||
120 | 215 | } | ||
121 | 216 | |||
122 | 217 | ForecastDetailsDelegate { | ||
123 | 218 | id: pollenForecast | ||
124 | 219 | forecast: i18n.tr("Pollen") | ||
125 | 220 | // FIXME: need icon | ||
126 | 221 | } | ||
127 | 222 | |||
128 | 223 | ForecastDetailsDelegate { | ||
129 | 224 | id: humidityForecast | ||
130 | 225 | forecast: i18n.tr("Humidity") | ||
131 | 226 | imageSource: "../graphics/extended-information_humidity.svg" | ||
132 | 227 | } | ||
133 | 228 | |||
134 | 229 | ForecastDetailsDelegate { | ||
135 | 230 | id: sunriseForecast | ||
136 | 231 | forecast: i18n.tr("Sunrise") | ||
137 | 232 | imageSource: "../graphics/extended-information_sunrise.svg" | ||
138 | 233 | } | ||
139 | 234 | |||
140 | 235 | ForecastDetailsDelegate { | ||
141 | 236 | id: sunsetForecast | ||
142 | 237 | forecast: i18n.tr("Sunset") | ||
143 | 238 | imageSource: "../graphics/extended-information_sunset.svg" | ||
144 | 239 | } | ||
153 | 240 | } | 184 | } |
154 | 241 | } | 185 | } |
155 | 242 | 186 | ||
156 | 243 | 187 | ||
157 | === added file 'app/components/DayDelegateExtraInfo.qml' | |||
158 | --- app/components/DayDelegateExtraInfo.qml 1970-01-01 00:00:00 +0000 | |||
159 | +++ app/components/DayDelegateExtraInfo.qml 2015-08-26 20:35:40 +0000 | |||
160 | @@ -0,0 +1,91 @@ | |||
161 | 1 | /* | ||
162 | 2 | * Copyright (C) 2015 Canonical Ltd | ||
163 | 3 | * | ||
164 | 4 | * This file is part of Ubuntu Weather App | ||
165 | 5 | * | ||
166 | 6 | * Ubuntu Weather App is free software: you can redistribute it and/or modify | ||
167 | 7 | * it under the terms of the GNU General Public License version 3 as | ||
168 | 8 | * published by the Free Software Foundation. | ||
169 | 9 | * | ||
170 | 10 | * Ubuntu Weather App is distributed in the hope that it will be useful, | ||
171 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
172 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
173 | 13 | * GNU General Public License for more details. | ||
174 | 14 | * | ||
175 | 15 | * You should have received a copy of the GNU General Public License | ||
176 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
177 | 17 | */ | ||
178 | 18 | |||
179 | 19 | import QtQuick 2.4 | ||
180 | 20 | import Ubuntu.Components 1.2 | ||
181 | 21 | |||
182 | 22 | |||
183 | 23 | Column { | ||
184 | 24 | id: extraInfoColumn | ||
185 | 25 | anchors { | ||
186 | 26 | centerIn: parent | ||
187 | 27 | } | ||
188 | 28 | spacing: units.gu(2) | ||
189 | 29 | |||
190 | 30 | // FIXME: extended-infomation_* aren't actually on device | ||
191 | 31 | |||
192 | 32 | // Overview text | ||
193 | 33 | Label { | ||
194 | 34 | id: conditionForecast | ||
195 | 35 | color: UbuntuColors.coolGrey | ||
196 | 36 | font.capitalization: Font.Capitalize | ||
197 | 37 | fontSize: "x-large" | ||
198 | 38 | horizontalAlignment: Text.AlignHCenter | ||
199 | 39 | text: modelData.condition | ||
200 | 40 | width: parent.width | ||
201 | 41 | } | ||
202 | 42 | |||
203 | 43 | ForecastDetailsDelegate { | ||
204 | 44 | id: chanceOfRainForecast | ||
205 | 45 | forecast: i18n.tr("Chance of rain") | ||
206 | 46 | imageSource: "../graphics/extended-information_chance-of-rain.svg" | ||
207 | 47 | value: modelData.chanceOfRain | ||
208 | 48 | } | ||
209 | 49 | |||
210 | 50 | ForecastDetailsDelegate { | ||
211 | 51 | id: windForecast | ||
212 | 52 | forecast: i18n.tr("Winds") | ||
213 | 53 | imageSource: "../graphics/extended-information_wind.svg" | ||
214 | 54 | value: modelData.wind | ||
215 | 55 | } | ||
216 | 56 | |||
217 | 57 | ForecastDetailsDelegate { | ||
218 | 58 | id: uvIndexForecast | ||
219 | 59 | imageSource: "../graphics/extended-information_uv-level.svg" | ||
220 | 60 | forecast: i18n.tr("UV Index") | ||
221 | 61 | value: modelData.uvIndex | ||
222 | 62 | } | ||
223 | 63 | |||
224 | 64 | ForecastDetailsDelegate { | ||
225 | 65 | id: pollenForecast | ||
226 | 66 | forecast: i18n.tr("Pollen") | ||
227 | 67 | // FIXME: need icon | ||
228 | 68 | //value: modelData.pollen // TODO: extra from API | ||
229 | 69 | } | ||
230 | 70 | |||
231 | 71 | ForecastDetailsDelegate { | ||
232 | 72 | id: humidityForecast | ||
233 | 73 | forecast: i18n.tr("Humidity") | ||
234 | 74 | imageSource: "../graphics/extended-information_humidity.svg" | ||
235 | 75 | value: modelData.humidity | ||
236 | 76 | } | ||
237 | 77 | |||
238 | 78 | ForecastDetailsDelegate { | ||
239 | 79 | id: sunriseForecast | ||
240 | 80 | forecast: i18n.tr("Sunrise") | ||
241 | 81 | imageSource: "../graphics/extended-information_sunrise.svg" | ||
242 | 82 | value: modelData.sunrise | ||
243 | 83 | } | ||
244 | 84 | |||
245 | 85 | ForecastDetailsDelegate { | ||
246 | 86 | id: sunsetForecast | ||
247 | 87 | forecast: i18n.tr("Sunset") | ||
248 | 88 | imageSource: "../graphics/extended-information_sunset.svg" | ||
249 | 89 | value: modelData.sunset | ||
250 | 90 | } | ||
251 | 91 | } | ||
252 | 0 | 92 | ||
253 | === modified file 'app/components/HomeHourly.qml' | |||
254 | --- app/components/HomeHourly.qml 2015-06-21 18:35:36 +0000 | |||
255 | +++ app/components/HomeHourly.qml 2015-08-26 20:35:40 +0000 | |||
256 | @@ -25,14 +25,14 @@ | |||
257 | 25 | clip:true | 25 | clip:true |
258 | 26 | height: parent ? parent.height : undefined | 26 | height: parent ? parent.height : undefined |
259 | 27 | width: parent ? parent.width : undefined | 27 | width: parent ? parent.width : undefined |
261 | 28 | model: forecasts.length | 28 | model: hourlyForecastsData.length |
262 | 29 | orientation: ListView.Horizontal | 29 | orientation: ListView.Horizontal |
263 | 30 | 30 | ||
264 | 31 | property string currentDate: Qt.formatTime(new Date()) | 31 | property string currentDate: Qt.formatTime(new Date()) |
265 | 32 | 32 | ||
266 | 33 | onVisibleChanged: { | 33 | onVisibleChanged: { |
267 | 34 | if(visible) { | 34 | if(visible) { |
269 | 35 | ListView.model = forecasts.length | 35 | ListView.model = hourlyForecastsData.length |
270 | 36 | } | 36 | } |
271 | 37 | } | 37 | } |
272 | 38 | 38 | ||
273 | @@ -46,7 +46,7 @@ | |||
274 | 46 | delegate: Item { | 46 | delegate: Item { |
275 | 47 | id: delegate | 47 | id: delegate |
276 | 48 | 48 | ||
278 | 49 | property var hourData: forecasts[index] | 49 | property var hourData: hourlyForecastsData[index] |
279 | 50 | 50 | ||
280 | 51 | height: parent.height | 51 | height: parent.height |
281 | 52 | width: childrenRect.width | 52 | width: childrenRect.width |
282 | @@ -84,7 +84,7 @@ | |||
283 | 84 | anchors.horizontalCenter: parent.horizontalCenter | 84 | anchors.horizontalCenter: parent.horizontalCenter |
284 | 85 | font.pixelSize: units.gu(3) | 85 | font.pixelSize: units.gu(3) |
285 | 86 | font.weight: Font.Light | 86 | font.weight: Font.Light |
287 | 87 | text: Math.round(hourData[tempUnits].temp).toString()+settings.tempScale | 87 | text: Math.round(hourData[hourlyTempUnits].temp).toString()+settings.tempScale |
288 | 88 | } | 88 | } |
289 | 89 | } | 89 | } |
290 | 90 | 90 | ||
291 | 91 | 91 | ||
292 | === modified file 'app/ui/HomePage.qml' | |||
293 | --- app/ui/HomePage.qml 2015-07-30 04:10:44 +0000 | |||
294 | +++ app/ui/HomePage.qml 2015-08-26 20:35:40 +0000 | |||
295 | @@ -93,91 +93,58 @@ | |||
296 | 93 | } | 93 | } |
297 | 94 | 94 | ||
298 | 95 | /* | 95 | /* |
301 | 96 | Flickable to scroll the location vertically. | 96 | ListView for locations with snap-scrolling horizontally. |
300 | 97 | The respective contentHeight gets calculated after the Location is filled with data. | ||
302 | 98 | */ | 97 | */ |
385 | 99 | Flickable { | 98 | ListView { |
386 | 100 | id: locationFlickable | 99 | id: locationPages |
387 | 101 | width: parent.width | 100 | objectName: "locationPages" |
388 | 102 | height: parent.height | 101 | anchors.fill: parent |
389 | 103 | 102 | contentHeight: parent.height | |
390 | 104 | // FIXME: not sure where the 3GU comes from, PullToRefresh or something in HomePage? | 103 | currentIndex: settings.current |
391 | 105 | contentHeight: locationPages.currentItem ? locationPages.currentItem.childrenRect.height + units.gu(3) : 0 | 104 | delegate: LocationPane {} |
392 | 106 | contentWidth: parent.width | 105 | highlightRangeMode: ListView.StrictlyEnforceRange |
393 | 107 | 106 | model: weatherApp.locationsList.length | |
394 | 108 | Behavior on contentHeight { | 107 | orientation: ListView.Horizontal |
395 | 109 | NumberAnimation { | 108 | // TODO with snapMode, currentIndex is not properly set and setting currentIndex fails |
396 | 110 | 109 | //snapMode: ListView.SnapOneItem | |
397 | 111 | } | 110 | |
398 | 112 | } | 111 | property bool loaded: false |
399 | 113 | 112 | ||
400 | 114 | PullToRefresh { | 113 | signal collapseOtherDelegates(int index) |
401 | 115 | id: pullToRefresh | 114 | |
402 | 116 | parent: locationFlickable | 115 | onCurrentIndexChanged: { |
403 | 117 | refreshing: false | 116 | if (loaded) { |
404 | 118 | onRefresh: { | 117 | // FIXME: when a model is reloaded this causes the currentIndex to be lost |
405 | 119 | locationPages.loaded = false | 118 | settings.current = currentIndex |
406 | 120 | refreshing = true | 119 | |
407 | 121 | refreshData(false, true) | 120 | collapseOtherDelegates(-1) // collapse all |
408 | 122 | } | 121 | } |
409 | 123 | } | 122 | } |
410 | 124 | 123 | onModelChanged: { | |
411 | 125 | /* | 124 | currentIndex = settings.current |
412 | 126 | ListView for locations with snap-scrolling horizontally. | 125 | |
413 | 127 | */ | 126 | if (model > 0) { |
414 | 128 | ListView { | 127 | loading = false |
415 | 129 | id: locationPages | 128 | loaded = true |
416 | 130 | objectName: "locationPages" | 129 | } |
417 | 131 | anchors.fill: parent | 130 | } |
418 | 132 | currentIndex: settings.current | 131 | onVisibleChanged: { |
419 | 133 | delegate: LocationPane {} | 132 | if (!visible && loaded) { |
420 | 134 | height: childrenRect.height | 133 | collapseOtherDelegates(-1) // collapse all |
421 | 135 | highlightRangeMode: ListView.StrictlyEnforceRange | 134 | } |
422 | 136 | model: weatherApp.locationsList.length | 135 | } |
423 | 137 | orientation: ListView.Horizontal | 136 | |
424 | 138 | // TODO with snapMode, currentIndex is not properly set and setting currentIndex fails | 137 | // TODO: workaround for not being able to use snapMode property |
425 | 139 | //snapMode: ListView.SnapOneItem | 138 | Component.onCompleted: { |
426 | 140 | width: parent.width | 139 | var scaleFactor = units.gridUnit * 10; |
427 | 141 | 140 | maximumFlickVelocity = maximumFlickVelocity * scaleFactor; | |
428 | 142 | property bool loaded: false | 141 | flickDeceleration = flickDeceleration * scaleFactor; |
429 | 143 | 142 | } | |
430 | 144 | signal collapseOtherDelegates(int index) | 143 | |
431 | 145 | 144 | Connections { | |
432 | 146 | onCurrentIndexChanged: { | 145 | target: settings |
433 | 147 | if (loaded) { | 146 | onCurrentChanged: { |
434 | 148 | // FIXME: when a model is reloaded this causes the currentIndex to be lost | 147 | locationPages.currentIndex = settings.current |
353 | 149 | settings.current = currentIndex | ||
354 | 150 | |||
355 | 151 | collapseOtherDelegates(-1) // collapse all | ||
356 | 152 | } | ||
357 | 153 | } | ||
358 | 154 | onModelChanged: { | ||
359 | 155 | currentIndex = settings.current | ||
360 | 156 | |||
361 | 157 | if (model > 0) { | ||
362 | 158 | pullToRefresh.refreshing = false | ||
363 | 159 | loading = false | ||
364 | 160 | loaded = true | ||
365 | 161 | } | ||
366 | 162 | } | ||
367 | 163 | onVisibleChanged: { | ||
368 | 164 | if (!visible && loaded) { | ||
369 | 165 | collapseOtherDelegates(-1) // collapse all | ||
370 | 166 | } | ||
371 | 167 | } | ||
372 | 168 | |||
373 | 169 | // TODO: workaround for not being able to use snapMode property | ||
374 | 170 | Component.onCompleted: { | ||
375 | 171 | var scaleFactor = units.gridUnit * 10; | ||
376 | 172 | maximumFlickVelocity = maximumFlickVelocity * scaleFactor; | ||
377 | 173 | flickDeceleration = flickDeceleration * scaleFactor; | ||
378 | 174 | } | ||
379 | 175 | |||
380 | 176 | Connections { | ||
381 | 177 | target: settings | ||
382 | 178 | onCurrentChanged: { | ||
383 | 179 | locationPages.currentIndex = settings.current | ||
384 | 180 | } | ||
435 | 181 | } | 148 | } |
436 | 182 | } | 149 | } |
437 | 183 | } | 150 | } |
438 | 184 | 151 | ||
439 | === modified file 'app/ui/LocationPane.qml' | |||
440 | --- app/ui/LocationPane.qml 2015-08-09 12:20:27 +0000 | |||
441 | +++ app/ui/LocationPane.qml 2015-08-26 20:35:40 +0000 | |||
442 | @@ -22,8 +22,16 @@ | |||
443 | 22 | import "../components" | 22 | import "../components" |
444 | 23 | import "../data/suncalc.js" as SunCalc | 23 | import "../data/suncalc.js" as SunCalc |
445 | 24 | 24 | ||
448 | 25 | Item { | 25 | |
449 | 26 | id: locationItem | 26 | ListView { |
450 | 27 | id: mainPageWeekdayListView | ||
451 | 28 | height: parent.height | ||
452 | 29 | model: ListModel { | ||
453 | 30 | |||
454 | 31 | } | ||
455 | 32 | objectName: "locationListView" + index | ||
456 | 33 | width: weatherApp.width | ||
457 | 34 | |||
458 | 27 | /* | 35 | /* |
459 | 28 | Data properties | 36 | Data properties |
460 | 29 | */ | 37 | */ |
461 | @@ -35,11 +43,105 @@ | |||
462 | 35 | property string icon | 43 | property string icon |
463 | 36 | property string iconName | 44 | property string iconName |
464 | 37 | 45 | ||
470 | 38 | Component.onCompleted: renderData(index) | 46 | property var hourlyForecastsData |
471 | 39 | 47 | property string hourlyTempUnits | |
472 | 40 | width: locationPage.width | 48 | |
473 | 41 | height: childrenRect.height | 49 | delegate: DayDelegate { |
474 | 42 | anchors.fill: parent.fill | 50 | day: model.day |
475 | 51 | high: model.high | ||
476 | 52 | image: model.image | ||
477 | 53 | low: model.low | ||
478 | 54 | |||
479 | 55 | modelData: model | ||
480 | 56 | } | ||
481 | 57 | header: Column { | ||
482 | 58 | id: locationTop | ||
483 | 59 | |||
484 | 60 | anchors { | ||
485 | 61 | left: parent.left | ||
486 | 62 | right: parent.right | ||
487 | 63 | margins: units.gu(2) | ||
488 | 64 | } | ||
489 | 65 | spacing: units.gu(1) | ||
490 | 66 | onHeightChanged: mainPageWeekdayListView.contentY = -height | ||
491 | 67 | |||
492 | 68 | Row { // spacing at top | ||
493 | 69 | height: units.gu(1) | ||
494 | 70 | width: parent.width | ||
495 | 71 | } | ||
496 | 72 | |||
497 | 73 | HeaderRow { | ||
498 | 74 | id: headerRow | ||
499 | 75 | locationName: mainPageWeekdayListView.name | ||
500 | 76 | } | ||
501 | 77 | |||
502 | 78 | HomeGraphic { | ||
503 | 79 | id: homeGraphic | ||
504 | 80 | icon: mainPageWeekdayListView.icon | ||
505 | 81 | MouseArea { | ||
506 | 82 | anchors.fill: parent | ||
507 | 83 | onClicked: { | ||
508 | 84 | homeGraphic.visible = false; | ||
509 | 85 | } | ||
510 | 86 | } | ||
511 | 87 | } | ||
512 | 88 | |||
513 | 89 | Loader { | ||
514 | 90 | id: homeHourlyLoader | ||
515 | 91 | active: !homeGraphic.visible | ||
516 | 92 | asynchronous: true | ||
517 | 93 | height: units.gu(32) | ||
518 | 94 | source: "../components/HomeHourly.qml" | ||
519 | 95 | visible: active | ||
520 | 96 | width: parent.width | ||
521 | 97 | } | ||
522 | 98 | |||
523 | 99 | HomeTempInfo { | ||
524 | 100 | id: homeTempInfo | ||
525 | 101 | description: conditionText | ||
526 | 102 | high: mainPageWeekdayListView.todayMaxTemp | ||
527 | 103 | low: mainPageWeekdayListView.todayMinTemp | ||
528 | 104 | now: mainPageWeekdayListView.currentTemp | ||
529 | 105 | } | ||
530 | 106 | |||
531 | 107 | // TODO: Migrate this to using the new SDK list item when possible. | ||
532 | 108 | ListItem.ThinDivider { | ||
533 | 109 | anchors { | ||
534 | 110 | leftMargin: units.gu(-2); | ||
535 | 111 | rightMargin: units.gu(-2) | ||
536 | 112 | } | ||
537 | 113 | } | ||
538 | 114 | |||
539 | 115 | NumberAnimation { | ||
540 | 116 | id: scrollToTopAnimation | ||
541 | 117 | target: mainPageWeekdayListView; | ||
542 | 118 | property: "contentY"; | ||
543 | 119 | duration: 200; | ||
544 | 120 | easing.type: Easing.InOutQuad | ||
545 | 121 | to: -height | ||
546 | 122 | } | ||
547 | 123 | |||
548 | 124 | Connections { | ||
549 | 125 | target: locationPages | ||
550 | 126 | onCurrentIndexChanged: { | ||
551 | 127 | if (locationPages.currentIndex !== index) { | ||
552 | 128 | scrollToTopAnimation.start() | ||
553 | 129 | } else { | ||
554 | 130 | mainPageWeekdayListView.contentY = -locationTop.height | ||
555 | 131 | } | ||
556 | 132 | } | ||
557 | 133 | } | ||
558 | 134 | } | ||
559 | 135 | |||
560 | 136 | PullToRefresh { | ||
561 | 137 | id: pullToRefresh | ||
562 | 138 | refreshing: false | ||
563 | 139 | onRefresh: { | ||
564 | 140 | locationPages.loaded = false | ||
565 | 141 | refreshing = true | ||
566 | 142 | refreshData(false, true) | ||
567 | 143 | } | ||
568 | 144 | } | ||
569 | 43 | 145 | ||
570 | 44 | function emptyIfUndefined(variable, append) { | 146 | function emptyIfUndefined(variable, append) { |
571 | 45 | if (append === undefined) { | 147 | if (append === undefined) { |
572 | @@ -113,89 +215,10 @@ | |||
573 | 113 | 215 | ||
574 | 114 | // set data for hourly forecasts | 216 | // set data for hourly forecasts |
575 | 115 | if(hourlyForecasts.length > 0) { | 217 | if(hourlyForecasts.length > 0) { |
661 | 116 | homeHourlyLoader.forecasts = hourlyForecasts; | 218 | hourlyForecastsData = hourlyForecasts; |
662 | 117 | homeHourlyLoader.tempUnits = tempUnits; | 219 | hourlyTempUnits = tempUnits; |
663 | 118 | } | 220 | } |
664 | 119 | } | 221 | } |
665 | 120 | 222 | ||
666 | 121 | Column { | 223 | Component.onCompleted: renderData(index) |
582 | 122 | id: locationTop | ||
583 | 123 | |||
584 | 124 | anchors { | ||
585 | 125 | top: parent.top | ||
586 | 126 | left: parent.left | ||
587 | 127 | right: parent.right | ||
588 | 128 | margins: units.gu(2) | ||
589 | 129 | } | ||
590 | 130 | spacing: units.gu(1) | ||
591 | 131 | |||
592 | 132 | HeaderRow { | ||
593 | 133 | id: headerRow | ||
594 | 134 | locationName: locationItem.name | ||
595 | 135 | } | ||
596 | 136 | |||
597 | 137 | HomeGraphic { | ||
598 | 138 | id: homeGraphic | ||
599 | 139 | icon: locationItem.icon | ||
600 | 140 | MouseArea { | ||
601 | 141 | anchors.fill: parent | ||
602 | 142 | onClicked: { | ||
603 | 143 | homeGraphic.visible = false; | ||
604 | 144 | } | ||
605 | 145 | } | ||
606 | 146 | } | ||
607 | 147 | |||
608 | 148 | Loader { | ||
609 | 149 | id: homeHourlyLoader | ||
610 | 150 | active: !homeGraphic.visible | ||
611 | 151 | asynchronous: true | ||
612 | 152 | height: units.gu(32) | ||
613 | 153 | source: "../components/HomeHourly.qml" | ||
614 | 154 | visible: active | ||
615 | 155 | width: parent.width | ||
616 | 156 | |||
617 | 157 | property var forecasts: [] | ||
618 | 158 | property string tempUnits: "" | ||
619 | 159 | } | ||
620 | 160 | |||
621 | 161 | HomeTempInfo { | ||
622 | 162 | id: homeTempInfo | ||
623 | 163 | description: conditionText | ||
624 | 164 | high: locationItem.todayMaxTemp | ||
625 | 165 | low: locationItem.todayMinTemp | ||
626 | 166 | now: locationItem.currentTemp | ||
627 | 167 | } | ||
628 | 168 | |||
629 | 169 | // TODO: Migrate this to using the new SDK list item when possible. | ||
630 | 170 | ListItem.ThinDivider { anchors { leftMargin: units.gu(-2); rightMargin: units.gu(-2) } } | ||
631 | 171 | } | ||
632 | 172 | Column { | ||
633 | 173 | id: weekdayColumn | ||
634 | 174 | objectName: "weekdayColumn" + index | ||
635 | 175 | |||
636 | 176 | anchors.top: locationTop.bottom | ||
637 | 177 | height: childrenRect.height | ||
638 | 178 | width: parent.width | ||
639 | 179 | |||
640 | 180 | Repeater { | ||
641 | 181 | id: mainPageWeekdayListView | ||
642 | 182 | model: ListModel{} | ||
643 | 183 | delegate: DayDelegate { | ||
644 | 184 | day: model.day | ||
645 | 185 | high: model.high | ||
646 | 186 | image: model.image | ||
647 | 187 | low: model.low | ||
648 | 188 | |||
649 | 189 | condition: model.condition | ||
650 | 190 | chanceOfRain: model.chanceOfRain | ||
651 | 191 | humidity: model.humidity | ||
652 | 192 | // TODO: extra from API | ||
653 | 193 | //pollen: model.pollen | ||
654 | 194 | sunrise: model.sunrise | ||
655 | 195 | sunset: model.sunset | ||
656 | 196 | wind: model.wind | ||
657 | 197 | uvIndex: model.uvIndex | ||
658 | 198 | } | ||
659 | 199 | } | ||
660 | 200 | } | ||
667 | 201 | } | 224 | } |
668 | 202 | 225 | ||
669 | === modified file 'debian/changelog' | |||
670 | --- debian/changelog 2015-08-26 01:05:17 +0000 | |||
671 | +++ debian/changelog 2015-08-26 20:35:40 +0000 | |||
672 | @@ -38,6 +38,8 @@ | |||
673 | 38 | * Create autopilot test which adds a location via cached results (LP: #1452497) | 38 | * Create autopilot test which adds a location via cached results (LP: #1452497) |
674 | 39 | * Fix for racy search bar causing incorrect search query when typed quickly | 39 | * Fix for racy search bar causing incorrect search query when typed quickly |
675 | 40 | * Fix for flaky test as get_location does not wait for location to be loaded (LP: #1485657) | 40 | * Fix for flaky test as get_location does not wait for location to be loaded (LP: #1485657) |
676 | 41 | * Split day delegate extra info into a separate component that is loaded on demand | ||
677 | 42 | * Use ListView per Location Pane so that scrolling vertically only affect the currently focused pane | ||
678 | 41 | 43 | ||
679 | 42 | [ Carla Sella ] | 44 | [ Carla Sella ] |
680 | 43 | * Create autopilot test which shows the day delegate (LP: #1452491) | 45 | * Create autopilot test which shows the day delegate (LP: #1452491) |
681 | 44 | 46 | ||
682 | === modified file 'po/com.ubuntu.weather.pot' | |||
683 | --- po/com.ubuntu.weather.pot 2015-08-17 15:52:27 +0000 | |||
684 | +++ po/com.ubuntu.weather.pot 2015-08-26 20:35:40 +0000 | |||
685 | @@ -8,7 +8,7 @@ | |||
686 | 8 | msgstr "" | 8 | msgstr "" |
687 | 9 | "Project-Id-Version: ubuntu-weather-app\n" | 9 | "Project-Id-Version: ubuntu-weather-app\n" |
688 | 10 | "Report-Msgid-Bugs-To: \n" | 10 | "Report-Msgid-Bugs-To: \n" |
690 | 11 | "POT-Creation-Date: 2015-08-12 00:11+0100\n" | 11 | "POT-Creation-Date: 2015-08-24 19:08+0100\n" |
691 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
692 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
693 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
694 | @@ -18,31 +18,31 @@ | |||
695 | 18 | "Content-Transfer-Encoding: 8bit\n" | 18 | "Content-Transfer-Encoding: 8bit\n" |
696 | 19 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | 19 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" |
697 | 20 | 20 | ||
699 | 21 | #: ../app/components/DayDelegate.qml:200 | 21 | #: ../app/components/DayDelegateExtraInfo.qml:44 |
700 | 22 | msgid "Chance of rain" | 22 | msgid "Chance of rain" |
701 | 23 | msgstr "" | 23 | msgstr "" |
702 | 24 | 24 | ||
704 | 25 | #: ../app/components/DayDelegate.qml:206 | 25 | #: ../app/components/DayDelegateExtraInfo.qml:51 |
705 | 26 | msgid "Winds" | 26 | msgid "Winds" |
706 | 27 | msgstr "" | 27 | msgstr "" |
707 | 28 | 28 | ||
709 | 29 | #: ../app/components/DayDelegate.qml:213 | 29 | #: ../app/components/DayDelegateExtraInfo.qml:59 |
710 | 30 | msgid "UV Index" | 30 | msgid "UV Index" |
711 | 31 | msgstr "" | 31 | msgstr "" |
712 | 32 | 32 | ||
714 | 33 | #: ../app/components/DayDelegate.qml:218 | 33 | #: ../app/components/DayDelegateExtraInfo.qml:65 |
715 | 34 | msgid "Pollen" | 34 | msgid "Pollen" |
716 | 35 | msgstr "" | 35 | msgstr "" |
717 | 36 | 36 | ||
719 | 37 | #: ../app/components/DayDelegate.qml:224 | 37 | #: ../app/components/DayDelegateExtraInfo.qml:72 |
720 | 38 | msgid "Humidity" | 38 | msgid "Humidity" |
721 | 39 | msgstr "" | 39 | msgstr "" |
722 | 40 | 40 | ||
724 | 41 | #: ../app/components/DayDelegate.qml:230 | 41 | #: ../app/components/DayDelegateExtraInfo.qml:79 |
725 | 42 | msgid "Sunrise" | 42 | msgid "Sunrise" |
726 | 43 | msgstr "" | 43 | msgstr "" |
727 | 44 | 44 | ||
729 | 45 | #: ../app/components/DayDelegate.qml:236 | 45 | #: ../app/components/DayDelegateExtraInfo.qml:86 |
730 | 46 | msgid "Sunset" | 46 | msgid "Sunset" |
731 | 47 | msgstr "" | 47 | msgstr "" |
732 | 48 | 48 | ||
733 | @@ -98,19 +98,19 @@ | |||
734 | 98 | msgid "Search city" | 98 | msgid "Search city" |
735 | 99 | msgstr "" | 99 | msgstr "" |
736 | 100 | 100 | ||
738 | 101 | #: ../app/ui/AddLocationPage.qml:293 | 101 | #: ../app/ui/AddLocationPage.qml:295 |
739 | 102 | msgid "No city found" | 102 | msgid "No city found" |
740 | 103 | msgstr "" | 103 | msgstr "" |
741 | 104 | 104 | ||
743 | 105 | #: ../app/ui/AddLocationPage.qml:306 | 105 | #: ../app/ui/AddLocationPage.qml:308 |
744 | 106 | msgid "Couldn't load weather data, please try later again!" | 106 | msgid "Couldn't load weather data, please try later again!" |
745 | 107 | msgstr "" | 107 | msgstr "" |
746 | 108 | 108 | ||
748 | 109 | #: ../app/ui/AddLocationPage.qml:316 | 109 | #: ../app/ui/AddLocationPage.qml:318 |
749 | 110 | msgid "Location already added." | 110 | msgid "Location already added." |
750 | 111 | msgstr "" | 111 | msgstr "" |
751 | 112 | 112 | ||
753 | 113 | #: ../app/ui/AddLocationPage.qml:319 | 113 | #: ../app/ui/AddLocationPage.qml:321 |
754 | 114 | msgid "OK" | 114 | msgid "OK" |
755 | 115 | msgstr "" | 115 | msgstr "" |
756 | 116 | 116 | ||
757 | 117 | 117 | ||
758 | === modified file 'tests/autopilot/ubuntu_weather_app/__init__.py' | |||
759 | --- tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-26 01:05:17 +0000 | |||
760 | +++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-26 20:35:40 +0000 | |||
761 | @@ -144,10 +144,10 @@ | |||
762 | 144 | def get_selected_location_index(self): | 144 | def get_selected_location_index(self): |
763 | 145 | return self.get_location_pages().currentIndex | 145 | return self.get_location_pages().currentIndex |
764 | 146 | 146 | ||
769 | 147 | def get_daydelegate(self, weekdaycolumn, day): | 147 | def get_daydelegate(self, location, day): |
770 | 148 | weekdaycolumn = self.wait_select_single( | 148 | listview = self.wait_select_single( |
771 | 149 | "QQuickColumn", objectName="weekdayColumn" + str(weekdaycolumn)) | 149 | "LocationPane", objectName="locationListView" + str(location)) |
772 | 150 | return weekdaycolumn.wait_select_single( | 150 | return listview.wait_select_single( |
773 | 151 | "DayDelegate", objectName="dayDelegate" + str(day)) | 151 | "DayDelegate", objectName="dayDelegate" + str(day)) |
774 | 152 | 152 | ||
775 | 153 | @click_object | 153 | @click_object |
776 | 154 | 154 | ||
777 | === modified file 'tests/autopilot/ubuntu_weather_app/tests/test_home_page.py' | |||
778 | --- tests/autopilot/ubuntu_weather_app/tests/test_home_page.py 2015-08-09 16:28:57 +0000 | |||
779 | +++ tests/autopilot/ubuntu_weather_app/tests/test_home_page.py 2015-08-26 20:35:40 +0000 | |||
780 | @@ -42,6 +42,10 @@ | |||
781 | 42 | self.assertThat(day_delegate.state, Eventually(Equals("normal"))) | 42 | self.assertThat(day_delegate.state, Eventually(Equals("normal"))) |
782 | 43 | 43 | ||
783 | 44 | home_page.click_daydelegate(day_delegate) | 44 | home_page.click_daydelegate(day_delegate) |
784 | 45 | |||
785 | 46 | # Re-get daydelegate as change in loaders changes tree | ||
786 | 47 | day_delegate = home_page.get_daydelegate(weekdaycolumn, day) | ||
787 | 48 | |||
788 | 45 | day_delegate.height.wait_for(day_delegate.expandedHeight) | 49 | day_delegate.height.wait_for(day_delegate.expandedHeight) |
789 | 46 | self.assertThat(day_delegate.state, Eventually(Equals("expanded"))) | 50 | self.assertThat(day_delegate.state, Eventually(Equals("expanded"))) |
790 | 47 | self.assertEqual(day_delegate.height, day_delegate.expandedHeight) | 51 | self.assertEqual(day_delegate.height, day_delegate.expandedHeight) |
PASSED: Continuous integration, rev:99 91.189. 93.70:8080/ job/ubuntu- weather- app-reboot- ci/218/ 91.189. 93.70:8080/ job/ubuntu- weather- app-reboot- utopic- amd64-ci/ 188 91.189. 93.70:8080/ job/ubuntu- weather- app-reboot- vivid-amd64- ci/218
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- weather- app-reboot- ci/218/ rebuild
http://