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

Proposed by Martin Borho
Status: Merged
Approved by: Raúl Yeguas
Approved revision: 111
Merged at revision: 109
Proposed branch: lp:~martin-borho/ubuntu-weather-app/smaller-fixes
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 127 lines (+63/-6)
4 files modified
components/CurrentWeather.qml (+2/-2)
components/DateComponent.qml (+1/-1)
components/LastUpdatedComponent.qml (+50/-0)
components/LocationTab.qml (+10/-3)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/smaller-fixes
Reviewer Review Type Date Requested Status
Raúl Yeguas Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+184282@code.launchpad.net

Commit message

added updated label, removed years from date labels, improved hourly scrolling, date label aligned with header

Description of the change

Several smaller bugfixes combined:

* removed year from all date labels
* added last updated label to tabs
* improved sensitivity for hourly scrolling
* date aligned with location header

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 :

Good work, Martin! Everything is OK.

Maybe the hourly scroll is too sensitive now, but I'm not sure until I try it in a real device. By now with a mouse I need to move it too fast, but with a finger may be different.

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-09-04 09:44:36 +0000
3+++ components/CurrentWeather.qml 2013-09-06 12:03:59 +0000
4@@ -73,7 +73,7 @@
5 var distance = (parent.height - mouse.y),
6 now = new Date().getTime(),
7 speed = distance/(now-startTime);
8- if(speed < 1 && !flipable.flipped) {
9+ if(speed < 2.3 && !flipable.flipped) {
10 // slow scrolling detected
11 var movement = Math.round(distance/sectionHeight);
12 if(movement > 0) {
13@@ -85,7 +85,7 @@
14 currentConditionTempContent.currentTemp = temp;
15 adjustBackground(Math.round(temp));
16 var dateTime = new Date(currentWeather.hourly.get(hourIndex).date);
17- var dateTimeString = Qt.formatDateTime(dateTime, 'dddd, dd MMMM yyyy - HH:mm');
18+ var dateTimeString = Qt.formatDateTime(dateTime, 'dddd, dd MMMM - HH:mm');
19 dateComponent.dateString = dateTimeString;
20 dateComponent.renderText();
21 }
22
23=== modified file 'components/DateComponent.qml'
24--- components/DateComponent.qml 2013-07-20 16:52:37 +0000
25+++ components/DateComponent.qml 2013-09-06 12:03:59 +0000
26@@ -34,7 +34,7 @@
27
28 Item {
29 id: dayLabel
30- width:parent.width-units.gu(3)
31+ width:parent.width-units.gu(4.5)
32 height: units.gu(4)
33 anchors.top: topBorder.bottom
34 anchors.horizontalCenter: parent.horizontalCenter
35
36=== added file 'components/LastUpdatedComponent.qml'
37--- components/LastUpdatedComponent.qml 1970-01-01 00:00:00 +0000
38+++ components/LastUpdatedComponent.qml 2013-09-06 12:03:59 +0000
39@@ -0,0 +1,50 @@
40+/*
41+ * Copyright (C) 2013 Canonical Ltd
42+ *
43+ * This program is free software: you can redistribute it and/or modify
44+ * it under the terms of the GNU General Public License version 3 as
45+ * published by the Free Software Foundation.
46+ *
47+ * This program is distributed in the hope that it will be useful,
48+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
49+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+ * GNU General Public License for more details.
51+ *
52+ * You should have received a copy of the GNU General Public License
53+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
54+ *
55+ * Authored by: Martin Borho <martin@borho.net>
56+ */
57+import QtQuick 2.0
58+import Ubuntu.Components 0.1
59+
60+Rectangle {
61+ width:parent.width-units.gu(4.5)
62+ height: units.gu(4)
63+ anchors.bottom: parent.bottom
64+ anchors.bottomMargin: units.gu(2)
65+ anchors.horizontalCenter: parent.horizontalCenter
66+ color: "transparent"
67+
68+ property string updateDate;
69+
70+ onUpdateDateChanged: {
71+ var updatedLabel = i18n.tr("Updated: "),
72+ updated = new Date(updateDate*1000),
73+ updateTime = Qt.formatTime(updated, 'HH:mm');
74+ if(Qt.formatDateTime(updated, "yyyy-MM-dd") === Qt.formatDateTime(new Date(), "yyyy-MM-dd")) {
75+ updatedLabel += i18n.tr("Today, ")+updateTime;
76+ } else {
77+ updatedLabel += Qt.formatDate(updated, 'dddd, dd MMMM ')+updateTime
78+ }
79+ lastUpdatedLabel.text = updatedLabel
80+ }
81+
82+ Label {
83+ id: lastUpdatedLabel
84+ objectName: "LastUpdatedLabel"
85+ height: parent.height
86+ verticalAlignment: Text.AlignVCenter
87+ color: Theme.palette.normal.baseText
88+ }
89+}
90
91=== modified file 'components/LocationTab.qml'
92--- components/LocationTab.qml 2013-09-03 13:13:29 +0000
93+++ components/LocationTab.qml 2013-09-06 12:03:59 +0000
94@@ -52,8 +52,7 @@
95 units = (mainView.settings.units === 'imperial') ? 'imperial' : 'metric',
96 wind_units = (mainView.settings.wind_units === 'mph') ? 'imperial' : 'metric',
97 dailyForecasts = locData.data,
98- dailyLength = dailyForecasts.length,
99- todayForeCast = dailyForecasts[0];
100+ dailyLength = dailyForecasts.length;
101
102 // set location data as property
103 locationData = locData;
104@@ -81,9 +80,14 @@
105 }else if(degrees >330 && degrees <= 360){
106 direction = "N";
107 }
108+ // set last updated label
109+ if(x===0 && dailyForecasts[x].current) {
110+ lastUpdatedComponent.updateDate = dailyForecasts[x].current.timestamp;
111+ }
112+ //
113 dayForecastModel.append({
114 dateRel: "",//Tomorrow",
115- date: formatTimestamp(dailyForecasts[x].timestamp, 'dddd, dd MMMM yyyy'),
116+ date: formatTimestamp(dailyForecasts[x].timestamp, 'dddd, dd MMMM'),
117 temp: (dailyForecasts[x]["current"] === undefined) ? dailyForecasts[x][units].tempMax :
118 dailyForecasts[x]["current"][units].temp,
119 tempMin: dailyForecasts[x][units].tempMin,
120@@ -167,6 +171,9 @@
121 }
122 }
123 }
124+ LastUpdatedComponent{
125+ id: lastUpdatedComponent
126+ }
127 }
128
129

Subscribers

People subscribed via source and target branches