Merge lp:~neokore/ubuntu-weather-app/flippedInfo2 into lp:ubuntu-weather-app/obsolete.trunk
- flippedInfo2
- Merge into trunk
Proposed by
Raúl Yeguas
Status: | Merged |
---|---|
Approved by: | Martin Borho |
Approved revision: | 84 |
Merged at revision: | 84 |
Proposed branch: | lp:~neokore/ubuntu-weather-app/flippedInfo2 |
Merge into: | lp:ubuntu-weather-app/obsolete.trunk |
Diff against target: |
578 lines (+373/-117) 4 files modified
components/CurrentWeather.qml (+322/-102) components/LocationTab.qml (+30/-1) components/SettingsSheet.qml (+2/-2) components/WeatherApi.js (+19/-12) |
To merge this branch: | bzr merge lp:~neokore/ubuntu-weather-app/flippedInfo2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Borho | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+178622@code.launchpad.net |
Commit message
Added wind speed, wind direction and rain to internal data and implemented flipped component for more forecast info.
Description of the change
Added wind speed, wind direction and rain to internal data and implemented flipped component for more forecast info.
To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
review:
Approve
(continuous-integration)
Revision history for this message
Martin Borho (martin-borho) wrote : | # |
Excellent work, Raul!
I'll fix a litte issue on the device (double digit wind speed and double char wind direction is too wide) and the broken tests later. (I have already a branch with updated tests in the work)
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'components/CurrentWeather.qml' | |||
2 | --- components/CurrentWeather.qml 2013-07-27 16:02:29 +0000 | |||
3 | +++ components/CurrentWeather.qml 2013-08-05 18:56:25 +0000 | |||
4 | @@ -13,109 +13,329 @@ | |||
5 | 13 | property int minTemp | 13 | property int minTemp |
6 | 14 | property int maxTemp | 14 | property int maxTemp |
7 | 15 | property bool showMaxTemp | 15 | property bool showMaxTemp |
9 | 16 | property string scale: (mainView.settings["units"] === "imperial") ? "F" : "C" | 16 | property int windSpeed |
10 | 17 | property string windDir | ||
11 | 18 | property int humidity | ||
12 | 19 | property real precipitation | ||
13 | 20 | property string tempScale: (mainView.settings["units"] === "imperial") ? "F" : "C" | ||
14 | 21 | property string speedScale: (mainView.settings["units"] === "imperial") ? "mph" : "km/h" | ||
15 | 22 | property string precipScale: (mainView.settings["units"] === "imperial") ? "in" : "mm" | ||
16 | 17 | 23 | ||
17 | 18 | width: parent.width | 24 | width: parent.width |
19 | 19 | height: childrenRect.height+units.gu(10) | 25 | height: units.gu(40) |
20 | 20 | anchors.horizontalCenter: parent.horizontalCenter | 26 | anchors.horizontalCenter: parent.horizontalCenter |
21 | 21 | 27 | ||
122 | 22 | Components.WeatherConditionIconComponent { | 28 | Flipable { |
123 | 23 | id: currentCondition | 29 | id: flipable |
124 | 24 | width: units.gu(30) | 30 | anchors.fill: parent |
125 | 25 | height: units.gu(30) | 31 | |
126 | 26 | anchors.horizontalCenter: parent.horizontalCenter | 32 | property bool flipped: false |
127 | 27 | condition: currentWeather.icon | 33 | |
128 | 28 | 34 | MouseArea {anchors.fill: parent; onClicked: flipable.flipped = !flipable.flipped} | |
129 | 29 | NumberAnimation on opacity { | 35 | |
130 | 30 | id: createAnimation | 36 | back: |
131 | 31 | easing.type: Easing.Linear | 37 | Rectangle { |
132 | 32 | from: 0 | 38 | anchors.fill: parent |
133 | 33 | to: 1 | 39 | color: "transparent" |
134 | 34 | duration: 1000 | 40 | |
135 | 35 | } | 41 | Components.WeatherConditionIconComponent { |
136 | 36 | 42 | id: currentCondition2 | |
137 | 37 | Component.onCompleted: { | 43 | width: units.gu(20) |
138 | 38 | createAnimation.start() | 44 | height: units.gu(20) |
139 | 39 | } | 45 | anchors.horizontalCenter: parent.horizontalCenter |
140 | 40 | } | 46 | anchors.horizontalCenterOffset: units.gu(-6) |
141 | 41 | 47 | condition: currentWeather.icon | |
142 | 42 | Rectangle { | 48 | |
143 | 43 | id: rectangle1 | 49 | NumberAnimation on opacity { |
144 | 44 | width: units.gu(50) | 50 | id: createAnimation2 |
145 | 45 | height: units.gu(10) | 51 | easing.type: Easing.Linear |
146 | 46 | anchors.horizontalCenter: parent.horizontalCenter | 52 | from: 0 |
147 | 47 | anchors.top: currentCondition.bottom | 53 | to: 1 |
148 | 48 | anchors.topMargin: 0 | 54 | duration: 1000 |
149 | 49 | color: "transparent" | 55 | } |
150 | 50 | 56 | ||
151 | 51 | Column { | 57 | Component.onCompleted: { |
152 | 52 | id: column1 | 58 | createAnimation2.start() |
153 | 53 | width: units.gu(5) | 59 | } |
154 | 54 | height: units.gu(5) | 60 | } |
155 | 55 | anchors.rightMargin: units.gu(2) | 61 | |
156 | 56 | anchors.verticalCenter: parent.verticalCenter | 62 | Rectangle { |
157 | 57 | anchors.right: tempCurrent.left | 63 | id: rectangle12 |
158 | 58 | visible: showMaxTemp | 64 | width: units.gu(50) |
159 | 59 | 65 | height: units.gu(10) | |
160 | 60 | Label { | 66 | anchors.horizontalCenter: parent.horizontalCenter |
161 | 61 | text: i18n.tr("Max.") | 67 | anchors.top: currentCondition2.bottom |
162 | 62 | anchors.horizontalCenter: parent.horizontalCenter | 68 | anchors.topMargin: 0 |
163 | 63 | font.pixelSize: FontUtils.sizeToPixels("small") | 69 | color: "transparent" |
164 | 64 | horizontalAlignment: Text.AlignHCenter | 70 | |
165 | 65 | } | 71 | Column { |
166 | 66 | 72 | id: column12 | |
167 | 67 | Label { | 73 | width: units.gu(5) |
168 | 68 | id: tempMax | 74 | height: units.gu(5) |
169 | 69 | text: maxTemp+"°"+currentWeather.scale | 75 | anchors.rightMargin: units.gu(2) |
170 | 70 | anchors.horizontalCenter: parent.horizontalCenter | 76 | anchors.verticalCenter: parent.verticalCenter |
171 | 71 | font.pixelSize: FontUtils.sizeToPixels("large") | 77 | anchors.right: tempCurrent2.left |
172 | 72 | horizontalAlignment: Text.AlignHCenter | 78 | visible: showMaxTemp |
173 | 73 | color: Theme.palette.normal.baseText | 79 | |
174 | 74 | } | 80 | Label { |
175 | 75 | } | 81 | text: i18n.tr("Max.") |
176 | 76 | 82 | anchors.horizontalCenter: parent.horizontalCenter | |
177 | 77 | Text { | 83 | font.pixelSize: FontUtils.sizeToPixels("small") |
178 | 78 | width: units.gu(17) | 84 | horizontalAlignment: Text.AlignHCenter |
179 | 79 | height: units.gu(10) | 85 | } |
180 | 80 | id: tempCurrent | 86 | |
181 | 81 | objectName: "CurrentTempText" | 87 | Label { |
182 | 82 | text: currentTemp+String("°")+currentWeather.scale | 88 | id: tempMax2 |
183 | 83 | style: Text.Normal | 89 | text: maxTemp+"°"+currentWeather.tempScale |
184 | 84 | font.bold: false | 90 | anchors.horizontalCenter: parent.horizontalCenter |
185 | 85 | font.family: "Ubuntu" | 91 | font.pixelSize: FontUtils.sizeToPixels("large") |
186 | 86 | verticalAlignment: Text.AlignVCenter | 92 | horizontalAlignment: Text.AlignHCenter |
187 | 87 | anchors.horizontalCenter: parent.horizontalCenter | 93 | color: Theme.palette.normal.baseText |
188 | 88 | anchors.horizontalCenterOffset: (showMaxTemp) ? 0 : -units.gu(4) | 94 | } |
189 | 89 | anchors.verticalCenter: parent.verticalCenter | 95 | } |
190 | 90 | font.pointSize: 52 | 96 | |
191 | 91 | horizontalAlignment: Text.AlignHCenter | 97 | Text { |
192 | 92 | color: Theme.palette.normal.baseText | 98 | width: units.gu(17) |
193 | 93 | } | 99 | height: units.gu(10) |
194 | 94 | 100 | id: tempCurrent2 | |
195 | 95 | Column { | 101 | objectName: "CurrentTempText" |
196 | 96 | id: column2 | 102 | text: currentTemp+String("°")+currentWeather.tempScale |
197 | 97 | width: units.gu(5) | 103 | style: Text.Normal |
198 | 98 | height: units.gu(5) | 104 | font.bold: false |
199 | 99 | anchors.leftMargin: (showMaxTemp) ? units.gu(2) : units.gu(4) | 105 | font.family: "Ubuntu" |
200 | 100 | anchors.verticalCenter: parent.verticalCenter | 106 | verticalAlignment: Text.AlignVCenter |
201 | 101 | anchors.left: tempCurrent.right | 107 | anchors.horizontalCenter: parent.horizontalCenter |
202 | 102 | 108 | anchors.horizontalCenterOffset: (showMaxTemp) ? 0 : -units.gu(4) | |
203 | 103 | Label { | 109 | anchors.verticalCenter: parent.verticalCenter |
204 | 104 | text: i18n.tr("Min.") | 110 | font.pointSize: 52 |
205 | 105 | horizontalAlignment: Text.AlignHCenter | 111 | horizontalAlignment: Text.AlignHCenter |
206 | 106 | anchors.horizontalCenter: parent.horizontalCenter | 112 | color: Theme.palette.normal.baseText |
207 | 107 | font.pixelSize: FontUtils.sizeToPixels("small") | 113 | } |
208 | 108 | color: Theme.palette.normal.baseText | 114 | |
209 | 109 | } | 115 | Column { |
210 | 110 | 116 | id: column22 | |
211 | 111 | Label { | 117 | width: units.gu(5) |
212 | 112 | id: tempMin | 118 | height: units.gu(5) |
213 | 113 | text: minTemp+"°"+currentWeather.scale | 119 | anchors.leftMargin: (showMaxTemp) ? units.gu(2) : units.gu(4) |
214 | 114 | horizontalAlignment: Text.AlignHCenter | 120 | anchors.verticalCenter: parent.verticalCenter |
215 | 115 | anchors.horizontalCenter: parent.horizontalCenter | 121 | anchors.left: tempCurrent2.right |
216 | 116 | font.pixelSize: FontUtils.sizeToPixels("large") | 122 | |
217 | 117 | color: Theme.palette.normal.baseText | 123 | Label { |
218 | 118 | } | 124 | text: i18n.tr("Min.") |
219 | 119 | } | 125 | horizontalAlignment: Text.AlignHCenter |
220 | 120 | } | 126 | anchors.horizontalCenter: parent.horizontalCenter |
221 | 121 | } | 127 | font.pixelSize: FontUtils.sizeToPixels("small") |
222 | 128 | color: Theme.palette.normal.baseText | ||
223 | 129 | } | ||
224 | 130 | |||
225 | 131 | Label { | ||
226 | 132 | id: tempMin2 | ||
227 | 133 | text: minTemp+"°"+currentWeather.tempScale | ||
228 | 134 | horizontalAlignment: Text.AlignHCenter | ||
229 | 135 | anchors.horizontalCenter: parent.horizontalCenter | ||
230 | 136 | font.pixelSize: FontUtils.sizeToPixels("large") | ||
231 | 137 | color: Theme.palette.normal.baseText | ||
232 | 138 | } | ||
233 | 139 | } | ||
234 | 140 | } | ||
235 | 141 | |||
236 | 142 | Column { | ||
237 | 143 | id: windColumn | ||
238 | 144 | anchors.left: currentCondition2.right | ||
239 | 145 | anchors.leftMargin: units.gu(3) | ||
240 | 146 | height: childrenRect.height | ||
241 | 147 | width: childrenRect.width | ||
242 | 148 | |||
243 | 149 | Label { | ||
244 | 150 | id: windLabel | ||
245 | 151 | text: i18n.tr("Wind") | ||
246 | 152 | horizontalAlignment: Text.AlignLeft | ||
247 | 153 | font.pixelSize: FontUtils.sizeToPixels("small") | ||
248 | 154 | color: Theme.palette.normal.baseText | ||
249 | 155 | } | ||
250 | 156 | Label { | ||
251 | 157 | id: windValue | ||
252 | 158 | text: currentWeather.windSpeed+" "+currentWeather.speedScale+" "+currentWeather.windDir | ||
253 | 159 | horizontalAlignment: Text.AlignLeft | ||
254 | 160 | font.pixelSize: FontUtils.sizeToPixels("large") | ||
255 | 161 | color: Theme.palette.normal.baseText | ||
256 | 162 | } | ||
257 | 163 | } | ||
258 | 164 | |||
259 | 165 | Column { | ||
260 | 166 | id: humidityColumn | ||
261 | 167 | anchors.left: currentCondition2.right | ||
262 | 168 | anchors.leftMargin: units.gu(3) | ||
263 | 169 | anchors.top: windColumn.bottom | ||
264 | 170 | anchors.topMargin: units.gu(2) | ||
265 | 171 | height: childrenRect.height | ||
266 | 172 | width: childrenRect.width | ||
267 | 173 | |||
268 | 174 | Label { | ||
269 | 175 | id: humidityLabel | ||
270 | 176 | text: i18n.tr("Humidity") | ||
271 | 177 | horizontalAlignment: Text.AlignLeft | ||
272 | 178 | font.pixelSize: FontUtils.sizeToPixels("small") | ||
273 | 179 | color: Theme.palette.normal.baseText | ||
274 | 180 | } | ||
275 | 181 | Label { | ||
276 | 182 | id: humidityValue | ||
277 | 183 | text: currentWeather.humidity+"%" | ||
278 | 184 | horizontalAlignment: Text.AlignLeft | ||
279 | 185 | font.pixelSize: FontUtils.sizeToPixels("large") | ||
280 | 186 | color: Theme.palette.normal.baseText | ||
281 | 187 | } | ||
282 | 188 | } | ||
283 | 189 | |||
284 | 190 | Column { | ||
285 | 191 | id: precipitationColumn | ||
286 | 192 | anchors.left: currentCondition2.right | ||
287 | 193 | anchors.leftMargin: units.gu(3) | ||
288 | 194 | anchors.top: humidityColumn.bottom | ||
289 | 195 | anchors.topMargin: units.gu(2) | ||
290 | 196 | height: childrenRect.height | ||
291 | 197 | width: childrenRect.width | ||
292 | 198 | |||
293 | 199 | Label { | ||
294 | 200 | id: precipitationLabel | ||
295 | 201 | text: i18n.tr("Precipitation") | ||
296 | 202 | horizontalAlignment: Text.AlignLeft | ||
297 | 203 | font.pixelSize: FontUtils.sizeToPixels("small") | ||
298 | 204 | color: Theme.palette.normal.baseText | ||
299 | 205 | } | ||
300 | 206 | Label { | ||
301 | 207 | id: precipitationValue | ||
302 | 208 | text: currentWeather.precipitation.toFixed(1)+" "+currentWeather.precipScale | ||
303 | 209 | horizontalAlignment: Text.AlignLeft | ||
304 | 210 | font.pixelSize: FontUtils.sizeToPixels("large") | ||
305 | 211 | color: Theme.palette.normal.baseText | ||
306 | 212 | } | ||
307 | 213 | } | ||
308 | 214 | } | ||
309 | 215 | |||
310 | 216 | front: | ||
311 | 217 | Rectangle { | ||
312 | 218 | anchors.fill: parent | ||
313 | 219 | color: "transparent" | ||
314 | 220 | |||
315 | 221 | Components.WeatherConditionIconComponent { | ||
316 | 222 | id: currentCondition | ||
317 | 223 | width: units.gu(30) | ||
318 | 224 | height: units.gu(30) | ||
319 | 225 | anchors.horizontalCenter: parent.horizontalCenter | ||
320 | 226 | condition: currentWeather.icon | ||
321 | 227 | |||
322 | 228 | NumberAnimation on opacity { | ||
323 | 229 | id: createAnimation | ||
324 | 230 | easing.type: Easing.Linear | ||
325 | 231 | from: 0 | ||
326 | 232 | to: 1 | ||
327 | 233 | duration: 1000 | ||
328 | 234 | } | ||
329 | 235 | |||
330 | 236 | Component.onCompleted: { | ||
331 | 237 | createAnimation.start() | ||
332 | 238 | } | ||
333 | 239 | } | ||
334 | 240 | |||
335 | 241 | Rectangle { | ||
336 | 242 | id: rectangle1 | ||
337 | 243 | width: units.gu(50) | ||
338 | 244 | height: units.gu(10) | ||
339 | 245 | anchors.horizontalCenter: parent.horizontalCenter | ||
340 | 246 | anchors.top: currentCondition.bottom | ||
341 | 247 | anchors.topMargin: 0 | ||
342 | 248 | color: "transparent" | ||
343 | 249 | |||
344 | 250 | Column { | ||
345 | 251 | id: column1 | ||
346 | 252 | width: units.gu(5) | ||
347 | 253 | height: units.gu(5) | ||
348 | 254 | anchors.rightMargin: units.gu(2) | ||
349 | 255 | anchors.verticalCenter: parent.verticalCenter | ||
350 | 256 | anchors.right: tempCurrent.left | ||
351 | 257 | visible: showMaxTemp | ||
352 | 258 | |||
353 | 259 | Label { | ||
354 | 260 | text: i18n.tr("Max.") | ||
355 | 261 | anchors.horizontalCenter: parent.horizontalCenter | ||
356 | 262 | font.pixelSize: FontUtils.sizeToPixels("small") | ||
357 | 263 | horizontalAlignment: Text.AlignHCenter | ||
358 | 264 | } | ||
359 | 265 | |||
360 | 266 | Label { | ||
361 | 267 | id: tempMax | ||
362 | 268 | text: maxTemp+"°"+currentWeather.tempScale | ||
363 | 269 | anchors.horizontalCenter: parent.horizontalCenter | ||
364 | 270 | font.pixelSize: FontUtils.sizeToPixels("large") | ||
365 | 271 | horizontalAlignment: Text.AlignHCenter | ||
366 | 272 | color: Theme.palette.normal.baseText | ||
367 | 273 | } | ||
368 | 274 | } | ||
369 | 275 | |||
370 | 276 | Text { | ||
371 | 277 | width: units.gu(17) | ||
372 | 278 | height: units.gu(10) | ||
373 | 279 | id: tempCurrent | ||
374 | 280 | objectName: "CurrentTempText" | ||
375 | 281 | text: currentTemp+String("°")+currentWeather.tempScale | ||
376 | 282 | style: Text.Normal | ||
377 | 283 | font.bold: false | ||
378 | 284 | font.family: "Ubuntu" | ||
379 | 285 | verticalAlignment: Text.AlignVCenter | ||
380 | 286 | anchors.horizontalCenter: parent.horizontalCenter | ||
381 | 287 | anchors.horizontalCenterOffset: (showMaxTemp) ? 0 : -units.gu(4) | ||
382 | 288 | anchors.verticalCenter: parent.verticalCenter | ||
383 | 289 | font.pointSize: 52 | ||
384 | 290 | horizontalAlignment: Text.AlignHCenter | ||
385 | 291 | color: Theme.palette.normal.baseText | ||
386 | 292 | } | ||
387 | 293 | |||
388 | 294 | Column { | ||
389 | 295 | id: column2 | ||
390 | 296 | width: units.gu(5) | ||
391 | 297 | height: units.gu(5) | ||
392 | 298 | anchors.leftMargin: (showMaxTemp) ? units.gu(2) : units.gu(4) | ||
393 | 299 | anchors.verticalCenter: parent.verticalCenter | ||
394 | 300 | anchors.left: tempCurrent.right | ||
395 | 301 | |||
396 | 302 | Label { | ||
397 | 303 | text: i18n.tr("Min.") | ||
398 | 304 | horizontalAlignment: Text.AlignHCenter | ||
399 | 305 | anchors.horizontalCenter: parent.horizontalCenter | ||
400 | 306 | font.pixelSize: FontUtils.sizeToPixels("small") | ||
401 | 307 | color: Theme.palette.normal.baseText | ||
402 | 308 | } | ||
403 | 309 | |||
404 | 310 | Label { | ||
405 | 311 | id: tempMin | ||
406 | 312 | text: minTemp+"°"+currentWeather.tempScale | ||
407 | 313 | horizontalAlignment: Text.AlignHCenter | ||
408 | 314 | anchors.horizontalCenter: parent.horizontalCenter | ||
409 | 315 | font.pixelSize: FontUtils.sizeToPixels("large") | ||
410 | 316 | color: Theme.palette.normal.baseText | ||
411 | 317 | } | ||
412 | 318 | } | ||
413 | 319 | } | ||
414 | 320 | } | ||
415 | 321 | |||
416 | 322 | transform: Rotation { | ||
417 | 323 | id: rotation | ||
418 | 324 | origin.x: flipable.width/2 | ||
419 | 325 | origin.y: flipable.height/2 | ||
420 | 326 | axis.x: 0; axis.y: 1; axis.z: 0 // set axis.y to 1 to rotate around y-axis | ||
421 | 327 | angle: 0 // the default angle | ||
422 | 328 | } | ||
423 | 329 | |||
424 | 330 | states: State { | ||
425 | 331 | name: "back" | ||
426 | 332 | PropertyChanges { target: rotation; angle: 180 } | ||
427 | 333 | when: flipable.flipped | ||
428 | 334 | } | ||
429 | 335 | |||
430 | 336 | transitions: Transition { | ||
431 | 337 | NumberAnimation { target: rotation; property: "angle"; duration: 500 } | ||
432 | 338 | } | ||
433 | 339 | } | ||
434 | 340 | } | ||
435 | 341 | |||
436 | 122 | 342 | ||
437 | === modified file 'components/LocationTab.qml' | |||
438 | --- components/LocationTab.qml 2013-07-27 16:02:29 +0000 | |||
439 | +++ components/LocationTab.qml 2013-08-05 18:56:25 +0000 | |||
440 | @@ -51,6 +51,27 @@ | |||
441 | 51 | 51 | ||
442 | 52 | // set daily forecasts | 52 | // set daily forecasts |
443 | 53 | for(var x=0;x<dailyLength;x++) { | 53 | for(var x=0;x<dailyLength;x++) { |
444 | 54 | var direction = "?"; | ||
445 | 55 | var degrees = dailyForecasts[x].windDeg; | ||
446 | 56 | if(degrees >=0 && degrees <= 30){ | ||
447 | 57 | direction = "N"; | ||
448 | 58 | } else if(degrees >30 && degrees <= 60){ | ||
449 | 59 | direction = "NE"; | ||
450 | 60 | } else if(degrees >60 && degrees <= 120){ | ||
451 | 61 | direction = "E"; | ||
452 | 62 | } else if(degrees >120 && degrees <= 150){ | ||
453 | 63 | direction = "SE"; | ||
454 | 64 | } else if(degrees >150 && degrees <= 210){ | ||
455 | 65 | direction = "S"; | ||
456 | 66 | } else if(degrees >210 && degrees <= 240){ | ||
457 | 67 | direction = "SW"; | ||
458 | 68 | } else if(degrees >240 && degrees <= 300){ | ||
459 | 69 | direction = "W"; | ||
460 | 70 | } else if(degrees >300 && degrees <= 330){ | ||
461 | 71 | direction = "NW"; | ||
462 | 72 | }else if(degrees >330 && degrees <= 360){ | ||
463 | 73 | direction = "N"; | ||
464 | 74 | } | ||
465 | 54 | dayForecastModel.append({ | 75 | dayForecastModel.append({ |
466 | 55 | dateRel: "",//Tomorrow", | 76 | dateRel: "",//Tomorrow", |
467 | 56 | date: formatTimestamp(dailyForecasts[x].timestamp, 'dddd, dd MMMM yyyy'), | 77 | date: formatTimestamp(dailyForecasts[x].timestamp, 'dddd, dd MMMM yyyy'), |
468 | @@ -60,7 +81,11 @@ | |||
469 | 60 | tempMax: (dailyForecasts[x]["current"] !== undefined) ? dailyForecasts[x][units].tempMax : | 81 | tempMax: (dailyForecasts[x]["current"] !== undefined) ? dailyForecasts[x][units].tempMax : |
470 | 61 | null, | 82 | null, |
471 | 62 | cond: dailyForecasts[x].condition.id, | 83 | cond: dailyForecasts[x].condition.id, |
473 | 63 | condIcon: dailyForecasts[x].condition.icon | 84 | condIcon: dailyForecasts[x].condition.icon, |
474 | 85 | wind_speed: dailyForecasts[x][units].windSpeed, | ||
475 | 86 | wind_dir: direction, | ||
476 | 87 | humid: dailyForecasts[x].humidity, | ||
477 | 88 | precip: (dailyForecasts[x][units].rain !== null && dailyForecasts[x][units].rain !== undefined) ? dailyForecasts[x][units].rain : 0 | ||
478 | 64 | }); | 89 | }); |
479 | 65 | } | 90 | } |
480 | 66 | } | 91 | } |
481 | @@ -111,6 +136,10 @@ | |||
482 | 111 | maxTemp: tempMax | 136 | maxTemp: tempMax |
483 | 112 | icon: condIcon | 137 | icon: condIcon |
484 | 113 | condition: cond | 138 | condition: cond |
485 | 139 | windSpeed: wind_speed | ||
486 | 140 | windDir: wind_dir | ||
487 | 141 | humidity: humid | ||
488 | 142 | precipitation: precip | ||
489 | 114 | anchors.top: dateComponent.bottom | 143 | anchors.top: dateComponent.bottom |
490 | 115 | showMaxTemp: (index === 0) | 144 | showMaxTemp: (index === 0) |
491 | 116 | } | 145 | } |
492 | 117 | 146 | ||
493 | === modified file 'components/SettingsSheet.qml' | |||
494 | --- components/SettingsSheet.qml 2013-07-23 21:20:11 +0000 | |||
495 | +++ components/SettingsSheet.qml 2013-08-05 18:56:25 +0000 | |||
496 | @@ -31,8 +31,8 @@ | |||
497 | 31 | container: ListItem.ValueSelector { | 31 | container: ListItem.ValueSelector { |
498 | 32 | id: unitsSelector | 32 | id: unitsSelector |
499 | 33 | objectName: "UnitsSelector" | 33 | objectName: "UnitsSelector" |
502 | 34 | text: i18n.tr("Temperature unit") | 34 | text: i18n.tr("Units") |
503 | 35 | values: [i18n.tr("°C"), i18n.tr("°F")] | 35 | values: [i18n.tr("Metric"), i18n.tr("Imperial")] |
504 | 36 | selectedIndex: (settings["units"] === "imperial") ? 1 : 0; | 36 | selectedIndex: (settings["units"] === "imperial") ? 1 : 0; |
505 | 37 | } | 37 | } |
506 | 38 | 38 | ||
507 | 39 | 39 | ||
508 | === modified file 'components/WeatherApi.js' | |||
509 | --- components/WeatherApi.js 2013-07-27 16:01:13 +0000 | |||
510 | +++ components/WeatherApi.js 2013-08-05 18:56:25 +0000 | |||
511 | @@ -3,7 +3,7 @@ | |||
512 | 3 | * Version of the response data format. | 3 | * Version of the response data format. |
513 | 4 | * Increase this number to force a refresh. | 4 | * Increase this number to force a refresh. |
514 | 5 | */ | 5 | */ |
516 | 6 | var RESPONSE_DATA_VERSION = 20130727; | 6 | var RESPONSE_DATA_VERSION = 20130801; |
517 | 7 | 7 | ||
518 | 8 | /** | 8 | /** |
519 | 9 | * Helper functions | 9 | * Helper functions |
520 | @@ -11,8 +11,14 @@ | |||
521 | 11 | function calcFahrenheit(celsius) { | 11 | function calcFahrenheit(celsius) { |
522 | 12 | return celsius * 1.8 + 32; | 12 | return celsius * 1.8 + 32; |
523 | 13 | } | 13 | } |
526 | 14 | function calcMph(kmh) { | 14 | function calcMph(ms) { |
527 | 15 | return kmh*0.62137; | 15 | return ms*2.24; |
528 | 16 | } | ||
529 | 17 | function calcInch(mm) { | ||
530 | 18 | return mm/25.4; | ||
531 | 19 | } | ||
532 | 20 | function calcKmh(ms) { | ||
533 | 21 | return ms*3.6; | ||
534 | 16 | } | 22 | } |
535 | 17 | 23 | ||
536 | 18 | var OpenWeatherMapApi = (function() { | 24 | var OpenWeatherMapApi = (function() { |
537 | @@ -42,13 +48,11 @@ | |||
538 | 42 | var result = { | 48 | var result = { |
539 | 43 | timestamp: data.dt, | 49 | timestamp: data.dt, |
540 | 44 | date: Qt.formatDateTime(new Date(data.dt*1000), "yyyy-MM-dd hh:mm"), | 50 | date: Qt.formatDateTime(new Date(data.dt*1000), "yyyy-MM-dd hh:mm"), |
543 | 45 | metric: { temp:data.main.temp }, | 51 | metric: { temp:data.main.temp, windSpeed: calcKmh(data.main.speed), rain: data.main.rain}, |
544 | 46 | imperial: { temp: calcFahrenheit(data.main.temp) }, | 52 | imperial: { temp: calcFahrenheit(data.main.temp), windSpeed: calcMph(data.main.speed), rain: calcInch(data.main.rain)}, |
545 | 47 | humidity: data.main.humidity, | 53 | humidity: data.main.humidity, |
546 | 48 | pressure: data.main.pressure, | 54 | pressure: data.main.pressure, |
550 | 49 | wind_speed_kmh: data.wind.speed, | 55 | windDeg: data.main.deg, |
548 | 50 | wind_speed_mph: calcMph(data.wind.speed), | ||
549 | 51 | wind_deg: data.wind.deg, | ||
551 | 52 | condition: data.weather[0] | 56 | condition: data.weather[0] |
552 | 53 | }; | 57 | }; |
553 | 54 | if(data.id !== undefined) { | 58 | if(data.id !== undefined) { |
554 | @@ -64,17 +68,20 @@ | |||
555 | 64 | timestamp: data.dt, | 68 | timestamp: data.dt, |
556 | 65 | metric: { | 69 | metric: { |
557 | 66 | tempMin: data.temp.min, | 70 | tempMin: data.temp.min, |
559 | 67 | tempMax: data.temp.max | 71 | tempMax: data.temp.max, |
560 | 72 | windSpeed: calcKmh(data.speed), | ||
561 | 73 | rain: data.rain | ||
562 | 68 | }, | 74 | }, |
563 | 69 | imperial: { | 75 | imperial: { |
564 | 70 | tempMin: calcFahrenheit(data.temp.min), | 76 | tempMin: calcFahrenheit(data.temp.min), |
566 | 71 | tempMax: calcFahrenheit(data.temp.max) | 77 | tempMax: calcFahrenheit(data.temp.max), |
567 | 78 | windSpeed: calcMph(data.speed), | ||
568 | 79 | rain: calcInch(data.rain) | ||
569 | 72 | }, | 80 | }, |
570 | 73 | pressure: data.pressure, | 81 | pressure: data.pressure, |
571 | 74 | humidity: data.humidity, | 82 | humidity: data.humidity, |
572 | 75 | condition: data.weather[0], | 83 | condition: data.weather[0], |
575 | 76 | wind_speed: data.speed, | 84 | windDeg: data.deg, |
574 | 77 | wind_deg: data.deg, | ||
576 | 78 | hourly: [] | 85 | hourly: [] |
577 | 79 | } | 86 | } |
578 | 80 | return result; | 87 | return result; |
PASSED: Continuous integration, rev:84 91.189. 93.70:8080/ job/ubuntu- weather- app-ci/ 27/ 91.189. 93.70:8080/ job/ubuntu- weather- app-precise- amd64-ci/ 19 91.189. 93.70:8080/ job/ubuntu- weather- app-quantal- amd64-ci/ 26 91.189. 93.70:8080/ job/ubuntu- weather- app-raring- amd64-ci/ 26 91.189. 93.70:8080/ job/ubuntu- weather- app-saucy- amd64-ci/ 19
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- weather- app-ci/ 27/rebuild
http://