Merge lp:~nik90/ubuntu-clock-app/alarm-status-effects into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 80
Merged at revision: 77
Proposed branch: lp:~nik90/ubuntu-clock-app/alarm-status-effects
Merge into: lp:ubuntu-clock-app
Diff against target: 187 lines (+95/-7)
4 files modified
app/alarm/AlarmDelegate.qml (+59/-1)
app/alarm/AlarmUtils.qml (+17/-0)
debian/changelog (+2/-0)
po/com.ubuntu.clock.pot (+17/-6)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/alarm-status-effects
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Riccardo Padovani Approve
Review via email: mp+233068@code.launchpad.net

Commit message

Small visual tweaks to the alarm listitems when enabling/disabling alarms as specified in the design spec.

Description of the change

This MP implements small visual changes when enabling/disabling alarms as specified in the design spec.

- When an alarm is disabled, the opacity of the labels (alarm time, name, recurrence) is decreased to 80%

- When an alarm is enabled, the alarm recurrence options is replaced with the time to the alarm for 5 seconds. After the 5 seconds the original alarm recurrence options are shown again.

For instance if current time is 18:00 and the alarm is enabled to ring at 20:00 then it should say "in 2h" for 5 seconds.

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: Needs Fixing (continuous-integration)
76. By Nekhelesh Ramananthan

Added case for alarms in less an hour

77. By Nekhelesh Ramananthan

Updated changed

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Imo, you should add also a case in which alarmETA < 1h, to display online number of minutes before the ring.

Also, remember to update .pot file ;-)

review: Needs Fixing
78. By Nekhelesh Ramananthan

Updated pot file

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Lgtm now

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
79. By Nekhelesh Ramananthan

merged trunk

80. By Nekhelesh Ramananthan

tiny fix

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/alarm/AlarmDelegate.qml'
2--- app/alarm/AlarmDelegate.qml 2014-08-28 00:36:51 +0000
3+++ app/alarm/AlarmDelegate.qml 2014-09-03 22:51:58 +0000
4@@ -44,6 +44,8 @@
5 Column {
6 id: alarmDetailsColumn
7
8+ opacity: model.enabled ? 1.0 : 0.8
9+
10 anchors {
11 left: alarmTime.right
12 right: alarmStatus.left
13@@ -68,7 +70,7 @@
14
15 fontSize: "xx-small"
16 width: parent.width
17- visible: type === Alarm.Repeating
18+ visible: type === Alarm.Repeating || _internalTimerLoader.sourceComponent != undefined
19 wrapMode: Text.WrapAtWordBoundaryOrAnywhere
20 text: alarmUtils.format_day_string(daysOfWeek, type)
21 }
22@@ -90,6 +92,30 @@
23 }
24 }
25
26+ Component {
27+ id: _internalTimerComponent
28+ Timer {
29+ running: false
30+ interval: 5000
31+ repeat: false
32+ onTriggered: {
33+ alarmSubtitle.text = alarmUtils.format_day_string(daysOfWeek)
34+ _internalTimerLoader.sourceComponent = undefined
35+ }
36+ }
37+ }
38+
39+ Loader {
40+ id: _internalTimerLoader
41+ asynchronous: true
42+
43+ onStatusChanged: {
44+ if(status === Loader.Ready) {
45+ _internalTimerLoader.item.restart()
46+ }
47+ }
48+ }
49+
50 Connections {
51 target: model
52 onStatusChanged: {
53@@ -99,6 +125,38 @@
54 */
55 if (model.status === Alarm.Ready) {
56 alarmStatus.checked = model.enabled;
57+
58+ if(alarmStatus.checked) {
59+ var timeObject = alarmUtils.get_time_to_next_alarm(model.date - new Date())
60+ var alarmETA
61+
62+ // TRANSLATORS: the first argument is the number of days,
63+ // followed by hour and minute (eg. in 1d 20h 3m)
64+ if(timeObject.days) {
65+ alarmETA = i18n.tr("in %1d %1h %2m")
66+ .arg(timeObject.days)
67+ .arg(timeObject.hours)
68+ .arg(timeObject.minutes)
69+ }
70+
71+ // TRANSLATORS: the first argument is the number of
72+ // hours followed by the minutes (eg. in 4h 3m)
73+ else if (timeObject.hours) {
74+ alarmETA = i18n.tr("in %1h %2m")
75+ .arg(timeObject.hours)
76+ .arg(timeObject.minutes)
77+ }
78+
79+ // TRANSLATORS: the argument is the number of
80+ // minutes to the alarm (eg. in 3m)
81+ else {
82+ alarmETA = i18n.tr("in %1m")
83+ .arg(timeObject.minutes)
84+ }
85+
86+ alarmSubtitle.text = alarmETA
87+ _internalTimerLoader.sourceComponent = _internalTimerComponent
88+ }
89 }
90 }
91 }
92
93=== modified file 'app/alarm/AlarmUtils.qml'
94--- app/alarm/AlarmUtils.qml 2014-09-01 12:00:17 +0000
95+++ app/alarm/AlarmUtils.qml 2014-09-03 22:51:58 +0000
96@@ -50,6 +50,23 @@
97 }
98 }
99
100+ function get_time_to_next_alarm ( datetime_offset ) {
101+ // increase by a minute, so we could make a nicer time
102+ // to the next alarm, otherwise a minute always missing
103+ // which makes it look odd
104+ datetime_offset += 60000;
105+
106+ var days_in_offset = Math.floor( datetime_offset / ( 3600000 * 24 ) );
107+ var hours_in_offset = Math.floor( datetime_offset / 3600000 % 24 );
108+ var minutes_in_offset = Math.floor( datetime_offset / 60000 % 60 );
109+
110+ return {
111+ days : days_in_offset,
112+ hours : hours_in_offset,
113+ minutes : minutes_in_offset
114+ }
115+ }
116+
117 // Function return the alarm dayOfWeek according to the day provided
118 function get_alarm_day(day) {
119 switch(day) {
120
121=== modified file 'debian/changelog'
122--- debian/changelog 2014-09-03 22:14:49 +0000
123+++ debian/changelog 2014-09-03 22:51:58 +0000
124@@ -19,6 +19,8 @@
125 * Updated QtQuick library imports to v2.3
126 * Switched bzr branch to lp:ubuntu-clock-app
127 * Updated pot file name
128+ * Added visual tweaks (80% opacity for disabled alarms) and show time to
129+ next alarm when enabling an alarm.
130 * Enabled one-time alarms in the UI (LP: #1358320)
131 * Fixed the transition animation to alarms to be more smoother (LP: #1362081)
132
133
134=== modified file 'po/com.ubuntu.clock.pot'
135--- po/com.ubuntu.clock.pot 2014-08-26 14:07:25 +0000
136+++ po/com.ubuntu.clock.pot 2014-09-03 22:51:58 +0000
137@@ -8,7 +8,7 @@
138 msgstr ""
139 "Project-Id-Version: \n"
140 "Report-Msgid-Bugs-To: \n"
141-"POT-Creation-Date: 2014-08-26 16:06+0200\n"
142+"POT-Creation-Date: 2014-09-02 17:11+0200\n"
143 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
144 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
145 "Language-Team: LANGUAGE <LL@li.org>\n"
146@@ -17,6 +17,21 @@
147 "Content-Type: text/plain; charset=CHARSET\n"
148 "Content-Transfer-Encoding: 8bit\n"
149
150+#: ../app/alarm/AlarmDelegate.qml:135
151+#, qt-format
152+msgid "in %1d %1h %2m"
153+msgstr ""
154+
155+#: ../app/alarm/AlarmDelegate.qml:144
156+#, qt-format
157+msgid "in %1h %2m"
158+msgstr ""
159+
160+#: ../app/alarm/AlarmDelegate.qml:152
161+#, c-format, qt-format
162+msgid "in %1m"
163+msgstr ""
164+
165 #: ../app/alarm/AlarmLabel.qml:30 ../app/alarm/AlarmLabel.qml:52
166 #: ../app/alarm/EditAlarmPage.qml:268
167 msgid "Label"
168@@ -27,7 +42,7 @@
169 msgid "Delete"
170 msgstr ""
171
172-#: ../app/alarm/AlarmPage.qml:26
173+#: ../app/alarm/AlarmPage.qml:26 ../app/ubuntu-clock-app.qml:103
174 msgid "Alarms"
175 msgstr ""
176
177@@ -110,10 +125,6 @@
178 msgid "City"
179 msgstr ""
180
181-#: ../app/ubuntu-clock-app.qml:103
182-msgid "Next Alarm in .."
183-msgstr ""
184-
185 #: ../app/worldclock/UserWorldCityDelegate.qml:139
186 msgid "Today"
187 msgstr ""

Subscribers

People subscribed via source and target branches