Merge lp:~ken-vandine/ubuntu-system-settings/lp1519332 into lp:ubuntu-system-settings

Proposed by Ken VanDine
Status: Merged
Approved by: Ken VanDine
Approved revision: 1568
Merged at revision: 1574
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/lp1519332
Merge into: lp:ubuntu-system-settings
Diff against target: 94 lines (+25/-13)
2 files modified
plugins/sound/SoundsList.qml (+16/-7)
plugins/sound/sound.cpp (+9/-6)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/lp1519332
Reviewer Review Type Date Requested Status
Jonas G. Drange (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+279332@code.launchpad.net

Commit message

Don't delete previous custom ringtones unless a new custom ringtone is selected. Set header titled in the picker.

Description of the change

Don't delete previous custom ringtones unless a new custom ringtone is selected. Set header titled in the picker.

To post a comment you must log in.
1568. By Ken VanDine

Don't play more than 30 seconds of the ringtone preview

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

Testing this, I got three, long UI freezes when trying to go back from SoundsList.qml. I wonder if the timer is to blame? There's nothing immediately relevant in the logs.

review: Needs Fixing
Revision history for this message
Ken VanDine (ken-vandine) wrote :

> Testing this, I got three, long UI freezes when trying to go back from
> SoundsList.qml. I wonder if the timer is to blame? There's nothing immediately
> relevant in the logs.

Was the preview playing when you went back?

Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

On 3 December 2015 at 21:33, Ken VanDine <email address hidden> wrote:

>
> Was the preview playing when you went back?

​Not that I can recall.​

Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/sound/SoundsList.qml'
2--- plugins/sound/SoundsList.qml 2015-11-20 13:12:27 +0000
3+++ plugins/sound/SoundsList.qml 2015-12-02 20:51:07 +0000
4@@ -77,6 +77,7 @@
5 backendInfo.incomingMessageSound = path
6 }
7 soundFileNames = refreshSoundFileNames()
8+ previewTimer.start()
9 soundEffect.source = path
10 soundEffect.play()
11 }
12@@ -174,6 +175,12 @@
13 }
14 }
15
16+ Timer {
17+ id: previewTimer
18+ onTriggered: soundEffect.stop()
19+ interval: 30000
20+ }
21+
22 Connections {
23 id: contentHubConnection
24 property var ringtoneCallback
25@@ -181,7 +188,13 @@
26 onStateChanged: {
27 if (activeTransfer.state === ContentTransfer.Charged) {
28 if (activeTransfer.items.length > 0) {
29- var toneUri = activeTransfer.items[0].url;
30+ var item = activeTransfer.items[0];
31+ var toneUri;
32+ if (item.move(backendInfo.customRingtonePath)) {
33+ toneUri = item.url;
34+ } else {
35+ toneUri = backendInfo.customRingtonePath + "/" + item.url.toString().split("/").splice(-1,1);
36+ }
37 ringtoneCallback(toneUri);
38 }
39 }
40@@ -191,11 +204,7 @@
41 Page {
42 id: picker
43 visible: false
44-
45- ContentStore {
46- id: appStore
47- scope: ContentScope.App
48- }
49+ title: i18n.tr("Choose from")
50
51 ContentPeerPicker {
52 id: peerPicker
53@@ -210,7 +219,7 @@
54 function startContentTransfer(callback) {
55 if (callback)
56 contentHubConnection.ringtoneCallback = callback
57- var transfer = peer.request(appStore);
58+ var transfer = peer.request();
59 if (transfer !== null) {
60 soundsPage.activeTransfer = transfer;
61 }
62
63=== modified file 'plugins/sound/sound.cpp'
64--- plugins/sound/sound.cpp 2015-11-16 16:09:02 +0000
65+++ plugins/sound/sound.cpp 2015-12-02 20:51:07 +0000
66@@ -97,9 +97,15 @@
67 QVariant::fromValue(sound));
68 Q_EMIT(incomingCallSoundChanged());
69
70- if (prevSound.startsWith(QString(QStandardPaths::writableLocation(QStandardPaths::DataLocation))) &&
71- prevSound != getIncomingMessageSound())
72- QFile(prevSound).remove();
73+ if (sound.startsWith(customRingtonePath())) {
74+ QDir dir(customRingtonePath());
75+ QFileInfoList files(dir.entryInfoList(QDir::Files));
76+ Q_FOREACH(QFileInfo f, files) {
77+ if (f.absoluteFilePath() != sound)
78+ QFile(f.absoluteFilePath()).remove();
79+ }
80+ }
81+
82 }
83
84 QString Sound::getIncomingMessageSound()
85@@ -120,9 +126,6 @@
86 QVariant::fromValue(sound));
87
88 Q_EMIT(incomingMessageSoundChanged());
89- if (prevSound.startsWith(QString(QStandardPaths::writableLocation(QStandardPaths::DataLocation))) &&
90- prevSound != getIncomingCallSound())
91- QFile(prevSound).remove();
92 }
93
94 bool Sound::getIncomingCallVibrate()

Subscribers

People subscribed via source and target branches