Merge lp:~nik90/ubuntu-clock-app/add-custom-sound-backend into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 54
Merged at revision: 56
Proposed branch: lp:~nik90/ubuntu-clock-app/add-custom-sound-backend
Merge into: lp:ubuntu-clock-app
Prerequisite: lp:~nik90/ubuntu-clock-app/add-modify-alarm-support
Diff against target: 270 lines (+91/-45)
4 files modified
app/alarm/AlarmSound.qml (+20/-29)
app/alarm/EditAlarmPage.qml (+64/-14)
debian/changelog (+1/-0)
tests/autopilot/ubuntu_clock_app/emulators.py (+6/-2)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/add-custom-sound-backend
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Riccardo Padovani Approve
Nekhelesh Ramananthan Needs Fixing
Andrew Hayzen Pending
Review via email: mp+225812@code.launchpad.net

Commit message

Add support for custom sounds

Description of the change

Add support for custom sounds

NOTE: Test with image #189 and higher

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)
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)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :
review: Needs Fixing
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)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

#unblocked

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
Nicholas Skaggs (nskaggs) wrote :
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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
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: Approve (continuous-integration)
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
Riccardo Padovani (rpadovani) wrote :

Code looks good to me, and the new feature works on rev 197

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

merged trunk and fixed debian changelog conflict

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

There was a conflict in the debian/changelog file while merging the latest trunk. I fixed that and reapproved.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/alarm/AlarmSound.qml'
--- app/alarm/AlarmSound.qml 2014-07-30 20:16:06 +0000
+++ app/alarm/AlarmSound.qml 2014-08-18 11:06:04 +0000
@@ -18,7 +18,6 @@
1818
19import QtQuick 2.019import QtQuick 2.0
20import Ubuntu.Components 1.120import Ubuntu.Components 1.1
21import Qt.labs.folderlistmodel 2.1
22import Ubuntu.Components.ListItems 1.0 as ListItem21import Ubuntu.Components.ListItems 1.0 as ListItem
2322
24Page {23Page {
@@ -31,11 +30,17 @@
31 // Property to set the alarm sound in the edit alarm page30 // Property to set the alarm sound in the edit alarm page
32 property var alarmSound31 property var alarmSound
3332
34 FolderListModel {33 // Property to store the alarm object
35 id: _soundModel34 property var alarm
36 showDirs: false35
37 nameFilters: [ "*.ogg", "*.mp3" ]36 // Property to set the alarm sound model in the edit alarm page
38 folder: "/usr/share/sounds/ubuntu/ringtones"37 property var soundModel
38
39 head.backAction: Action {
40 iconName: "back"
41 onTriggered: {
42 pop()
43 }
39 }44 }
4045
41 Flickable {46 Flickable {
@@ -43,7 +48,7 @@
4348
44 clip: true49 clip: true
45 anchors.fill: parent50 anchors.fill: parent
46 contentHeight: _soundModel.count * units.gu(7)51 contentHeight: soundModel.count * units.gu(7)
4752
48 Column {53 Column {
49 id: _alarmSoundColumn54 id: _alarmSoundColumn
@@ -54,9 +59,9 @@
54 id: _alarmSounds59 id: _alarmSounds
55 objectName: "alarmSounds"60 objectName: "alarmSounds"
5661
57 model: _soundModel62 model: soundModel
5863
59 ListItem.Base {64 ListItem.Standard {
60 id: _alarmSoundDelegate65 id: _alarmSoundDelegate
6166
62 property alias isChecked: _soundStatus.checked67 property alias isChecked: _soundStatus.checked
@@ -69,6 +74,7 @@
6974
70 anchors {75 anchors {
71 left: parent.left76 left: parent.left
77 leftMargin: units.gu(2)
72 verticalCenter: parent.verticalCenter78 verticalCenter: parent.verticalCenter
73 }79 }
7480
@@ -77,23 +83,19 @@
77 text: fileBaseName83 text: fileBaseName
78 }84 }
7985
80 CheckBox {86 control: CheckBox {
81 id: _soundStatus87 id: _soundStatus
82 objectName: "soundStatus" + index88 objectName: "soundStatus" + index
8389
84 anchors {90 checked: alarmSound.subText === _soundName.text ? true
85 right: parent.right91 : false
86 verticalCenter: parent.verticalCenter
87 }
88
89 checked: alarmSound.subText === _soundName.text ? true :
90 false
91 onClicked: {92 onClicked: {
92 if (checked) {93 if (checked) {
93 alarmSound.subText = _soundName.text94 alarmSound.subText = _soundName.text
95 alarm.sound = fileURL
9496
95 // Ensures only one alarm sound is selected97 // Ensures only one alarm sound is selected
96 for(var i=0; i<_soundModel.count; i++) {98 for(var i=0; i<soundModel.count; i++) {
97 if(_alarmSounds.itemAt(i).isChecked &&99 if(_alarmSounds.itemAt(i).isChecked &&
98 i !== index) {100 i !== index) {
99 _alarmSounds.itemAt(i).isChecked = false101 _alarmSounds.itemAt(i).isChecked = false
@@ -106,15 +108,4 @@
106 }108 }
107 }109 }
108 }110 }
109
110 tools: ToolbarItems {
111 back: Button {
112 action: Action {
113 iconName: "back"
114 onTriggered: {
115 mainStack.pop()
116 }
117 }
118 }
119 }
120}111}
121112
=== modified file 'app/alarm/EditAlarmPage.qml'
--- app/alarm/EditAlarmPage.qml 2014-08-11 22:04:27 +0000
+++ app/alarm/EditAlarmPage.qml 2014-08-18 11:06:04 +0000
@@ -19,6 +19,7 @@
19import QtQuick 2.019import QtQuick 2.0
20import DateTime 1.020import DateTime 1.0
21import Ubuntu.Components 1.121import Ubuntu.Components 1.1
22import Qt.labs.folderlistmodel 2.1
22import Ubuntu.Components.Pickers 1.023import Ubuntu.Components.Pickers 1.0
23import Ubuntu.Components.ListItems 1.0 as ListItem24import Ubuntu.Components.ListItems 1.0 as ListItem
24import "../components"25import "../components"
@@ -73,7 +74,10 @@
73 var alarmTime = new Date()74 var alarmTime = new Date()
74 alarmTime.setHours(_timePicker.hours, _timePicker.minutes, 0)75 alarmTime.setHours(_timePicker.hours, _timePicker.minutes, 0)
7576
76 _alarm.message = _alarmLabel.subText77 /*
78 _alarm.sound, _alarm.message and _alarm.daysOfWeek have been set in
79 the respective individual pages already.
80 */
77 _alarm.date = alarmTime81 _alarm.date = alarmTime
78 _alarm.type = Alarm.Repeating82 _alarm.type = Alarm.Repeating
79 _alarm.enabled = true83 _alarm.enabled = true
@@ -89,6 +93,7 @@
89 _alarm.daysOfWeek = tempAlarm.daysOfWeek93 _alarm.daysOfWeek = tempAlarm.daysOfWeek
90 _alarm.enabled = tempAlarm.enabled94 _alarm.enabled = tempAlarm.enabled
91 _alarm.date = tempAlarm.date95 _alarm.date = tempAlarm.date
96 _alarm.sound = tempAlarm.sound
92 }97 }
9398
94 // Function to delete a saved alarm99 // Function to delete a saved alarm
@@ -112,11 +117,7 @@
112 tempAlarm.date = alarmTime117 tempAlarm.date = alarmTime
113 tempAlarm.type = Alarm.Repeating118 tempAlarm.type = Alarm.Repeating
114 tempAlarm.enabled = _alarm.enabled119 tempAlarm.enabled = _alarm.enabled
115120 tempAlarm.sound = _alarm.sound
116 /*
117 #FIXME: Sometimes the clock app crashes due to this code. Cause not
118 known yet! This has been reported at http://pad.lv/1337405.
119 */
120 tempAlarm.daysOfWeek = _alarm.daysOfWeek121 tempAlarm.daysOfWeek = _alarm.daysOfWeek
121122
122 tempAlarm.save()123 tempAlarm.save()
@@ -137,6 +138,22 @@
137 }138 }
138 }139 }
139140
141 function getSoundName(chosenSoundPath) {
142 for(var i=0; i<soundModel.count; i++) {
143 if(chosenSoundPath === Qt.resolvedUrl(soundModel.get(i, "filePath"))) {
144 return soundModel.get(i, "fileBaseName")
145 }
146 }
147 }
148
149 function getSoundPath(chosenSoundName) {
150 for(var i=0; i<soundModel.count; i++) {
151 if(chosenSoundName === soundModel.get(i, "fileBaseName")) {
152 return soundModel.get(i, "filePath")
153 }
154 }
155 }
156
140 Alarm {157 Alarm {
141 id: _alarm158 id: _alarm
142 onStatusChanged: {159 onStatusChanged: {
@@ -155,6 +172,37 @@
155 }172 }
156 }173 }
157174
175 FolderListModel {
176 id: soundModel
177
178 showDirs: false
179 nameFilters: [ "*.ogg", "*.mp3" ]
180 folder: "/usr/share/sounds/ubuntu/ringtones"
181
182 onCountChanged: {
183 if(count > 0) {
184 /*
185 When folder model is completely loaded, proceed to perform
186 the following operations,
187
188 if new alarm, then set the sound name as "Suru arpeggio" and
189 retrieve the sound path from the folder model to assign to
190 the alarm model sound property.
191
192 If it is a saved alarm, get the sound path from the alarm
193 object and retrieve the sound name from the folder model.
194 */
195 if(isNewAlarm) {
196 _alarm.sound = getSoundPath(_alarmSound._soundName)
197 _alarmSound.subText = _alarmSound._soundName
198 }
199 else {
200 _alarmSound.subText = getSoundName(_alarm.sound.toString())
201 }
202 }
203 }
204 }
205
158 AlarmUtils {206 AlarmUtils {
159 id: alarmUtils207 id: alarmUtils
160 }208 }
@@ -226,14 +274,16 @@
226 SubtitledListItem {274 SubtitledListItem {
227 id: _alarmSound275 id: _alarmSound
228 objectName: "alarmSound"276 objectName: "alarmSound"
229 /*277
230 #TODO: Add support for choosing new alarm sound when indicator-278 // Default Alarm Sound for new alarms
231 datetime supports custom alarm sounds279 property string _soundName: "Suru arpeggio"
232 */280
233 text: i18n.tr("Sound (disabled)")281 text: i18n.tr("Sound")
234 subText: "Suru arpeggio"282 onClicked: mainStack.push(Qt.resolvedUrl("AlarmSound.qml"), {
235 onClicked: mainStack.push(Qt.resolvedUrl("AlarmSound.qml"),283 "alarmSound": _alarmSound,
236 {"alarmSound": _alarmSound})284 "alarm": _alarm,
285 "soundModel": soundModel
286 })
237 }287 }
238 }288 }
239289
240290
=== modified file 'debian/changelog'
--- debian/changelog 2014-08-16 08:40:21 +0000
+++ debian/changelog 2014-08-18 11:06:04 +0000
@@ -5,6 +5,7 @@
5 strings. (LP: #1355414)5 strings. (LP: #1355414)
6 * Synced the fast scroll component with upstream changes6 * Synced the fast scroll component with upstream changes
7 * Updated inner clock texture as requested by design7 * Updated inner clock texture as requested by design
8 * Added support for custom alarm sounds as per the design spec.
89
9 [David Planella]10 [David Planella]
10 * Added internationalization support (LP: #1354522)11 * Added internationalization support (LP: #1354522)
1112
=== modified file 'tests/autopilot/ubuntu_clock_app/emulators.py'
--- tests/autopilot/ubuntu_clock_app/emulators.py 2014-08-12 20:41:45 +0000
+++ tests/autopilot/ubuntu_clock_app/emulators.py 2014-08-18 11:06:04 +0000
@@ -228,8 +228,12 @@
228 :param test_sound_name = new sound name228 :param test_sound_name = new sound name
229229
230 """230 """
231 self.wait_select_single("SubtitledListItem", objectName="alarmSound")\231 try:
232 .subText == test_sound_name232 self.wait_select_single(
233 "SubtitledListItem", objectName="alarmSound").subText.wait_for(
234 test_sound_name)
235 except AssertionError:
236 raise ClockEmulatorException('Error! Incorrect alarm sound')
233237
234238
235class AlarmRepeat(Page):239class AlarmRepeat(Page):

Subscribers

People subscribed via source and target branches