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

Proposed by Martin Borho
Status: Merged
Approved by: Raúl Yeguas
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 Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
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.
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
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
=== modified file 'components/CurrentWeather.qml'
--- components/CurrentWeather.qml 2013-03-08 16:08:49 +0000
+++ components/CurrentWeather.qml 2013-03-09 15:42:21 +0000
@@ -12,8 +12,9 @@
12 property int maxTemp12 property int maxTemp
13 property bool metric13 property bool metric
1414
15 width: units.gu(50)15 width: parent.width
16 height: units.gu(60)16 height: childrenRect.height+units.gu(10)
17 anchors.horizontalCenter: parent.horizontalCenter
1718
18 Component.onCompleted: {19 Component.onCompleted: {
19 if(currentWeather.metric){20 if(currentWeather.metric){
@@ -42,6 +43,7 @@
42 id: rectangle143 id: rectangle1
43 width: units.gu(50)44 width: units.gu(50)
44 height: units.gu(10)45 height: units.gu(10)
46 anchors.horizontalCenter: parent.horizontalCenter
45 anchors.top: image1.bottom47 anchors.top: image1.bottom
46 anchors.topMargin: 048 anchors.topMargin: 0
47 color: "#00000000"49 color: "#00000000"
4850
=== added file 'components/DateComponent.qml'
--- components/DateComponent.qml 1970-01-01 00:00:00 +0000
+++ components/DateComponent.qml 2013-03-09 15:42:21 +0000
@@ -0,0 +1,51 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3
4Rectangle {
5 width: parent.width
6 height: childrenRect.height
7
8 property bool borderTopVisible: true
9 property string dateRelative: ""
10 property string dateString: ""
11 property string borderColor: "#D6D6D6"
12 property int borderHeight: units.gu(0.1)
13
14 Component.onCompleted: {
15 var dateText = ""
16 if(dateRelative !== "") {
17 dateText += dateRelative+", ";
18 }
19 dateText += dateString
20 dayText.text = dateText
21 }
22
23 Rectangle {
24 id: topBorder
25 visible: borderTopVisible
26 width:parent.width
27 height: borderHeight
28 color: borderColor
29 }
30
31 Item {
32 id: dayLabel
33 width:parent.width-units.gu(3)
34 height: units.gu(4)
35 anchors.top: topBorder.bottom
36 anchors.horizontalCenter: parent.horizontalCenter
37
38 Label {
39 id: dayText
40 height: parent.height
41 verticalAlignment: Text.AlignVCenter
42 }
43 }
44
45 Rectangle {
46 width:parent.width
47 height: borderHeight
48 anchors.top: dayLabel.bottom
49 color: borderColor
50 }
51}
052
=== added file 'components/DayWeatherComponent.qml'
--- components/DayWeatherComponent.qml 1970-01-01 00:00:00 +0000
+++ components/DayWeatherComponent.qml 2013-03-09 15:42:21 +0000
@@ -0,0 +1,56 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3import "OpenWeatherMap.js" as Weather
4
5Rectangle {
6 id: dayWeatherComponent
7 width: parent.width-units.gu(2)
8 anchors.horizontalCenter: parent.horizontalCenter
9 height:contentShape.height+units.gu(2)
10
11 property int condition
12 property int temperature
13 property int temperatureMin
14 property bool metric: true
15 property string scale: (metric) ? "C" : "F"
16 property string shapeColor: "#D6D6D6"
17
18 onConditionChanged: {
19 currentIcon.source = "../resources/images/"+Weather.getConditionIcon(condition)+"-day.png"
20 }
21
22 UbuntuShape{
23 id: contentShape
24 radius: "small"
25 width: parent.width
26 color: shapeColor
27 anchors.centerIn: parent
28 height:childrenRect.height
29 Row {
30 width:parent.width
31 Image {
32 id: currentIcon
33 height: units.gu(10)
34 fillMode: Image.PreserveAspectFit
35 }
36 Label {
37 id: currentTemp
38 horizontalAlignment: Text.AlignHCenter
39 verticalAlignment: Text.AlignVCenter
40 width:parent.width/9*3
41 height:parent.height
42 ItemStyle.class: "title"
43 text: dayWeatherComponent.temperature+"°"+dayWeatherComponent.scale
44 }
45 Label {
46 id: minTemp
47 horizontalAlignment: Text.AlignHCenter
48 verticalAlignment: Text.AlignVCenter
49 width:parent.width/9*3
50 height: parent.height
51 text: i18n.tr("Min.")+"\n"+dayWeatherComponent.temperatureMin+"°"+dayWeatherComponent.scale
52 }
53 }
54 }
55}
56
057
=== added file 'resources/images/02-day.png'
1Binary 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 differ58Binary 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
=== modified file 'weather.qml'
--- weather.qml 2013-03-08 16:08:49 +0000
+++ weather.qml 2013-03-09 15:42:21 +0000
@@ -27,15 +27,55 @@
27 27
28 // Tab content begins here28 // Tab content begins here
29 page: Page {29 page: Page {
30 Column {30 Rectangle {
31 id: column131 id: startPage
32 anchors.centerIn: parent32 width: parent.width
33 Components.CurrentWeather {33 height: parent.height
34 condition: 80134 Flickable {
35 currentTemp: 2035 width: parent.width
36 minTemp: 1236 height: parent.height
37 maxTemp: 2537 contentHeight: column1.height
38 metric: true38 Column {
39 id: column1
40 width: parent.width
41 Components.DateComponent {
42 dateRelative: "Today"
43 dateString:"Saturday, 9th February"
44 borderTopVisible: false
45 }
46 Components.CurrentWeather {
47 condition: 801
48 currentTemp: 20
49 minTemp: 12
50 maxTemp: 25
51 metric: true
52 }
53 Components.DateComponent {
54 dateRelative: "Tomorrow"
55 dateString:"Sunday, 10th February"
56 }
57 Components.DayWeatherComponent {
58 temperature: 22
59 temperatureMin: 11
60 condition: 801
61 }
62 Components.DateComponent {
63 dateString:"Monday, 11th February"
64 }
65 Components.DayWeatherComponent {
66 temperature: 22
67 temperatureMin: 11
68 condition: 801
69 }
70 Components.DateComponent {
71 dateString:"Tuesday, 12th February"
72 }
73 Components.DayWeatherComponent {
74 temperature: 22
75 temperatureMin: 11
76 condition: 801
77 }
78 }
39 }79 }
40 }80 }
41 }81 }

Subscribers

People subscribed via source and target branches