Merge lp:~martin-borho/ubuntu-weather-app/DayWeatherComponent into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Martin Borho on 2013-03-09
Status: Merged
Approved by: Raúl Yeguas on 2013-03-09
Approved revision: 5
Merged at revision: 4
Proposed branch: lp:~martin-borho/ubuntu-weather-app/DayWeatherComponent
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 211 lines (+160/-11)
4 files modified
components/CurrentWeather.qml (+4/-2)
components/DateComponent.qml (+51/-0)
components/DayWeatherComponent.qml (+56/-0)
weather.qml (+49/-9)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/DayWeatherComponent
Reviewer Review Type Date Requested Status
Raúl Yeguas 2013-03-09 Approve on 2013-03-09
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2013-03-09
Review via email: mp+152562@code.launchpad.net

Commit message

added DayWeatherComponent and DateComponent

Description of the change

a) added DayWeatherComponent, DateComponent

b) added a smaller dummy condition icon as png with transparent background

c) added some dummy DayWeatherComponents and DateComponents to first Tab

d) fixed alignment in CurrentWeater to fit other aspect ratios too. (for example when qmlscene window gets resized)

To post a comment you must log in.
Raúl Yeguas (neokore) wrote :

Great work, Martin!
Everything seems OK and I like the way you resolved the 'metric' issue, I'll take it to current weather component too.

Cheers!

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 2013-03-08 16:08:49 +0000
3+++ components/CurrentWeather.qml 2013-03-09 15:42:21 +0000
4@@ -12,8 +12,9 @@
5 property int maxTemp
6 property bool metric
7
8- width: units.gu(50)
9- height: units.gu(60)
10+ width: parent.width
11+ height: childrenRect.height+units.gu(10)
12+ anchors.horizontalCenter: parent.horizontalCenter
13
14 Component.onCompleted: {
15 if(currentWeather.metric){
16@@ -42,6 +43,7 @@
17 id: rectangle1
18 width: units.gu(50)
19 height: units.gu(10)
20+ anchors.horizontalCenter: parent.horizontalCenter
21 anchors.top: image1.bottom
22 anchors.topMargin: 0
23 color: "#00000000"
24
25=== added file 'components/DateComponent.qml'
26--- components/DateComponent.qml 1970-01-01 00:00:00 +0000
27+++ components/DateComponent.qml 2013-03-09 15:42:21 +0000
28@@ -0,0 +1,51 @@
29+import QtQuick 2.0
30+import Ubuntu.Components 0.1
31+
32+Rectangle {
33+ width: parent.width
34+ height: childrenRect.height
35+
36+ property bool borderTopVisible: true
37+ property string dateRelative: ""
38+ property string dateString: ""
39+ property string borderColor: "#D6D6D6"
40+ property int borderHeight: units.gu(0.1)
41+
42+ Component.onCompleted: {
43+ var dateText = ""
44+ if(dateRelative !== "") {
45+ dateText += dateRelative+", ";
46+ }
47+ dateText += dateString
48+ dayText.text = dateText
49+ }
50+
51+ Rectangle {
52+ id: topBorder
53+ visible: borderTopVisible
54+ width:parent.width
55+ height: borderHeight
56+ color: borderColor
57+ }
58+
59+ Item {
60+ id: dayLabel
61+ width:parent.width-units.gu(3)
62+ height: units.gu(4)
63+ anchors.top: topBorder.bottom
64+ anchors.horizontalCenter: parent.horizontalCenter
65+
66+ Label {
67+ id: dayText
68+ height: parent.height
69+ verticalAlignment: Text.AlignVCenter
70+ }
71+ }
72+
73+ Rectangle {
74+ width:parent.width
75+ height: borderHeight
76+ anchors.top: dayLabel.bottom
77+ color: borderColor
78+ }
79+}
80
81=== added file 'components/DayWeatherComponent.qml'
82--- components/DayWeatherComponent.qml 1970-01-01 00:00:00 +0000
83+++ components/DayWeatherComponent.qml 2013-03-09 15:42:21 +0000
84@@ -0,0 +1,56 @@
85+import QtQuick 2.0
86+import Ubuntu.Components 0.1
87+import "OpenWeatherMap.js" as Weather
88+
89+Rectangle {
90+ id: dayWeatherComponent
91+ width: parent.width-units.gu(2)
92+ anchors.horizontalCenter: parent.horizontalCenter
93+ height:contentShape.height+units.gu(2)
94+
95+ property int condition
96+ property int temperature
97+ property int temperatureMin
98+ property bool metric: true
99+ property string scale: (metric) ? "C" : "F"
100+ property string shapeColor: "#D6D6D6"
101+
102+ onConditionChanged: {
103+ currentIcon.source = "../resources/images/"+Weather.getConditionIcon(condition)+"-day.png"
104+ }
105+
106+ UbuntuShape{
107+ id: contentShape
108+ radius: "small"
109+ width: parent.width
110+ color: shapeColor
111+ anchors.centerIn: parent
112+ height:childrenRect.height
113+ Row {
114+ width:parent.width
115+ Image {
116+ id: currentIcon
117+ height: units.gu(10)
118+ fillMode: Image.PreserveAspectFit
119+ }
120+ Label {
121+ id: currentTemp
122+ horizontalAlignment: Text.AlignHCenter
123+ verticalAlignment: Text.AlignVCenter
124+ width:parent.width/9*3
125+ height:parent.height
126+ ItemStyle.class: "title"
127+ text: dayWeatherComponent.temperature+"°"+dayWeatherComponent.scale
128+ }
129+ Label {
130+ id: minTemp
131+ horizontalAlignment: Text.AlignHCenter
132+ verticalAlignment: Text.AlignVCenter
133+ width:parent.width/9*3
134+ height: parent.height
135+ text: i18n.tr("Min.")+"\n"+dayWeatherComponent.temperatureMin+"°"+dayWeatherComponent.scale
136+ }
137+ }
138+ }
139+}
140+
141
142=== added file 'resources/images/02-day.png'
143Binary files resources/images/02-day.png 1970-01-01 00:00:00 +0000 and resources/images/02-day.png 2013-03-09 15:42:21 +0000 differ
144=== modified file 'weather.qml'
145--- weather.qml 2013-03-08 16:08:49 +0000
146+++ weather.qml 2013-03-09 15:42:21 +0000
147@@ -27,15 +27,55 @@
148
149 // Tab content begins here
150 page: Page {
151- Column {
152- id: column1
153- anchors.centerIn: parent
154- Components.CurrentWeather {
155- condition: 801
156- currentTemp: 20
157- minTemp: 12
158- maxTemp: 25
159- metric: true
160+ Rectangle {
161+ id: startPage
162+ width: parent.width
163+ height: parent.height
164+ Flickable {
165+ width: parent.width
166+ height: parent.height
167+ contentHeight: column1.height
168+ Column {
169+ id: column1
170+ width: parent.width
171+ Components.DateComponent {
172+ dateRelative: "Today"
173+ dateString:"Saturday, 9th February"
174+ borderTopVisible: false
175+ }
176+ Components.CurrentWeather {
177+ condition: 801
178+ currentTemp: 20
179+ minTemp: 12
180+ maxTemp: 25
181+ metric: true
182+ }
183+ Components.DateComponent {
184+ dateRelative: "Tomorrow"
185+ dateString:"Sunday, 10th February"
186+ }
187+ Components.DayWeatherComponent {
188+ temperature: 22
189+ temperatureMin: 11
190+ condition: 801
191+ }
192+ Components.DateComponent {
193+ dateString:"Monday, 11th February"
194+ }
195+ Components.DayWeatherComponent {
196+ temperature: 22
197+ temperatureMin: 11
198+ condition: 801
199+ }
200+ Components.DateComponent {
201+ dateString:"Tuesday, 12th February"
202+ }
203+ Components.DayWeatherComponent {
204+ temperature: 22
205+ temperatureMin: 11
206+ condition: 801
207+ }
208+ }
209 }
210 }
211 }

Subscribers

People subscribed via source and target branches