Merge lp:~nik90/ubuntu-clock-app/improve-setting-listitem into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 226
Merged at revision: 250
Proposed branch: lp:~nik90/ubuntu-clock-app/improve-setting-listitem
Merge into: lp:ubuntu-clock-app
Diff against target: 346 lines (+146/-133)
4 files modified
app/alarm/AlarmSettingsPage.qml (+44/-126)
app/components/ExpandableListItem.qml (+93/-0)
debian/changelog (+2/-0)
po/com.ubuntu.clock.pot (+7/-7)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/improve-setting-listitem
Reviewer Review Type Date Requested Status
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Riccardo Padovani Pending
Review via email: mp+252930@code.launchpad.net

Commit message

Made the expandable list item used in AlarmSettings.qml into a generic component to avoid code duplication and also polished its visual style (related to side anchors and tick to indicate selected setting).

Description of the change

Made the expandable list item used in AlarmSettings.qml into a generic component to avoid code duplication and also polished its visual style (related to side anchors and tick to indicate selected setting).

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)
222. By Nekhelesh Ramananthan

Updated copyright

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

merged lp:ubuntu-clock-app

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

Merged lp:ubuntu-clock-app

225. By Nekhelesh Ramananthan

merged lp:ubuntu-clock-app

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

merged lp:ubuntu-clock-app

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
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Looks good to me, testing on krillin. Nice work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/alarm/AlarmSettingsPage.qml'
2--- app/alarm/AlarmSettingsPage.qml 2015-03-12 23:22:12 +0000
3+++ app/alarm/AlarmSettingsPage.qml 2015-04-14 11:08:13 +0000
4@@ -116,140 +116,58 @@
5 }
6 }
7
8- ListItem.Expandable {
9+ ExpandableListItem {
10 id: _alarmDuration
11
12- anchors {
13- left: parent.left
14- right: parent.right
15- }
16-
17- collapseOnClick: true
18- expandedHeight: _contentColumn.height + units.gu(1)
19-
20- Column {
21- id: _contentColumn
22-
23- anchors {
24- left: parent.left
25- right: parent.right
26- margins: units.gu(-2)
27- }
28-
29- Item {
30- width: parent.width
31- height: _alarmDuration.collapsedHeight
32-
33- SubtitledListItem {
34- id: _header
35- text: i18n.tr("Silence after")
36- subText: i18n.tr("%1 minute", "%1 minutes", alarmSettings.duration).arg(alarmSettings.duration)
37- onClicked: _alarmDuration.expanded = true
38-
39- Icon {
40- id: _upArrow
41-
42- width: units.gu(2)
43- height: width
44- anchors.right: parent.right
45- anchors.rightMargin: units.gu(2)
46- anchors.verticalCenter: parent.verticalCenter
47-
48- name: "go-down"
49- color: "Grey"
50- rotation: _alarmDuration.expanded ? 180 : 0
51-
52- Behavior on rotation {
53- UbuntuNumberAnimation {}
54- }
55- }
56- }
57- }
58-
59- ListView {
60- id: _resultsList
61-
62- interactive: false
63- model: durationModel
64- width: parent.width
65- height: units.gu(24)
66-
67- delegate: ListItem.Standard {
68- text: model.text
69- onClicked: {
70- alarmSettings.duration = duration
71- _alarmDuration.expanded = false
72- }
73- }
74+ listViewHeight: units.gu(24)
75+ text: i18n.tr("Silence after")
76+ subText: i18n.tr("%1 minute", "%1 minutes", alarmSettings.duration).arg(alarmSettings.duration)
77+
78+ model: durationModel
79+
80+ delegate: ListItem.Standard {
81+ text: model.text
82+ onClicked: {
83+ alarmSettings.duration = duration
84+ _alarmDuration.expanded = false
85+ }
86+
87+ Icon {
88+ width: units.gu(2)
89+ height: width
90+ name: "ok"
91+ visible: alarmSettings.duration === duration
92+ anchors.right: parent.right
93+ anchors.rightMargin: units.gu(2)
94+ anchors.verticalCenter: parent.verticalCenter
95 }
96 }
97 }
98
99- ListItem.Expandable {
100+ ExpandableListItem {
101 id: _alarmSnooze
102
103- anchors {
104- left: parent.left
105- right: parent.right
106- }
107-
108- collapseOnClick: true
109- expandedHeight: _snoozeContentColumn.height + units.gu(1)
110-
111- Column {
112- id: _snoozeContentColumn
113-
114- anchors {
115- left: parent.left
116- right: parent.right
117- margins: units.gu(-2)
118- }
119-
120- Item {
121- width: parent.width
122- height: _alarmSnooze.collapsedHeight
123-
124- SubtitledListItem {
125- id: _snoozeHeader
126- text: i18n.tr("Snooze for")
127- subText: i18n.tr("%1 minute", "%1 minutes", alarmSettings.snoozeDuration).arg(alarmSettings.snoozeDuration)
128- onClicked: _alarmSnooze.expanded = true
129-
130- Icon {
131- id: _snoozeUpArrow
132-
133- width: units.gu(2)
134- height: width
135- anchors.right: parent.right
136- anchors.rightMargin: units.gu(2)
137- anchors.verticalCenter: parent.verticalCenter
138-
139- name: "go-down"
140- color: "Grey"
141- rotation: _alarmSnooze.expanded ? 180 : 0
142-
143- Behavior on rotation {
144- UbuntuNumberAnimation {}
145- }
146- }
147- }
148- }
149-
150- ListView {
151- id: _snoozeResultsList
152-
153- interactive: false
154- model: snoozeModel
155- width: parent.width
156- height: units.gu(24)
157-
158- delegate: ListItem.Standard {
159- text: model.text
160- onClicked: {
161- alarmSettings.snoozeDuration = duration
162- _alarmSnooze.expanded = false
163- }
164- }
165+ listViewHeight: units.gu(24)
166+ text: i18n.tr("Snooze for")
167+ subText: i18n.tr("%1 minute", "%1 minutes", alarmSettings.snoozeDuration).arg(alarmSettings.snoozeDuration)
168+
169+ model: snoozeModel
170+
171+ delegate: ListItem.Standard {
172+ text: model.text
173+ onClicked: {
174+ alarmSettings.snoozeDuration = duration
175+ _alarmSnooze.expanded = false
176+ }
177+
178+ Icon {
179+ width: units.gu(2)
180+ height: width
181+ name: "ok"
182+ visible: alarmSettings.snoozeDuration === duration
183+ anchors.right: parent.right
184+ anchors.rightMargin: units.gu(2)
185+ anchors.verticalCenter: parent.verticalCenter
186 }
187 }
188 }
189
190=== added file 'app/components/ExpandableListItem.qml'
191--- app/components/ExpandableListItem.qml 1970-01-01 00:00:00 +0000
192+++ app/components/ExpandableListItem.qml 2015-04-14 11:08:13 +0000
193@@ -0,0 +1,93 @@
194+/*
195+ * Copyright (C) 2015 Canonical Ltd
196+ *
197+ * This file is part of Ubuntu Clock App
198+ *
199+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
200+ * it under the terms of the GNU General Public License version 3 as
201+ * published by the Free Software Foundation.
202+ *
203+ * Ubuntu Clock App is distributed in the hope that it will be useful,
204+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
205+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
206+ * GNU General Public License for more details.
207+ *
208+ * You should have received a copy of the GNU General Public License
209+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
210+ */
211+
212+import QtQuick 2.3
213+import Ubuntu.Components 1.1
214+import Ubuntu.Components.ListItems 1.0 as ListItem
215+
216+/*
217+ Component which extends the SDK Expandable list item and provides a easy
218+ to use component where the title, subtitle and a listview can be displayed. It
219+ matches the design specification provided for clock.
220+*/
221+
222+ListItem.Expandable {
223+ id: expandableListItem
224+
225+ // Public APIs
226+ property ListModel model
227+ property Component delegate
228+ property alias text: expandableHeader.text
229+ property alias subText: expandableHeader.subText
230+ property alias listViewHeight: expandableList.height
231+
232+ anchors {
233+ left: parent.left
234+ right: parent.right
235+ margins: units.gu(-2)
236+ }
237+
238+ collapseOnClick: true
239+ expandedHeight: contentColumn.height + units.gu(1)
240+
241+ Column {
242+ id: contentColumn
243+
244+ anchors {
245+ left: parent.left
246+ right: parent.right
247+ }
248+
249+ Item {
250+ width: parent.width
251+ height: expandableListItem.collapsedHeight
252+
253+ SubtitledListItem {
254+ id: expandableHeader
255+ onClicked: expandableListItem.expanded = true
256+
257+ Icon {
258+ id: arrow
259+
260+ width: units.gu(2)
261+ height: width
262+ anchors.right: parent.right
263+ anchors.rightMargin: units.gu(2)
264+ anchors.verticalCenter: parent.verticalCenter
265+
266+ name: "go-down"
267+ color: "Grey"
268+ rotation: expandableListItem.expanded ? 180 : 0
269+
270+ Behavior on rotation {
271+ UbuntuNumberAnimation {}
272+ }
273+ }
274+ }
275+ }
276+
277+ ListView {
278+ id: expandableList
279+ width: parent.width
280+ interactive: false
281+ model: expandableListItem.model
282+ delegate: expandableListItem.delegate
283+ }
284+ }
285+}
286+
287
288=== modified file 'debian/changelog'
289--- debian/changelog 2015-04-06 13:34:43 +0000
290+++ debian/changelog 2015-04-14 11:08:13 +0000
291@@ -12,6 +12,8 @@
292 * Fixed empty state description not wrapping (LP: #1428165)
293 * Fixed edit alarm crash issue in vivid (thanks to Zsombor) (LP: #1429273)
294 * Fixed strings not following gettext-style plural forms. (LP: #1431446)
295+ * Created a generic expandable listitem component for the settings page to avoid
296+ code duplication in AlarmSettings.qml
297 * Renabled create alarm tests on device which were disabled due to upstream bug
298 in autopilot. (LP: #1426108)
299 * Fixed timezone difference label overflowing into the clock (LP: #1440732)
300
301=== modified file 'po/com.ubuntu.clock.pot'
302--- po/com.ubuntu.clock.pot 2015-04-06 13:33:55 +0000
303+++ po/com.ubuntu.clock.pot 2015-04-14 11:08:13 +0000
304@@ -8,7 +8,7 @@
305 msgstr ""
306 "Project-Id-Version: \n"
307 "Report-Msgid-Bugs-To: \n"
308-"POT-Creation-Date: 2015-04-06 15:32+0200\n"
309+"POT-Creation-Date: 2015-04-14 13:07+0200\n"
310 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
311 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
312 "Language-Team: LANGUAGE <LL@li.org>\n"
313@@ -69,8 +69,8 @@
314 #: ../app/alarm/AlarmSettingsPage.qml:55 ../app/alarm/AlarmSettingsPage.qml:56
315 #: ../app/alarm/AlarmSettingsPage.qml:65 ../app/alarm/AlarmSettingsPage.qml:66
316 #: ../app/alarm/AlarmSettingsPage.qml:67 ../app/alarm/AlarmSettingsPage.qml:68
317-#: ../app/alarm/AlarmSettingsPage.qml:146
318-#: ../app/alarm/AlarmSettingsPage.qml:215
319+#: ../app/alarm/AlarmSettingsPage.qml:124
320+#: ../app/alarm/AlarmSettingsPage.qml:152
321 #, qt-format
322 msgid "%1 minute"
323 msgid_plural "%1 minutes"
324@@ -81,19 +81,19 @@
325 msgid "Alarm volume"
326 msgstr ""
327
328-#: ../app/alarm/AlarmSettingsPage.qml:145
329+#: ../app/alarm/AlarmSettingsPage.qml:123
330 msgid "Silence after"
331 msgstr ""
332
333-#: ../app/alarm/AlarmSettingsPage.qml:214
334+#: ../app/alarm/AlarmSettingsPage.qml:151
335 msgid "Snooze for"
336 msgstr ""
337
338-#: ../app/alarm/AlarmSettingsPage.qml:259
339+#: ../app/alarm/AlarmSettingsPage.qml:177
340 msgid "Vibration"
341 msgstr ""
342
343-#: ../app/alarm/AlarmSettingsPage.qml:293
344+#: ../app/alarm/AlarmSettingsPage.qml:211
345 msgid "Change time and date"
346 msgstr ""
347

Subscribers

People subscribed via source and target branches