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
=== modified file 'components/CurrentWeather.qml'
--- components/CurrentWeather.qml 2014-02-19 23:35:58 +0000
+++ components/CurrentWeather.qml 2014-02-21 10:40:13 +0000
@@ -48,8 +48,9 @@
48 // set the width to trigger this layout to be higher than that48 // set the width to trigger this layout to be higher than that
49 // of a N7, so that on that device it will still be in phone49 // of a N7, so that on that device it will still be in phone
50 // mode50 // mode
51 // Nexus 7's width is 1920px/21px/GU = 91.43 GU51 // Nexus 7's width is 1920px/21px/GU = 91.43 GU (we use 95)
52 property real wideModeThreshold: units.gu(95)52 // Nexus 7's width with new GU 1920px/18px/GU = 106.67 GU (we use 110)
53 property real wideModeThreshold: units.gu(110)
5354
54 property NumberAnimation appearAnimation: frontrect.conditionIcon.appearAnimation55 property NumberAnimation appearAnimation: frontrect.conditionIcon.appearAnimation
5556
5657
=== modified file 'components/LocationTab.qml'
--- components/LocationTab.qml 2014-02-20 09:56:13 +0000
+++ components/LocationTab.qml 2014-02-21 10:40:13 +0000
@@ -141,197 +141,202 @@
141 Rectangle {141 Rectangle {
142 anchors.fill: parent142 anchors.fill: parent
143 color: "transparent"143 color: "transparent"
144 ItemLayout {144 ItemLayout {
145 item: "ForecastList"145 item: "ForecastList"
146 width: parent.width*0.625146 width: parent.width*0.625
147 height:parent.height147 height:parent.height
148 }148 }
149 Rectangle {149 Rectangle {
150 width: parent.width*0.375150 width: parent.width*0.375
151 height:parent.height151 height:parent.height
152 anchors.right: parent.right152 anchors.right: parent.right
153 anchors.top: parent.top153 anchors.top: parent.top
154 color: "black"154 color: "black"
155 opacity: 0.3155 opacity: 0.3
156 }156 }
157 ItemLayout {157 ItemLayout {
158 item: "TabFooter"158 item: "TabFooter"
159 // We're making the footer to be full-width159 // We're making the footer to be full-width
160 // so that it looks good on a Nexus 7160 // so that it looks good on a Nexus 7
161 width: mainView.width // * 0.625161 //width: parent.width // * 0.625
162 height: units.gu(8)162 height: units.gu(8)
163 anchors.bottom: parent.bottom163 anchors.bottom: parent.bottom
164 clip: true164 anchors.left: parent.left
165 }165 anchors.right: parent.right
166 Rectangle {166 clip: true
167 id: sideLabel167 }
168 anchors.top: parent.top168 Rectangle {
169 anchors.right: parent.right169 id: sideLabel
170 width: parent.width*0.375170 anchors.top: parent.top
171 height: units.gu(6)171 anchors.right: parent.right
172 width: parent.width*0.375
173 height: units.gu(6)
174 color: "transparent"
175 Label {
176 text: i18n.tr("Forecast")
177 fontSize: "large"
178 anchors.left:parent.left
179 anchors.leftMargin: units.gu(3)
180 verticalAlignment: Text.AlignVCenter
181 anchors.top: parent.top;
182 anchors.bottom: parent.bottom
183 }
184 }
185 ListView {
186 id: locationDailySide
187 width: (parent.width*0.375)-units.gu(1)
188 height: parent.height-sideLabel.height-units.gu(9)
189 anchors.right: parent.right
190 anchors.top: sideLabel.bottom
191 model:dayForecastModel
192 clip: true
193 // TODO doubled code, to refactor
194 property var conditionIcon: {
195 "clear_day": "02",
196 "clear_night": "12",
197 "few_clouds_day": "05",
198 "few_clouds_night": "04",
199 "scattered_clouds_day": "05",
200 "scattered_clouds_night": "04",
201 "broken_clouds_day": "03",
202 "broken_clouds_night": "03",
203 "mostly_cloudy": "03",
204 "shower_rain_day": "09",
205 "shower_rain_night": "09",
206 "rain_day": "09",
207 "rain_night": "09",
208 "thunderstorm_day": "13",
209 "thunderstorm_night": "13",
210 "snow_day": "14",
211 "snow_night": "14",
212 "chance_snow_day": "11",
213 "chances_now_night": "11",
214 "snow_shower": "11",
215 "mist_day": "06",
216 "mist_night": "06"
217 }
218 delegate: ListItem.Subtitled {
219 subText: "H:"+Math.round(temp)+" L:"+Math.round(tempMin)
220 text: date
221 //selected: (dailyForecastList.currentIndex == index)
222 iconSource: "../resources/images/"+locationDailySide.conditionIcon[dayForecastModel.get(index).condIcon]+".png"
223 onClicked: { dailyForecastList.currentIndex = index }
224 }
225 }
226 }
227 }
228 ]
229
230 ListView {
231 id: dailyForecastList
232 objectName: "DailyForecastList"
233 width: parent.width
234 height:parent.height
235 model:dayForecastModel
236 Layouts.item: "ForecastList"
237 onCurrentIndexChanged: {
238 if(visible) {
239 var data = dayForecastModel.get(currentIndex)
240 adjustBackground(Math.round(data.temp))
241 dailyForecastList.currentItem.appearAnimation.start()
242 }
243 }
244
245 interactive: false
246 snapMode: ListView.SnapOneItem
247 highlightRangeMode: ListView.StrictlyEnforceRange
248 verticalLayoutDirection: ListView.TopToBottom
249 flickableDirection: Flickable.VerticalFlick
250 clip: true
251
252 delegate: Item {
253 id: dailyForecastItem
254 width:parent.width
255 height: locationPage.height
256
257 property NumberAnimation appearAnimation: currentWeatherComponent.appearAnimation
258
259 signal hideDetail()
260 signal toggle()
261
262 Rectangle {
263 id: listRectangle
264 width: parent.width
265 height: dailyForecastList.height-tabFooter.height
266 anchors.top: parent.top
172 color: "transparent"267 color: "transparent"
173 Label {268
174 text: i18n.tr("Forecast")269 DateComponent {
175 fontSize: "large"270 id: dateComponent
176 anchors.left:parent.left271 dateRelative: dateRel
177 anchors.leftMargin: units.gu(3)272 dateString: date
178 anchors.verticalCenter: parent.verticalCenter273 borderTopVisible: false
179 }274 }
180 }275 CurrentWeather {
181 ListView {276 id: currentWeatherComponent
182 id: locationDailySide277 currentTemp: temp
183 width: (parent.width*0.375)-units.gu(1)278 minTemp: tempMin
184 height: parent.height-sideLabel.height-units.gu(9)279 maxTemp: tempMax
185 anchors.right: parent.right280 icon: condIcon
186 anchors.top: sideLabel.bottom281 windSpeed: wind_speed
187 model:dayForecastModel282 windDir: wind_dir
188 clip: true283 humidity: humid
189 // TODO doubled code, to refactor284 precipitation: precip
190 property var conditionIcon: {285 propPrecip: prop_precip
191 "clear_day": "02",286 precipType: precip_type
192 "clear_night": "12",287 pressure: press
193 "few_clouds_day": "05",288 uvIndex: uv
194 "few_clouds_night": "04",289 hourly: hours
195 "scattered_clouds_day": "05",290 anchors.top: dateComponent.bottom
196 "scattered_clouds_night": "04",291 showMaxTemp: (index === 0)
197 "broken_clouds_day": "03",292 }
198 "broken_clouds_night": "03",293 }
199 "mostly_cloudy": "03",294 }
200 "shower_rain_day": "09",295 LastUpdatedComponent{
201 "shower_rain_night": "09",296 id: lastUpdatedComponent
202 "rain_day": "09",297 anchors.bottom: parent.bottom
203 "rain_night": "09",298 anchors.bottomMargin: (tabFooter.visible) ? units.gu(8) : 0
204 "thunderstorm_day": "13",299 }
205 "thunderstorm_night": "13",300 TabFooter {
206 "snow_day": "14",301 id:tabFooter
207 "snow_night": "14",302 objectName: "TabFooter"
208 "chance_snow_day": "11",303 Layouts.item: "TabFooter"
209 "chances_now_night": "11",304 visible: !dataProviderLogo.visible
210 "snow_shower": "11",305 }
211 "mist_day": "06",306 Image {
212 "mist_night": "06"307 id: dataProviderLogo
213 }308 objectName: "DataProviderLogo"
214 delegate: ListItem.Subtitled {309 visible: (settings["service"] === "openweathermap")
215 subText: "H:"+Math.round(temp)+" L:"+Math.round(tempMin)310 source: Qt.resolvedUrl("../resources/images/openWeatherMapLogo.png")
216 text: date311 anchors {
217 //selected: (dailyForecastList.currentIndex == index)312 bottom: parent.bottom
218 iconSource: "../resources/images/"+locationDailySide.conditionIcon[dayForecastModel.get(index).condIcon]+".png"313 right: parent.right
219 onClicked: { dailyForecastList.currentIndex = index }314 bottomMargin: units.gu(1)
220 }315 rightMargin: units.gu(1)
221 }316 }
222 }317 height: units.gu(8)
223 }318 width: units.gu(8)
224 ]319 fillMode: Image.PreserveAspectFit
225 ListView {320 MouseArea {
226 id: dailyForecastList321 anchors.fill: parent
227 objectName: "DailyForecastList"322 onClicked: Qt.openUrlExternally("http://m.openweathermap.org/city/" + locationData.location.services.openweathermap)
228 width: parent.width323 }
229 height:parent.height324 }
230 model:dayForecastModel
231 Layouts.item: "ForecastList"
232 onCurrentIndexChanged: {
233 if(visible) {
234 var data = dayForecastModel.get(currentIndex)
235 adjustBackground(Math.round(data.temp))
236 dailyForecastList.currentItem.appearAnimation.start()
237 }
238 }
239
240 interactive: false
241 snapMode: ListView.SnapOneItem
242 highlightRangeMode: ListView.StrictlyEnforceRange
243 verticalLayoutDirection: ListView.TopToBottom
244 flickableDirection: Flickable.VerticalFlick
245 clip: true
246
247 delegate: Item {
248 id: dailyForecastItem
249 width:parent.width
250 height: locationPage.height
251
252 property NumberAnimation appearAnimation: currentWeatherComponent.appearAnimation
253
254 signal hideDetail()
255 signal toggle()
256
257 Rectangle {325 Rectangle {
258 id: listRectangle326 id: noDataAvaible
259 width: parent.width327 visible: false
260 height: dailyForecastList.height-tabFooter.height328 width:parent.width-units.gu(10)
261 anchors.top: parent.top329 anchors.centerIn:parent
330 anchors.verticalCenterOffset: -units.gu(10)
262 color: "transparent"331 color: "transparent"
263332 Label {
264 DateComponent {333 width:parent.width
265 id: dateComponent334 text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
266 dateRelative: dateRel335 fontSize: "large"
267 dateString: date336 wrapMode: Text.WordWrap
268 borderTopVisible: false337 }
269 }338 }
270 CurrentWeather {339 }
271 id: currentWeatherComponent
272 currentTemp: temp
273 minTemp: tempMin
274 maxTemp: tempMax
275 icon: condIcon
276 windSpeed: wind_speed
277 windDir: wind_dir
278 humidity: humid
279 precipitation: precip
280 propPrecip: prop_precip
281 precipType: precip_type
282 pressure: press
283 uvIndex: uv
284 hourly: hours
285 anchors.top: dateComponent.bottom
286 showMaxTemp: (index === 0)
287 }
288 }
289 }
290 LastUpdatedComponent{
291 id: lastUpdatedComponent
292 anchors.bottom: parent.bottom
293 anchors.bottomMargin: (tabFooter.visible) ? units.gu(8) : 0
294 }
295 TabFooter {
296 id:tabFooter
297 objectName: "TabFooter"
298 Layouts.item: "TabFooter"
299 visible: !dataProviderLogo.visible
300 }
301 Image {
302 id: dataProviderLogo
303 objectName: "DataProviderLogo"
304 visible: (settings["service"] === "openweathermap")
305 source: Qt.resolvedUrl("../resources/images/openWeatherMapLogo.png")
306 anchors {
307 bottom: parent.bottom
308 right: parent.right
309 bottomMargin: units.gu(1)
310 rightMargin: units.gu(1)
311 }
312 height: units.gu(8)
313 width: units.gu(8)
314 fillMode: Image.PreserveAspectFit
315 MouseArea {
316 anchors.fill: parent
317 onClicked: Qt.openUrlExternally("http://m.openweathermap.org/city/" + locationData.location.services.openweathermap)
318 }
319 }
320 Rectangle {
321 id: noDataAvaible
322 visible: false
323 width:parent.width-units.gu(10)
324 anchors.centerIn:parent
325 anchors.verticalCenterOffset: -units.gu(10)
326 color: "transparent"
327 Label {
328 width:parent.width
329 text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
330 fontSize: "large"
331 wrapMode: Text.WordWrap
332 }
333 }
334 }
335 }340 }
336341
337 tools: ToolbarItems {342 tools: ToolbarItems {
338343
=== modified file 'ubuntu-weather-app.qml'
--- ubuntu-weather-app.qml 2014-02-15 14:31:10 +0000
+++ ubuntu-weather-app.qml 2014-02-21 10:40:13 +0000
@@ -31,8 +31,8 @@
3131
32 id: mainView32 id: mainView
33 33
34 width: units.gu(50)34 width: units.gu(107)
35 height: units.gu(75)35 height: units.gu(67)
3636
37 headerColor: "#E04414"37 headerColor: "#E04414"
38 backgroundColor: "#E04414"38 backgroundColor: "#E04414"

Subscribers

People subscribed via source and target branches