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

Proposed by Ken VanDine
Status: Merged
Approved by: Ken VanDine
Approved revision: 969
Merged at revision: 972
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/dialpad_sounds
Merge into: lp:ubuntu-system-settings
Diff against target: 261 lines (+104/-10)
8 files modified
debian/control (+1/-1)
plugins/phone/PageComponent.qml (+16/-2)
plugins/sound/PageComponent.qml (+9/-0)
plugins/sound/sound.cpp (+17/-0)
plugins/sound/sound.h (+8/-0)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+23/-5)
tests/autopilot/ubuntu_system_settings/tests/test_phone.py (+20/-2)
tests/autopilot/ubuntu_system_settings/tests/test_sound.py (+10/-0)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/dialpad_sounds
Reviewer Review Type Date Requested Status
Jonas G. Drange (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+232606@code.launchpad.net

Commit message

Added setting for dialpad sounds to both the sound and phone panels.

Description of the change

Added setting for dialpad sounds to both the sound and phone panels. Requires the accounts settings schema from https://code.launchpad.net/~ken-vandine/gsettings-ubuntu-touch-schemas/dialpad_sounds/+merge/232596

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

The CI failure is expected, it depends on an unreleased version of accountsservice-ubuntu-schemas.

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

NOTE: The design calls for playing back tone sounds when enabling dialpad sounds, which isn't implemented yet. This handles the setting itself, the sample playback can come in a separate branch.

968. By Ken VanDine

merged trunk

969. By Ken VanDine

Bumped depends for accountsservice-ubuntu-schemas to >= 0.0.3+14.10.20140829 to
get the DialpadSoundsEnabled setting

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

Battling with deps on my phone, but LGTM! Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-08-28 18:11:36 +0000
3+++ debian/control 2014-08-29 15:47:15 +0000
4@@ -52,7 +52,7 @@
5 Depends: ${misc:Depends},
6 ${shlibs:Depends},
7 accountsservice,
8- accountsservice-ubuntu-schemas (>= 0.0.3),
9+ accountsservice-ubuntu-schemas (>= 0.0.3+14.10.20140829),
10 bluez (>= 4.36),
11 dbus-property-service [amd64 armhf i386],
12 gsettings-desktop-schemas,
13
14=== modified file 'plugins/phone/PageComponent.qml'
15--- plugins/phone/PageComponent.qml 2014-08-19 15:59:18 +0000
16+++ plugins/phone/PageComponent.qml 2014-08-29 15:47:15 +0000
17@@ -22,6 +22,7 @@
18 import SystemSettings 1.0
19 import Ubuntu.Components 0.1
20 import Ubuntu.Components.ListItems 0.1 as ListItem
21+import Ubuntu.SystemSettings.Sound 1.0
22 import MeeGo.QOfono 0.2
23 import "sims.js" as Sims
24
25@@ -79,6 +80,8 @@
26 }
27 }
28
29+ UbuntuSoundPanel { id: soundPlugin }
30+
31 Flickable {
32 id: flick
33 anchors.fill: parent
34@@ -88,11 +91,22 @@
35 Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
36
37 Column {
38- anchors { left: parent.left; right: parent.right }
39+ anchors { left: parent.left; right: parent.right }
40
41 Loader {
42 id: loader
43- anchors { left: parent.left; right: parent.right }
44+ anchors { left: parent.left; right: parent.right }
45+ }
46+
47+ ListItem.Divider {}
48+
49+ ListItem.Standard {
50+ control: Switch {
51+ objectName: "dialpadSounds"
52+ checked: soundPlugin.dialpadSoundsEnabled
53+ onCheckedChanged: soundPlugin.dialpadSoundsEnabled = checked
54+ }
55+ text: i18n.tr("Dialpad sounds")
56 }
57 }
58 }
59
60=== modified file 'plugins/sound/PageComponent.qml'
61--- plugins/sound/PageComponent.qml 2014-07-28 15:14:46 +0000
62+++ plugins/sound/PageComponent.qml 2014-08-29 15:47:15 +0000
63@@ -144,6 +144,15 @@
64 }
65
66 ListItem.Standard {
67+ control: Switch {
68+ objectName: "dialpadSounds"
69+ checked: backendInfo.dialpadSoundsEnabled
70+ onCheckedChanged: backendInfo.dialpadSoundsEnabled = checked
71+ }
72+ text: i18n.tr("Dialpad sounds")
73+ }
74+
75+ ListItem.Standard {
76 text: i18n.tr("Messages:")
77 }
78
79
80=== modified file 'plugins/sound/sound.cpp'
81--- plugins/sound/sound.cpp 2014-08-11 09:18:12 +0000
82+++ plugins/sound/sound.cpp 2014-08-29 15:47:15 +0000
83@@ -193,6 +193,23 @@
84 Q_EMIT(incomingMessageVibrateSilentModeChanged());
85 }
86
87+bool Sound::getDialpadSoundsEnabled()
88+{
89+ return m_accountsService.getUserProperty(AS_INTERFACE,
90+ "DialpadSoundsEnabled").toBool();
91+}
92+
93+void Sound::setDialpadSoundsEnabled(bool enabled)
94+{
95+ if (enabled == getDialpadSoundsEnabled())
96+ return;
97+
98+ m_accountsService.setUserProperty(AS_INTERFACE,
99+ "DialpadSoundsEnabled",
100+ QVariant::fromValue(enabled));
101+ Q_EMIT(dialpadSoundsEnabledChanged());
102+}
103+
104 QStringList Sound::listSounds(const QString &dirString)
105 {
106 if (m_soundsList.isEmpty())
107
108=== modified file 'plugins/sound/sound.h'
109--- plugins/sound/sound.h 2014-07-28 14:30:10 +0000
110+++ plugins/sound/sound.h 2014-08-29 15:47:15 +0000
111@@ -62,6 +62,11 @@
112 WRITE setIncomingMessageVibrateSilentMode
113 NOTIFY incomingMessageVibrateSilentModeChanged)
114
115+ Q_PROPERTY (bool dialpadSoundsEnabled
116+ READ getDialpadSoundsEnabled
117+ WRITE setDialpadSoundsEnabled
118+ NOTIFY dialpadSoundsEnabledChanged)
119+
120
121 public Q_SLOTS:
122 void slotChanged(QString, QString);
123@@ -75,6 +80,7 @@
124 void incomingMessageVibrateChanged();
125 void incomingCallVibrateSilentModeChanged();
126 void incomingMessageVibrateSilentModeChanged();
127+ void dialpadSoundsEnabledChanged();
128
129 private:
130 AccountsService m_accountsService;
131@@ -94,6 +100,8 @@
132 void setIncomingCallVibrateSilentMode(bool enabled);
133 bool getIncomingMessageVibrateSilentMode();
134 void setIncomingMessageVibrateSilentMode(bool enabled);
135+ bool getDialpadSoundsEnabled();
136+ void setDialpadSoundsEnabled(bool enabled);
137
138 };
139
140
141=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
142--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-08-27 22:18:18 +0000
143+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-08-29 15:47:15 +0000
144@@ -515,7 +515,7 @@
145 klass.start_system_bus()
146 klass.dbus_con = klass.get_dbus(True)
147
148- def setUp(self):
149+ def setUp(self, panel='sound'):
150
151 user_obj = '/user/foo'
152
153@@ -527,7 +527,9 @@
154 'IncomingMessageVibrate': dbus.Boolean(False,
155 variant_level=1),
156 'IncomingMessageVibrateSilentMode': dbus.Boolean(False,
157- variant_level=1)}
158+ variant_level=1),
159+ 'DialpadSoundsEnabled': dbus.Boolean(True,
160+ variant_level=1)}
161
162 # start dbus system bus
163 self.mock_server = self.spawn_server(ACCOUNTS_IFACE, ACCOUNTS_OBJ,
164@@ -586,17 +588,23 @@
165 'GetIncomingMessageVibrateSilentMode', '', 'v',
166 'ret = self.Get("%s", \
167 "IncomingMessageVibrateSilentMode")' %
168+ ACCOUNTS_SOUND_IFACE),
169+ (
170+ 'GetDialpadSoundsEnabled', '', 'v',
171+ 'ret = self.Get("%s", \
172+ "DialpadSoundsEnabled")' %
173 ACCOUNTS_SOUND_IFACE)
174 ])
175
176 self.obj_test = self.dbus_con.get_object(ACCOUNTS_IFACE, user_obj,
177 ACCOUNTS_IFACE)
178
179- super(SoundBaseTestCase, self).setUp('sound')
180+ super(SoundBaseTestCase, self).setUp(panel)
181
182 """ Go to Sound page """
183- self.assertThat(self.system_settings.main_view.sound_page.active,
184- Eventually(Equals(True)))
185+ if panel == 'sound':
186+ self.assertThat(self.system_settings.main_view.sound_page.active,
187+ Eventually(Equals(True)))
188
189 def tearDown(self):
190 self.mock_server.terminate()
191@@ -678,3 +686,13 @@
192
193 def tearDown(self):
194 super(SecurityBaseTestCase, self).tearDown()
195+
196+
197+class PhoneSoundBaseTestCase(SoundBaseTestCase):
198+ def setUp(self):
199+ """ Go to Phone page """
200+ super(PhoneSoundBaseTestCase, self).setUp('phone')
201+ self.phone_page = self.system_settings.main_view.go_to_phone_page()
202+
203+ def tearDown(self):
204+ super(PhoneSoundBaseTestCase, self).tearDown()
205
206=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_phone.py'
207--- tests/autopilot/ubuntu_system_settings/tests/test_phone.py 2014-08-08 08:37:12 +0000
208+++ tests/autopilot/ubuntu_system_settings/tests/test_phone.py 2014-08-29 15:47:15 +0000
209@@ -8,10 +8,14 @@
210 from __future__ import absolute_import
211
212 from autopilot.matchers import Eventually
213-from testtools.matchers import Contains, Equals
214+from testtools.matchers import Contains, Equals, NotEquals
215
216 from ubuntu_system_settings.tests import (
217- PhoneOfonoBaseTestCase, CALL_FWD_IFACE, CALL_SETTINGS_IFACE)
218+ PhoneOfonoBaseTestCase,
219+ PhoneSoundBaseTestCase,
220+ CALL_FWD_IFACE,
221+ CALL_SETTINGS_IFACE
222+)
223
224
225 class PhoneTestCase(PhoneOfonoBaseTestCase):
226@@ -109,3 +113,17 @@
227 lambda: str(self.modem_1.Get(CALL_SETTINGS_IFACE,
228 'VoiceCallWaiting')),
229 Eventually(Contains('enabled')))
230+
231+
232+class PhoneSoundTestCase(PhoneSoundBaseTestCase):
233+ """Tests for Phone Page"""
234+
235+ def test_dialpad_sounds_switch(self):
236+ """ Check that dialpad_sounds is present and clickable"""
237+ snd = self.phone_page.select_single(
238+ objectName="dialpadSounds")
239+ prev_value = self.obj_test.GetDialpadSoundsEnabled()
240+ self.system_settings.main_view.scroll_to_and_click(snd)
241+ self.assertThat(
242+ lambda: self.obj_test.GetDialpadSoundsEnabled(),
243+ Eventually(NotEquals(prev_value)))
244
245=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_sound.py'
246--- tests/autopilot/ubuntu_system_settings/tests/test_sound.py 2014-08-01 16:00:55 +0000
247+++ tests/autopilot/ubuntu_system_settings/tests/test_sound.py 2014-08-29 15:47:15 +0000
248@@ -102,3 +102,13 @@
249 self.system_settings.main_view.scroll_to_and_click(kbd_snd)
250 self.assertThat(
251 kbd_snd.get_properties()["checked"], NotEquals(current_value))
252+
253+ def test_dialpad_sounds_switch(self):
254+ """ Check that dialpad_sounds is present and clickable"""
255+ snd = self.system_settings.main_view.sound_page.select_single(
256+ objectName="dialpadSounds")
257+ prev_value = self.obj_test.GetDialpadSoundsEnabled()
258+ self.system_settings.main_view.scroll_to_and_click(snd)
259+ self.assertThat(
260+ lambda: self.obj_test.GetDialpadSoundsEnabled(),
261+ Eventually(NotEquals(prev_value)))

Subscribers

People subscribed via source and target branches