Merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-url-layout into lp:phablet-extras/maliit-plugins
- maliit-plugins-url-layout
- Merge into maliit-plugins
Status: | Merged |
---|---|
Approved by: | Thomas Moenicke |
Approved revision: | 2150 |
Merged at revision: | 2138 |
Proposed branch: | lp:~thomas-moenicke/phablet-extras/maliit-plugins-url-layout |
Merge into: | lp:phablet-extras/maliit-plugins |
Diff against target: |
1628 lines (+1208/-74) 24 files modified
.bzrignore (+23/-0) buildOnDevice.sh (+118/-0) debian/changelog (+6/-0) maliit-keyboard/data/languages/email.xml (+487/-0) maliit-keyboard/data/languages/number.xml (+20/-23) maliit-keyboard/lib/logic/dynamiclayout.cpp (+24/-28) maliit-keyboard/lib/logic/keyareaconverter.cpp (+1/-2) maliit-keyboard/lib/logic/layoutupdater.cpp (+0/-2) maliit-keyboard/lib/models/layout.cpp (+14/-0) maliit-keyboard/lib/models/layout.h (+8/-0) maliit-keyboard/maliit-keyboard.pro (+0/-1) maliit-keyboard/plugin/inputmethod.cpp (+69/-9) maliit-keyboard/plugin/inputmethod.h (+6/-0) maliit-keyboard/tests/common/common.pro (+3/-0) maliit-keyboard/tests/common/helper.js (+13/-0) maliit-keyboard/tests/language-layout-switching/main.cpp (+2/-0) maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir (+2/-0) maliit-keyboard/tests/qml-api-tests/plugin.cpp (+55/-0) maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro (+20/-0) maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml (+124/-0) maliit-keyboard/tests/qml-test-app/layout-test.qml (+202/-0) maliit-keyboard/tests/qml-test-app/qml-test-app.pro (+2/-1) maliit-keyboard/tests/tests.pro (+1/-0) unittests.sh (+8/-8) |
To merge this branch: | bzr merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-url-layout |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Günter Schwann (community) | Approve | ||
Review via email: mp+178264@code.launchpad.net |
Commit message
adding contentType property to inputmethod
Description of the change
enable url layout: adding contentType property to inputmethod
- 2139. By Thomas Moenicke
-
minor change: using Maliit::ContentType
PS Jenkins bot (ps-jenkins) wrote : | # |
- 2140. By Thomas Moenicke
-
changing layout in onCOntentTypeCh
anged slot
using Maliit::TextContentTyp e type
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2140
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 2141. By Thomas Moenicke
-
according to contentType, inputmethod switches to special layouts, or back to the active language
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2141
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 2142. By Thomas Moenicke
-
exposed activeView to maliit-qml
added qml API tests - 2143. By Thomas Moenicke
-
adding file to build on device
adding .bzrignore
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2142
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2143
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 2144. By Thomas Moenicke
-
removed old subdir in pro file
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2144
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Thomas Moenicke (thomas-moenicke) wrote : | # |
for testing, change in the browser in /usr/share/
TextField {
id: textField
inputMethodH
install the packages, then reboot.
For the browser, it should show a .com key. In phone app or notes app, it should show the regular layout.
- 2145. By Thomas Moenicke
-
set a default activeId in constructor, fixes crash
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2145
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 2146. By Thomas Moenicke
-
adding support for number, phonenumber and email layouts
adding test app for layouts - 2147. By Thomas Moenicke
-
removed useless assert
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2147
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 2148. By Thomas Moenicke
-
fixed caluclation of margins: if no layout was loaded before, it took values from wrong cache.
Instead of caching the margins, we should reduce calling switchToMainView() and reduce creating new keyAreas
see also:
void LayoutUpdater::switchToMainVi ew()
converter.keyArea( )
createFromKeyboard( m_attributes, m_loader- >keyboard( ), m_orientation);
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2148
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Günter Schwann (schwann) wrote : | # |
707 +<!--
712 +<!--
Commented code should be removed
Rest looks ok, and it works
- 2149. By Thomas Moenicke
-
removed commented code/xml
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2149
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 2150. By Thomas Moenicke
-
bumped changelog: url, phonenumber and number layouts
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2150
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === added file '.bzrignore' | |||
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 | |||
3 | +++ .bzrignore 2013-08-08 14:28:50 +0000 | |||
4 | @@ -0,0 +1,23 @@ | |||
5 | 1 | Makefile | ||
6 | 2 | moc_* | ||
7 | 3 | *.pro.user | ||
8 | 4 | *.moc | ||
9 | 5 | debian/tmp | ||
10 | 6 | debian/ubuntu-keyboard/ | ||
11 | 7 | debian/ubuntu-keyboard-data/ | ||
12 | 8 | debian/files | ||
13 | 9 | debian/maliit-keyboard/ | ||
14 | 10 | debian/maliit-keyboard-data/ | ||
15 | 11 | debian/nemo-keyboard/ | ||
16 | 12 | *.debhelper.log | ||
17 | 13 | *.substvars | ||
18 | 14 | *.so | ||
19 | 15 | */benchmark/maliit-keyboard-benchmark | ||
20 | 16 | */tests/editor/editor | ||
21 | 17 | */tests/language-layout-loading/language-layout-loading | ||
22 | 18 | */tests/language-layout-switching/language-layout-switching | ||
23 | 19 | */tests/preedit-string/preedit-string | ||
24 | 20 | */tests/repeat-backspace/repeat-backspace | ||
25 | 21 | */tests/unittests/libdummy.so.1* | ||
26 | 22 | */tests/word-candidates/word-candidates | ||
27 | 23 | libdummy.so* | ||
28 | 0 | 24 | ||
29 | === added file 'buildOnDevice.sh' | |||
30 | --- buildOnDevice.sh 1970-01-01 00:00:00 +0000 | |||
31 | +++ buildOnDevice.sh 2013-08-08 14:28:50 +0000 | |||
32 | @@ -0,0 +1,118 @@ | |||
33 | 1 | #!/bin/sh | ||
34 | 2 | CODE_DIR=ubuntu-keyboard | ||
35 | 3 | USER=phablet | ||
36 | 4 | USER_ID=32011 | ||
37 | 5 | PASSWORD=phablet | ||
38 | 6 | PACKAGE=maliit-keyboard | ||
39 | 7 | BINARY=maliit-server | ||
40 | 8 | TARGET_IP=127.0.0.1 | ||
41 | 9 | TARGET_SSH_PORT=2222 | ||
42 | 10 | TARGET_DEBUG_PORT=3768 | ||
43 | 11 | RUN_OPTIONS="" | ||
44 | 12 | # -qmljsdebugger=port:$TARGET_DEBUG_PORT" | ||
45 | 13 | SETUP=false | ||
46 | 14 | SUDO="echo $PASSWORD | sudo -S" | ||
47 | 15 | |||
48 | 16 | usage() { | ||
49 | 17 | echo "usage: run_on_device [OPTIONS]\n" | ||
50 | 18 | echo "Script to setup a build environment for the shell and sync build and run it on the device\n" | ||
51 | 19 | echo "OPTIONS:" | ||
52 | 20 | echo " -s, --setup Setup the build environment" | ||
53 | 21 | echo "" | ||
54 | 22 | echo "IMPORTANT:" | ||
55 | 23 | echo " * Make sure to have the networking and PPAs setup on the device beforehand (phablet-deploy-networking && phablet-ppa-fetch)." | ||
56 | 24 | echo " * Execute that script from a directory containing a branch of the shell code." | ||
57 | 25 | exit 1 | ||
58 | 26 | } | ||
59 | 27 | |||
60 | 28 | exec_with_ssh() { | ||
61 | 29 | ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t $USER@$TARGET_IP -p $TARGET_SSH_PORT "bash -ic \"$@\"" | ||
62 | 30 | } | ||
63 | 31 | |||
64 | 32 | exec_with_adb() { | ||
65 | 33 | adb shell chroot /data/ubuntu /usr/bin/env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin "$@" | ||
66 | 34 | } | ||
67 | 35 | |||
68 | 36 | adb_root() { | ||
69 | 37 | adb root | ||
70 | 38 | adb wait-for-device | ||
71 | 39 | } | ||
72 | 40 | |||
73 | 41 | install_ssh_key() { | ||
74 | 42 | ssh-keygen -R $TARGET_IP | ||
75 | 43 | HOME_DIR=/data/ubuntu/home/phablet | ||
76 | 44 | adb push ~/.ssh/id_rsa.pub $HOME_DIR/.ssh/authorized_keys | ||
77 | 45 | adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh | ||
78 | 46 | adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh/authorized_keys | ||
79 | 47 | adb shell chmod 700 $HOME_DIR/.ssh | ||
80 | 48 | adb shell chmod 600 $HOME_DIR/.ssh/authorized_keys | ||
81 | 49 | } | ||
82 | 50 | |||
83 | 51 | install_dependencies() { | ||
84 | 52 | exec_with_adb apt-get -y install openssh-server | ||
85 | 53 | exec_with_ssh $SUDO apt-get -y install build-essential rsync bzr ccache gdb libglib2.0-bin | ||
86 | 54 | exec_with_ssh $SUDO add-apt-repository -y ppa:canonical-qt5-edgers/qt5-proper | ||
87 | 55 | exec_with_ssh $SUDO add-apt-repository -s -y ppa:phablet-team/ppa | ||
88 | 56 | exec_with_ssh $SUDO apt-get update | ||
89 | 57 | exec_with_ssh $SUDO apt-get -y install qt5-qmake qtdeclarative5-dev-tools qtdeclarative5-test-plugin qtdeclarative5-private-dev libqt5v8-5-private-dev fakeroot | ||
90 | 58 | exec_with_ssh $SUDO apt-get -y build-dep $PACKAGE | ||
91 | 59 | } | ||
92 | 60 | |||
93 | 61 | reset_screen_powerdown() { | ||
94 | 62 | exec_with_ssh $SUDO dbus-launch gsettings set com.canonical.powerd activity-timeout 600 | ||
95 | 63 | exec_with_ssh $SUDO sudo initctl restart powerd | ||
96 | 64 | } | ||
97 | 65 | |||
98 | 66 | setup_adb_forwarding() { | ||
99 | 67 | adb forward tcp:$TARGET_SSH_PORT tcp:22 | ||
100 | 68 | adb forward tcp:$TARGET_DEBUG_PORT tcp:$TARGET_DEBUG_PORT | ||
101 | 69 | } | ||
102 | 70 | |||
103 | 71 | sync_code() { | ||
104 | 72 | bzr export --uncommitted --format=dir /tmp/$CODE_DIR | ||
105 | 73 | rsync -crlOzv -e "ssh -p $TARGET_SSH_PORT -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" /tmp/$CODE_DIR/ $USER@$TARGET_IP:$CODE_DIR/ | ||
106 | 74 | rm -rf /tmp/$CODE_DIR | ||
107 | 75 | } | ||
108 | 76 | |||
109 | 77 | build() { | ||
110 | 78 | # exec_with_ssh "cd $CODE_DIR/ && qmake . && make -j 2" | ||
111 | 79 | exec_with_ssh "cd $CODE_DIR/ && dpkg-buildpackage -j4" | ||
112 | 80 | } | ||
113 | 81 | |||
114 | 82 | run() { | ||
115 | 83 | # exec_with_ssh $SUDO "make install" | ||
116 | 84 | exec_with_ssh $SUDO "/sbin/initctl stop maliit-server" | ||
117 | 85 | # adb shell pkill $BINARY | ||
118 | 86 | # exec_with_ssh "$BINARY $RUN_OPTIONS" | ||
119 | 87 | } | ||
120 | 88 | |||
121 | 89 | set -- `getopt -n$0 -u -a --longoptions="setup,help" "sh" "$@"` | ||
122 | 90 | |||
123 | 91 | # FIXME: giving incorrect arguments does not call usage and exit | ||
124 | 92 | while [ $# -gt 0 ] | ||
125 | 93 | do | ||
126 | 94 | case "$1" in | ||
127 | 95 | -s|--setup) SETUP=true;; | ||
128 | 96 | -h|--help) usage;; | ||
129 | 97 | --) shift;break;; | ||
130 | 98 | esac | ||
131 | 99 | shift | ||
132 | 100 | done | ||
133 | 101 | |||
134 | 102 | adb_root | ||
135 | 103 | setup_adb_forwarding | ||
136 | 104 | |||
137 | 105 | if $SETUP; then | ||
138 | 106 | echo "Setting up environment for building shell.." | ||
139 | 107 | install_ssh_key | ||
140 | 108 | install_dependencies | ||
141 | 109 | reset_screen_powerdown | ||
142 | 110 | sync_code | ||
143 | 111 | else | ||
144 | 112 | echo "Transferring code.." | ||
145 | 113 | sync_code | ||
146 | 114 | echo "Building.." | ||
147 | 115 | build | ||
148 | 116 | echo "Running.." | ||
149 | 117 | run | ||
150 | 118 | fi | ||
151 | 0 | 119 | ||
152 | === modified file 'debian/changelog' | |||
153 | --- debian/changelog 2013-07-31 14:44:31 +0000 | |||
154 | +++ debian/changelog 2013-08-08 14:28:50 +0000 | |||
155 | @@ -1,3 +1,9 @@ | |||
156 | 1 | maliit-plugins (0.99.trunk.phablet4) saycu; urgency=low | ||
157 | 2 | |||
158 | 3 | * url, phonenumber and number layouts | ||
159 | 4 | |||
160 | 5 | -- Thomas Moenicke <thomas@pachamama> Thu, 08 Aug 2013 16:27:47 +0200 | ||
161 | 6 | |||
162 | 1 | maliit-plugins (0.99.trunk.phablet3) saucy; urgency=low | 7 | maliit-plugins (0.99.trunk.phablet3) saucy; urgency=low |
163 | 2 | 8 | ||
164 | 3 | * support for inputMethodHints and contentOrientation | 9 | * support for inputMethodHints and contentOrientation |
165 | 4 | 10 | ||
166 | === added file 'maliit-keyboard/data/languages/email.xml' | |||
167 | --- maliit-keyboard/data/languages/email.xml 1970-01-01 00:00:00 +0000 | |||
168 | +++ maliit-keyboard/data/languages/email.xml 2013-08-08 14:28:50 +0000 | |||
169 | @@ -0,0 +1,487 @@ | |||
170 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
171 | 2 | <!DOCTYPE keyboard SYSTEM "VirtualKeyboardLayout.dtd"> | ||
172 | 3 | |||
173 | 4 | <keyboard catalog="en_us" language="en_us" title="English (US)" version="1.0"> | ||
174 | 5 | <layout type="general"> | ||
175 | 6 | <section id="main"> | ||
176 | 7 | <row> | ||
177 | 8 | <key> | ||
178 | 9 | <binding label="q"> | ||
179 | 10 | <modifiers keys="shift"> | ||
180 | 11 | <binding label="Q" /> | ||
181 | 12 | </modifiers> | ||
182 | 13 | </binding> | ||
183 | 14 | </key> | ||
184 | 15 | <key> | ||
185 | 16 | <binding label="w"> | ||
186 | 17 | <modifiers keys="shift"> | ||
187 | 18 | <binding label="W" /> | ||
188 | 19 | </modifiers> | ||
189 | 20 | </binding> | ||
190 | 21 | </key> | ||
191 | 22 | <key> | ||
192 | 23 | <extended> | ||
193 | 24 | <row> | ||
194 | 25 | <key> | ||
195 | 26 | <binding label="è"> | ||
196 | 27 | <modifiers keys="shift"> | ||
197 | 28 | <binding label="È" /> | ||
198 | 29 | </modifiers> | ||
199 | 30 | </binding> | ||
200 | 31 | </key> | ||
201 | 32 | <key> | ||
202 | 33 | <binding label="é"> | ||
203 | 34 | <modifiers keys="shift"> | ||
204 | 35 | <binding label="É" /> | ||
205 | 36 | </modifiers> | ||
206 | 37 | </binding> | ||
207 | 38 | </key> | ||
208 | 39 | <key> | ||
209 | 40 | <binding label="ê"> | ||
210 | 41 | <modifiers keys="shift"> | ||
211 | 42 | <binding label="Ê" /> | ||
212 | 43 | </modifiers> | ||
213 | 44 | </binding> | ||
214 | 45 | </key> | ||
215 | 46 | <key> | ||
216 | 47 | <binding label="ë"> | ||
217 | 48 | <modifiers keys="shift"> | ||
218 | 49 | <binding label="Ë" /> | ||
219 | 50 | </modifiers> | ||
220 | 51 | </binding> | ||
221 | 52 | </key> | ||
222 | 53 | <key> | ||
223 | 54 | <binding label="€"> | ||
224 | 55 | <modifiers keys="shift"> | ||
225 | 56 | <binding label="€" /> | ||
226 | 57 | </modifiers> | ||
227 | 58 | </binding> | ||
228 | 59 | </key> | ||
229 | 60 | </row> | ||
230 | 61 | </extended> | ||
231 | 62 | <binding label="e"> | ||
232 | 63 | <modifiers keys="shift"> | ||
233 | 64 | <binding label="E" /> | ||
234 | 65 | </modifiers> | ||
235 | 66 | </binding> | ||
236 | 67 | </key> | ||
237 | 68 | <key> | ||
238 | 69 | <binding label="r"> | ||
239 | 70 | <modifiers keys="shift"> | ||
240 | 71 | <binding label="R" /> | ||
241 | 72 | </modifiers> | ||
242 | 73 | </binding> | ||
243 | 74 | </key> | ||
244 | 75 | <key> | ||
245 | 76 | <extended> | ||
246 | 77 | <row> | ||
247 | 78 | <key> | ||
248 | 79 | <binding label="þ"> | ||
249 | 80 | <modifiers keys="shift"> | ||
250 | 81 | <binding label="Þ" /> | ||
251 | 82 | </modifiers> | ||
252 | 83 | </binding> | ||
253 | 84 | </key> | ||
254 | 85 | </row> | ||
255 | 86 | </extended> | ||
256 | 87 | <binding label="t"> | ||
257 | 88 | <modifiers keys="shift"> | ||
258 | 89 | <binding label="T" /> | ||
259 | 90 | </modifiers> | ||
260 | 91 | </binding> | ||
261 | 92 | </key> | ||
262 | 93 | <key> | ||
263 | 94 | <extended> | ||
264 | 95 | <row> | ||
265 | 96 | <key> | ||
266 | 97 | <binding label="ý"> | ||
267 | 98 | <modifiers keys="shift"> | ||
268 | 99 | <binding label="Ý" /> | ||
269 | 100 | </modifiers> | ||
270 | 101 | </binding> | ||
271 | 102 | </key> | ||
272 | 103 | <key> | ||
273 | 104 | <binding label="¥"> | ||
274 | 105 | <modifiers keys="shift"> | ||
275 | 106 | <binding label="¥" /> | ||
276 | 107 | </modifiers> | ||
277 | 108 | </binding> | ||
278 | 109 | </key> | ||
279 | 110 | </row> | ||
280 | 111 | </extended> | ||
281 | 112 | <binding label="y"> | ||
282 | 113 | <modifiers keys="shift"> | ||
283 | 114 | <binding label="Y" /> | ||
284 | 115 | </modifiers> | ||
285 | 116 | </binding> | ||
286 | 117 | </key> | ||
287 | 118 | <key> | ||
288 | 119 | <extended> | ||
289 | 120 | <row> | ||
290 | 121 | <key> | ||
291 | 122 | <binding label="û"> | ||
292 | 123 | <modifiers keys="shift"> | ||
293 | 124 | <binding label="Û" /> | ||
294 | 125 | </modifiers> | ||
295 | 126 | </binding> | ||
296 | 127 | </key> | ||
297 | 128 | <key> | ||
298 | 129 | <binding label="ù"> | ||
299 | 130 | <modifiers keys="shift"> | ||
300 | 131 | <binding label="Ù" /> | ||
301 | 132 | </modifiers> | ||
302 | 133 | </binding> | ||
303 | 134 | </key> | ||
304 | 135 | <key> | ||
305 | 136 | <binding label="ú"> | ||
306 | 137 | <modifiers keys="shift"> | ||
307 | 138 | <binding label="Ú" /> | ||
308 | 139 | </modifiers> | ||
309 | 140 | </binding> | ||
310 | 141 | </key> | ||
311 | 142 | <key> | ||
312 | 143 | <binding label="ü"> | ||
313 | 144 | <modifiers keys="shift"> | ||
314 | 145 | <binding label="Ü" /> | ||
315 | 146 | </modifiers> | ||
316 | 147 | </binding> | ||
317 | 148 | </key> | ||
318 | 149 | </row> | ||
319 | 150 | </extended> | ||
320 | 151 | <binding label="u"> | ||
321 | 152 | <modifiers keys="shift"> | ||
322 | 153 | <binding label="U" /> | ||
323 | 154 | </modifiers> | ||
324 | 155 | </binding> | ||
325 | 156 | </key> | ||
326 | 157 | <key> | ||
327 | 158 | <extended> | ||
328 | 159 | <row> | ||
329 | 160 | <key> | ||
330 | 161 | <binding label="î"> | ||
331 | 162 | <modifiers keys="shift"> | ||
332 | 163 | <binding label="Î" /> | ||
333 | 164 | </modifiers> | ||
334 | 165 | </binding> | ||
335 | 166 | </key> | ||
336 | 167 | <key> | ||
337 | 168 | <binding label="ï"> | ||
338 | 169 | <modifiers keys="shift"> | ||
339 | 170 | <binding label="Ï" /> | ||
340 | 171 | </modifiers> | ||
341 | 172 | </binding> | ||
342 | 173 | </key> | ||
343 | 174 | <key> | ||
344 | 175 | <binding label="ì"> | ||
345 | 176 | <modifiers keys="shift"> | ||
346 | 177 | <binding label="Ì" /> | ||
347 | 178 | </modifiers> | ||
348 | 179 | </binding> | ||
349 | 180 | </key> | ||
350 | 181 | <key> | ||
351 | 182 | <binding label="í"> | ||
352 | 183 | <modifiers keys="shift"> | ||
353 | 184 | <binding label="Í" /> | ||
354 | 185 | </modifiers> | ||
355 | 186 | </binding> | ||
356 | 187 | </key> | ||
357 | 188 | </row> | ||
358 | 189 | </extended> | ||
359 | 190 | <binding label="i"> | ||
360 | 191 | <modifiers keys="shift"> | ||
361 | 192 | <binding label="I" /> | ||
362 | 193 | </modifiers> | ||
363 | 194 | </binding> | ||
364 | 195 | </key> | ||
365 | 196 | <key> | ||
366 | 197 | <extended> | ||
367 | 198 | <row> | ||
368 | 199 | <key> | ||
369 | 200 | <binding label="ö"> | ||
370 | 201 | <modifiers keys="shift"> | ||
371 | 202 | <binding label="Ö" /> | ||
372 | 203 | </modifiers> | ||
373 | 204 | </binding> | ||
374 | 205 | </key> | ||
375 | 206 | <key> | ||
376 | 207 | <binding label="ô"> | ||
377 | 208 | <modifiers keys="shift"> | ||
378 | 209 | <binding label="Ô" /> | ||
379 | 210 | </modifiers> | ||
380 | 211 | </binding> | ||
381 | 212 | </key> | ||
382 | 213 | <key> | ||
383 | 214 | <binding label="ò"> | ||
384 | 215 | <modifiers keys="shift"> | ||
385 | 216 | <binding label="Ò" /> | ||
386 | 217 | </modifiers> | ||
387 | 218 | </binding> | ||
388 | 219 | </key> | ||
389 | 220 | <key> | ||
390 | 221 | <binding label="ó"> | ||
391 | 222 | <modifiers keys="shift"> | ||
392 | 223 | <binding label="Ó" /> | ||
393 | 224 | </modifiers> | ||
394 | 225 | </binding> | ||
395 | 226 | </key> | ||
396 | 227 | </row> | ||
397 | 228 | </extended> | ||
398 | 229 | <binding label="o"> | ||
399 | 230 | <modifiers keys="shift"> | ||
400 | 231 | <binding label="O" /> | ||
401 | 232 | </modifiers> | ||
402 | 233 | </binding> | ||
403 | 234 | </key> | ||
404 | 235 | <key> | ||
405 | 236 | <binding label="p"> | ||
406 | 237 | <modifiers keys="shift"> | ||
407 | 238 | <binding label="P" /> | ||
408 | 239 | </modifiers> | ||
409 | 240 | </binding> | ||
410 | 241 | </key> | ||
411 | 242 | </row> | ||
412 | 243 | <row> | ||
413 | 244 | <spacer /> | ||
414 | 245 | <key> | ||
415 | 246 | <extended> | ||
416 | 247 | <row> | ||
417 | 248 | <key> | ||
418 | 249 | <binding label="ä"> | ||
419 | 250 | <modifiers keys="shift"> | ||
420 | 251 | <binding label="Ä" /> | ||
421 | 252 | </modifiers> | ||
422 | 253 | </binding> | ||
423 | 254 | </key> | ||
424 | 255 | <key> | ||
425 | 256 | <binding label="à"> | ||
426 | 257 | <modifiers keys="shift"> | ||
427 | 258 | <binding label="À" /> | ||
428 | 259 | </modifiers> | ||
429 | 260 | </binding> | ||
430 | 261 | </key> | ||
431 | 262 | <key> | ||
432 | 263 | <binding label="â"> | ||
433 | 264 | <modifiers keys="shift"> | ||
434 | 265 | <binding label="Â" /> | ||
435 | 266 | </modifiers> | ||
436 | 267 | </binding> | ||
437 | 268 | </key> | ||
438 | 269 | <key> | ||
439 | 270 | <binding label="á"> | ||
440 | 271 | <modifiers keys="shift"> | ||
441 | 272 | <binding label="Á" /> | ||
442 | 273 | </modifiers> | ||
443 | 274 | </binding> | ||
444 | 275 | </key> | ||
445 | 276 | <key> | ||
446 | 277 | <binding label="ã"> | ||
447 | 278 | <modifiers keys="shift"> | ||
448 | 279 | <binding label="Ã" /> | ||
449 | 280 | </modifiers> | ||
450 | 281 | </binding> | ||
451 | 282 | </key> | ||
452 | 283 | <key> | ||
453 | 284 | <binding label="å"> | ||
454 | 285 | <modifiers keys="shift"> | ||
455 | 286 | <binding label="Å" /> | ||
456 | 287 | </modifiers> | ||
457 | 288 | </binding> | ||
458 | 289 | </key> | ||
459 | 290 | </row> | ||
460 | 291 | </extended> | ||
461 | 292 | <binding label="a"> | ||
462 | 293 | <modifiers keys="shift"> | ||
463 | 294 | <binding label="A" /> | ||
464 | 295 | </modifiers> | ||
465 | 296 | </binding> | ||
466 | 297 | </key> | ||
467 | 298 | <key> | ||
468 | 299 | <extended> | ||
469 | 300 | <row> | ||
470 | 301 | <key> | ||
471 | 302 | <binding label="ß"> | ||
472 | 303 | <modifiers keys="shift"> | ||
473 | 304 | <binding label="$" /> | ||
474 | 305 | </modifiers> | ||
475 | 306 | </binding> | ||
476 | 307 | </key> | ||
477 | 308 | <key> | ||
478 | 309 | <binding label="$" /> | ||
479 | 310 | </key> | ||
480 | 311 | </row> | ||
481 | 312 | </extended> | ||
482 | 313 | <binding label="s"> | ||
483 | 314 | <modifiers keys="shift"> | ||
484 | 315 | <binding label="S" /> | ||
485 | 316 | </modifiers> | ||
486 | 317 | </binding> | ||
487 | 318 | </key> | ||
488 | 319 | <key> | ||
489 | 320 | <extended> | ||
490 | 321 | <row> | ||
491 | 322 | <key> | ||
492 | 323 | <binding label="ð"> | ||
493 | 324 | <modifiers keys="shift"> | ||
494 | 325 | <binding label="Ð" /> | ||
495 | 326 | </modifiers> | ||
496 | 327 | </binding> | ||
497 | 328 | </key> | ||
498 | 329 | </row> | ||
499 | 330 | </extended> | ||
500 | 331 | <binding label="d"> | ||
501 | 332 | <modifiers keys="shift"> | ||
502 | 333 | <binding label="D" /> | ||
503 | 334 | </modifiers> | ||
504 | 335 | </binding> | ||
505 | 336 | </key> | ||
506 | 337 | <key> | ||
507 | 338 | <binding label="f"> | ||
508 | 339 | <modifiers keys="shift"> | ||
509 | 340 | <binding label="F" /> | ||
510 | 341 | </modifiers> | ||
511 | 342 | </binding> | ||
512 | 343 | </key> | ||
513 | 344 | <key> | ||
514 | 345 | <binding label="g"> | ||
515 | 346 | <modifiers keys="shift"> | ||
516 | 347 | <binding label="G" /> | ||
517 | 348 | </modifiers> | ||
518 | 349 | </binding> | ||
519 | 350 | </key> | ||
520 | 351 | <key> | ||
521 | 352 | <binding label="h"> | ||
522 | 353 | <modifiers keys="shift"> | ||
523 | 354 | <binding label="H" /> | ||
524 | 355 | </modifiers> | ||
525 | 356 | </binding> | ||
526 | 357 | </key> | ||
527 | 358 | <key> | ||
528 | 359 | <binding label="j"> | ||
529 | 360 | <modifiers keys="shift"> | ||
530 | 361 | <binding label="J" /> | ||
531 | 362 | </modifiers> | ||
532 | 363 | </binding> | ||
533 | 364 | </key> | ||
534 | 365 | <key> | ||
535 | 366 | <binding label="k"> | ||
536 | 367 | <modifiers keys="shift"> | ||
537 | 368 | <binding label="K" /> | ||
538 | 369 | </modifiers> | ||
539 | 370 | </binding> | ||
540 | 371 | </key> | ||
541 | 372 | <key> | ||
542 | 373 | <binding label="l"> | ||
543 | 374 | <modifiers keys="shift"> | ||
544 | 375 | <binding label="L" /> | ||
545 | 376 | </modifiers> | ||
546 | 377 | </binding> | ||
547 | 378 | </key> | ||
548 | 379 | <spacer /> | ||
549 | 380 | </row> | ||
550 | 381 | <row> | ||
551 | 382 | <key style="special" width="large"> | ||
552 | 383 | <binding action="shift" /> | ||
553 | 384 | </key> | ||
554 | 385 | <spacer /> | ||
555 | 386 | <key> | ||
556 | 387 | <binding label="z"> | ||
557 | 388 | <modifiers keys="shift"> | ||
558 | 389 | <binding label="Z" /> | ||
559 | 390 | </modifiers> | ||
560 | 391 | </binding> | ||
561 | 392 | </key> | ||
562 | 393 | <key> | ||
563 | 394 | <binding label="x"> | ||
564 | 395 | <modifiers keys="shift"> | ||
565 | 396 | <binding label="X" /> | ||
566 | 397 | </modifiers> | ||
567 | 398 | </binding> | ||
568 | 399 | </key> | ||
569 | 400 | <key> | ||
570 | 401 | <extended> | ||
571 | 402 | <row> | ||
572 | 403 | <key> | ||
573 | 404 | <binding label="ç"> | ||
574 | 405 | <modifiers keys="shift"> | ||
575 | 406 | <binding label="Ç" /> | ||
576 | 407 | </modifiers> | ||
577 | 408 | </binding> | ||
578 | 409 | </key> | ||
579 | 410 | </row> | ||
580 | 411 | </extended> | ||
581 | 412 | <binding label="c"> | ||
582 | 413 | <modifiers keys="shift"> | ||
583 | 414 | <binding label="C" /> | ||
584 | 415 | </modifiers> | ||
585 | 416 | </binding> | ||
586 | 417 | </key> | ||
587 | 418 | <key> | ||
588 | 419 | <binding label="v"> | ||
589 | 420 | <modifiers keys="shift"> | ||
590 | 421 | <binding label="V" /> | ||
591 | 422 | </modifiers> | ||
592 | 423 | </binding> | ||
593 | 424 | </key> | ||
594 | 425 | <key> | ||
595 | 426 | <binding label="b"> | ||
596 | 427 | <modifiers keys="shift"> | ||
597 | 428 | <binding label="B" /> | ||
598 | 429 | </modifiers> | ||
599 | 430 | </binding> | ||
600 | 431 | </key> | ||
601 | 432 | <key> | ||
602 | 433 | <extended> | ||
603 | 434 | <row> | ||
604 | 435 | <key> | ||
605 | 436 | <binding label="ñ"> | ||
606 | 437 | <modifiers keys="shift"> | ||
607 | 438 | <binding label="Ñ" /> | ||
608 | 439 | </modifiers> | ||
609 | 440 | </binding> | ||
610 | 441 | </key> | ||
611 | 442 | </row> | ||
612 | 443 | </extended> | ||
613 | 444 | <binding label="n"> | ||
614 | 445 | <modifiers keys="shift"> | ||
615 | 446 | <binding label="N" /> | ||
616 | 447 | </modifiers> | ||
617 | 448 | </binding> | ||
618 | 449 | </key> | ||
619 | 450 | <key> | ||
620 | 451 | <binding label="m"> | ||
621 | 452 | <modifiers keys="shift"> | ||
622 | 453 | <binding label="M" /> | ||
623 | 454 | </modifiers> | ||
624 | 455 | </binding> | ||
625 | 456 | </key> | ||
626 | 457 | <spacer /> | ||
627 | 458 | <key style="special" width="large"> | ||
628 | 459 | <binding action="backspace" /> | ||
629 | 460 | </key> | ||
630 | 461 | </row> | ||
631 | 462 | <row> | ||
632 | 463 | <key style="special" width="x-large"> | ||
633 | 464 | <binding action="sym" label="?123" /> | ||
634 | 465 | </key> | ||
635 | 466 | <spacer /> | ||
636 | 467 | <key id="urlKey"> | ||
637 | 468 | <binding label=".com" /> | ||
638 | 469 | </key> | ||
639 | 470 | <key width="large"> | ||
640 | 471 | <binding action="space" /> | ||
641 | 472 | </key> | ||
642 | 473 | <key id="urlKey" width="large"> | ||
643 | 474 | <binding label=".com" /> | ||
644 | 475 | </key> | ||
645 | 476 | <key> | ||
646 | 477 | <binding label="." /> | ||
647 | 478 | </key> | ||
648 | 479 | <spacer /> | ||
649 | 480 | <key id="actionKey" style="special" width="x-large"> | ||
650 | 481 | <binding action="return" /> | ||
651 | 482 | </key> | ||
652 | 483 | </row> | ||
653 | 484 | </section> | ||
654 | 485 | </layout> | ||
655 | 486 | <import file="symbols_en.xml" /> | ||
656 | 487 | </keyboard> | ||
657 | 0 | 488 | ||
658 | === modified file 'maliit-keyboard/data/languages/number.xml' | |||
659 | --- maliit-keyboard/data/languages/number.xml 2012-08-17 12:00:21 +0000 | |||
660 | +++ maliit-keyboard/data/languages/number.xml 2013-08-08 14:28:50 +0000 | |||
661 | @@ -5,51 +5,48 @@ | |||
662 | 5 | <layout orientation="landscape" type="number"> | 5 | <layout orientation="landscape" type="number"> |
663 | 6 | <section id="main" movable="false"> | 6 | <section id="main" movable="false"> |
664 | 7 | <row> | 7 | <row> |
666 | 8 | <key> | 8 | <key width="x-large"> |
667 | 9 | <binding label="1" /> | 9 | <binding label="1" /> |
668 | 10 | </key> | 10 | </key> |
670 | 11 | <key> | 11 | <key width="x-large"> |
671 | 12 | <binding label="2" /> | 12 | <binding label="2" /> |
672 | 13 | </key> | 13 | </key> |
674 | 14 | <key> | 14 | <key width="x-large"> |
675 | 15 | <binding label="3" /> | 15 | <binding label="3" /> |
676 | 16 | </key> | 16 | </key> |
678 | 17 | <key> | 17 | </row> |
679 | 18 | <row> | ||
680 | 19 | <key width="x-large"> | ||
681 | 18 | <binding label="4" /> | 20 | <binding label="4" /> |
682 | 19 | </key> | 21 | </key> |
684 | 20 | <key> | 22 | <key width="x-large"> |
685 | 21 | <binding label="5" /> | 23 | <binding label="5" /> |
686 | 22 | </key> | 24 | </key> |
688 | 23 | <key> | 25 | <key width="x-large"> |
689 | 24 | <binding label="6" /> | 26 | <binding label="6" /> |
690 | 25 | </key> | 27 | </key> |
692 | 26 | <key> | 28 | </row> |
693 | 29 | <row> | ||
694 | 30 | <key width="x-large"> | ||
695 | 27 | <binding label="7" /> | 31 | <binding label="7" /> |
696 | 28 | </key> | 32 | </key> |
698 | 29 | <key> | 33 | <key width="x-large"> |
699 | 30 | <binding label="8" /> | 34 | <binding label="8" /> |
700 | 31 | </key> | 35 | </key> |
702 | 32 | <key> | 36 | <key width="x-large"> |
703 | 33 | <binding label="9" /> | 37 | <binding label="9" /> |
704 | 34 | </key> | 38 | </key> |
706 | 35 | <key> | 39 | </row> |
707 | 40 | <row> | ||
708 | 41 | <key width="x-large"> | ||
709 | 42 | <binding action="plus_minus_toggle" label="+/-" /> | ||
710 | 43 | </key> | ||
711 | 44 | <key width="x-large"> | ||
712 | 36 | <binding label="0" /> | 45 | <binding label="0" /> |
713 | 37 | </key> | 46 | </key> |
724 | 38 | </row> | 47 | <key style="special" width="x-large"> |
715 | 39 | <row> | ||
716 | 40 | <spacer /> | ||
717 | 41 | <key width="large"> | ||
718 | 42 | <binding action="plus_minus_toggle" label="+/-" /> | ||
719 | 43 | </key> | ||
720 | 44 | <key width="large"> | ||
721 | 45 | <binding action="decimal_separator" /> | ||
722 | 46 | </key> | ||
723 | 47 | <key style="special" width="large"> | ||
725 | 48 | <binding action="backspace" label="" /> | 48 | <binding action="backspace" label="" /> |
726 | 49 | </key> | 49 | </key> |
727 | 50 | <key id="actionKey" style="special" width="large"> | ||
728 | 51 | <binding action="return" /> | ||
729 | 52 | </key> | ||
730 | 53 | </row> | 50 | </row> |
731 | 54 | </section> | 51 | </section> |
732 | 55 | </layout> | 52 | </layout> |
733 | 56 | 53 | ||
734 | === modified file 'maliit-keyboard/lib/logic/dynamiclayout.cpp' | |||
735 | --- maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-07-30 16:16:14 +0000 | |||
736 | +++ maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-08-08 14:28:50 +0000 | |||
737 | @@ -33,40 +33,36 @@ | |||
738 | 33 | return vMargin; | 33 | return vMargin; |
739 | 34 | } | 34 | } |
740 | 35 | 35 | ||
741 | 36 | /* | ||
742 | 37 | * calculates margin per row | ||
743 | 38 | **/ | ||
744 | 39 | |||
745 | 36 | QVector<int> DynamicLayout::calculateMargins(LayoutHelper::Orientation orientation, | 40 | QVector<int> DynamicLayout::calculateMargins(LayoutHelper::Orientation orientation, |
746 | 37 | Keyboard& kb) | 41 | Keyboard& kb) |
747 | 38 | { | 42 | { |
772 | 39 | if (d->marginsCachedOrientation != orientation) | 43 | const qreal keyboardWidth = windowWidth(orientation); |
773 | 40 | d->invalidateMarginsCache(); | 44 | |
774 | 41 | 45 | QVector<int> margins; | |
775 | 42 | if (!d->marginsCacheValid) { | 46 | int spaceTakenByKeys = 0; |
776 | 43 | const qreal keyboardWidth = windowWidth(orientation); | 47 | int numberOfKeysInRow = 0; |
777 | 44 | 48 | for (int index = 0; index < kb.keys.count(); ++index) { | |
778 | 45 | QVector<int> margins; | 49 | const KeyDescription &desc(kb.key_descriptions.at(index)); |
779 | 46 | int spaceTakenByKeys = 0; | 50 | int width = uiConst->keyWidth(orientation, desc.width); |
780 | 47 | int numberOfKeysInRow = 0; | 51 | spaceTakenByKeys += width; |
781 | 48 | for (int index = 0; index < kb.keys.count(); ++index) { | 52 | numberOfKeysInRow++; |
782 | 49 | const KeyDescription &desc(kb.key_descriptions.at(index)); | 53 | |
783 | 50 | int width = uiConst->keyWidth(orientation, desc.width); | 54 | bool at_row_end((index + 1 == kb.keys.count()) |
784 | 51 | spaceTakenByKeys += width; | 55 | || (index + 1 < kb.keys.count() |
785 | 52 | numberOfKeysInRow++; | 56 | && kb.key_descriptions.at(index + 1).row > desc.row)); |
786 | 53 | 57 | ||
787 | 54 | bool at_row_end((index + 1 == kb.keys.count()) | 58 | if (at_row_end) { |
788 | 55 | || (index + 1 < kb.keys.count() | 59 | int marginThisRow = ( (keyboardWidth - spaceTakenByKeys) / (numberOfKeysInRow-1) ) / 2; |
789 | 56 | && kb.key_descriptions.at(index + 1).row > desc.row)); | 60 | margins.append(marginThisRow); |
790 | 57 | 61 | spaceTakenByKeys = 0; | |
767 | 58 | if (at_row_end) { | ||
768 | 59 | int marginThisRow = ( (keyboardWidth - spaceTakenByKeys) / (numberOfKeysInRow-1) ) / 2; | ||
769 | 60 | d->marginsCached.append(marginThisRow); | ||
770 | 61 | spaceTakenByKeys = 0; | ||
771 | 62 | } | ||
791 | 63 | } | 62 | } |
792 | 64 | |||
793 | 65 | d->marginsCachedOrientation = orientation; | ||
794 | 66 | d->marginsCacheValid = true; | ||
795 | 67 | } | 63 | } |
796 | 68 | 64 | ||
798 | 69 | return d->marginsCached; | 65 | return margins; |
799 | 70 | } | 66 | } |
800 | 71 | 67 | ||
801 | 72 | void DynamicLayout::calculateNumberOfRows(Keyboard& kb) | 68 | void DynamicLayout::calculateNumberOfRows(Keyboard& kb) |
802 | 73 | 69 | ||
803 | === modified file 'maliit-keyboard/lib/logic/keyareaconverter.cpp' | |||
804 | --- maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-07-30 16:16:14 +0000 | |||
805 | +++ maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-08-08 14:28:50 +0000 | |||
806 | @@ -100,11 +100,10 @@ | |||
807 | 100 | qreal consumed_width = 0; | 100 | qreal consumed_width = 0; |
808 | 101 | 101 | ||
809 | 102 | QVector<int> margins = uiConst->calculateMargins(orientation, kb); | 102 | QVector<int> margins = uiConst->calculateMargins(orientation, kb); |
810 | 103 | Q_ASSERT(margins.size() > 0); | ||
811 | 104 | qreal margin = margins[0]; | ||
812 | 105 | 103 | ||
813 | 106 | int row = 0; | 104 | int row = 0; |
814 | 107 | for (int index = 0; index < kb.keys.count(); ++index) { | 105 | for (int index = 0; index < kb.keys.count(); ++index) { |
815 | 106 | const qreal margin = margins[row]; | ||
816 | 108 | row_indices.append(index); | 107 | row_indices.append(index); |
817 | 109 | Key &key(kb.keys[index]); | 108 | Key &key(kb.keys[index]); |
818 | 110 | const KeyDescription &desc(kb.key_descriptions.at(index)); | 109 | const KeyDescription &desc(kb.key_descriptions.at(index)); |
819 | 111 | 110 | ||
820 | === modified file 'maliit-keyboard/lib/logic/layoutupdater.cpp' | |||
821 | --- maliit-keyboard/lib/logic/layoutupdater.cpp 2013-07-29 11:52:26 +0000 | |||
822 | +++ maliit-keyboard/lib/logic/layoutupdater.cpp 2013-08-08 14:28:50 +0000 | |||
823 | @@ -332,8 +332,6 @@ | |||
824 | 332 | d->layout->setCenterPanel(d->inShiftedState() ? converter.shiftedKeyArea() | 332 | d->layout->setCenterPanel(d->inShiftedState() ? converter.shiftedKeyArea() |
825 | 333 | : converter.keyArea()); | 333 | : converter.keyArea()); |
826 | 334 | 334 | ||
827 | 335 | converter.keyArea(); | ||
828 | 336 | d->layout->setCenterPanel(converter.keyArea()); | ||
829 | 337 | if (isWordRibbonVisible()) | 335 | if (isWordRibbonVisible()) |
830 | 338 | applyStyleToWordRibbon(d->layout->wordRibbon(), d->style, orientation); | 336 | applyStyleToWordRibbon(d->layout->wordRibbon(), d->style, orientation); |
831 | 339 | 337 | ||
832 | 340 | 338 | ||
833 | === modified file 'maliit-keyboard/lib/models/layout.cpp' | |||
834 | --- maliit-keyboard/lib/models/layout.cpp 2013-06-05 14:58:50 +0000 | |||
835 | +++ maliit-keyboard/lib/models/layout.cpp 2013-08-08 14:28:50 +0000 | |||
836 | @@ -63,6 +63,7 @@ | |||
837 | 63 | KeyArea key_area; | 63 | KeyArea key_area; |
838 | 64 | QString image_directory; | 64 | QString image_directory; |
839 | 65 | QHash<int, QByteArray> roles; | 65 | QHash<int, QByteArray> roles; |
840 | 66 | QString activeViewId; | ||
841 | 66 | 67 | ||
842 | 67 | explicit LayoutPrivate(); | 68 | explicit LayoutPrivate(); |
843 | 68 | }; | 69 | }; |
844 | @@ -229,6 +230,19 @@ | |||
845 | 229 | qGuiApp->primaryScreen()->orientation()) ); | 230 | qGuiApp->primaryScreen()->orientation()) ); |
846 | 230 | } | 231 | } |
847 | 231 | 232 | ||
848 | 233 | |||
849 | 234 | QString Layout::activeView() const | ||
850 | 235 | { | ||
851 | 236 | Q_D(const Layout); | ||
852 | 237 | return d->activeViewId; | ||
853 | 238 | } | ||
854 | 239 | |||
855 | 240 | void Layout::setActiveView(const QString& activeViewId) | ||
856 | 241 | { | ||
857 | 242 | Q_D(Layout); | ||
858 | 243 | d->activeViewId = activeViewId; | ||
859 | 244 | } | ||
860 | 245 | |||
861 | 232 | void Layout::setImageDirectory(const QString &directory) | 246 | void Layout::setImageDirectory(const QString &directory) |
862 | 233 | { | 247 | { |
863 | 234 | Q_D(Layout); | 248 | Q_D(Layout); |
864 | 235 | 249 | ||
865 | === modified file 'maliit-keyboard/lib/models/layout.h' | |||
866 | --- maliit-keyboard/lib/models/layout.h 2013-06-05 14:58:50 +0000 | |||
867 | +++ maliit-keyboard/lib/models/layout.h 2013-08-08 14:28:50 +0000 | |||
868 | @@ -78,6 +78,10 @@ | |||
869 | 78 | Q_PROPERTY(int invisible_toucharea_height READ invisibleTouchAreaHeight | 78 | Q_PROPERTY(int invisible_toucharea_height READ invisibleTouchAreaHeight |
870 | 79 | NOTIFY invisibleTouchAreaHeightChanged) | 79 | NOTIFY invisibleTouchAreaHeightChanged) |
871 | 80 | 80 | ||
872 | 81 | Q_PROPERTY(QString activeView READ activeView WRITE setActiveView | ||
873 | 82 | NOTIFY activeViewChanged) | ||
874 | 83 | |||
875 | 84 | |||
876 | 81 | public: | 85 | public: |
877 | 82 | enum Roles { | 86 | enum Roles { |
878 | 83 | RoleKeyRectangle = Qt::UserRole + 1, | 87 | RoleKeyRectangle = Qt::UserRole + 1, |
879 | @@ -133,6 +137,10 @@ | |||
880 | 133 | Q_SLOT int invisibleTouchAreaHeight() const; | 137 | Q_SLOT int invisibleTouchAreaHeight() const; |
881 | 134 | Q_SIGNAL void invisibleTouchAreaHeightChanged(int &changed); | 138 | Q_SIGNAL void invisibleTouchAreaHeightChanged(int &changed); |
882 | 135 | 139 | ||
883 | 140 | Q_SLOT QString activeView() const; | ||
884 | 141 | Q_SLOT void setActiveView(const QString& activeViewId); | ||
885 | 142 | Q_SIGNAL void activeViewChanged(const QString &activeViewId); | ||
886 | 143 | |||
887 | 136 | virtual QHash<int, QByteArray> roleNames() const; | 144 | virtual QHash<int, QByteArray> roleNames() const; |
888 | 137 | virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; | 145 | virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; |
889 | 138 | virtual QVariant data(const QModelIndex &index, | 146 | virtual QVariant data(const QModelIndex &index, |
890 | 139 | 147 | ||
891 | === modified file 'maliit-keyboard/maliit-keyboard.pro' | |||
892 | --- maliit-keyboard/maliit-keyboard.pro 2013-07-29 13:51:23 +0000 | |||
893 | +++ maliit-keyboard/maliit-keyboard.pro 2013-08-08 14:28:50 +0000 | |||
894 | @@ -9,7 +9,6 @@ | |||
895 | 9 | tests \ | 9 | tests \ |
896 | 10 | benchmark \ | 10 | benchmark \ |
897 | 11 | 11 | ||
898 | 12 | |||
899 | 13 | !notests { | 12 | !notests { |
900 | 14 | SUBDIRS += tests | 13 | SUBDIRS += tests |
901 | 15 | } | 14 | } |
902 | 16 | 15 | ||
903 | === modified file 'maliit-keyboard/plugin/inputmethod.cpp' | |||
904 | --- maliit-keyboard/plugin/inputmethod.cpp 2013-07-30 16:16:14 +0000 | |||
905 | +++ maliit-keyboard/plugin/inputmethod.cpp 2013-08-08 14:28:50 +0000 | |||
906 | @@ -62,7 +62,7 @@ | |||
907 | 62 | #include <maliit/plugins/abstractpluginsetting.h> | 62 | #include <maliit/plugins/abstractpluginsetting.h> |
908 | 63 | #include <maliit/plugins/updateevent.h> | 63 | #include <maliit/plugins/updateevent.h> |
909 | 64 | #include <maliit/plugins/abstractinputmethodhost.h> | 64 | #include <maliit/plugins/abstractinputmethodhost.h> |
911 | 65 | 65 | #include <maliit/namespace.h> | |
912 | 66 | 66 | ||
913 | 67 | #include <QApplication> | 67 | #include <QApplication> |
914 | 68 | #include <QWidget> | 68 | #include <QWidget> |
915 | @@ -169,6 +169,8 @@ | |||
916 | 169 | QQuickView* view; | 169 | QQuickView* view; |
917 | 170 | 170 | ||
918 | 171 | bool predictionEnabled; | 171 | bool predictionEnabled; |
919 | 172 | Maliit::TextContentType contentType; | ||
920 | 173 | QString activeLanguageId; | ||
921 | 172 | 174 | ||
922 | 173 | explicit InputMethodPrivate(InputMethod * const q, | 175 | explicit InputMethodPrivate(InputMethod * const q, |
923 | 174 | MAbstractInputMethodHost *host); | 176 | MAbstractInputMethodHost *host); |
924 | @@ -176,6 +178,7 @@ | |||
925 | 176 | void updateKeyboardOrientation(); | 178 | void updateKeyboardOrientation(); |
926 | 177 | void updateWordRibbon(); | 179 | void updateWordRibbon(); |
927 | 178 | 180 | ||
928 | 181 | void setActiveKeyboardId(const QString& id); | ||
929 | 179 | void connectToNotifier(); | 182 | void connectToNotifier(); |
930 | 180 | void setContextProperties(QQmlContext *qml_context); | 183 | void setContextProperties(QQmlContext *qml_context); |
931 | 181 | }; | 184 | }; |
932 | @@ -204,6 +207,8 @@ | |||
933 | 204 | , host(host) | 207 | , host(host) |
934 | 205 | , view(0) | 208 | , view(0) |
935 | 206 | , predictionEnabled(false) | 209 | , predictionEnabled(false) |
936 | 210 | , contentType(Maliit::FreeTextContentType) | ||
937 | 211 | , activeLanguageId("en_us") | ||
938 | 207 | { | 212 | { |
939 | 208 | view = createWindow(host); | 213 | view = createWindow(host); |
940 | 209 | 214 | ||
941 | @@ -359,6 +364,20 @@ | |||
942 | 359 | setLayoutOrientation(QGuiApplication::primaryScreen()->orientation()); | 364 | setLayoutOrientation(QGuiApplication::primaryScreen()->orientation()); |
943 | 360 | } | 365 | } |
944 | 361 | 366 | ||
945 | 367 | /* | ||
946 | 368 | * changes keyboard layout | ||
947 | 369 | * called directly to show URL or num layout for special contentTypes, | ||
948 | 370 | * does not change the current language id / activeView | ||
949 | 371 | */ | ||
950 | 372 | |||
951 | 373 | void InputMethodPrivate::setActiveKeyboardId(const QString &id) | ||
952 | 374 | { | ||
953 | 375 | // FIXME: Perhaps better to let both LayoutUpdater share the same KeyboardLoader instance? | ||
954 | 376 | layout.updater.setActiveKeyboardId(id); | ||
955 | 377 | extended_layout.updater.setActiveKeyboardId(id); | ||
956 | 378 | layout.model.setActiveView(id); | ||
957 | 379 | } | ||
958 | 380 | |||
959 | 362 | void InputMethodPrivate::connectToNotifier() | 381 | void InputMethodPrivate::connectToNotifier() |
960 | 363 | { | 382 | { |
961 | 364 | #ifdef TEMP_DISABLED | 383 | #ifdef TEMP_DISABLED |
962 | @@ -436,6 +455,7 @@ | |||
963 | 436 | connect(this, SIGNAL(wordRibbonEnabledChanged(bool)), uiConst, SLOT(onWordEngineSettingsChanged(bool))); | 455 | connect(this, SIGNAL(wordRibbonEnabledChanged(bool)), uiConst, SLOT(onWordEngineSettingsChanged(bool))); |
964 | 437 | 456 | ||
965 | 438 | connect(this, SIGNAL(predictionEnabledChanged()), this, SLOT(updateWordEngine())); | 457 | connect(this, SIGNAL(predictionEnabledChanged()), this, SLOT(updateWordEngine())); |
966 | 458 | connect(this, SIGNAL(contentTypeChanged(Maliit::TextContentType)), this, SLOT(onContentTypeChanged(Maliit::TextContentType))); | ||
967 | 439 | 459 | ||
968 | 440 | registerStyleSetting(host); | 460 | registerStyleSetting(host); |
969 | 441 | 461 | ||
970 | @@ -457,13 +477,9 @@ | |||
971 | 457 | void InputMethod::show() | 477 | void InputMethod::show() |
972 | 458 | { | 478 | { |
973 | 459 | Q_D(InputMethod); | 479 | Q_D(InputMethod); |
974 | 460 | bool valid = true; | ||
975 | 461 | 480 | ||
976 | 462 | d->view->setVisible(true); | 481 | d->view->setVisible(true); |
977 | 463 | 482 | ||
978 | 464 | if (d->host->contentType(valid) == Maliit::UrlContentType) | ||
979 | 465 | setActiveSubView("url"); | ||
980 | 466 | |||
981 | 467 | #ifdef EXTENDED_SURFACE_TEMP_DISABLED | 483 | #ifdef EXTENDED_SURFACE_TEMP_DISABLED |
982 | 468 | d->surface->show(); | 484 | d->surface->show(); |
983 | 469 | d->extended_surface->show(); | 485 | d->extended_surface->show(); |
984 | @@ -551,15 +567,17 @@ | |||
985 | 551 | return views; | 567 | return views; |
986 | 552 | } | 568 | } |
987 | 553 | 569 | ||
988 | 570 | // called by settings change/language change | ||
989 | 554 | void InputMethod::setActiveSubView(const QString &id, | 571 | void InputMethod::setActiveSubView(const QString &id, |
990 | 555 | Maliit::HandlerState state) | 572 | Maliit::HandlerState state) |
991 | 556 | { | 573 | { |
992 | 557 | Q_UNUSED(state) | 574 | Q_UNUSED(state) |
993 | 558 | Q_D(InputMethod); | 575 | Q_D(InputMethod); |
994 | 559 | 576 | ||
998 | 560 | // FIXME: Perhaps better to let both LayoutUpdater share the same KeyboardLoader instance? | 577 | // store language id, so we can switch back to current active view |
999 | 561 | d->layout.updater.setActiveKeyboardId(id); | 578 | // after showing special layouts as e.g. URL or Num layouts |
1000 | 562 | d->extended_layout.updater.setActiveKeyboardId(id); | 579 | d->activeLanguageId = id; |
1001 | 580 | d->setActiveKeyboardId(id); | ||
1002 | 563 | } | 581 | } |
1003 | 564 | 582 | ||
1004 | 565 | QString InputMethod::activeSubView(Maliit::HandlerState state) const | 583 | QString InputMethod::activeSubView(Maliit::HandlerState state) const |
1005 | @@ -610,7 +628,6 @@ | |||
1006 | 610 | return true; | 628 | return true; |
1007 | 611 | } | 629 | } |
1008 | 612 | 630 | ||
1009 | 613 | |||
1010 | 614 | void InputMethod::registerStyleSetting(MAbstractInputMethodHost *host) | 631 | void InputMethod::registerStyleSetting(MAbstractInputMethodHost *host) |
1011 | 615 | { | 632 | { |
1012 | 616 | Q_D(InputMethod); | 633 | Q_D(InputMethod); |
1013 | @@ -899,6 +916,8 @@ | |||
1014 | 899 | bool valid; | 916 | bool valid; |
1015 | 900 | 917 | ||
1016 | 901 | bool emitPredictionEnabled = false; | 918 | bool emitPredictionEnabled = false; |
1017 | 919 | bool emitContentType = false; | ||
1018 | 920 | |||
1019 | 902 | bool newPredictionEnabled = inputMethodHost()->predictionEnabled(valid); | 921 | bool newPredictionEnabled = inputMethodHost()->predictionEnabled(valid); |
1020 | 903 | 922 | ||
1021 | 904 | if (!valid) | 923 | if (!valid) |
1022 | @@ -908,9 +927,24 @@ | |||
1023 | 908 | d->predictionEnabled = newPredictionEnabled; | 927 | d->predictionEnabled = newPredictionEnabled; |
1024 | 909 | emitPredictionEnabled = true; | 928 | emitPredictionEnabled = true; |
1025 | 910 | } | 929 | } |
1026 | 930 | |||
1027 | 931 | Maliit::TextContentType newContentType = static_cast<Maliit::TextContentType>( inputMethodHost()->contentType(valid) ); | ||
1028 | 932 | if (!valid) { | ||
1029 | 933 | newContentType = Maliit::FreeTextContentType; | ||
1030 | 934 | } | ||
1031 | 935 | |||
1032 | 936 | if (newContentType != d->contentType) { | ||
1033 | 937 | d->contentType = newContentType; | ||
1034 | 938 | emitContentType = true; | ||
1035 | 939 | } | ||
1036 | 940 | |||
1037 | 941 | |||
1038 | 911 | if (emitPredictionEnabled) | 942 | if (emitPredictionEnabled) |
1039 | 912 | Q_EMIT predictionEnabledChanged(); | 943 | Q_EMIT predictionEnabledChanged(); |
1040 | 913 | 944 | ||
1041 | 945 | if (emitContentType) | ||
1042 | 946 | Q_EMIT contentTypeChanged(d->contentType); | ||
1043 | 947 | |||
1044 | 914 | } | 948 | } |
1045 | 915 | 949 | ||
1046 | 916 | void InputMethod::updateWordEngine() | 950 | void InputMethod::updateWordEngine() |
1047 | @@ -931,6 +965,32 @@ | |||
1048 | 931 | return d->predictionEnabled; | 965 | return d->predictionEnabled; |
1049 | 932 | } | 966 | } |
1050 | 933 | 967 | ||
1051 | 968 | Maliit::TextContentType InputMethod::contentType() | ||
1052 | 969 | { | ||
1053 | 970 | Q_D(InputMethod); | ||
1054 | 971 | return d->contentType; | ||
1055 | 972 | } | ||
1056 | 973 | |||
1057 | 974 | void InputMethod::onContentTypeChanged(Maliit::TextContentType contentType) | ||
1058 | 975 | { | ||
1059 | 976 | Q_D(InputMethod); | ||
1060 | 977 | |||
1061 | 978 | if (contentType == Maliit::FreeTextContentType) | ||
1062 | 979 | d->setActiveKeyboardId( d->activeLanguageId ); | ||
1063 | 980 | |||
1064 | 981 | if (contentType == Maliit::NumberContentType) | ||
1065 | 982 | d->setActiveKeyboardId( "number" ); | ||
1066 | 983 | |||
1067 | 984 | if (contentType == Maliit::PhoneNumberContentType) | ||
1068 | 985 | d->setActiveKeyboardId( "phonenumber" ); | ||
1069 | 986 | |||
1070 | 987 | if (contentType == Maliit::EmailContentType) | ||
1071 | 988 | d->setActiveKeyboardId( "email" ); | ||
1072 | 989 | |||
1073 | 990 | if (contentType == Maliit::UrlContentType) | ||
1074 | 991 | d->setActiveKeyboardId("url"); | ||
1075 | 992 | } | ||
1076 | 993 | |||
1077 | 934 | void InputMethod::onQQuickViewStatusChanged(QQuickView::Status status) | 994 | void InputMethod::onQQuickViewStatusChanged(QQuickView::Status status) |
1078 | 935 | { | 995 | { |
1079 | 936 | Q_D(InputMethod); | 996 | Q_D(InputMethod); |
1080 | 937 | 997 | ||
1081 | === modified file 'maliit-keyboard/plugin/inputmethod.h' | |||
1082 | --- maliit-keyboard/plugin/inputmethod.h 2013-07-30 11:04:20 +0000 | |||
1083 | +++ maliit-keyboard/plugin/inputmethod.h 2013-08-08 14:28:50 +0000 | |||
1084 | @@ -80,12 +80,16 @@ | |||
1085 | 80 | Q_SLOT void onQQuickViewStatusChanged(QQuickView::Status status); | 80 | Q_SLOT void onQQuickViewStatusChanged(QQuickView::Status status); |
1086 | 81 | 81 | ||
1087 | 82 | Q_PROPERTY(bool predictionEnabled READ predictionEnabled NOTIFY predictionEnabledChanged) | 82 | Q_PROPERTY(bool predictionEnabled READ predictionEnabled NOTIFY predictionEnabledChanged) |
1088 | 83 | Q_PROPERTY(Maliit::TextContentType contentType READ contentType NOTIFY contentTypeChanged) | ||
1089 | 83 | 84 | ||
1090 | 84 | bool predictionEnabled(); | 85 | bool predictionEnabled(); |
1091 | 86 | Maliit::TextContentType contentType(); | ||
1092 | 87 | |||
1093 | 85 | void update(); | 88 | void update(); |
1094 | 86 | 89 | ||
1095 | 87 | Q_SIGNALS: | 90 | Q_SIGNALS: |
1096 | 88 | void predictionEnabledChanged(); | 91 | void predictionEnabledChanged(); |
1097 | 92 | void contentTypeChanged(Maliit::TextContentType contentType); | ||
1098 | 89 | 93 | ||
1099 | 90 | private: | 94 | private: |
1100 | 91 | void registerStyleSetting(MAbstractInputMethodHost *host); | 95 | void registerStyleSetting(MAbstractInputMethodHost *host); |
1101 | @@ -115,6 +119,8 @@ | |||
1102 | 115 | Q_SLOT void onMagnifierLayoutOriginChanged(const QPoint &origin); | 119 | Q_SLOT void onMagnifierLayoutOriginChanged(const QPoint &origin); |
1103 | 116 | #endif | 120 | #endif |
1104 | 117 | 121 | ||
1105 | 122 | Q_SLOT void onContentTypeChanged(Maliit::TextContentType contentType); | ||
1106 | 123 | |||
1107 | 118 | Q_SLOT void onHideAnimationFinished(); | 124 | Q_SLOT void onHideAnimationFinished(); |
1108 | 119 | Q_SIGNAL void wordEngineEnabledChanged(bool wordEngineEnabled); | 125 | Q_SIGNAL void wordEngineEnabledChanged(bool wordEngineEnabled); |
1109 | 120 | Q_SIGNAL void wordRibbonEnabledChanged(bool wordRibbonEnabled); | 126 | Q_SIGNAL void wordRibbonEnabledChanged(bool wordRibbonEnabled); |
1110 | 121 | 127 | ||
1111 | === modified file 'maliit-keyboard/tests/common/common.pro' | |||
1112 | --- maliit-keyboard/tests/common/common.pro 2012-11-21 15:19:50 +0000 | |||
1113 | +++ maliit-keyboard/tests/common/common.pro 2013-08-08 14:28:50 +0000 | |||
1114 | @@ -29,3 +29,6 @@ | |||
1115 | 29 | check.target = check | 29 | check.target = check |
1116 | 30 | check.command = $$system(true) | 30 | check.command = $$system(true) |
1117 | 31 | check.depends += libtests-common.a | 31 | check.depends += libtests-common.a |
1118 | 32 | |||
1119 | 33 | OTHER_FILES += \ | ||
1120 | 34 | helper.js | ||
1121 | 32 | 35 | ||
1122 | === added file 'maliit-keyboard/tests/common/helper.js' | |||
1123 | --- maliit-keyboard/tests/common/helper.js 1970-01-01 00:00:00 +0000 | |||
1124 | +++ maliit-keyboard/tests/common/helper.js 2013-08-08 14:28:50 +0000 | |||
1125 | @@ -0,0 +1,13 @@ | |||
1126 | 1 | .pragma library | ||
1127 | 2 | |||
1128 | 3 | // Find an object with the given name recursively, starting | ||
1129 | 4 | // at the given object "obj" | ||
1130 | 5 | function findChild(obj,objectName) { | ||
1131 | 6 | for (var i in obj.children) { | ||
1132 | 7 | var child = obj.children[i]; | ||
1133 | 8 | if (child.objectName === objectName) return child; | ||
1134 | 9 | var subChild = findChild(child,objectName); | ||
1135 | 10 | if (subChild !== undefined) return subChild; | ||
1136 | 11 | } | ||
1137 | 12 | return undefined; | ||
1138 | 13 | } | ||
1139 | 0 | 14 | ||
1140 | === modified file 'maliit-keyboard/tests/language-layout-switching/main.cpp' | |||
1141 | --- maliit-keyboard/tests/language-layout-switching/main.cpp 2013-03-22 16:40:29 +0000 | |||
1142 | +++ maliit-keyboard/tests/language-layout-switching/main.cpp 2013-08-08 14:28:50 +0000 | |||
1143 | @@ -87,6 +87,8 @@ | |||
1144 | 87 | QCOMPARE(layout.activeKeyArea().keys().count(), expected_key_count); | 87 | QCOMPARE(layout.activeKeyArea().keys().count(), expected_key_count); |
1145 | 88 | } | 88 | } |
1146 | 89 | 89 | ||
1147 | 90 | // Note: this feature is not important in Ubuntu UX | ||
1148 | 91 | |||
1149 | 90 | // This test is very trivial. It's required however because none of the | 92 | // This test is very trivial. It's required however because none of the |
1150 | 91 | // current mainline layouts feature layout switch keys, thus making | 93 | // current mainline layouts feature layout switch keys, thus making |
1151 | 92 | // regressions impossible to spot. | 94 | // regressions impossible to spot. |
1152 | 93 | 95 | ||
1153 | === added directory 'maliit-keyboard/tests/qml-api-tests' | |||
1154 | === added directory 'maliit-keyboard/tests/qml-api-tests/imports' | |||
1155 | === added directory 'maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport' | |||
1156 | === added file 'maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir' | |||
1157 | --- maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir 1970-01-01 00:00:00 +0000 | |||
1158 | +++ maliit-keyboard/tests/qml-api-tests/imports/MaliitTestSupport/qmldir 2013-08-08 14:28:50 +0000 | |||
1159 | @@ -0,0 +1,2 @@ | |||
1160 | 1 | module MaliitTestSupport | ||
1161 | 2 | plugin maliitqmlhelperplugin | ||
1162 | 0 | 3 | ||
1163 | === added file 'maliit-keyboard/tests/qml-api-tests/plugin.cpp' | |||
1164 | --- maliit-keyboard/tests/qml-api-tests/plugin.cpp 1970-01-01 00:00:00 +0000 | |||
1165 | +++ maliit-keyboard/tests/qml-api-tests/plugin.cpp 2013-08-08 14:28:50 +0000 | |||
1166 | @@ -0,0 +1,55 @@ | |||
1167 | 1 | #include <QtQml/QQmlExtensionPlugin> | ||
1168 | 2 | #include <QtQml/qqml.h> | ||
1169 | 3 | #include <qdebug.h> | ||
1170 | 4 | #include <qcoreapplication.h> | ||
1171 | 5 | |||
1172 | 6 | #include <QStringList> | ||
1173 | 7 | #include <QUrl> | ||
1174 | 8 | #include <QFile> | ||
1175 | 9 | |||
1176 | 10 | class MaliitTestHelper : public QObject | ||
1177 | 11 | { | ||
1178 | 12 | Q_OBJECT | ||
1179 | 13 | |||
1180 | 14 | public: | ||
1181 | 15 | MaliitTestHelper(QObject *parent=0) : QObject(parent) | ||
1182 | 16 | { | ||
1183 | 17 | } | ||
1184 | 18 | |||
1185 | 19 | ~MaliitTestHelper() | ||
1186 | 20 | { | ||
1187 | 21 | } | ||
1188 | 22 | |||
1189 | 23 | Q_INVOKABLE QStringList localeUiLanguages(QVariant value) { | ||
1190 | 24 | QLocale locale = value.toLocale(); | ||
1191 | 25 | return locale.uiLanguages(); | ||
1192 | 26 | } | ||
1193 | 27 | |||
1194 | 28 | Q_INVOKABLE QString localeName(QVariant value) { | ||
1195 | 29 | QLocale locale = value.toLocale(); | ||
1196 | 30 | return locale.name(); | ||
1197 | 31 | } | ||
1198 | 32 | |||
1199 | 33 | signals: | ||
1200 | 34 | private: | ||
1201 | 35 | }; | ||
1202 | 36 | |||
1203 | 37 | |||
1204 | 38 | class MaliitQmlHelperPlugin : public QQmlExtensionPlugin | ||
1205 | 39 | { | ||
1206 | 40 | Q_OBJECT | ||
1207 | 41 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") | ||
1208 | 42 | |||
1209 | 43 | public: | ||
1210 | 44 | |||
1211 | 45 | void registerTypes(const char *uri) | ||
1212 | 46 | { | ||
1213 | 47 | Q_ASSERT(uri == QLatin1String("MaliitTestSupport")); | ||
1214 | 48 | qmlRegisterType<MaliitTestHelper>(uri, 1, 0, "MaliitTestHelper"); | ||
1215 | 49 | } | ||
1216 | 50 | }; | ||
1217 | 51 | |||
1218 | 52 | |||
1219 | 53 | #include "plugin.moc" | ||
1220 | 54 | |||
1221 | 55 | |||
1222 | 0 | 56 | ||
1223 | === added file 'maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro' | |||
1224 | --- maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro 1970-01-01 00:00:00 +0000 | |||
1225 | +++ maliit-keyboard/tests/qml-api-tests/qml-api-tests.pro 2013-08-08 14:28:50 +0000 | |||
1226 | @@ -0,0 +1,20 @@ | |||
1227 | 1 | include(../../config-plugin.pri) | ||
1228 | 2 | |||
1229 | 3 | TARGET = maliitqmlhelperplugin | ||
1230 | 4 | DESTDIR = imports/MaliitTestSupport | ||
1231 | 5 | TEMPLATE = lib | ||
1232 | 6 | CONFIG += qt plugin | ||
1233 | 7 | |||
1234 | 8 | SOURCES += \ | ||
1235 | 9 | plugin.cpp | ||
1236 | 10 | |||
1237 | 11 | QT = core gui qml quick qml-private | ||
1238 | 12 | |||
1239 | 13 | INCLUDEPATH += ../../lib ../../ | ||
1240 | 14 | |||
1241 | 15 | pluginfiles.files += \ | ||
1242 | 16 | imports/MaliitTestSupport/qmldir \ | ||
1243 | 17 | |||
1244 | 18 | OTHER_FILES += \ | ||
1245 | 19 | tst_inputMethodHints.qml | ||
1246 | 20 | |||
1247 | 0 | 21 | ||
1248 | === added file 'maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml' | |||
1249 | --- maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml 1970-01-01 00:00:00 +0000 | |||
1250 | +++ maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml 2013-08-08 14:28:50 +0000 | |||
1251 | @@ -0,0 +1,124 @@ | |||
1252 | 1 | |||
1253 | 2 | import QtQuick 2.0 | ||
1254 | 3 | import QtTest 1.0 // for TestCase | ||
1255 | 4 | import Ubuntu.Components 0.1 | ||
1256 | 5 | import MaliitTestSupport 1.0 | ||
1257 | 6 | |||
1258 | 7 | /* | ||
1259 | 8 | * qmltestrunner -import maliit-keyboard/tests/qml-api-tests/imports/ -input maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml | ||
1260 | 9 | * | ||
1261 | 10 | * Note: if tests fail, try to increase asyncDelay | ||
1262 | 11 | */ | ||
1263 | 12 | |||
1264 | 13 | Item { | ||
1265 | 14 | id: mainWindow | ||
1266 | 15 | |||
1267 | 16 | width: 1280 | ||
1268 | 17 | height: 720 | ||
1269 | 18 | |||
1270 | 19 | anchors.margins: 60 | ||
1271 | 20 | |||
1272 | 21 | /** | ||
1273 | 22 | maliitTestHelper.localeName(Qt.inputMethod.locale) | ||
1274 | 23 | maliitTestHelper.localeUiLanguages(Qt.inputMethod.locale) | ||
1275 | 24 | */ | ||
1276 | 25 | |||
1277 | 26 | MaliitTestHelper { | ||
1278 | 27 | id: maliitTestHelper | ||
1279 | 28 | } | ||
1280 | 29 | |||
1281 | 30 | Rectangle | ||
1282 | 31 | { | ||
1283 | 32 | anchors.fill: parent | ||
1284 | 33 | color: "red" | ||
1285 | 34 | } | ||
1286 | 35 | |||
1287 | 36 | TextField { | ||
1288 | 37 | id: unusedTextField | ||
1289 | 38 | anchors { | ||
1290 | 39 | top: mainWindow.top | ||
1291 | 40 | horizontalCenter: parent.horizontalCenter | ||
1292 | 41 | topMargin: 50 | ||
1293 | 42 | } | ||
1294 | 43 | inputMethodHints: Qt.ImhUrlCharactersOnly | ||
1295 | 44 | } | ||
1296 | 45 | |||
1297 | 46 | TextField { | ||
1298 | 47 | id: textField | ||
1299 | 48 | anchors { | ||
1300 | 49 | top: unusedTextField.bottom | ||
1301 | 50 | horizontalCenter: parent.horizontalCenter | ||
1302 | 51 | topMargin: 50 | ||
1303 | 52 | } | ||
1304 | 53 | inputMethodHints: Qt.ImhUrlCharactersOnly | ||
1305 | 54 | } | ||
1306 | 55 | |||
1307 | 56 | TextField { | ||
1308 | 57 | id: noPredictiveTextField | ||
1309 | 58 | anchors { | ||
1310 | 59 | top: textField.bottom | ||
1311 | 60 | horizontalCenter: parent.horizontalCenter | ||
1312 | 61 | topMargin: 50 | ||
1313 | 62 | } | ||
1314 | 63 | inputMethodHints: Qt.ImhNoPredictiveText | ||
1315 | 64 | } | ||
1316 | 65 | |||
1317 | 66 | TestCase { | ||
1318 | 67 | id: inputMethodHintsTest | ||
1319 | 68 | name: "inputMethodHints" | ||
1320 | 69 | |||
1321 | 70 | // We must wait until the window is shown because we're going to do mouse interaction | ||
1322 | 71 | when: windowShown | ||
1323 | 72 | |||
1324 | 73 | function initTestCase() { | ||
1325 | 74 | } | ||
1326 | 75 | |||
1327 | 76 | function test_1_oskShownHide() | ||
1328 | 77 | { | ||
1329 | 78 | compare(Qt.inputMethod.visible, false) | ||
1330 | 79 | |||
1331 | 80 | click(textField) | ||
1332 | 81 | |||
1333 | 82 | tryCompare(Qt.inputMethod, "visible", true) | ||
1334 | 83 | |||
1335 | 84 | wait(500) | ||
1336 | 85 | |||
1337 | 86 | // TODO get actual values from MaliitTestHelper, e.g height 608 | ||
1338 | 87 | verify(Qt.inputMethod.keyboardRectangle.height > 0) | ||
1339 | 88 | |||
1340 | 89 | textField.focus = false | ||
1341 | 90 | compare(textField.focus, false) | ||
1342 | 91 | |||
1343 | 92 | wait(500) | ||
1344 | 93 | |||
1345 | 94 | tryCompare(Qt.inputMethod, "visible", false) | ||
1346 | 95 | tryCompare(Qt.inputMethod.keyboardRectangle, "height", 0) | ||
1347 | 96 | } | ||
1348 | 97 | |||
1349 | 98 | function test_2_noPredictiveText() | ||
1350 | 99 | { | ||
1351 | 100 | textField.focus = true | ||
1352 | 101 | |||
1353 | 102 | click(textField) | ||
1354 | 103 | |||
1355 | 104 | tryCompare(Qt.inputMethod, "visible", true) | ||
1356 | 105 | wait(500) | ||
1357 | 106 | verify(Qt.inputMethod.keyboardRectangle.height > 0) | ||
1358 | 107 | tryCompare(Qt.inputMethod.keyboardRectangle, "height", 796) | ||
1359 | 108 | |||
1360 | 109 | textField.focus = false | ||
1361 | 110 | noPredictiveTextField.focus = true | ||
1362 | 111 | |||
1363 | 112 | tryCompare(Qt.inputMethod.keyboardRectangle, "height", 608) | ||
1364 | 113 | } | ||
1365 | 114 | |||
1366 | 115 | /* helper */ | ||
1367 | 116 | |||
1368 | 117 | function click(target) { | ||
1369 | 118 | mouseClick(target, (target).width / 2, (target).height / 2) | ||
1370 | 119 | keyClick(Qt.Key_5) | ||
1371 | 120 | } | ||
1372 | 121 | |||
1373 | 122 | } | ||
1374 | 123 | |||
1375 | 124 | } | ||
1376 | 0 | 125 | ||
1377 | === added file 'maliit-keyboard/tests/qml-test-app/layout-test.qml' | |||
1378 | --- maliit-keyboard/tests/qml-test-app/layout-test.qml 1970-01-01 00:00:00 +0000 | |||
1379 | +++ maliit-keyboard/tests/qml-test-app/layout-test.qml 2013-08-08 14:28:50 +0000 | |||
1380 | @@ -0,0 +1,202 @@ | |||
1381 | 1 | import QtQuick 2.0 | ||
1382 | 2 | |||
1383 | 3 | |||
1384 | 4 | |||
1385 | 5 | import QtQuick 2.0 | ||
1386 | 6 | import Ubuntu.Components 0.1 | ||
1387 | 7 | |||
1388 | 8 | MainView { | ||
1389 | 9 | id: root | ||
1390 | 10 | |||
1391 | 11 | automaticOrientation: true | ||
1392 | 12 | |||
1393 | 13 | Rectangle { | ||
1394 | 14 | anchors.fill: parent | ||
1395 | 15 | color: "lightblue" | ||
1396 | 16 | } | ||
1397 | 17 | |||
1398 | 18 | Column { | ||
1399 | 19 | |||
1400 | 20 | y: units.gu(3) | ||
1401 | 21 | width: parent.width | ||
1402 | 22 | anchors.horizontalCenter: parent.horizontalCenter | ||
1403 | 23 | spacing: units.gu(1) | ||
1404 | 24 | |||
1405 | 25 | anchors.margins: units.gu(1) | ||
1406 | 26 | |||
1407 | 27 | Text { | ||
1408 | 28 | id: label | ||
1409 | 29 | text: "OSK Layout Test" | ||
1410 | 30 | anchors.horizontalCenter: parent.horizontalCenter | ||
1411 | 31 | font.pixelSize: units.gu(2) | ||
1412 | 32 | font.bold: true | ||
1413 | 33 | } | ||
1414 | 34 | |||
1415 | 35 | Rectangle { | ||
1416 | 36 | anchors.horizontalCenter: parent.horizontalCenter | ||
1417 | 37 | width: units.gu(18); | ||
1418 | 38 | height: units.gu(6); | ||
1419 | 39 | |||
1420 | 40 | anchors.leftMargin: units.gu(1) | ||
1421 | 41 | |||
1422 | 42 | color: "white" | ||
1423 | 43 | |||
1424 | 44 | TextInput { | ||
1425 | 45 | id: input; | ||
1426 | 46 | anchors.fill: parent | ||
1427 | 47 | color: "black"; selectionColor: "red" | ||
1428 | 48 | |||
1429 | 49 | // Qt.ImhPreferNumbers | ||
1430 | 50 | inputMethodHints: Qt.ImhUrlCharactersOnly | ||
1431 | 51 | font.pixelSize: units.gu(3) | ||
1432 | 52 | font.bold: true | ||
1433 | 53 | } | ||
1434 | 54 | } | ||
1435 | 55 | |||
1436 | 56 | Rectangle { | ||
1437 | 57 | anchors.horizontalCenter: parent.horizontalCenter; | ||
1438 | 58 | width: units.gu(18); | ||
1439 | 59 | height: units.gu(6); | ||
1440 | 60 | |||
1441 | 61 | color: "white" | ||
1442 | 62 | |||
1443 | 63 | TextInput { | ||
1444 | 64 | id: secondInput; | ||
1445 | 65 | anchors.fill: parent | ||
1446 | 66 | font.pixelSize: units.gu(3) | ||
1447 | 67 | inputMethodHints: Qt.ImhNone | ||
1448 | 68 | } | ||
1449 | 69 | } | ||
1450 | 70 | |||
1451 | 71 | Rectangle { | ||
1452 | 72 | anchors.horizontalCenter: parent.horizontalCenter; | ||
1453 | 73 | width: units.gu(18); | ||
1454 | 74 | height: units.gu(6); | ||
1455 | 75 | |||
1456 | 76 | color: "white" | ||
1457 | 77 | |||
1458 | 78 | TextInput { | ||
1459 | 79 | anchors.fill: parent | ||
1460 | 80 | font.pixelSize: units.gu(3) | ||
1461 | 81 | inputMethodHints: Qt.ImhDigitsOnly | ||
1462 | 82 | } | ||
1463 | 83 | } | ||
1464 | 84 | |||
1465 | 85 | Rectangle { | ||
1466 | 86 | anchors.horizontalCenter: parent.horizontalCenter; | ||
1467 | 87 | width: units.gu(18); | ||
1468 | 88 | height: units.gu(6); | ||
1469 | 89 | |||
1470 | 90 | color: "white" | ||
1471 | 91 | |||
1472 | 92 | TextInput { | ||
1473 | 93 | anchors.fill: parent | ||
1474 | 94 | font.pixelSize: units.gu(3) | ||
1475 | 95 | inputMethodHints: Qt.ImhDialableCharactersOnly | ||
1476 | 96 | } | ||
1477 | 97 | } | ||
1478 | 98 | |||
1479 | 99 | |||
1480 | 100 | Row { | ||
1481 | 101 | anchors.horizontalCenter: parent.horizontalCenter; | ||
1482 | 102 | |||
1483 | 103 | Text { | ||
1484 | 104 | id: textRectangle | ||
1485 | 105 | |||
1486 | 106 | font.pixelSize: units.gu(1) | ||
1487 | 107 | text: Qt.inputMethod.keyboardRectangle + " " | ||
1488 | 108 | } | ||
1489 | 109 | |||
1490 | 110 | Rectangle { | ||
1491 | 111 | id: clickBehindOSKDetectedIndicator | ||
1492 | 112 | |||
1493 | 113 | width: units.gu(18) | ||
1494 | 114 | height: units.gu(3) | ||
1495 | 115 | state: "default" | ||
1496 | 116 | |||
1497 | 117 | Text { | ||
1498 | 118 | id: clickBehindOSKDetectedIndicatorText | ||
1499 | 119 | anchors.centerIn: parent | ||
1500 | 120 | text: "clicked" | ||
1501 | 121 | font.pixelSize: units.gu(2) | ||
1502 | 122 | font.bold: true | ||
1503 | 123 | } | ||
1504 | 124 | |||
1505 | 125 | states: [ | ||
1506 | 126 | State { | ||
1507 | 127 | name: "default" | ||
1508 | 128 | PropertyChanges { | ||
1509 | 129 | target: clickBehindOSKDetectedIndicator | ||
1510 | 130 | color: "gray" | ||
1511 | 131 | } | ||
1512 | 132 | PropertyChanges { | ||
1513 | 133 | target: clickBehindOSKDetectedIndicatorText | ||
1514 | 134 | color: "gray" | ||
1515 | 135 | } | ||
1516 | 136 | }, | ||
1517 | 137 | State { | ||
1518 | 138 | name: "highlight" | ||
1519 | 139 | PropertyChanges { | ||
1520 | 140 | target: clickBehindOSKDetectedIndicator | ||
1521 | 141 | color: "red" | ||
1522 | 142 | } | ||
1523 | 143 | PropertyChanges { | ||
1524 | 144 | target: clickBehindOSKDetectedIndicatorText | ||
1525 | 145 | color: "white" | ||
1526 | 146 | } | ||
1527 | 147 | } | ||
1528 | 148 | ] | ||
1529 | 149 | } | ||
1530 | 150 | |||
1531 | 151 | } | ||
1532 | 152 | |||
1533 | 153 | Text { | ||
1534 | 154 | id: textVisible | ||
1535 | 155 | |||
1536 | 156 | anchors.horizontalCenter: parent.horizontalCenter; | ||
1537 | 157 | |||
1538 | 158 | font.pixelSize: units.gu(2) | ||
1539 | 159 | text: "keyboard reports visible: " + Qt.inputMethod.visible | ||
1540 | 160 | } | ||
1541 | 161 | |||
1542 | 162 | } // column | ||
1543 | 163 | |||
1544 | 164 | Rectangle { | ||
1545 | 165 | id: fakeBrowserUrlBar | ||
1546 | 166 | width: keyboardRect.width | ||
1547 | 167 | height: units.gu(4) | ||
1548 | 168 | color: "orange" | ||
1549 | 169 | anchors.bottom: keyboardRect.top | ||
1550 | 170 | |||
1551 | 171 | Text { | ||
1552 | 172 | visible: Qt.inputMethod.visible | ||
1553 | 173 | anchors.centerIn: parent | ||
1554 | 174 | font.pixelSize: units.gu(1) | ||
1555 | 175 | text: "browser url bar" | ||
1556 | 176 | } | ||
1557 | 177 | } | ||
1558 | 178 | |||
1559 | 179 | Rectangle { | ||
1560 | 180 | id: keyboardRect | ||
1561 | 181 | |||
1562 | 182 | width: Qt.inputMethod.keyboardRectangle.width | ||
1563 | 183 | height: Qt.inputMethod.keyboardRectangle.height | ||
1564 | 184 | |||
1565 | 185 | anchors.bottom: parent.bottom | ||
1566 | 186 | color: " green" | ||
1567 | 187 | |||
1568 | 188 | Text { | ||
1569 | 189 | visible: Qt.inputMethod.visible | ||
1570 | 190 | anchors.centerIn: parent | ||
1571 | 191 | font.pointSize: 24 | ||
1572 | 192 | text: Qt.inputMethod.keyboardRectangle + " " | ||
1573 | 193 | } | ||
1574 | 194 | |||
1575 | 195 | MouseArea { | ||
1576 | 196 | anchors.fill: parent | ||
1577 | 197 | onClicked: clickBehindOSKDetectedIndicator.visible = true | ||
1578 | 198 | onPressed: clickBehindOSKDetectedIndicator.state = "highlight" | ||
1579 | 199 | onReleased: clickBehindOSKDetectedIndicator.state = "default" | ||
1580 | 200 | } | ||
1581 | 201 | } | ||
1582 | 202 | } | ||
1583 | 0 | 203 | ||
1584 | === modified file 'maliit-keyboard/tests/qml-test-app/qml-test-app.pro' | |||
1585 | --- maliit-keyboard/tests/qml-test-app/qml-test-app.pro 2013-05-15 14:35:21 +0000 | |||
1586 | +++ maliit-keyboard/tests/qml-test-app/qml-test-app.pro 2013-08-08 14:28:50 +0000 | |||
1587 | @@ -6,5 +6,6 @@ | |||
1588 | 6 | 6 | ||
1589 | 7 | INSTALLS += qml | 7 | INSTALLS += qml |
1590 | 8 | OTHER_FILES += \ | 8 | OTHER_FILES += \ |
1592 | 9 | keyboard-test.qml | 9 | keyboard-test.qml \ |
1593 | 10 | layout-test.qml | ||
1594 | 10 | 11 | ||
1595 | 11 | 12 | ||
1596 | === modified file 'maliit-keyboard/tests/tests.pro' | |||
1597 | --- maliit-keyboard/tests/tests.pro 2013-07-29 13:51:23 +0000 | |||
1598 | +++ maliit-keyboard/tests/tests.pro 2013-08-08 14:28:50 +0000 | |||
1599 | @@ -8,6 +8,7 @@ | |||
1600 | 8 | word-candidates \ | 8 | word-candidates \ |
1601 | 9 | language-layout-loading \ | 9 | language-layout-loading \ |
1602 | 10 | qml-test-app \ | 10 | qml-test-app \ |
1603 | 11 | qml-api-tests \ | ||
1604 | 11 | wordengine \ | 12 | wordengine \ |
1605 | 12 | 13 | ||
1606 | 13 | CONFIG += ordered | 14 | CONFIG += ordered |
1607 | 14 | 15 | ||
1608 | === modified file 'unittests.sh' | |||
1609 | --- unittests.sh 2013-07-29 13:51:23 +0000 | |||
1610 | +++ unittests.sh 2013-08-08 14:28:50 +0000 | |||
1611 | @@ -1,11 +1,11 @@ | |||
1612 | 1 | 1 | ||
1621 | 2 | 2 | # to be run on the device | |
1622 | 3 | adb push maliit-keyboard/plugin/libmaliit-keyboard-plugin.so /data/ubuntu/usr/lib/maliit/plugins/libmaliit-keyboard-plugin.so | 3 | |
1623 | 4 | adb push maliit-keyboard/tests/wordengine/ut_wordengine /data/ubuntu/usr/bin | 4 | LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/editor/ut_editor |
1624 | 5 | adb push maliit-keyboard/tests/editor/ut_editor /data/ubuntu/usr/bin | 5 | LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/wordengine/ut_wordengine |
1625 | 6 | 6 | LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/dynamic-layout/ut_dynamiclayout | |
1626 | 7 | adb shell QT_QPA_PLATFORM=minimal LD_LIBRARY_PATH=/usr/lib/maliit/plugins:$_LD_LIBRARY_PATH /usr/bin/ut_editor | 7 | LD_LIBRARY_PATH=maliit-keyboard/plugin:$LD_LIBRARY_PATH maliit-keyboard/tests/language-layout-switching/language-layout-switching |
1627 | 8 | adb shell QT_QPA_PLATFORM=minimal LD_LIBRARY_PATH=/usr/lib/maliit/plugins:$_LD_LIBRARY_PATH /usr/bin/ut_wordengine | 8 | |
1628 | 9 | 9 | qmltestrunner -import maliit-keyboard/tests/qml-api-tests/imports/ -input maliit-keyboard/tests/qml-api-tests/tst_inputMethodHints.qml | |
1629 | 10 | 10 | ||
1630 | 11 | 11 |
PASSED: Continuous integration, rev:2138 jenkins. qa.ubuntu. com/job/ phablet- extras- maliit- plugins- ci/100/ jenkins. qa.ubuntu. com/job/ phablet- extras- maliit- plugins- saucy-armhf- ci/52 jenkins. qa.ubuntu. com/job/ phablet- extras- maliit- plugins- saucy-armhf- ci/52/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ phablet- extras- maliit- plugins- saucy-i386- ci/52
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ phablet- extras- maliit- plugins- ci/100/ rebuild
http://