Merge lp:~dpm/ubuntu-weather-app/n7-tweaks into lp:ubuntu-weather-app/obsolete.trunk

Proposed by David Planella
Status: Merged
Approved by: David Planella
Approved revision: 218
Merged at revision: 207
Proposed branch: lp:~dpm/ubuntu-weather-app/n7-tweaks
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 425 lines (+198/-192)
3 files modified
components/CurrentWeather.qml (+3/-2)
components/LocationTab.qml (+193/-188)
ubuntu-weather-app.qml (+2/-2)
To merge this branch: bzr merge lp:~dpm/ubuntu-weather-app/n7-tweaks
Reviewer Review Type Date Requested Status
Martin Borho Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+207616@code.launchpad.net

Commit message

Fixes the shorter length header on the N7 using anchors instead of widths.

Description of the change

Fixes the shorter length header on the N7 using anchors instead of widths. Got some advice from zsombi from the SDK team: it's not safe to use the mainview width, which might be changed before it reaches the footer's calculation.

Thus we use the parent page's anchors, which occupies the main view.

The diff is long because it fixes indentation, but essentially the changes are:

http://pastebin.ubuntu.com/6970159/

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)
lp:~dpm/ubuntu-weather-app/n7-tweaks updated
217. By David Planella

Remove unneded print statements and discard .desktop file

218. By David Planella

Remove unneded print statements for real

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 :

Looks good on n4 and n7 (2012/portrait)

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 2014-02-19 23:35:58 +0000
3+++ components/CurrentWeather.qml 2014-02-21 10:40:13 +0000
4@@ -48,8 +48,9 @@
5 // set the width to trigger this layout to be higher than that
6 // of a N7, so that on that device it will still be in phone
7 // mode
8- // Nexus 7's width is 1920px/21px/GU = 91.43 GU
9- property real wideModeThreshold: units.gu(95)
10+ // Nexus 7's width is 1920px/21px/GU = 91.43 GU (we use 95)
11+ // Nexus 7's width with new GU 1920px/18px/GU = 106.67 GU (we use 110)
12+ property real wideModeThreshold: units.gu(110)
13
14 property NumberAnimation appearAnimation: frontrect.conditionIcon.appearAnimation
15
16
17=== modified file 'components/LocationTab.qml'
18--- components/LocationTab.qml 2014-02-20 09:56:13 +0000
19+++ components/LocationTab.qml 2014-02-21 10:40:13 +0000
20@@ -141,197 +141,202 @@
21 Rectangle {
22 anchors.fill: parent
23 color: "transparent"
24- ItemLayout {
25- item: "ForecastList"
26- width: parent.width*0.625
27- height:parent.height
28- }
29- Rectangle {
30- width: parent.width*0.375
31- height:parent.height
32- anchors.right: parent.right
33- anchors.top: parent.top
34- color: "black"
35- opacity: 0.3
36- }
37- ItemLayout {
38- item: "TabFooter"
39- // We're making the footer to be full-width
40- // so that it looks good on a Nexus 7
41- width: mainView.width // * 0.625
42- height: units.gu(8)
43- anchors.bottom: parent.bottom
44- clip: true
45- }
46- Rectangle {
47- id: sideLabel
48- anchors.top: parent.top
49- anchors.right: parent.right
50- width: parent.width*0.375
51- height: units.gu(6)
52+ ItemLayout {
53+ item: "ForecastList"
54+ width: parent.width*0.625
55+ height:parent.height
56+ }
57+ Rectangle {
58+ width: parent.width*0.375
59+ height:parent.height
60+ anchors.right: parent.right
61+ anchors.top: parent.top
62+ color: "black"
63+ opacity: 0.3
64+ }
65+ ItemLayout {
66+ item: "TabFooter"
67+ // We're making the footer to be full-width
68+ // so that it looks good on a Nexus 7
69+ //width: parent.width // * 0.625
70+ height: units.gu(8)
71+ anchors.bottom: parent.bottom
72+ anchors.left: parent.left
73+ anchors.right: parent.right
74+ clip: true
75+ }
76+ Rectangle {
77+ id: sideLabel
78+ anchors.top: parent.top
79+ anchors.right: parent.right
80+ width: parent.width*0.375
81+ height: units.gu(6)
82+ color: "transparent"
83+ Label {
84+ text: i18n.tr("Forecast")
85+ fontSize: "large"
86+ anchors.left:parent.left
87+ anchors.leftMargin: units.gu(3)
88+ verticalAlignment: Text.AlignVCenter
89+ anchors.top: parent.top;
90+ anchors.bottom: parent.bottom
91+ }
92+ }
93+ ListView {
94+ id: locationDailySide
95+ width: (parent.width*0.375)-units.gu(1)
96+ height: parent.height-sideLabel.height-units.gu(9)
97+ anchors.right: parent.right
98+ anchors.top: sideLabel.bottom
99+ model:dayForecastModel
100+ clip: true
101+ // TODO doubled code, to refactor
102+ property var conditionIcon: {
103+ "clear_day": "02",
104+ "clear_night": "12",
105+ "few_clouds_day": "05",
106+ "few_clouds_night": "04",
107+ "scattered_clouds_day": "05",
108+ "scattered_clouds_night": "04",
109+ "broken_clouds_day": "03",
110+ "broken_clouds_night": "03",
111+ "mostly_cloudy": "03",
112+ "shower_rain_day": "09",
113+ "shower_rain_night": "09",
114+ "rain_day": "09",
115+ "rain_night": "09",
116+ "thunderstorm_day": "13",
117+ "thunderstorm_night": "13",
118+ "snow_day": "14",
119+ "snow_night": "14",
120+ "chance_snow_day": "11",
121+ "chances_now_night": "11",
122+ "snow_shower": "11",
123+ "mist_day": "06",
124+ "mist_night": "06"
125+ }
126+ delegate: ListItem.Subtitled {
127+ subText: "H:"+Math.round(temp)+" L:"+Math.round(tempMin)
128+ text: date
129+ //selected: (dailyForecastList.currentIndex == index)
130+ iconSource: "../resources/images/"+locationDailySide.conditionIcon[dayForecastModel.get(index).condIcon]+".png"
131+ onClicked: { dailyForecastList.currentIndex = index }
132+ }
133+ }
134+ }
135+ }
136+ ]
137+
138+ ListView {
139+ id: dailyForecastList
140+ objectName: "DailyForecastList"
141+ width: parent.width
142+ height:parent.height
143+ model:dayForecastModel
144+ Layouts.item: "ForecastList"
145+ onCurrentIndexChanged: {
146+ if(visible) {
147+ var data = dayForecastModel.get(currentIndex)
148+ adjustBackground(Math.round(data.temp))
149+ dailyForecastList.currentItem.appearAnimation.start()
150+ }
151+ }
152+
153+ interactive: false
154+ snapMode: ListView.SnapOneItem
155+ highlightRangeMode: ListView.StrictlyEnforceRange
156+ verticalLayoutDirection: ListView.TopToBottom
157+ flickableDirection: Flickable.VerticalFlick
158+ clip: true
159+
160+ delegate: Item {
161+ id: dailyForecastItem
162+ width:parent.width
163+ height: locationPage.height
164+
165+ property NumberAnimation appearAnimation: currentWeatherComponent.appearAnimation
166+
167+ signal hideDetail()
168+ signal toggle()
169+
170+ Rectangle {
171+ id: listRectangle
172+ width: parent.width
173+ height: dailyForecastList.height-tabFooter.height
174+ anchors.top: parent.top
175 color: "transparent"
176- Label {
177- text: i18n.tr("Forecast")
178- fontSize: "large"
179- anchors.left:parent.left
180- anchors.leftMargin: units.gu(3)
181- anchors.verticalCenter: parent.verticalCenter
182- }
183- }
184- ListView {
185- id: locationDailySide
186- width: (parent.width*0.375)-units.gu(1)
187- height: parent.height-sideLabel.height-units.gu(9)
188- anchors.right: parent.right
189- anchors.top: sideLabel.bottom
190- model:dayForecastModel
191- clip: true
192- // TODO doubled code, to refactor
193- property var conditionIcon: {
194- "clear_day": "02",
195- "clear_night": "12",
196- "few_clouds_day": "05",
197- "few_clouds_night": "04",
198- "scattered_clouds_day": "05",
199- "scattered_clouds_night": "04",
200- "broken_clouds_day": "03",
201- "broken_clouds_night": "03",
202- "mostly_cloudy": "03",
203- "shower_rain_day": "09",
204- "shower_rain_night": "09",
205- "rain_day": "09",
206- "rain_night": "09",
207- "thunderstorm_day": "13",
208- "thunderstorm_night": "13",
209- "snow_day": "14",
210- "snow_night": "14",
211- "chance_snow_day": "11",
212- "chances_now_night": "11",
213- "snow_shower": "11",
214- "mist_day": "06",
215- "mist_night": "06"
216- }
217- delegate: ListItem.Subtitled {
218- subText: "H:"+Math.round(temp)+" L:"+Math.round(tempMin)
219- text: date
220- //selected: (dailyForecastList.currentIndex == index)
221- iconSource: "../resources/images/"+locationDailySide.conditionIcon[dayForecastModel.get(index).condIcon]+".png"
222- onClicked: { dailyForecastList.currentIndex = index }
223- }
224- }
225- }
226- }
227- ]
228- ListView {
229- id: dailyForecastList
230- objectName: "DailyForecastList"
231- width: parent.width
232- height:parent.height
233- model:dayForecastModel
234- Layouts.item: "ForecastList"
235- onCurrentIndexChanged: {
236- if(visible) {
237- var data = dayForecastModel.get(currentIndex)
238- adjustBackground(Math.round(data.temp))
239- dailyForecastList.currentItem.appearAnimation.start()
240- }
241- }
242-
243- interactive: false
244- snapMode: ListView.SnapOneItem
245- highlightRangeMode: ListView.StrictlyEnforceRange
246- verticalLayoutDirection: ListView.TopToBottom
247- flickableDirection: Flickable.VerticalFlick
248- clip: true
249-
250- delegate: Item {
251- id: dailyForecastItem
252- width:parent.width
253- height: locationPage.height
254-
255- property NumberAnimation appearAnimation: currentWeatherComponent.appearAnimation
256-
257- signal hideDetail()
258- signal toggle()
259-
260+
261+ DateComponent {
262+ id: dateComponent
263+ dateRelative: dateRel
264+ dateString: date
265+ borderTopVisible: false
266+ }
267+ CurrentWeather {
268+ id: currentWeatherComponent
269+ currentTemp: temp
270+ minTemp: tempMin
271+ maxTemp: tempMax
272+ icon: condIcon
273+ windSpeed: wind_speed
274+ windDir: wind_dir
275+ humidity: humid
276+ precipitation: precip
277+ propPrecip: prop_precip
278+ precipType: precip_type
279+ pressure: press
280+ uvIndex: uv
281+ hourly: hours
282+ anchors.top: dateComponent.bottom
283+ showMaxTemp: (index === 0)
284+ }
285+ }
286+ }
287+ LastUpdatedComponent{
288+ id: lastUpdatedComponent
289+ anchors.bottom: parent.bottom
290+ anchors.bottomMargin: (tabFooter.visible) ? units.gu(8) : 0
291+ }
292+ TabFooter {
293+ id:tabFooter
294+ objectName: "TabFooter"
295+ Layouts.item: "TabFooter"
296+ visible: !dataProviderLogo.visible
297+ }
298+ Image {
299+ id: dataProviderLogo
300+ objectName: "DataProviderLogo"
301+ visible: (settings["service"] === "openweathermap")
302+ source: Qt.resolvedUrl("../resources/images/openWeatherMapLogo.png")
303+ anchors {
304+ bottom: parent.bottom
305+ right: parent.right
306+ bottomMargin: units.gu(1)
307+ rightMargin: units.gu(1)
308+ }
309+ height: units.gu(8)
310+ width: units.gu(8)
311+ fillMode: Image.PreserveAspectFit
312+ MouseArea {
313+ anchors.fill: parent
314+ onClicked: Qt.openUrlExternally("http://m.openweathermap.org/city/" + locationData.location.services.openweathermap)
315+ }
316+ }
317 Rectangle {
318- id: listRectangle
319- width: parent.width
320- height: dailyForecastList.height-tabFooter.height
321- anchors.top: parent.top
322+ id: noDataAvaible
323+ visible: false
324+ width:parent.width-units.gu(10)
325+ anchors.centerIn:parent
326+ anchors.verticalCenterOffset: -units.gu(10)
327 color: "transparent"
328-
329- DateComponent {
330- id: dateComponent
331- dateRelative: dateRel
332- dateString: date
333- borderTopVisible: false
334- }
335- CurrentWeather {
336- id: currentWeatherComponent
337- currentTemp: temp
338- minTemp: tempMin
339- maxTemp: tempMax
340- icon: condIcon
341- windSpeed: wind_speed
342- windDir: wind_dir
343- humidity: humid
344- precipitation: precip
345- propPrecip: prop_precip
346- precipType: precip_type
347- pressure: press
348- uvIndex: uv
349- hourly: hours
350- anchors.top: dateComponent.bottom
351- showMaxTemp: (index === 0)
352- }
353- }
354- }
355- LastUpdatedComponent{
356- id: lastUpdatedComponent
357- anchors.bottom: parent.bottom
358- anchors.bottomMargin: (tabFooter.visible) ? units.gu(8) : 0
359- }
360- TabFooter {
361- id:tabFooter
362- objectName: "TabFooter"
363- Layouts.item: "TabFooter"
364- visible: !dataProviderLogo.visible
365- }
366- Image {
367- id: dataProviderLogo
368- objectName: "DataProviderLogo"
369- visible: (settings["service"] === "openweathermap")
370- source: Qt.resolvedUrl("../resources/images/openWeatherMapLogo.png")
371- anchors {
372- bottom: parent.bottom
373- right: parent.right
374- bottomMargin: units.gu(1)
375- rightMargin: units.gu(1)
376- }
377- height: units.gu(8)
378- width: units.gu(8)
379- fillMode: Image.PreserveAspectFit
380- MouseArea {
381- anchors.fill: parent
382- onClicked: Qt.openUrlExternally("http://m.openweathermap.org/city/" + locationData.location.services.openweathermap)
383- }
384- }
385- Rectangle {
386- id: noDataAvaible
387- visible: false
388- width:parent.width-units.gu(10)
389- anchors.centerIn:parent
390- anchors.verticalCenterOffset: -units.gu(10)
391- color: "transparent"
392- Label {
393- width:parent.width
394- text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
395- fontSize: "large"
396- wrapMode: Text.WordWrap
397- }
398- }
399- }
400+ Label {
401+ width:parent.width
402+ text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
403+ fontSize: "large"
404+ wrapMode: Text.WordWrap
405+ }
406+ }
407+ }
408 }
409
410 tools: ToolbarItems {
411
412=== modified file 'ubuntu-weather-app.qml'
413--- ubuntu-weather-app.qml 2014-02-15 14:31:10 +0000
414+++ ubuntu-weather-app.qml 2014-02-21 10:40:13 +0000
415@@ -31,8 +31,8 @@
416
417 id: mainView
418
419- width: units.gu(50)
420- height: units.gu(75)
421+ width: units.gu(107)
422+ height: units.gu(67)
423
424 headerColor: "#E04414"
425 backgroundColor: "#E04414"

Subscribers

People subscribed via source and target branches