Merge lp:~neokore/ubuntu-weather-app/bug1187801 into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Raúl Yeguas on 2013-07-22
Status: Merged
Approved by: Martin Borho on 2013-07-22
Approved revision: 73
Merged at revision: 73
Proposed branch: lp:~neokore/ubuntu-weather-app/bug1187801
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 147 lines (+51/-49)
1 file modified
components/LocationTab.qml (+51/-49)
To merge this branch: bzr merge lp:~neokore/ubuntu-weather-app/bug1187801
Reviewer Review Type Date Requested Status
Martin Borho 2013-07-22 Approve on 2013-07-22
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2013-07-22
Review via email: mp+176275@code.launchpad.net

Commit message

Solved bug 1187801: Daily weather should snap in view.
Daily weather is changed to a list where each element is like the current weather element and snaps for each day when scrolling.

Description of the change

Solved bug 1187801: Daily weather should snap in view.
Daily weather is changed to a list where each element is like the current weather element and snaps for each day when scrolling.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components/LocationTab.qml'
2--- components/LocationTab.qml 2013-07-20 16:52:37 +0000
3+++ components/LocationTab.qml 2013-07-22 19:29:40 +0000
4@@ -23,6 +23,9 @@
5 Tab {
6 id: locationTab
7 objectName: "LocationTab"
8+
9+ anchors.fill: parent
10+
11 property int locationIndex: 0
12 property var locationData: {}
13
14@@ -47,25 +50,14 @@
15 // set location data as property
16 locationData = locData;
17
18- // set today date
19- todayDateComponent.dateString = formatTimestamp(currentData.timestamp, 'dddd, dd MMMM yyyy')+" - "
20- + formatTimestampToTime(currentData.timestamp, 'HH:mm');
21- todayDateComponent.renderText()
22-
23- // set current Condition
24- currentCondition.condition = currentData.condition.id;
25- currentCondition.icon = currentData.condition.icon;
26- currentCondition.currentTemp = currentData[units].temp;
27- currentCondition.minTemp = todayForeCast[units].min;
28- currentCondition.maxTemp = todayForeCast[units].max;
29-
30 // set daily forecasts
31- for(var x=1;x<dailyLength;x++) {
32+ for(var x=0;x<dailyLength;x++) {
33 dayForecastModel.append({
34 dateRel: "",//Tomorrow",
35 date: formatTimestamp(dailyForecasts[x].timestamp, 'dddd, dd MMMM yyyy'),
36 temp: dailyForecasts[x][units].max,
37 tempMin: dailyForecasts[x][units].min,
38+ tempMax: dailyForecasts[x][units].max,
39 cond: dailyForecasts[x].condition.id,
40 condIcon: dailyForecasts[x].condition.icon
41 });
42@@ -75,52 +67,60 @@
43 // Menu for options
44 page: Page {
45 id: locationPage
46+ isLeaf: true
47+ anchors.top: locationTab.top
48 anchors.fill: parent
49
50- ListModel {
51- id: dayForecastModel
52- }
53-
54- Flickable {
55- id: flickable
56+
57+ Rectangle {
58+ id: listContainer
59+
60 anchors.fill: parent
61- contentHeight: flickContent.height;
62- Rectangle {
63- id: flickContent
64- width:parent.width
65- height: childrenRect.height
66- color: "transparent"
67- DateComponent {
68- id: todayDateComponent
69- //dateRelative: i18n.tr("Today")
70- borderTopVisible: false
71- }
72- CurrentWeather {
73- id: currentCondition
74- anchors.top: todayDateComponent.bottom
75- }
76- ListView {
77- id: dailyForecastList
78- width: parent.width;
79- height:childrenRect.height
80- anchors.top: currentCondition.bottom
81- model:dayForecastModel
82- interactive: false
83- delegate: Item {
84- id: dailyForecastItem
85- width:parent.width
86+ // TODO: Fix that hardcoded value
87+ anchors.topMargin: units.gu(9.5)
88+ color: "transparent"
89+
90+ ListModel {
91+ id: dayForecastModel
92+ }
93+
94+ ListView {
95+ id: dailyForecastList
96+ anchors.fill: parent
97+ anchors.top: parent.top
98+
99+ model:dayForecastModel
100+
101+ snapMode: ListView.SnapOneItem
102+ verticalLayoutDirection: ListView.TopToBottom
103+ flickableDirection: Flickable.VerticalFlick
104+
105+ clip: true
106+
107+ delegate: Item {
108+ id: dailyForecastItem
109+ width:parent.width
110+ height: listContainer.height
111+
112+ Rectangle {
113+ width: parent.width
114 height: childrenRect.height
115+ anchors.verticalCenter: parent.verticalCenter
116+ color: "transparent"
117+
118 DateComponent {
119 id: dateComponent
120 dateRelative: dateRel
121 dateString: date
122+ borderTopVisible: false
123 }
124- DayWeatherComponent {
125+ CurrentWeather {
126+ currentTemp: temp
127+ minTemp: tempMin
128+ maxTemp: tempMax
129+ icon: condIcon
130+ condition: cond
131 anchors.top: dateComponent.bottom
132- temperature: temp
133- temperatureMin: tempMin
134- condition: cond
135- icon: condIcon
136 }
137 }
138 }
139@@ -128,6 +128,8 @@
140 }
141
142
143+
144+
145 tools: ToolbarItems {
146 id: pageTools
147 ToolbarButton {

Subscribers

People subscribed via source and target branches