Merge lp:~dpm/ubuntu-weather-app/fix-nexus7 into lp:ubuntu-weather-app/obsolete.trunk

Proposed by David Planella
Status: Merged
Approved by: Martin Borho
Approved revision: 201
Merged at revision: 205
Proposed branch: lp:~dpm/ubuntu-weather-app/fix-nexus7
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 529 lines (+264/-119)
6 files modified
CMakeLists.txt (+4/-3)
com.ubuntu.weather_weather.desktop.in.in (+0/-1)
components/CurrentWeather.qml (+14/-6)
components/CurrentWeatherFront.qml (+5/-1)
components/WeatherConditionIconComponent.qml (+4/-2)
components/WeatherTemperatureComponent.qml (+237/-106)
To merge this branch: bzr merge lp:~dpm/ubuntu-weather-app/fix-nexus7
Reviewer Review Type Date Requested Status
Martin Borho Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+207325@code.launchpad.net

Commit message

Removes SideStage hint, fixes related to the sizes of the current weather data display on tablets

Description of the change

This branch includes 3 fixes:

- Raúl Yeguas' work to resize the UbuntuShapes on the current weather view to fit on a Nexus 7
- Removal of the sidestage hint on the desktop file so that Weather loads in tablet mode on the N7 and N10
- Enables a semi-tablet mode for N7, where the current weather boxes work in phone mode

This can be tested directly from this click package: http://people.canonical.com/~dpm/click/com.ubuntu.weather_1.0.201_all.click

On a Nexus 10:
http://ubuntuone.com/46IatexM4cnTub78iHfDAn

On a Nexus 7:
http://ubuntuone.com/5cqF5SY2qEPgVV32JUJLh5

Known issues:
- Current weather boxes not vertically centered on the N7
- Weather data provider toolbar is a bit off on the N7
- Sometimes the H temperature is not shown (see N10 screenshot above)
- Discovered a crash [1] on the N7. It might need a wipe of the DB to reproduce it

[1] http://paste.ubuntu.com/6962965/

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 :

Great work!

review: Approve
Revision history for this message
Martin Borho (martin-borho) wrote :

 \o/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-02-18 21:26:36 +0000
3+++ CMakeLists.txt 2014-02-19 23:50:23 +0000
4@@ -12,7 +12,7 @@
5 set(URLS_FILE "${PROJECT_NAME}_${APP_NAME}.url-dispatcher")
6 set(APP_HARDCODE ubuntu-weather-app)
7 set(MAIN_QML ubuntu-weather-app.qml)
8-set(ICON weather-app@30.png)
9+set(ICON_FILE weather-app@30.png)
10 set(AUTOPILOT_DIR ubuntu_weather_app)
11
12 if(CLICK_MODE)
13@@ -23,13 +23,14 @@
14 set(CMAKE_INSTALL_PREFIX /)
15 set(CMAKE_INSTALL_BINDIR /)
16 set(DATA_DIR /)
17+ set(ICON ${ICON_FILE})
18 set(EXEC "qmlscene ${MAIN_QML}")
19 set(DESKTOP_DIR ${DATA_DIR})
20 set(URLS_DIR ${DATA_DIR})
21 else(CLICK_MODE)
22 set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_HARDCODE})
23 set(EXEC ${APP_HARDCODE})
24- set(ICON ${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/${ICON})
25+ set(ICON ${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/${ICON_FILE})
26 configure_file(${APP_HARDCODE}.in
27 ${CMAKE_CURRENT_BINARY_DIR}/${APP_HARDCODE})
28 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${APP_HARDCODE}
29@@ -48,7 +49,7 @@
30 *.qml *.js *.png *.js)
31 install(DIRECTORY components resources DESTINATION ${DATA_DIR})
32 install(FILES key.js DESTINATION ${DATA_DIR})
33-install(FILES ${MAIN_QML} DESTINATION ${DATA_DIR})
34+install(FILES ${MAIN_QML} ${ICON_FILE} DESTINATION ${DATA_DIR})
35
36 configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in @ONLY)
37 file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE})
38
39=== modified file 'com.ubuntu.weather_weather.desktop.in.in'
40--- com.ubuntu.weather_weather.desktop.in.in 2014-02-14 09:04:01 +0000
41+++ com.ubuntu.weather_weather.desktop.in.in 2014-02-19 23:50:23 +0000
42@@ -6,5 +6,4 @@
43 Icon=@ICON@
44 Name=tr("Weather")
45 X-Ubuntu-Touch=true
46-X-Ubuntu-StageHint=SideStage
47 X-Ubuntu-Gettext-Domain=@PROJECT_NAME@
48
49=== modified file 'components/CurrentWeather.qml'
50--- components/CurrentWeather.qml 2014-02-18 17:55:17 +0000
51+++ components/CurrentWeather.qml 2014-02-19 23:50:23 +0000
52@@ -43,6 +43,13 @@
53 property string tempScale: (mainView.settings["units"] === "imperial") ? "F" : "C"
54 property string speedScale: (mainView.settings["wind_units"] === "mph") ? "mph" : "km/h"
55 property string precipScale: (mainView.settings["precip_units"] === "in") ? "in" : "mm"
56+ // Note that this should actually be a phone width, but since
57+ // the tablet layout is not yet working well on a N7, we
58+ // set the width to trigger this layout to be higher than that
59+ // of a N7, so that on that device it will still be in phone
60+ // mode
61+ // Nexus 7's width is 1920px/21px/GU = 91.43 GU
62+ property real wideModeThreshold: units.gu(95)
63
64 property NumberAnimation appearAnimation: frontrect.conditionIcon.appearAnimation
65
66@@ -85,13 +92,13 @@
67 layouts: [
68 ConditionalLayout {
69 name: "WeatherItem"
70- when: layouts.width > units.gu(80)
71+ when: layouts.width > wideModeThreshold
72 Rectangle {
73 color: "transparent"
74 anchors.fill: parent
75 CurrentWeatherFront {
76 id: frontrect
77- shapeSize: units.gu(18)
78+ viewMode: 1
79 anchors {
80 horizontalCenter: parent.horizontalCenter
81 verticalCenter: parent.verticalCenter
82@@ -104,9 +111,9 @@
83 shapeSize: units.gu(14)
84 gridColumns: 4
85 anchors {
86+ top: frontrect.bottom
87+ topMargin: units.gu(7)
88 horizontalCenter: parent.horizontalCenter
89- verticalCenter: parent.verticalCenter
90- verticalCenterOffset: (parent.height*0.2);
91 }
92 }
93 Components.ScrollingArea {}
94@@ -133,16 +140,17 @@
95 id: frontrect
96 anchors.fill: parent
97 Layouts.item: "front"
98+ viewMode: 0
99 }
100
101 states:[
102 State {
103 name: "back"
104- when: flipable.flipped && layouts.width < units.gu(80)
105+ when: flipable.flipped && layouts.width < wideModeThreshold
106 },
107 State {
108 name: "front"
109- when: !flipable.flipped && layouts.width < units.gu(80)
110+ when: !flipable.flipped && layouts.width < wideModeThreshold
111 }
112 ]
113
114
115=== modified file 'components/CurrentWeatherFront.qml'
116--- components/CurrentWeatherFront.qml 2014-02-15 16:04:16 +0000
117+++ components/CurrentWeatherFront.qml 2014-02-19 23:50:23 +0000
118@@ -29,7 +29,8 @@
119 property alias conditionIcon: currentConditionIcon
120 property alias conditionTempContent: currentConditionTempContent
121 property alias conditionTemp: currentConditionTemp
122- property int shapeSize: units.gu(15)
123+ property int shapeSize: (viewMode == 0) ? units.gu(15) : units.gu(28)
124+ property int viewMode // 0: Mobile, 1: Tablet
125
126 UbuntuShape {
127 id: currentCondition
128@@ -49,6 +50,7 @@
129 anchors.centerIn: parent
130 anchors.margins: units.gu(1)
131 condition: currentWeather.icon
132+ viewMode: frontrect.viewMode
133 }
134 }
135
136@@ -71,6 +73,8 @@
137 minTemp: Math.round(currentWeather.minTemp)
138 maxTemp: Math.round(currentWeather.maxTemp)
139 anchors.fill: parent
140+
141+ viewMode: frontrect.viewMode
142 }
143 }
144 }
145
146=== modified file 'components/WeatherConditionIconComponent.qml'
147--- components/WeatherConditionIconComponent.qml 2014-01-28 10:04:42 +0000
148+++ components/WeatherConditionIconComponent.qml 2014-02-19 23:50:23 +0000
149@@ -15,6 +15,8 @@
150 property int totalImage: 50
151 property NumberAnimation appearAnimation : appear
152
153+ property int viewMode // 0: mobile, 1: tablet
154+
155 /* temporary icon map */
156 property var conditionicon: {
157 "clear_day": "02",
158@@ -45,8 +47,8 @@
159 id: icon
160 anchors.centerIn: parent
161 source: "../resources/images/"+conditionicon[condition]+"/"+currentImage+".png"
162- height: units.gu(18)
163- width: units.gu(18)
164+ height: (viewMode == 0) ? units.gu(18) : units.gu(30)
165+ width: (viewMode == 0) ? units.gu(18) : units.gu(30)
166 }
167
168 NumberAnimation {
169
170=== modified file 'components/WeatherTemperatureComponent.qml'
171--- components/WeatherTemperatureComponent.qml 2014-01-22 22:02:58 +0000
172+++ components/WeatherTemperatureComponent.qml 2014-02-19 23:50:23 +0000
173@@ -18,6 +18,7 @@
174 import QtQuick 2.0
175 import QtGraphicalEffects 1.0
176 import Ubuntu.Components 0.1
177+import Ubuntu.Layouts 0.1
178
179 Rectangle {
180 id: tempComponent
181@@ -28,112 +29,242 @@
182 property int maxTemp
183 property int minTemp
184
185- Text {
186- id: value
187- objectName: "CurrentTempText"
188- text: tempComponent.currentTemp
189- color: Theme.palette.normal.baseText
190- style: Text.Raised
191- font.bold: false
192- font.family: "Ubuntu"
193- font.pointSize: units.gu(9) //FontUtils.sizeToPixels("xx-large")
194- font.letterSpacing: -2
195- fontSizeMode: Text.Fit
196- verticalAlignment: Text.AlignTop
197- horizontalAlignment: Text.AlignRight
198- height: units.gu(9)
199- width: units.gu(9)
200- anchors {
201- top: parent.top
202- topMargin: units.gu(1)
203- left: parent.left
204- leftMargin: units.gu(1)
205- }
206- }
207- Text {
208- id: currentTempScale
209- objectName: "CurrentTempScale"
210- text: String("°") + tempComponent.tempScale
211- style: Text.Raised
212- font.bold: false
213- font.family: "Ubuntu"
214- font.pointSize: FontUtils.sizeToPixels("medium")
215- verticalAlignment: Text.AlignTop
216- horizontalAlignment: Text.AlignLeft
217- color: Theme.palette.normal.baseText
218- height: units.gu(9)
219- anchors {
220- top: value.top
221- topMargin: units.gu(0.5)
222- left: value.right
223- }
224- }
225-
226- Rectangle {
227- id: line2
228- color: "#55000000"
229- anchors {
230- top: value.bottom
231- left: parent.left
232- leftMargin: units.gu(2)
233- right: parent.right
234- rightMargin: units.gu(2)
235- }
236- height: 1
237- width: units.gu(10)
238-
239- }
240- Rectangle {
241- color: "#55FFFFFF"
242- anchors {
243- top: line2.bottom
244- bottomMargin: 1
245- left: line2.left
246- right: line2.right
247- }
248- height: 1
249- width: units.gu(10)
250-
251- }
252-
253-
254- Text {
255- id: max
256- // TRANSLATORS: this refers to the High (max) temperature forecasted for a day
257- text: i18n.tr("H:") + " " + tempComponent.maxTemp
258- color: Theme.palette.normal.baseText
259- style: Text.Raised
260- font.bold: false
261- font.family: "Ubuntu"
262- font.pointSize: FontUtils.sizeToPixels("small")
263- verticalAlignment: Text.AlignVCenter
264- horizontalAlignment: Text.AlignHCenter
265- visible:(dailyForecastList.currentIndex === 0 && tempComponent.maxTemp)
266- anchors {
267- bottom: parent.bottom
268- bottomMargin: units.gu(2)
269- left: parent.left
270- leftMargin: units.gu(2)
271- }
272- }
273-
274- Text {
275- id: min
276- // TRANSLATORS: this refers to the Low (min) temperature forecasted for a day
277- text: i18n.tr("L:") + " " + tempComponent.minTemp
278- color: Theme.palette.normal.baseText
279- style: Text.Raised
280- font.bold: false
281- font.family: "Ubuntu"
282- font.pointSize: FontUtils.sizeToPixels("small")
283- fontSizeMode: Text.Fit
284- verticalAlignment: Text.AlignVCenter
285- horizontalAlignment: Text.AlignHCenter
286- anchors {
287- bottom: parent.bottom
288- bottomMargin: units.gu(2)
289- right: parent.right
290- rightMargin: units.gu(2)
291+ property int viewMode // 0: Mobile, 1: Tablet
292+
293+ Layouts {
294+ objectName: "WeatherTemperatureLayout"
295+ id: layoutsCurrentTemp
296+
297+ anchors.fill: parent
298+
299+ /*layouts: [
300+ ConditionalLayout {
301+ name: "WeatherTempItem"
302+ when: layouts.width > units.gu(80)
303+
304+ Text {
305+ id: valueBig
306+ objectName: "CurrentTempText"
307+ text: tempComponent.currentTemp
308+ color: Theme.palette.normal.baseText
309+ style: Text.Raised
310+ font.bold: false
311+ font.family: "Ubuntu"
312+ font.pointSize: units.gu(14)
313+ font.letterSpacing: -2
314+ fontSizeMode: Text.Fit
315+ verticalAlignment: Text.AlignTop
316+ horizontalAlignment: Text.AlignRight
317+ height: units.gu(14)
318+ width: units.gu(14)
319+ anchors {
320+ top: parent.top
321+ topMargin: units.gu(1)
322+ left: parent.left
323+ leftMargin: units.gu(1)
324+ }
325+ }
326+
327+ Text {
328+ id: currentTempScaleBig
329+ objectName: "CurrentTempScale"
330+ text: String("°") + tempComponent.tempScale
331+ style: Text.Raised
332+ font.bold: false
333+ font.family: "Ubuntu"
334+ font.pointSize: FontUtils.sizeToPixels("x-large");
335+ verticalAlignment: Text.AlignTop
336+ horizontalAlignment: Text.AlignLeft
337+ color: Theme.palette.normal.baseText
338+ height: units.gu(9)
339+ anchors {
340+ top: value.top
341+ topMargin: units.gu(0.5)
342+ left: value.right
343+ }
344+ }
345+
346+ Rectangle {
347+ id: line2Big
348+ color: "#55000000"
349+ anchors {
350+ bottom: maxBig.top
351+ bottomMargin: units.gu(1)
352+ left: parent.left
353+ leftMargin: units.gu(2)
354+ right: parent.right
355+ rightMargin: units.gu(2)
356+ }
357+ height: 1
358+ width: units.gu(10)
359+
360+ }
361+ Rectangle {
362+ color: "#55FFFFFF"
363+ anchors {
364+ top: line2Big.bottom
365+ bottomMargin: 1
366+ left: line2Big.left
367+ right: line2Big.right
368+ }
369+ height: 1
370+ width: units.gu(10)
371+
372+ }
373+
374+
375+ Text {
376+ id: maxBig
377+ // TRANSLATORS: this refers to the High (max) temperature forecasted for a day
378+ text: i18n.tr("H:") + " " + tempComponent.maxTemp
379+ color: Theme.palette.normal.baseText
380+ style: Text.Raised
381+ font.bold: false
382+ font.family: "Ubuntu"
383+ font.pointSize: FontUtils.sizeToPixels("large");
384+ verticalAlignment: Text.AlignVCenter
385+ horizontalAlignment: Text.AlignHCenter
386+ visible:(dailyForecastList.currentIndex === 0 && tempComponent.maxTemp)
387+ anchors {
388+ bottom: parent.bottom
389+ bottomMargin: units.gu(2)
390+ left: parent.left
391+ leftMargin: units.gu(2)
392+ }
393+ }
394+
395+ Text {
396+ id: minBig
397+ // TRANSLATORS: this refers to the Low (min) temperature forecasted for a day
398+ text: i18n.tr("L:") + " " + tempComponent.minTemp
399+ color: Theme.palette.normal.baseText
400+ style: Text.Raised
401+ font.bold: false
402+ font.family: "Ubuntu"
403+ font.pointSize: FontUtils.sizeToPixels("large");
404+ fontSizeMode: Text.Fit
405+ verticalAlignment: Text.AlignVCenter
406+ horizontalAlignment: Text.AlignHCenter
407+ anchors {
408+ bottom: parent.bottom
409+ bottomMargin: units.gu(2)
410+ right: parent.right
411+ rightMargin: units.gu(2)
412+ }
413+ }
414+ }
415+
416+ ]*/
417+
418+
419+ Text {
420+ id: value
421+ objectName: "CurrentTempText"
422+ text: tempComponent.currentTemp
423+ color: Theme.palette.normal.baseText
424+ style: Text.Raised
425+ font.bold: false
426+ font.family: "Ubuntu"
427+ font.pointSize: (viewMode == 0) ? units.gu(9) : units.gu(18) //FontUtils.sizeToPixels("xx-large")
428+ font.letterSpacing: -2
429+ fontSizeMode: Text.Fit
430+ verticalAlignment: Text.AlignTop
431+ horizontalAlignment: Text.AlignRight
432+ height: (viewMode == 0) ? units.gu(9) : units.gu(18)
433+ width: (viewMode == 0) ? units.gu(9) : units.gu(18)
434+ anchors {
435+ top: parent.top
436+ topMargin: units.gu(1)
437+ left: parent.left
438+ leftMargin: units.gu(1)
439+ }
440+ }
441+ Text {
442+ id: currentTempScale
443+ objectName: "CurrentTempScale"
444+ text: String("°") + tempComponent.tempScale
445+ style: Text.Raised
446+ font.bold: false
447+ font.family: "Ubuntu"
448+ font.pointSize: (viewMode == 0) ? FontUtils.sizeToPixels("medium") : FontUtils.sizeToPixels("x-large")
449+ verticalAlignment: Text.AlignTop
450+ horizontalAlignment: Text.AlignLeft
451+ color: Theme.palette.normal.baseText
452+ height: units.gu(9)
453+ anchors {
454+ top: value.top
455+ topMargin: units.gu(0.5)
456+ left: value.right
457+ }
458+ }
459+
460+ Rectangle {
461+ id: line2
462+ color: "#55000000"
463+ anchors {
464+ bottom: max.top
465+ bottomMargin: (viewMode == 0) ? 0 : units.gu(1)
466+ left: parent.left
467+ leftMargin: units.gu(2)
468+ right: parent.right
469+ rightMargin: units.gu(2)
470+ }
471+ height: 1
472+ width: units.gu(10)
473+
474+ }
475+ Rectangle {
476+ color: "#55FFFFFF"
477+ anchors {
478+ top: line2.bottom
479+ bottomMargin: 1
480+ left: line2.left
481+ right: line2.right
482+ }
483+ height: 1
484+ width: units.gu(10)
485+
486+ }
487+
488+
489+ Text {
490+ id: max
491+ // TRANSLATORS: this refers to the High (max) temperature forecasted for a day
492+ text: i18n.tr("H:") + " " + tempComponent.maxTemp
493+ color: Theme.palette.normal.baseText
494+ style: Text.Raised
495+ font.bold: false
496+ font.family: "Ubuntu"
497+ font.pointSize: (viewMode == 0) ? FontUtils.sizeToPixels("small") : FontUtils.sizeToPixels("large")
498+ verticalAlignment: Text.AlignVCenter
499+ horizontalAlignment: Text.AlignHCenter
500+ visible:(dailyForecastList.currentIndex === 0 && tempComponent.maxTemp)
501+ anchors {
502+ bottom: parent.bottom
503+ bottomMargin: units.gu(2)
504+ left: parent.left
505+ leftMargin: units.gu(2)
506+ }
507+ }
508+
509+ Text {
510+ id: min
511+ // TRANSLATORS: this refers to the Low (min) temperature forecasted for a day
512+ text: i18n.tr("L:") + " " + tempComponent.minTemp
513+ color: Theme.palette.normal.baseText
514+ style: Text.Raised
515+ font.bold: false
516+ font.family: "Ubuntu"
517+ font.pointSize: (viewMode == 0) ? FontUtils.sizeToPixels("small") : FontUtils.sizeToPixels("large")
518+ fontSizeMode: Text.Fit
519+ verticalAlignment: Text.AlignVCenter
520+ horizontalAlignment: Text.AlignHCenter
521+ anchors {
522+ bottom: parent.bottom
523+ bottomMargin: units.gu(2)
524+ right: parent.right
525+ rightMargin: units.gu(2)
526+ }
527 }
528 }
529 }

Subscribers

People subscribed via source and target branches