Merge lp:~nik90/ubuntu-clock-app/add-custom-sound-backend into lp:ubuntu-clock-app
- add-custom-sound-backend
- Merge into trunk
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 | ||||
Related bugs: |
|
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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:37
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:38
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Nekhelesh Ramananthan (nik90) wrote : | # |
#blocked due to https:/
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:42
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:43
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Nekhelesh Ramananthan (nik90) wrote : | # |
#unblocked
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:44
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:45
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:46
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:49
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:50
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:51
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:52
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:53
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Riccardo Padovani (rpadovani) wrote : | # |
Code looks good to me, and the new feature works on rev 197
Riccardo Padovani (rpadovani) : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
- 54. By Nekhelesh Ramananthan
-
merged trunk and fixed debian changelog conflict
Nekhelesh Ramananthan (nik90) wrote : | # |
There was a conflict in the debian/changelog file while merging the latest trunk. I fixed that and reapproved.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) : | # |
Preview Diff
1 | === modified file 'app/alarm/AlarmSound.qml' | |||
2 | --- app/alarm/AlarmSound.qml 2014-07-30 20:16:06 +0000 | |||
3 | +++ app/alarm/AlarmSound.qml 2014-08-18 11:06:04 +0000 | |||
4 | @@ -18,7 +18,6 @@ | |||
5 | 18 | 18 | ||
6 | 19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 |
7 | 20 | import Ubuntu.Components 1.1 | 20 | import Ubuntu.Components 1.1 |
8 | 21 | import Qt.labs.folderlistmodel 2.1 | ||
9 | 22 | import Ubuntu.Components.ListItems 1.0 as ListItem | 21 | import Ubuntu.Components.ListItems 1.0 as ListItem |
10 | 23 | 22 | ||
11 | 24 | Page { | 23 | Page { |
12 | @@ -31,11 +30,17 @@ | |||
13 | 31 | // Property to set the alarm sound in the edit alarm page | 30 | // Property to set the alarm sound in the edit alarm page |
14 | 32 | property var alarmSound | 31 | property var alarmSound |
15 | 33 | 32 | ||
21 | 34 | FolderListModel { | 33 | // Property to store the alarm object |
22 | 35 | id: _soundModel | 34 | property var alarm |
23 | 36 | showDirs: false | 35 | |
24 | 37 | nameFilters: [ "*.ogg", "*.mp3" ] | 36 | // Property to set the alarm sound model in the edit alarm page |
25 | 38 | folder: "/usr/share/sounds/ubuntu/ringtones" | 37 | property var soundModel |
26 | 38 | |||
27 | 39 | head.backAction: Action { | ||
28 | 40 | iconName: "back" | ||
29 | 41 | onTriggered: { | ||
30 | 42 | pop() | ||
31 | 43 | } | ||
32 | 39 | } | 44 | } |
33 | 40 | 45 | ||
34 | 41 | Flickable { | 46 | Flickable { |
35 | @@ -43,7 +48,7 @@ | |||
36 | 43 | 48 | ||
37 | 44 | clip: true | 49 | clip: true |
38 | 45 | anchors.fill: parent | 50 | anchors.fill: parent |
40 | 46 | contentHeight: _soundModel.count * units.gu(7) | 51 | contentHeight: soundModel.count * units.gu(7) |
41 | 47 | 52 | ||
42 | 48 | Column { | 53 | Column { |
43 | 49 | id: _alarmSoundColumn | 54 | id: _alarmSoundColumn |
44 | @@ -54,9 +59,9 @@ | |||
45 | 54 | id: _alarmSounds | 59 | id: _alarmSounds |
46 | 55 | objectName: "alarmSounds" | 60 | objectName: "alarmSounds" |
47 | 56 | 61 | ||
49 | 57 | model: _soundModel | 62 | model: soundModel |
50 | 58 | 63 | ||
52 | 59 | ListItem.Base { | 64 | ListItem.Standard { |
53 | 60 | id: _alarmSoundDelegate | 65 | id: _alarmSoundDelegate |
54 | 61 | 66 | ||
55 | 62 | property alias isChecked: _soundStatus.checked | 67 | property alias isChecked: _soundStatus.checked |
56 | @@ -69,6 +74,7 @@ | |||
57 | 69 | 74 | ||
58 | 70 | anchors { | 75 | anchors { |
59 | 71 | left: parent.left | 76 | left: parent.left |
60 | 77 | leftMargin: units.gu(2) | ||
61 | 72 | verticalCenter: parent.verticalCenter | 78 | verticalCenter: parent.verticalCenter |
62 | 73 | } | 79 | } |
63 | 74 | 80 | ||
64 | @@ -77,23 +83,19 @@ | |||
65 | 77 | text: fileBaseName | 83 | text: fileBaseName |
66 | 78 | } | 84 | } |
67 | 79 | 85 | ||
69 | 80 | CheckBox { | 86 | control: CheckBox { |
70 | 81 | id: _soundStatus | 87 | id: _soundStatus |
71 | 82 | objectName: "soundStatus" + index | 88 | objectName: "soundStatus" + index |
72 | 83 | 89 | ||
80 | 84 | anchors { | 90 | checked: alarmSound.subText === _soundName.text ? true |
81 | 85 | right: parent.right | 91 | : false |
75 | 86 | verticalCenter: parent.verticalCenter | ||
76 | 87 | } | ||
77 | 88 | |||
78 | 89 | checked: alarmSound.subText === _soundName.text ? true : | ||
79 | 90 | false | ||
82 | 91 | onClicked: { | 92 | onClicked: { |
83 | 92 | if (checked) { | 93 | if (checked) { |
84 | 93 | alarmSound.subText = _soundName.text | 94 | alarmSound.subText = _soundName.text |
85 | 95 | alarm.sound = fileURL | ||
86 | 94 | 96 | ||
87 | 95 | // Ensures only one alarm sound is selected | 97 | // Ensures only one alarm sound is selected |
89 | 96 | for(var i=0; i<_soundModel.count; i++) { | 98 | for(var i=0; i<soundModel.count; i++) { |
90 | 97 | if(_alarmSounds.itemAt(i).isChecked && | 99 | if(_alarmSounds.itemAt(i).isChecked && |
91 | 98 | i !== index) { | 100 | i !== index) { |
92 | 99 | _alarmSounds.itemAt(i).isChecked = false | 101 | _alarmSounds.itemAt(i).isChecked = false |
93 | @@ -106,15 +108,4 @@ | |||
94 | 106 | } | 108 | } |
95 | 107 | } | 109 | } |
96 | 108 | } | 110 | } |
97 | 109 | |||
98 | 110 | tools: ToolbarItems { | ||
99 | 111 | back: Button { | ||
100 | 112 | action: Action { | ||
101 | 113 | iconName: "back" | ||
102 | 114 | onTriggered: { | ||
103 | 115 | mainStack.pop() | ||
104 | 116 | } | ||
105 | 117 | } | ||
106 | 118 | } | ||
107 | 119 | } | ||
108 | 120 | } | 111 | } |
109 | 121 | 112 | ||
110 | === modified file 'app/alarm/EditAlarmPage.qml' | |||
111 | --- app/alarm/EditAlarmPage.qml 2014-08-11 22:04:27 +0000 | |||
112 | +++ app/alarm/EditAlarmPage.qml 2014-08-18 11:06:04 +0000 | |||
113 | @@ -19,6 +19,7 @@ | |||
114 | 19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 |
115 | 20 | import DateTime 1.0 | 20 | import DateTime 1.0 |
116 | 21 | import Ubuntu.Components 1.1 | 21 | import Ubuntu.Components 1.1 |
117 | 22 | import Qt.labs.folderlistmodel 2.1 | ||
118 | 22 | import Ubuntu.Components.Pickers 1.0 | 23 | import Ubuntu.Components.Pickers 1.0 |
119 | 23 | import Ubuntu.Components.ListItems 1.0 as ListItem | 24 | import Ubuntu.Components.ListItems 1.0 as ListItem |
120 | 24 | import "../components" | 25 | import "../components" |
121 | @@ -73,7 +74,10 @@ | |||
122 | 73 | var alarmTime = new Date() | 74 | var alarmTime = new Date() |
123 | 74 | alarmTime.setHours(_timePicker.hours, _timePicker.minutes, 0) | 75 | alarmTime.setHours(_timePicker.hours, _timePicker.minutes, 0) |
124 | 75 | 76 | ||
126 | 76 | _alarm.message = _alarmLabel.subText | 77 | /* |
127 | 78 | _alarm.sound, _alarm.message and _alarm.daysOfWeek have been set in | ||
128 | 79 | the respective individual pages already. | ||
129 | 80 | */ | ||
130 | 77 | _alarm.date = alarmTime | 81 | _alarm.date = alarmTime |
131 | 78 | _alarm.type = Alarm.Repeating | 82 | _alarm.type = Alarm.Repeating |
132 | 79 | _alarm.enabled = true | 83 | _alarm.enabled = true |
133 | @@ -89,6 +93,7 @@ | |||
134 | 89 | _alarm.daysOfWeek = tempAlarm.daysOfWeek | 93 | _alarm.daysOfWeek = tempAlarm.daysOfWeek |
135 | 90 | _alarm.enabled = tempAlarm.enabled | 94 | _alarm.enabled = tempAlarm.enabled |
136 | 91 | _alarm.date = tempAlarm.date | 95 | _alarm.date = tempAlarm.date |
137 | 96 | _alarm.sound = tempAlarm.sound | ||
138 | 92 | } | 97 | } |
139 | 93 | 98 | ||
140 | 94 | // Function to delete a saved alarm | 99 | // Function to delete a saved alarm |
141 | @@ -112,11 +117,7 @@ | |||
142 | 112 | tempAlarm.date = alarmTime | 117 | tempAlarm.date = alarmTime |
143 | 113 | tempAlarm.type = Alarm.Repeating | 118 | tempAlarm.type = Alarm.Repeating |
144 | 114 | tempAlarm.enabled = _alarm.enabled | 119 | tempAlarm.enabled = _alarm.enabled |
150 | 115 | 120 | tempAlarm.sound = _alarm.sound | |
146 | 116 | /* | ||
147 | 117 | #FIXME: Sometimes the clock app crashes due to this code. Cause not | ||
148 | 118 | known yet! This has been reported at http://pad.lv/1337405. | ||
149 | 119 | */ | ||
151 | 120 | tempAlarm.daysOfWeek = _alarm.daysOfWeek | 121 | tempAlarm.daysOfWeek = _alarm.daysOfWeek |
152 | 121 | 122 | ||
153 | 122 | tempAlarm.save() | 123 | tempAlarm.save() |
154 | @@ -137,6 +138,22 @@ | |||
155 | 137 | } | 138 | } |
156 | 138 | } | 139 | } |
157 | 139 | 140 | ||
158 | 141 | function getSoundName(chosenSoundPath) { | ||
159 | 142 | for(var i=0; i<soundModel.count; i++) { | ||
160 | 143 | if(chosenSoundPath === Qt.resolvedUrl(soundModel.get(i, "filePath"))) { | ||
161 | 144 | return soundModel.get(i, "fileBaseName") | ||
162 | 145 | } | ||
163 | 146 | } | ||
164 | 147 | } | ||
165 | 148 | |||
166 | 149 | function getSoundPath(chosenSoundName) { | ||
167 | 150 | for(var i=0; i<soundModel.count; i++) { | ||
168 | 151 | if(chosenSoundName === soundModel.get(i, "fileBaseName")) { | ||
169 | 152 | return soundModel.get(i, "filePath") | ||
170 | 153 | } | ||
171 | 154 | } | ||
172 | 155 | } | ||
173 | 156 | |||
174 | 140 | Alarm { | 157 | Alarm { |
175 | 141 | id: _alarm | 158 | id: _alarm |
176 | 142 | onStatusChanged: { | 159 | onStatusChanged: { |
177 | @@ -155,6 +172,37 @@ | |||
178 | 155 | } | 172 | } |
179 | 156 | } | 173 | } |
180 | 157 | 174 | ||
181 | 175 | FolderListModel { | ||
182 | 176 | id: soundModel | ||
183 | 177 | |||
184 | 178 | showDirs: false | ||
185 | 179 | nameFilters: [ "*.ogg", "*.mp3" ] | ||
186 | 180 | folder: "/usr/share/sounds/ubuntu/ringtones" | ||
187 | 181 | |||
188 | 182 | onCountChanged: { | ||
189 | 183 | if(count > 0) { | ||
190 | 184 | /* | ||
191 | 185 | When folder model is completely loaded, proceed to perform | ||
192 | 186 | the following operations, | ||
193 | 187 | |||
194 | 188 | if new alarm, then set the sound name as "Suru arpeggio" and | ||
195 | 189 | retrieve the sound path from the folder model to assign to | ||
196 | 190 | the alarm model sound property. | ||
197 | 191 | |||
198 | 192 | If it is a saved alarm, get the sound path from the alarm | ||
199 | 193 | object and retrieve the sound name from the folder model. | ||
200 | 194 | */ | ||
201 | 195 | if(isNewAlarm) { | ||
202 | 196 | _alarm.sound = getSoundPath(_alarmSound._soundName) | ||
203 | 197 | _alarmSound.subText = _alarmSound._soundName | ||
204 | 198 | } | ||
205 | 199 | else { | ||
206 | 200 | _alarmSound.subText = getSoundName(_alarm.sound.toString()) | ||
207 | 201 | } | ||
208 | 202 | } | ||
209 | 203 | } | ||
210 | 204 | } | ||
211 | 205 | |||
212 | 158 | AlarmUtils { | 206 | AlarmUtils { |
213 | 159 | id: alarmUtils | 207 | id: alarmUtils |
214 | 160 | } | 208 | } |
215 | @@ -226,14 +274,16 @@ | |||
216 | 226 | SubtitledListItem { | 274 | SubtitledListItem { |
217 | 227 | id: _alarmSound | 275 | id: _alarmSound |
218 | 228 | objectName: "alarmSound" | 276 | objectName: "alarmSound" |
227 | 229 | /* | 277 | |
228 | 230 | #TODO: Add support for choosing new alarm sound when indicator- | 278 | // Default Alarm Sound for new alarms |
229 | 231 | datetime supports custom alarm sounds | 279 | property string _soundName: "Suru arpeggio" |
230 | 232 | */ | 280 | |
231 | 233 | text: i18n.tr("Sound (disabled)") | 281 | text: i18n.tr("Sound") |
232 | 234 | subText: "Suru arpeggio" | 282 | onClicked: mainStack.push(Qt.resolvedUrl("AlarmSound.qml"), { |
233 | 235 | onClicked: mainStack.push(Qt.resolvedUrl("AlarmSound.qml"), | 283 | "alarmSound": _alarmSound, |
234 | 236 | {"alarmSound": _alarmSound}) | 284 | "alarm": _alarm, |
235 | 285 | "soundModel": soundModel | ||
236 | 286 | }) | ||
237 | 237 | } | 287 | } |
238 | 238 | } | 288 | } |
239 | 239 | 289 | ||
240 | 240 | 290 | ||
241 | === modified file 'debian/changelog' | |||
242 | --- debian/changelog 2014-08-16 08:40:21 +0000 | |||
243 | +++ debian/changelog 2014-08-18 11:06:04 +0000 | |||
244 | @@ -5,6 +5,7 @@ | |||
245 | 5 | strings. (LP: #1355414) | 5 | strings. (LP: #1355414) |
246 | 6 | * Synced the fast scroll component with upstream changes | 6 | * Synced the fast scroll component with upstream changes |
247 | 7 | * Updated inner clock texture as requested by design | 7 | * Updated inner clock texture as requested by design |
248 | 8 | * Added support for custom alarm sounds as per the design spec. | ||
249 | 8 | 9 | ||
250 | 9 | [David Planella] | 10 | [David Planella] |
251 | 10 | * Added internationalization support (LP: #1354522) | 11 | * Added internationalization support (LP: #1354522) |
252 | 11 | 12 | ||
253 | === modified file 'tests/autopilot/ubuntu_clock_app/emulators.py' | |||
254 | --- tests/autopilot/ubuntu_clock_app/emulators.py 2014-08-12 20:41:45 +0000 | |||
255 | +++ tests/autopilot/ubuntu_clock_app/emulators.py 2014-08-18 11:06:04 +0000 | |||
256 | @@ -228,8 +228,12 @@ | |||
257 | 228 | :param test_sound_name = new sound name | 228 | :param test_sound_name = new sound name |
258 | 229 | 229 | ||
259 | 230 | """ | 230 | """ |
262 | 231 | self.wait_select_single("SubtitledListItem", objectName="alarmSound")\ | 231 | try: |
263 | 232 | .subText == test_sound_name | 232 | self.wait_select_single( |
264 | 233 | "SubtitledListItem", objectName="alarmSound").subText.wait_for( | ||
265 | 234 | test_sound_name) | ||
266 | 235 | except AssertionError: | ||
267 | 236 | raise ClockEmulatorException('Error! Incorrect alarm sound') | ||
268 | 233 | 237 | ||
269 | 234 | 238 | ||
270 | 235 | class AlarmRepeat(Page): | 239 | class AlarmRepeat(Page): |
FAILED: Continuous integration, rev:36 91.189. 93.70:8080/ job/ubuntu- clock-dev- ubuntu- clock-app- utopic- 3.0-ci/ 14/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 905/console 91.189. 93.70:8080/ job/ubuntu- clock-dev- ubuntu- clock-app- utopic- 3.0-utopic- amd64-ci/ 14/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- clock-dev- ubuntu- clock-app- utopic- 3.0-ci/ 14/rebuild
http://