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

Proposed by Raúl Yeguas
Status: Merged
Approved by: Martin Borho
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 Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
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.

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, well done!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'components/LocationTab.qml'
--- components/LocationTab.qml 2013-07-20 16:52:37 +0000
+++ components/LocationTab.qml 2013-07-22 19:29:40 +0000
@@ -23,6 +23,9 @@
23Tab {23Tab {
24 id: locationTab24 id: locationTab
25 objectName: "LocationTab"25 objectName: "LocationTab"
26
27 anchors.fill: parent
28
26 property int locationIndex: 029 property int locationIndex: 0
27 property var locationData: {}30 property var locationData: {}
2831
@@ -47,25 +50,14 @@
47 // set location data as property50 // set location data as property
48 locationData = locData;51 locationData = locData;
4952
50 // set today date
51 todayDateComponent.dateString = formatTimestamp(currentData.timestamp, 'dddd, dd MMMM yyyy')+" - "
52 + formatTimestampToTime(currentData.timestamp, 'HH:mm');
53 todayDateComponent.renderText()
54
55 // set current Condition
56 currentCondition.condition = currentData.condition.id;
57 currentCondition.icon = currentData.condition.icon;
58 currentCondition.currentTemp = currentData[units].temp;
59 currentCondition.minTemp = todayForeCast[units].min;
60 currentCondition.maxTemp = todayForeCast[units].max;
61
62 // set daily forecasts53 // set daily forecasts
63 for(var x=1;x<dailyLength;x++) {54 for(var x=0;x<dailyLength;x++) {
64 dayForecastModel.append({55 dayForecastModel.append({
65 dateRel: "",//Tomorrow",56 dateRel: "",//Tomorrow",
66 date: formatTimestamp(dailyForecasts[x].timestamp, 'dddd, dd MMMM yyyy'),57 date: formatTimestamp(dailyForecasts[x].timestamp, 'dddd, dd MMMM yyyy'),
67 temp: dailyForecasts[x][units].max,58 temp: dailyForecasts[x][units].max,
68 tempMin: dailyForecasts[x][units].min,59 tempMin: dailyForecasts[x][units].min,
60 tempMax: dailyForecasts[x][units].max,
69 cond: dailyForecasts[x].condition.id,61 cond: dailyForecasts[x].condition.id,
70 condIcon: dailyForecasts[x].condition.icon62 condIcon: dailyForecasts[x].condition.icon
71 });63 });
@@ -75,52 +67,60 @@
75 // Menu for options67 // Menu for options
76 page: Page {68 page: Page {
77 id: locationPage69 id: locationPage
70 isLeaf: true
71 anchors.top: locationTab.top
78 anchors.fill: parent72 anchors.fill: parent
7973
80 ListModel {74
81 id: dayForecastModel75 Rectangle {
82 }76 id: listContainer
8377
84 Flickable {
85 id: flickable
86 anchors.fill: parent78 anchors.fill: parent
87 contentHeight: flickContent.height;79 // TODO: Fix that hardcoded value
88 Rectangle {80 anchors.topMargin: units.gu(9.5)
89 id: flickContent81 color: "transparent"
90 width:parent.width82
91 height: childrenRect.height83 ListModel {
92 color: "transparent"84 id: dayForecastModel
93 DateComponent {85 }
94 id: todayDateComponent86
95 //dateRelative: i18n.tr("Today")87 ListView {
96 borderTopVisible: false88 id: dailyForecastList
97 }89 anchors.fill: parent
98 CurrentWeather {90 anchors.top: parent.top
99 id: currentCondition91
100 anchors.top: todayDateComponent.bottom92 model:dayForecastModel
101 }93
102 ListView {94 snapMode: ListView.SnapOneItem
103 id: dailyForecastList95 verticalLayoutDirection: ListView.TopToBottom
104 width: parent.width;96 flickableDirection: Flickable.VerticalFlick
105 height:childrenRect.height97
106 anchors.top: currentCondition.bottom98 clip: true
107 model:dayForecastModel99
108 interactive: false100 delegate: Item {
109 delegate: Item {101 id: dailyForecastItem
110 id: dailyForecastItem102 width:parent.width
111 width:parent.width103 height: listContainer.height
104
105 Rectangle {
106 width: parent.width
112 height: childrenRect.height107 height: childrenRect.height
108 anchors.verticalCenter: parent.verticalCenter
109 color: "transparent"
110
113 DateComponent {111 DateComponent {
114 id: dateComponent112 id: dateComponent
115 dateRelative: dateRel113 dateRelative: dateRel
116 dateString: date114 dateString: date
115 borderTopVisible: false
117 }116 }
118 DayWeatherComponent {117 CurrentWeather {
118 currentTemp: temp
119 minTemp: tempMin
120 maxTemp: tempMax
121 icon: condIcon
122 condition: cond
119 anchors.top: dateComponent.bottom123 anchors.top: dateComponent.bottom
120 temperature: temp
121 temperatureMin: tempMin
122 condition: cond
123 icon: condIcon
124 }124 }
125 }125 }
126 }126 }
@@ -128,6 +128,8 @@
128 }128 }
129129
130130
131
132
131 tools: ToolbarItems {133 tools: ToolbarItems {
132 id: pageTools134 id: pageTools
133 ToolbarButton {135 ToolbarButton {

Subscribers

People subscribed via source and target branches