Merge lp:~ken-vandine/ubuntu-system-settings/custom_ringtone into lp:ubuntu-system-settings
- custom_ringtone
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Jonas G. Drange | ||||
Approved revision: | 1562 | ||||
Merged at revision: | 1564 | ||||
Proposed branch: | lp:~ken-vandine/ubuntu-system-settings/custom_ringtone | ||||
Merge into: | lp:ubuntu-system-settings | ||||
Diff against target: |
355 lines (+202/-50) 4 files modified
plugins/background/MainPage.qml (+1/-1) plugins/sound/SoundsList.qml (+176/-49) plugins/sound/sound.cpp (+19/-0) plugins/sound/sound.h (+6/-0) |
||||
To merge this branch: | bzr merge lp:~ken-vandine/ubuntu-system-settings/custom_ringtone | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Jonas G. Drange (community) | Approve | ||
Review via email: mp+277576@code.launchpad.net |
Commit message
Allow setting custom ringtone with content-hub
Description of the change
Allow setting custom ringtone with content-hub
PS Jenkins bot (ps-jenkins) wrote : | # |
- 1557. By Ken VanDine
-
delete custom ringtone when it's no longer used
- 1558. By Ken VanDine
-
don't remove custom ringtone if it's still being used for other messages
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1558
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 1559. By Ken VanDine
-
Updated visuals of the stop playback control to match design
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1559
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1559
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1560. By Ken VanDine
-
Don't specifically set the height on the ItemSelector
Jonas G. Drange (jonas-drange) wrote : | # |
Two issues:
* There's a bug in the flickable. I'm unable to scroll to the end. Let me create some steps to repro
* double header http://
Otherwise it works well and looks good!
Jonas G. Drange (jonas-drange) wrote : | # |
Steps to repro:
1. USS -> Sound -> Ringtone
2. Quickly swipe down in the list
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1560
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1561. By Ken VanDine
-
Fixes in the SoundsList flickable
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1561
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1562. By Ken VanDine
-
Don't show the page title in the peer picker and use progression to indicate the peer picker is a page
Jonas G. Drange (jonas-drange) wrote : | # |
Looks good and works well. Thanks!
- 1563. By Ken VanDine
-
Only show the custom ringtone picker for incoming calls
- 1564. By Ken VanDine
-
merged trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1562
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1565. By Ken VanDine
-
Don't include the custom ringtone for messages
Preview Diff
1 | === modified file 'plugins/background/MainPage.qml' |
2 | --- plugins/background/MainPage.qml 2015-08-10 13:31:45 +0000 |
3 | +++ plugins/background/MainPage.qml 2015-11-20 13:12:56 +0000 |
4 | @@ -21,7 +21,7 @@ |
5 | import QtQuick 2.4 |
6 | import GSettings 1.0 |
7 | import SystemSettings 1.0 |
8 | -import Ubuntu.Content 0.1 |
9 | +import Ubuntu.Content 1.3 |
10 | import Ubuntu.Components 1.3 |
11 | import Ubuntu.Components.ListItems 1.3 as ListItem |
12 | import Ubuntu.Components.Popups 1.3 |
13 | |
14 | === modified file 'plugins/sound/SoundsList.qml' |
15 | --- plugins/sound/SoundsList.qml 2015-10-16 13:42:50 +0000 |
16 | +++ plugins/sound/SoundsList.qml 2015-11-20 13:12:56 +0000 |
17 | @@ -2,6 +2,7 @@ |
18 | import QtQuick 2.4 |
19 | import QtMultimedia 5.0 |
20 | import SystemSettings 1.0 |
21 | +import Ubuntu.Content 1.3 |
22 | import Ubuntu.Components 1.3 |
23 | import Ubuntu.Components.ListItems 1.3 as ListItem |
24 | import Ubuntu.SystemSettings.Sound 1.0 |
25 | @@ -12,13 +13,25 @@ |
26 | ItemPage { |
27 | property variant soundDisplayNames: |
28 | Utilities.buildSoundValues(soundFileNames) |
29 | - property variant soundFileNames: backendInfo.listSounds( |
30 | - [soundsDir, "/custom" + soundsDir]) |
31 | + property variant soundFileNames: refreshSoundFileNames() |
32 | property bool showStopButton: false |
33 | property int soundType // 0: ringtone, 1: message |
34 | property string soundsDir |
35 | + property var activeTransfer |
36 | + |
37 | + onSoundFileNamesChanged: { |
38 | + soundDisplayNames = Utilities.buildSoundValues(soundFileNames) |
39 | + updateSelectedIndex() |
40 | + } |
41 | |
42 | id: soundsPage |
43 | + flickable: scrollWidget |
44 | + |
45 | + function refreshSoundFileNames() { |
46 | + if (soundType === 0) |
47 | + return backendInfo.listSounds([soundsDir, "/custom" + soundsDir, backendInfo.customRingtonePath]) |
48 | + return backendInfo.listSounds([soundsDir, "/custom" + soundsDir]) |
49 | + } |
50 | |
51 | UbuntuSoundPanel { |
52 | id: backendInfo |
53 | @@ -55,52 +68,166 @@ |
54 | audioRole: MediaPlayer.alert |
55 | } |
56 | |
57 | - Column { |
58 | - id: columnId |
59 | - anchors.left: parent.left |
60 | - anchors.right: parent.right |
61 | - |
62 | - ListItem.SingleControl { |
63 | - id: listId |
64 | - control: Button { |
65 | - text: i18n.tr("Stop playing") |
66 | - width: parent.width - units.gu(4) |
67 | - onClicked: |
68 | - soundEffect.stop() |
69 | - } |
70 | + function setRingtone(path) { |
71 | + if (soundType == 0) { |
72 | + soundSettings.incomingCallSound = path |
73 | + backendInfo.incomingCallSound = path |
74 | + } else if (soundType == 1) { |
75 | + soundSettings.incomingMessageSound = path |
76 | + backendInfo.incomingMessageSound = path |
77 | + } |
78 | + soundFileNames = refreshSoundFileNames() |
79 | + soundEffect.source = path |
80 | + soundEffect.play() |
81 | + } |
82 | + |
83 | + function updateSelectedIndex() { |
84 | + if (soundType == 0) |
85 | + soundSelector.selectedIndex = |
86 | + Utilities.indexSelectedFile(soundFileNames, |
87 | + backendInfo.incomingCallSound) |
88 | + else if (soundType == 1) |
89 | + soundSelector.selectedIndex = |
90 | + Utilities.indexSelectedFile(soundFileNames, |
91 | + backendInfo.incomingMessageSound) |
92 | + } |
93 | + |
94 | + Flickable { |
95 | + id: scrollWidget |
96 | + anchors.fill: parent |
97 | + contentWidth: parent.width |
98 | + contentHeight: selectorColumn.height + stopItem.height |
99 | + boundsBehavior: (contentHeight > height) ? |
100 | + Flickable.DragAndOvershootBounds : |
101 | + Flickable.StopAtBounds |
102 | + /* Set the direction to workaround https://bugreports.qt-project.org/browse/QTBUG-31905 |
103 | + otherwise the UI might end up in a situation where scrolling doesn't work */ |
104 | + flickableDirection: Flickable.VerticalFlick |
105 | + |
106 | + Column { |
107 | + id: selectorColumn |
108 | + anchors.left: parent.left |
109 | + anchors.right: parent.right |
110 | + |
111 | + ListItem.ItemSelector { |
112 | + id: soundSelector |
113 | + expanded: true |
114 | + model: soundDisplayNames |
115 | + selectedIndex: { |
116 | + updateSelectedIndex() |
117 | + } |
118 | + onDelegateClicked: { |
119 | + setRingtone(soundFileNames[index]) |
120 | + } |
121 | + } |
122 | + |
123 | + ListItem.Standard { |
124 | + id: customRingtone |
125 | + text: i18n.tr("Custom Ringtone") |
126 | + visible: soundType === 0 |
127 | + progression: true |
128 | + onClicked: { |
129 | + pageStack.push(picker); |
130 | + } |
131 | + } |
132 | + } |
133 | + } |
134 | + |
135 | + ListItem.SingleControl { |
136 | + id: stopItem |
137 | + anchors.bottom: parent.bottom |
138 | + control: AbstractButton { |
139 | + id: stopButton |
140 | + anchors.verticalCenter: parent.verticalCenter |
141 | + anchors.horizontalCenter: parent.horizontalCenter |
142 | + focus: false |
143 | + width: height |
144 | + height: units.gu(4) |
145 | enabled: soundEffect.playbackState == Audio.PlayingState |
146 | - visible: showStopButton |
147 | - } |
148 | - } |
149 | - |
150 | - ListItem.ItemSelector { |
151 | - id: soundSelector |
152 | - anchors.top: columnId.bottom |
153 | - anchors.bottom: soundsPage.bottom |
154 | - containerHeight: height |
155 | - |
156 | - expanded: true |
157 | - model: soundDisplayNames |
158 | - selectedIndex: { |
159 | - if (soundType == 0) |
160 | - soundSelector.selectedIndex = |
161 | - Utilities.indexSelectedFile(soundFileNames, |
162 | - backendInfo.incomingCallSound) |
163 | - else if (soundType == 1) |
164 | - soundSelector.selectedIndex = |
165 | - Utilities.indexSelectedFile(soundFileNames, |
166 | - backendInfo.incomingMessageSound) |
167 | - } |
168 | - onDelegateClicked: { |
169 | - if (soundType == 0) { |
170 | - soundSettings.incomingCallSound = soundFileNames[index] |
171 | - backendInfo.incomingCallSound = soundFileNames[index] |
172 | - } else if (soundType == 1) { |
173 | - soundSettings.incomingMessageSound = soundFileNames[index] |
174 | - backendInfo.incomingMessageSound = soundFileNames[index] |
175 | - } |
176 | - soundEffect.source = soundFileNames[index] |
177 | - soundEffect.play() |
178 | - } |
179 | - } |
180 | + visible: enabled |
181 | + |
182 | + onClicked: soundEffect.stop() |
183 | + |
184 | + Rectangle { |
185 | + anchors.fill: parent |
186 | + radius: width * 0.5 |
187 | + border.color: UbuntuColors.warmGrey |
188 | + border.width: 1 |
189 | + } |
190 | + |
191 | + Rectangle { |
192 | + width: parent.height * 0.4 |
193 | + height: width |
194 | + smooth: true |
195 | + anchors { |
196 | + verticalCenter: parent.verticalCenter |
197 | + horizontalCenter: parent.horizontalCenter |
198 | + } |
199 | + color: UbuntuColors.warmGrey |
200 | + } |
201 | + } |
202 | + Rectangle { |
203 | + anchors.fill: parent |
204 | + z: parent.z - 1 |
205 | + visible: stopButton.visible |
206 | + color: Theme.palette.normal.background |
207 | + } |
208 | + } |
209 | + |
210 | + Connections { |
211 | + id: contentHubConnection |
212 | + property var ringtoneCallback |
213 | + target: activeTransfer ? activeTransfer : null |
214 | + onStateChanged: { |
215 | + if (activeTransfer.state === ContentTransfer.Charged) { |
216 | + if (activeTransfer.items.length > 0) { |
217 | + var toneUri = activeTransfer.items[0].url; |
218 | + ringtoneCallback(toneUri); |
219 | + } |
220 | + } |
221 | + } |
222 | + } |
223 | + |
224 | + Page { |
225 | + id: picker |
226 | + visible: false |
227 | + |
228 | + ContentStore { |
229 | + id: appStore |
230 | + scope: ContentScope.App |
231 | + } |
232 | + |
233 | + ContentPeerPicker { |
234 | + id: peerPicker |
235 | + visible: parent.visible |
236 | + handler: ContentHandler.Source |
237 | + contentType: ContentType.Music |
238 | + showTitle: false |
239 | + |
240 | + onPeerSelected: { |
241 | + pageStack.pop(); |
242 | + // requests an active transfer from peer |
243 | + function startContentTransfer(callback) { |
244 | + if (callback) |
245 | + contentHubConnection.ringtoneCallback = callback |
246 | + var transfer = peer.request(appStore); |
247 | + if (transfer !== null) { |
248 | + soundsPage.activeTransfer = transfer; |
249 | + } |
250 | + } |
251 | + peer.selectionType = ContentTransfer.Single; |
252 | + startContentTransfer(function(uri) { |
253 | + setRingtone(uri.toString().replace("file:///", "/")); |
254 | + }); |
255 | + } |
256 | + |
257 | + onCancelPressed: pageStack.pop(); |
258 | + } |
259 | + } |
260 | + |
261 | + ContentTransferHint { |
262 | + anchors.fill: parent |
263 | + activeTransfer: soundsPage.activeTransfer |
264 | + } |
265 | + |
266 | } |
267 | |
268 | === modified file 'plugins/sound/sound.cpp' |
269 | --- plugins/sound/sound.cpp 2015-01-28 11:37:35 +0000 |
270 | +++ plugins/sound/sound.cpp 2015-11-20 13:12:56 +0000 |
271 | @@ -21,6 +21,8 @@ |
272 | #include "sound.h" |
273 | |
274 | #include <QDir> |
275 | +#include <QFile> |
276 | +#include <QStandardPaths> |
277 | #include <unistd.h> |
278 | |
279 | #define AS_INTERFACE "com.ubuntu.touch.AccountsService.Sound" |
280 | @@ -88,10 +90,16 @@ |
281 | if (sound == getIncomingCallSound()) |
282 | return; |
283 | |
284 | + QString prevSound = getIncomingCallSound(); |
285 | + |
286 | m_accountsService.setUserProperty(AS_INTERFACE, |
287 | "IncomingCallSound", |
288 | QVariant::fromValue(sound)); |
289 | Q_EMIT(incomingCallSoundChanged()); |
290 | + |
291 | + if (prevSound.startsWith(QString(QStandardPaths::writableLocation(QStandardPaths::DataLocation))) && |
292 | + prevSound != getIncomingMessageSound()) |
293 | + QFile(prevSound).remove(); |
294 | } |
295 | |
296 | QString Sound::getIncomingMessageSound() |
297 | @@ -105,10 +113,16 @@ |
298 | if (sound == getIncomingMessageSound()) |
299 | return; |
300 | |
301 | + QString prevSound = getIncomingMessageSound(); |
302 | + |
303 | m_accountsService.setUserProperty(AS_INTERFACE, |
304 | "IncomingMessageSound", |
305 | QVariant::fromValue(sound)); |
306 | + |
307 | Q_EMIT(incomingMessageSoundChanged()); |
308 | + if (prevSound.startsWith(QString(QStandardPaths::writableLocation(QStandardPaths::DataLocation))) && |
309 | + prevSound != getIncomingCallSound()) |
310 | + QFile(prevSound).remove(); |
311 | } |
312 | |
313 | bool Sound::getIncomingCallVibrate() |
314 | @@ -213,6 +227,11 @@ |
315 | Q_EMIT(dialpadSoundsEnabledChanged()); |
316 | } |
317 | |
318 | +QString Sound::customRingtonePath() |
319 | +{ |
320 | + return QString(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/Music"); |
321 | +} |
322 | + |
323 | QStringList soundsListFromDir(const QString &dirString) |
324 | { |
325 | QDir soundsDir(dirString); |
326 | |
327 | === modified file 'plugins/sound/sound.h' |
328 | --- plugins/sound/sound.h 2015-01-28 11:37:35 +0000 |
329 | +++ plugins/sound/sound.h 2015-11-20 13:12:56 +0000 |
330 | @@ -67,6 +67,10 @@ |
331 | WRITE setDialpadSoundsEnabled |
332 | NOTIFY dialpadSoundsEnabledChanged) |
333 | |
334 | + Q_PROPERTY (QString customRingtonePath |
335 | + READ customRingtonePath |
336 | + NOTIFY customRingtonePathChanged) |
337 | + |
338 | |
339 | public Q_SLOTS: |
340 | void slotChanged(QString, QString); |
341 | @@ -81,6 +85,7 @@ |
342 | void incomingMessageVibrateSilentModeChanged(); |
343 | void otherVibrateChanged(); |
344 | void dialpadSoundsEnabledChanged(); |
345 | + void customRingtonePathChanged(); |
346 | |
347 | private: |
348 | AccountsService m_accountsService; |
349 | @@ -101,6 +106,7 @@ |
350 | void setOtherVibrate(bool enabled); |
351 | bool getDialpadSoundsEnabled(); |
352 | void setDialpadSoundsEnabled(bool enabled); |
353 | + QString customRingtonePath(); |
354 | |
355 | }; |
356 |
FAILED: Continuous integration, rev:1556 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- ci/2481/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- vivid-touch/ 5172/console jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- vivid-amd64- ci/256 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- vivid-i386- ci/665 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 5186 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 5186/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- system- settings- ci/2481/ rebuild
http://