Merge lp:~sil2100/ubuntu-keyboard/feedback_sound_gsettings into lp:ubuntu-keyboard

Proposed by Łukasz Zemczak
Status: Merged
Approved by: Michael Sheldon
Approved revision: 149
Merged at revision: 177
Proposed branch: lp:~sil2100/ubuntu-keyboard/feedback_sound_gsettings
Merge into: lp:ubuntu-keyboard
Diff against target: 226 lines (+60/-8)
8 files modified
data/schemas/com.canonical.keyboard.maliit.gschema.xml (+5/-0)
qml/KeyboardContainer.qml (+6/-1)
src/plugin/inputmethod.cpp (+10/-0)
src/plugin/inputmethod.h (+4/-0)
src/plugin/inputmethod_p.h (+6/-0)
src/plugin/keyboardsettings.cpp (+14/-0)
src/plugin/keyboardsettings.h (+2/-0)
tests/unittests/ut_keyboardsettings/ut_keyboardsettings.cpp (+13/-7)
To merge this branch: bzr merge lp:~sil2100/ubuntu-keyboard/feedback_sound_gsettings
Reviewer Review Type Date Requested Status
Michael Sheldon (community) Approve
PS Jenkins bot continuous-integration Approve
Sebastien Bacher Needs Fixing
Review via email: mp+212684@code.launchpad.net

Commit message

Store the keyboard feedback sound in gsettings, making it configurable.

* Are there any related MPs required for this MP to build/function as expected? Please list.
-> No.

* Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
-> Yes.

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
-> Yes.

Did you successfully run all tests found in your component's Test Plan on device or emulator?
-> All testing has been performed on a Mako device.

If you changed the UI, was the change specified/approved by design?
-> N/A.

If you changed the packaging (debian), did you subscribe a core-dev to this MP?
-> N/A

Description of the change

Store the keyboard feedback sound in gsettings, making it configurable.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks Łukasz, one comment (without doing a full code review), could we have that path to be an absolute one rather than relative to some code defined directory? One of the goal is to be able to preview the sound in settings and it would be nicer to not have to code a directory there but just play the filename from the key

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, let me try and change that, thanks for the pointer!

148. By Łukasz Zemczak

Try using absolute path for the feedback sound

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Could somebody from the ubuntu-keyboard team review that work? it has been pending review for a while

149. By Łukasz Zemczak

Merge trunk and resolve conflicts

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?

 * Yes

Did CI run pass? If not, please explain why.

 * Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?

 * Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/schemas/com.canonical.keyboard.maliit.gschema.xml'
2--- data/schemas/com.canonical.keyboard.maliit.gschema.xml 2014-05-12 20:24:36 +0000
3+++ data/schemas/com.canonical.keyboard.maliit.gschema.xml 2014-06-13 12:25:24 +0000
4@@ -31,6 +31,11 @@
5 <description>Emit sound on key press.</description>
6 <default>false</default>
7 </key>
8+ <key name="key-press-feedback-sound" type="s">
9+ <summary>Key press feedback sound</summary>
10+ <description>Path to the key press feedback sound.</description>
11+ <default>'/usr/share/maliit/plugins/com/ubuntu/styles/ubuntu/sounds/key_tick2_quiet.wav'</default>
12+ </key>
13 <key name="key-press-haptic-feedback" type="b">
14 <summary>Key press haptic feedback</summary>
15 <description>Vibrate on key press.</description>
16
17=== modified file 'qml/KeyboardContainer.qml'
18--- qml/KeyboardContainer.qml 2014-05-20 15:04:34 +0000
19+++ qml/KeyboardContainer.qml 2014-06-13 12:25:24 +0000
20@@ -57,7 +57,12 @@
21
22 SoundEffect {
23 id: audioFeedback
24- source: Qt.resolvedUrl("styles/ubuntu/sounds/key_tick2_quiet.wav")
25+ source: maliit_input_method.audioFeedbackSound
26+ }
27+
28+ Connections {
29+ target: maliit_input_method
30+ onAudioFeedbackSoundChanged: audioFeedback.source = sound;
31 }
32
33 HapticsEffect {
34
35=== modified file 'src/plugin/inputmethod.cpp'
36--- src/plugin/inputmethod.cpp 2014-06-11 13:33:06 +0000
37+++ src/plugin/inputmethod.cpp 2014-06-13 12:25:24 +0000
38@@ -103,6 +103,7 @@
39 connect(this, SIGNAL(contentTypeChanged(TextContentType)), this, SLOT(setContentType(TextContentType)));
40 connect(this, SIGNAL(activeLanguageChanged(QString)), d->editor.wordEngine(), SLOT(onLanguageChanged(QString)));
41 connect(d->m_geometry, SIGNAL(visibleRectChanged()), this, SLOT(onVisibleRectChanged()));
42+ d->registerAudioFeedbackSoundSetting();
43 d->registerAudioFeedbackSetting();
44 d->registerHapticFeedbackSetting();
45 d->registerAutoCorrectSetting();
46@@ -450,6 +451,15 @@
47 return d->actionKeyOverrider.data();
48 }
49
50+//! \brief InputMethod::audioFeedbackSound returns the current path to the audio
51+//! feedback sound
52+//! \return path to the feedback sound
53+const QString InputMethod::audioFeedbackSound() const
54+{
55+ Q_D(const InputMethod);
56+ return d->m_settings.keyPressAudioFeedbackSound();
57+}
58+
59 //! \brief InputMethod::setActiveLanguage
60 //! Sets the currently active/used language
61 //! \param newLanguage id of the new language. For example "en" or "es"
62
63=== modified file 'src/plugin/inputmethod.h'
64--- src/plugin/inputmethod.h 2014-05-01 16:39:00 +0000
65+++ src/plugin/inputmethod.h 2014-06-13 12:25:24 +0000
66@@ -52,6 +52,7 @@
67 Q_PROPERTY(QStringList enabledLanguages READ enabledLanguages NOTIFY enabledLanguagesChanged)
68 Q_PROPERTY(QString activeLanguage READ activeLanguage WRITE setActiveLanguage NOTIFY activeLanguageChanged)
69 Q_PROPERTY(bool useAudioFeedback READ useAudioFeedback NOTIFY useAudioFeedbackChanged)
70+ Q_PROPERTY(QString audioFeedbackSound READ audioFeedbackSound NOTIFY audioFeedbackSoundChanged)
71 Q_PROPERTY(QObject* actionKeyOverride READ actionKeyOverride NOTIFY actionKeyOverrideChanged)
72 Q_PROPERTY(bool useHapticFeedback READ useHapticFeedback NOTIFY useHapticFeedbackChanged)
73
74@@ -106,7 +107,9 @@
75 Q_SLOT void setActiveLanguage(const QString& newLanguage);
76
77 Q_SLOT void onVisibleRectChanged();
78+
79 bool useAudioFeedback() const;
80+ const QString audioFeedbackSound() const;
81 bool useHapticFeedback() const;
82
83 QObject* actionKeyOverride() const;
84@@ -117,6 +120,7 @@
85 void enabledLanguagesChanged(QStringList languages);
86 void activeLanguageChanged(QString language);
87 void useAudioFeedbackChanged();
88+ void audioFeedbackSoundChanged(QString sound);
89 void useHapticFeedbackChanged();
90 void wordEngineEnabledChanged(bool wordEngineEnabled);
91 void wordRibbonEnabledChanged(bool wordRibbonEnabled);
92
93=== modified file 'src/plugin/inputmethod_p.h'
94--- src/plugin/inputmethod_p.h 2014-05-12 15:30:05 +0000
95+++ src/plugin/inputmethod_p.h 2014-06-13 12:25:24 +0000
96@@ -178,6 +178,12 @@
97 /*
98 * register settings
99 */
100+ void registerAudioFeedbackSoundSetting()
101+ {
102+ QObject::connect(&m_settings, SIGNAL(keyPressAudioFeedbackSoundChanged(QString)),
103+ q, SIGNAL(audioFeedbackSoundChanged(QString)));
104+ }
105+
106 void registerAudioFeedbackSetting()
107 {
108 QObject::connect(&m_settings, SIGNAL(keyPressAudioFeedbackChanged(bool)),
109
110=== modified file 'src/plugin/keyboardsettings.cpp'
111--- src/plugin/keyboardsettings.cpp 2014-04-17 11:16:56 +0000
112+++ src/plugin/keyboardsettings.cpp 2014-06-13 12:25:24 +0000
113@@ -41,6 +41,7 @@
114 const QLatin1String PREDICTIVE_TEXT_KEY = QLatin1String("predictiveText");
115 const QLatin1String SPELL_CHECKING_KEY = QLatin1String("spellChecking");
116 const QLatin1String KEY_PRESS_AUDIO_FEEDBACK_KEY = QLatin1String("keyPressFeedback");
117+const QLatin1String KEY_PRESS_AUDIO_FEEDBACK_SOUND_KEY = QLatin1String("keyPressFeedbackSound");
118 const QLatin1String KEY_PRESS_HAPTIC_FEEDBACK_KEY = QLatin1String("keyPressHapticFeedback");
119
120 /*!
121@@ -142,6 +143,16 @@
122 }
123
124 /*!
125+ * \brief KeyboardSettings::keyPressFeedbackSound returns the path to the current key
126+ * feedback sound
127+ * \return path to the feedback sound
128+ */
129+QString KeyboardSettings::keyPressAudioFeedbackSound() const
130+{
131+ return m_settings->get(KEY_PRESS_AUDIO_FEEDBACK_SOUND_KEY).toString();
132+}
133+
134+/*!
135 * \brief KeyboardSettings::settingUpdated slot to handle changes in the settings backend
136 * A specialized signal is emitted for the affected setting
137 * \param key
138@@ -172,6 +183,9 @@
139 } else if (key == KEY_PRESS_HAPTIC_FEEDBACK_KEY) {
140 Q_EMIT keyPressHapticFeedbackChanged(keyPressHapticFeedback());
141 return;
142+ } else if (key == KEY_PRESS_AUDIO_FEEDBACK_SOUND_KEY) {
143+ Q_EMIT keyPressAudioFeedbackSoundChanged(keyPressAudioFeedbackSound());
144+ return;
145 }
146
147 qWarning() << Q_FUNC_INFO << "unknown settings key:" << key;
148
149=== modified file 'src/plugin/keyboardsettings.h'
150--- src/plugin/keyboardsettings.h 2014-04-17 11:16:56 +0000
151+++ src/plugin/keyboardsettings.h 2014-06-13 12:25:24 +0000
152@@ -51,6 +51,7 @@
153 bool predictiveText() const;
154 bool spellchecking() const;
155 bool keyPressAudioFeedback() const;
156+ QString keyPressAudioFeedbackSound() const;
157 bool keyPressHapticFeedback() const;
158
159 Q_SIGNALS:
160@@ -61,6 +62,7 @@
161 void predictiveTextChanged(bool);
162 void spellCheckingChanged(bool);
163 void keyPressAudioFeedbackChanged(bool);
164+ void keyPressAudioFeedbackSoundChanged(QString);
165 void keyPressHapticFeedbackChanged(bool);
166
167 private:
168
169=== modified file 'tests/unittests/ut_keyboardsettings/ut_keyboardsettings.cpp'
170--- tests/unittests/ut_keyboardsettings/ut_keyboardsettings.cpp 2014-04-17 11:16:56 +0000
171+++ tests/unittests/ut_keyboardsettings/ut_keyboardsettings.cpp 2014-06-13 12:25:24 +0000
172@@ -65,21 +65,24 @@
173 QTest::addColumn<int>("predictSpyCount");
174 QTest::addColumn<int>("spellSpyCount");
175 QTest::addColumn<int>("feedbackSpyCount");
176+ QTest::addColumn<int>("feedbackSoundSpyCount");
177
178 QTest::newRow("languages changed") << QString("enabledLanguages")
179- << 1 << 0 << 0 << 0 << 0 << 0;
180+ << 1 << 0 << 0 << 0 << 0 << 0 << 0;
181 QTest::newRow("capitalization changed") << QString("autoCapitalization")
182- << 0 << 1 << 0 << 0 << 0 << 0;
183+ << 0 << 1 << 0 << 0 << 0 << 0 << 0;
184 QTest::newRow("completion changed") << QString("autoCompletion")
185- << 0 << 0 << 1 << 0 << 0 << 0;
186+ << 0 << 0 << 1 << 0 << 0 << 0 << 0;
187 QTest::newRow("predict changed") << QString("predictiveText")
188- << 0 << 0 << 0 << 1 << 0 << 0;
189+ << 0 << 0 << 0 << 1 << 0 << 0 << 0;
190 QTest::newRow("spellcheck changed") << QString("spellChecking")
191- << 0 << 0 << 0 << 0 << 1 << 0;
192+ << 0 << 0 << 0 << 0 << 1 << 0 << 0;
193 QTest::newRow("feedback changed") << QString("keyPressFeedback")
194- << 0 << 0 << 0 << 0 << 0 << 1;
195+ << 0 << 0 << 0 << 0 << 0 << 1 << 0;
196+ QTest::newRow("feedback sound changed") << QString("keyPressFeedbackSound")
197+ << 0 << 0 << 0 << 0 << 0 << 0 << 1;
198 QTest::newRow("unknown changed") << QString("unknownKey")
199- << 0 << 0 << 0 << 0 << 0 << 0;
200+ << 0 << 0 << 0 << 0 << 0 << 0 << 0;
201 }
202
203 Q_SLOT void testSettingUpdated()
204@@ -91,6 +94,7 @@
205 QFETCH(int, predictSpyCount);
206 QFETCH(int, spellSpyCount);
207 QFETCH(int, feedbackSpyCount);
208+ QFETCH(int, feedbackSoundSpyCount);
209
210 QSignalSpy languagesSpy(m_settings, SIGNAL(enabledLanguagesChanged(QStringList)));
211 QSignalSpy capitalSpy(m_settings, SIGNAL(autoCapitalizationChanged(bool)));
212@@ -98,6 +102,7 @@
213 QSignalSpy predictSpy(m_settings, SIGNAL(predictiveTextChanged(bool)));
214 QSignalSpy spellSpy(m_settings, SIGNAL(spellCheckingChanged(bool)));
215 QSignalSpy feedbackSpy(m_settings, SIGNAL(keyPressAudioFeedbackChanged(bool)));
216+ QSignalSpy feedbackSoundSpy(m_settings, SIGNAL(keyPressAudioFeedbackSoundChanged(QString)));
217
218 m_settings->settingUpdated(key);
219
220@@ -107,6 +112,7 @@
221 QCOMPARE(predictSpy.count(), predictSpyCount);
222 QCOMPARE(spellSpy.count(), spellSpyCount);
223 QCOMPARE(feedbackSpy.count(), feedbackSpyCount);
224+ QCOMPARE(feedbackSoundSpy.count(), feedbackSoundSpyCount);
225 }
226 };
227

Subscribers

People subscribed via source and target branches