Merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-pinyin into lp:phablet-extras/maliit-plugins
- maliit-plugins-pinyin
- Merge into maliit-plugins
Status: | Merged |
---|---|
Merged at revision: | 2132 |
Proposed branch: | lp:~thomas-moenicke/phablet-extras/maliit-plugins-pinyin |
Merge into: | lp:phablet-extras/maliit-plugins |
Diff against target: |
1376 lines (+522/-189) 31 files modified
debian/control (+4/-1) debian/rules (+1/-0) maliit-keyboard/data/languages/de.xml (+3/-0) maliit-keyboard/data/languages/en_gb.xml (+4/-1) maliit-keyboard/data/languages/en_us.xml (+4/-1) maliit-keyboard/data/languages/es.xml (+5/-2) maliit-keyboard/data/languages/zh_cn_pinyin.xml (+18/-168) maliit-keyboard/lib/lib.pro (+5/-0) maliit-keyboard/lib/logic/chineselanguagefeatures.cpp (+42/-0) maliit-keyboard/lib/logic/chineselanguagefeatures.h (+39/-0) maliit-keyboard/lib/logic/dynamiclayout.cpp (+15/-1) maliit-keyboard/lib/logic/dynamiclayout.h (+16/-0) maliit-keyboard/lib/logic/eventhandler.cpp (+7/-0) maliit-keyboard/lib/logic/eventhandler.h (+3/-0) maliit-keyboard/lib/logic/layoutupdater.cpp (+1/-0) maliit-keyboard/lib/logic/layoutupdater.h (+1/-0) maliit-keyboard/lib/logic/logic.pri (+6/-2) maliit-keyboard/lib/logic/pinyinadapter.cpp (+103/-0) maliit-keyboard/lib/logic/pinyinadapter.h (+50/-0) maliit-keyboard/lib/logic/wordengine.cpp (+67/-12) maliit-keyboard/lib/logic/wordengine.h (+3/-0) maliit-keyboard/plugin/editor.cpp (+2/-0) maliit-keyboard/plugin/inputmethod.cpp (+18/-0) maliit-keyboard/plugin/inputmethod.h (+2/-0) maliit-keyboard/qml/Keyboard.qml (+13/-0) maliit-keyboard/qml/LanguageMenu.qml (+53/-0) maliit-keyboard/qml/qml.pro (+2/-1) maliit-keyboard/view/abstracttexteditor.cpp (+20/-0) maliit-keyboard/view/abstracttexteditor.h (+3/-0) maliit-keyboard/word-prediction.pri (+7/-0) maliit-plugins.pro (+5/-0) |
To merge this branch: | bzr merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-pinyin |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Thomas Moenicke (community) | Abstain | ||
Bill Filler | Pending | ||
Review via email: mp+169238@code.launchpad.net |
Commit message
adding Chinese - pinyin support
Description of the change
adding Chinese - pinyin support
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2132
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 2133. By Thomas Moenicke
-
switch wordengine backend according to language
- 2134. By Thomas Moenicke
-
typo
Thomas Moenicke (thomas-moenicke) wrote : | # |
the head of /etc/xdg/
[maliit]
onscreen\
pluginsettings\
pluginsettings\
...
Thomas Moenicke (thomas-moenicke) wrote : | # |
these steps also should be done in order to set the phone to chinese:
1) sudo apt-get install fonts-droid
2) sudo locale-gen zh_CN.UTF-8
3) sudo vi /etc/default/local change LANG="en_US.UTF-8" to LANG="zh_CN.UTF-8"
4) sudo vi /etc/environment change LANG="zh_CN.UTF-8" and LANGUAGE="zh_CN"
5) reboot
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2134
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Thomas Moenicke (thomas-moenicke) wrote : | # |
Logic::
- 2135. By Thomas Moenicke
-
added chinese language features: no space after word suggestion, no upper/lowercase
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2135
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 2136. By Thomas Moenicke
-
adding dependency to glib-2.0-dev
- 2137. By Thomas Moenicke
-
polished layout:
- removed uppercase, not needed for pinyin
- removed redundant return key
- fixed spacing
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2136
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2137
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2013-06-06 10:29:18 +0000 | |||
3 | +++ debian/control 2013-06-17 15:53:36 +0000 | |||
4 | @@ -14,7 +14,9 @@ | |||
5 | 14 | maliit-framework-dev (>= 0.94.0-w03-springbok1phablet15), | 14 | maliit-framework-dev (>= 0.94.0-w03-springbok1phablet15), |
6 | 15 | libhunspell-dev, | 15 | libhunspell-dev, |
7 | 16 | libpresage-dev, | 16 | libpresage-dev, |
9 | 17 | libubuntu-platform-api1-dev | 17 | libubuntu-platform-api1-dev, |
10 | 18 | libpinyin2-dev, | ||
11 | 19 | libglib2.0-dev | ||
12 | 18 | Standards-Version: 3.9.3 | 20 | Standards-Version: 3.9.3 |
13 | 19 | 21 | ||
14 | 20 | Package: nemo-keyboard | 22 | Package: nemo-keyboard |
15 | @@ -39,6 +41,7 @@ | |||
16 | 39 | Architecture: armhf | 41 | Architecture: armhf |
17 | 40 | Depends: maliit-framework, | 42 | Depends: maliit-framework, |
18 | 41 | libpresage1, | 43 | libpresage1, |
19 | 44 | libpinyin2, | ||
20 | 42 | ${misc:Depends}, | 45 | ${misc:Depends}, |
21 | 43 | ${shlibs:Depends}, | 46 | ${shlibs:Depends}, |
22 | 44 | qtdeclarative5-window-plugin | 47 | qtdeclarative5-window-plugin |
23 | 45 | 48 | ||
24 | === modified file 'debian/rules' | |||
25 | --- debian/rules 2013-06-07 08:43:47 +0000 | |||
26 | +++ debian/rules 2013-06-17 15:53:36 +0000 | |||
27 | @@ -16,6 +16,7 @@ | |||
28 | 16 | CONFIG+=enable-presage \ | 16 | CONFIG+=enable-presage \ |
29 | 17 | CONFIG+=enable-hunspell \ | 17 | CONFIG+=enable-hunspell \ |
30 | 18 | CONFIG+=enable-preedit \ | 18 | CONFIG+=enable-preedit \ |
31 | 19 | CONFIG+=enable-pinyin \ | ||
32 | 19 | CONFIG+=enable-qt-mobility \ | 20 | CONFIG+=enable-qt-mobility \ |
33 | 20 | CONFIG+=enable-maliit-keyboard \ | 21 | CONFIG+=enable-maliit-keyboard \ |
34 | 21 | CONFIG+=enable-nemo-keyboard | 22 | CONFIG+=enable-nemo-keyboard |
35 | 22 | 23 | ||
36 | === modified file 'maliit-keyboard/data/languages/de.xml' | |||
37 | --- maliit-keyboard/data/languages/de.xml 2013-04-26 13:05:20 +0000 | |||
38 | +++ maliit-keyboard/data/languages/de.xml 2013-06-17 15:53:36 +0000 | |||
39 | @@ -490,6 +490,9 @@ | |||
40 | 490 | </key> | 490 | </key> |
41 | 491 | </row> | 491 | </row> |
42 | 492 | <row> | 492 | <row> |
43 | 493 | <key id="actionKey" style="special" width="large"> | ||
44 | 494 | <binding action="layout_menu" label="de" /> | ||
45 | 495 | </key> | ||
46 | 493 | <key style="special" width="large"> | 496 | <key style="special" width="large"> |
47 | 494 | <binding action="sym" label="?123" /> | 497 | <binding action="sym" label="?123" /> |
48 | 495 | </key> | 498 | </key> |
49 | 496 | 499 | ||
50 | === modified file 'maliit-keyboard/data/languages/en_gb.xml' | |||
51 | --- maliit-keyboard/data/languages/en_gb.xml 2013-04-26 13:05:20 +0000 | |||
52 | +++ maliit-keyboard/data/languages/en_gb.xml 2013-06-17 15:53:36 +0000 | |||
53 | @@ -463,7 +463,10 @@ | |||
54 | 463 | </key> | 463 | </key> |
55 | 464 | </row> | 464 | </row> |
56 | 465 | <row> | 465 | <row> |
58 | 466 | <key style="special" width="x-large"> | 466 | <key id="actionKey" style="special" width="large"> |
59 | 467 | <binding action="layout_menu" label="en" /> | ||
60 | 468 | </key> | ||
61 | 469 | <key style="special" width="large"> | ||
62 | 467 | <binding action="sym" label="?123" /> | 470 | <binding action="sym" label="?123" /> |
63 | 468 | </key> | 471 | </key> |
64 | 469 | <spacer /> | 472 | <spacer /> |
65 | 470 | 473 | ||
66 | === modified file 'maliit-keyboard/data/languages/en_us.xml' | |||
67 | --- maliit-keyboard/data/languages/en_us.xml 2013-04-26 13:05:20 +0000 | |||
68 | +++ maliit-keyboard/data/languages/en_us.xml 2013-06-17 15:53:36 +0000 | |||
69 | @@ -460,7 +460,10 @@ | |||
70 | 460 | </key> | 460 | </key> |
71 | 461 | </row> | 461 | </row> |
72 | 462 | <row> | 462 | <row> |
74 | 463 | <key style="special" width="x-large"> | 463 | <key id="actionKey" style="special" width="large"> |
75 | 464 | <binding action="layout_menu" label="en" /> | ||
76 | 465 | </key> | ||
77 | 466 | <key style="special" width="large"> | ||
78 | 464 | <binding action="sym" label="?123" /> | 467 | <binding action="sym" label="?123" /> |
79 | 465 | </key> | 468 | </key> |
80 | 466 | <spacer /> | 469 | <spacer /> |
81 | 467 | 470 | ||
82 | === modified file 'maliit-keyboard/data/languages/es.xml' | |||
83 | --- maliit-keyboard/data/languages/es.xml 2012-08-17 12:00:21 +0000 | |||
84 | +++ maliit-keyboard/data/languages/es.xml 2013-06-17 15:53:36 +0000 | |||
85 | @@ -466,7 +466,10 @@ | |||
86 | 466 | </key> | 466 | </key> |
87 | 467 | </row> | 467 | </row> |
88 | 468 | <row> | 468 | <row> |
90 | 469 | <key style="special" width="x-large"> | 469 | <key id="actionKey" style="special" width="large"> |
91 | 470 | <binding action="layout_menu" label="es" /> | ||
92 | 471 | </key> | ||
93 | 472 | <key style="special" width="large"> | ||
94 | 470 | <binding action="sym" label="?123" /> | 473 | <binding action="sym" label="?123" /> |
95 | 471 | </key> | 474 | </key> |
96 | 472 | <key style="special"> | 475 | <key style="special"> |
97 | @@ -475,7 +478,7 @@ | |||
98 | 475 | <key id="emailUrlKey"> | 478 | <key id="emailUrlKey"> |
99 | 476 | <binding label="," /> | 479 | <binding label="," /> |
100 | 477 | </key> | 480 | </key> |
102 | 478 | <key width="stretched"> | 481 | <key width="xx-large"> |
103 | 479 | <binding action="space" label="" /> | 482 | <binding action="space" label="" /> |
104 | 480 | </key> | 483 | </key> |
105 | 481 | <key> | 484 | <key> |
106 | 482 | 485 | ||
107 | === modified file 'maliit-keyboard/data/languages/zh_cn_pinyin.xml' | |||
108 | --- maliit-keyboard/data/languages/zh_cn_pinyin.xml 2012-08-17 12:00:21 +0000 | |||
109 | +++ maliit-keyboard/data/languages/zh_cn_pinyin.xml 2013-06-17 15:53:36 +0000 | |||
110 | @@ -7,72 +7,42 @@ | |||
111 | 7 | <row> | 7 | <row> |
112 | 8 | <key> | 8 | <key> |
113 | 9 | <binding label="q"> | 9 | <binding label="q"> |
114 | 10 | <modifiers keys="shift"> | ||
115 | 11 | <binding label="Q" /> | ||
116 | 12 | </modifiers> | ||
117 | 13 | </binding> | 10 | </binding> |
118 | 14 | </key> | 11 | </key> |
119 | 15 | <key> | 12 | <key> |
120 | 16 | <binding label="w"> | 13 | <binding label="w"> |
121 | 17 | <modifiers keys="shift"> | ||
122 | 18 | <binding label="W" /> | ||
123 | 19 | </modifiers> | ||
124 | 20 | </binding> | 14 | </binding> |
125 | 21 | </key> | 15 | </key> |
126 | 22 | <key> | 16 | <key> |
127 | 23 | <binding label="e"> | 17 | <binding label="e"> |
128 | 24 | <modifiers keys="shift"> | ||
129 | 25 | <binding label="E" /> | ||
130 | 26 | </modifiers> | ||
131 | 27 | </binding> | 18 | </binding> |
132 | 28 | </key> | 19 | </key> |
133 | 29 | <key> | 20 | <key> |
134 | 30 | <binding label="r"> | 21 | <binding label="r"> |
135 | 31 | <modifiers keys="shift"> | ||
136 | 32 | <binding label="R" /> | ||
137 | 33 | </modifiers> | ||
138 | 34 | </binding> | 22 | </binding> |
139 | 35 | </key> | 23 | </key> |
140 | 36 | <key> | 24 | <key> |
141 | 37 | <binding label="t"> | 25 | <binding label="t"> |
142 | 38 | <modifiers keys="shift"> | ||
143 | 39 | <binding label="T" /> | ||
144 | 40 | </modifiers> | ||
145 | 41 | </binding> | 26 | </binding> |
146 | 42 | </key> | 27 | </key> |
147 | 43 | <key> | 28 | <key> |
148 | 44 | <binding label="y"> | 29 | <binding label="y"> |
149 | 45 | <modifiers keys="shift"> | ||
150 | 46 | <binding label="Y" /> | ||
151 | 47 | </modifiers> | ||
152 | 48 | </binding> | 30 | </binding> |
153 | 49 | </key> | 31 | </key> |
154 | 50 | <key> | 32 | <key> |
155 | 51 | <binding label="u"> | 33 | <binding label="u"> |
156 | 52 | <modifiers keys="shift"> | ||
157 | 53 | <binding label="U" /> | ||
158 | 54 | </modifiers> | ||
159 | 55 | </binding> | 34 | </binding> |
160 | 56 | </key> | 35 | </key> |
161 | 57 | <key> | 36 | <key> |
162 | 58 | <binding label="i"> | 37 | <binding label="i"> |
163 | 59 | <modifiers keys="shift"> | ||
164 | 60 | <binding label="I" /> | ||
165 | 61 | </modifiers> | ||
166 | 62 | </binding> | 38 | </binding> |
167 | 63 | </key> | 39 | </key> |
168 | 64 | <key> | 40 | <key> |
169 | 65 | <binding label="o"> | 41 | <binding label="o"> |
170 | 66 | <modifiers keys="shift"> | ||
171 | 67 | <binding label="O" /> | ||
172 | 68 | </modifiers> | ||
173 | 69 | </binding> | 42 | </binding> |
174 | 70 | </key> | 43 | </key> |
175 | 71 | <key> | 44 | <key> |
176 | 72 | <binding label="p"> | 45 | <binding label="p"> |
177 | 73 | <modifiers keys="shift"> | ||
178 | 74 | <binding label="P" /> | ||
179 | 75 | </modifiers> | ||
180 | 76 | </binding> | 46 | </binding> |
181 | 77 | </key> | 47 | </key> |
182 | 78 | </row> | 48 | </row> |
183 | @@ -80,143 +50,100 @@ | |||
184 | 80 | <spacer /> | 50 | <spacer /> |
185 | 81 | <key> | 51 | <key> |
186 | 82 | <binding label="a"> | 52 | <binding label="a"> |
187 | 83 | <modifiers keys="shift"> | ||
188 | 84 | <binding label="A" /> | ||
189 | 85 | </modifiers> | ||
190 | 86 | </binding> | 53 | </binding> |
191 | 87 | </key> | 54 | </key> |
192 | 88 | <key> | 55 | <key> |
193 | 89 | <binding label="s"> | 56 | <binding label="s"> |
194 | 90 | <modifiers keys="shift"> | ||
195 | 91 | <binding label="S" /> | ||
196 | 92 | </modifiers> | ||
197 | 93 | </binding> | 57 | </binding> |
198 | 94 | </key> | 58 | </key> |
199 | 95 | <key> | 59 | <key> |
200 | 96 | <binding label="d"> | 60 | <binding label="d"> |
201 | 97 | <modifiers keys="shift"> | ||
202 | 98 | <binding label="D" /> | ||
203 | 99 | </modifiers> | ||
204 | 100 | </binding> | 61 | </binding> |
205 | 101 | </key> | 62 | </key> |
206 | 102 | <key> | 63 | <key> |
207 | 103 | <binding label="f"> | 64 | <binding label="f"> |
208 | 104 | <modifiers keys="shift"> | ||
209 | 105 | <binding label="F" /> | ||
210 | 106 | </modifiers> | ||
211 | 107 | </binding> | 65 | </binding> |
212 | 108 | </key> | 66 | </key> |
213 | 109 | <key> | 67 | <key> |
214 | 110 | <binding label="g"> | 68 | <binding label="g"> |
215 | 111 | <modifiers keys="shift"> | ||
216 | 112 | <binding label="G" /> | ||
217 | 113 | </modifiers> | ||
218 | 114 | </binding> | 69 | </binding> |
219 | 115 | </key> | 70 | </key> |
220 | 116 | <key> | 71 | <key> |
221 | 117 | <binding label="h"> | 72 | <binding label="h"> |
222 | 118 | <modifiers keys="shift"> | ||
223 | 119 | <binding label="H" /> | ||
224 | 120 | </modifiers> | ||
225 | 121 | </binding> | 73 | </binding> |
226 | 122 | </key> | 74 | </key> |
227 | 123 | <key> | 75 | <key> |
228 | 124 | <binding label="j"> | 76 | <binding label="j"> |
229 | 125 | <modifiers keys="shift"> | ||
230 | 126 | <binding label="J" /> | ||
231 | 127 | </modifiers> | ||
232 | 128 | </binding> | 77 | </binding> |
233 | 129 | </key> | 78 | </key> |
234 | 130 | <key> | 79 | <key> |
235 | 131 | <binding label="k"> | 80 | <binding label="k"> |
236 | 132 | <modifiers keys="shift"> | ||
237 | 133 | <binding label="K" /> | ||
238 | 134 | </modifiers> | ||
239 | 135 | </binding> | 81 | </binding> |
240 | 136 | </key> | 82 | </key> |
241 | 137 | <key> | 83 | <key> |
242 | 138 | <binding label="l"> | 84 | <binding label="l"> |
243 | 139 | <modifiers keys="shift"> | ||
244 | 140 | <binding label="L" /> | ||
245 | 141 | </modifiers> | ||
246 | 142 | </binding> | 85 | </binding> |
247 | 143 | </key> | 86 | </key> |
248 | 144 | <spacer /> | 87 | <spacer /> |
249 | 145 | </row> | 88 | </row> |
250 | 146 | <row> | 89 | <row> |
252 | 147 | <key style="special" width="large"> | 90 | <!-- <key style="special" width="large"> |
253 | 148 | <binding action="shift" label="" /> | 91 | <binding action="shift" label="" /> |
255 | 149 | </key> | 92 | </key>//--> |
256 | 93 | <spacer /> | ||
257 | 150 | <spacer /> | 94 | <spacer /> |
258 | 151 | <key> | 95 | <key> |
259 | 152 | <binding label="z"> | 96 | <binding label="z"> |
260 | 153 | <modifiers keys="shift"> | ||
261 | 154 | <binding label="Z" /> | ||
262 | 155 | </modifiers> | ||
263 | 156 | </binding> | 97 | </binding> |
264 | 157 | </key> | 98 | </key> |
265 | 158 | <key> | 99 | <key> |
266 | 159 | <binding label="x"> | 100 | <binding label="x"> |
267 | 160 | <modifiers keys="shift"> | ||
268 | 161 | <binding label="X" /> | ||
269 | 162 | </modifiers> | ||
270 | 163 | </binding> | 101 | </binding> |
271 | 164 | </key> | 102 | </key> |
272 | 165 | <key> | 103 | <key> |
273 | 166 | <binding label="c"> | 104 | <binding label="c"> |
274 | 167 | <modifiers keys="shift"> | ||
275 | 168 | <binding label="C" /> | ||
276 | 169 | </modifiers> | ||
277 | 170 | </binding> | 105 | </binding> |
278 | 171 | </key> | 106 | </key> |
279 | 172 | <key> | 107 | <key> |
280 | 173 | <binding label="v"> | 108 | <binding label="v"> |
281 | 174 | <modifiers keys="shift"> | ||
282 | 175 | <binding label="V" /> | ||
283 | 176 | </modifiers> | ||
284 | 177 | </binding> | 109 | </binding> |
285 | 178 | </key> | 110 | </key> |
286 | 179 | <key> | 111 | <key> |
287 | 180 | <binding label="b"> | 112 | <binding label="b"> |
288 | 181 | <modifiers keys="shift"> | ||
289 | 182 | <binding label="B" /> | ||
290 | 183 | </modifiers> | ||
291 | 184 | </binding> | 113 | </binding> |
292 | 185 | </key> | 114 | </key> |
293 | 186 | <key> | 115 | <key> |
294 | 187 | <binding label="n"> | 116 | <binding label="n"> |
295 | 188 | <modifiers keys="shift"> | ||
296 | 189 | <binding label="N" /> | ||
297 | 190 | </modifiers> | ||
298 | 191 | </binding> | 117 | </binding> |
299 | 192 | </key> | 118 | </key> |
300 | 193 | <key> | 119 | <key> |
301 | 194 | <binding label="m"> | 120 | <binding label="m"> |
302 | 195 | <modifiers keys="shift"> | ||
303 | 196 | <binding label="M" /> | ||
304 | 197 | </modifiers> | ||
305 | 198 | </binding> | 121 | </binding> |
306 | 199 | </key> | 122 | </key> |
307 | 200 | <spacer /> | 123 | <spacer /> |
308 | 201 | <key style="special" width="large"> | 124 | <key style="special" width="large"> |
309 | 202 | <binding action="backspace" label="" /> | 125 | <binding action="backspace" label="" /> |
310 | 203 | </key> | 126 | </key> |
311 | 127 | <spacer /> | ||
312 | 204 | </row> | 128 | </row> |
313 | 205 | <row> | 129 | <row> |
315 | 206 | <key style="special" width="x-large"> | 130 | <key id="actionKey" style="special" width="large"> |
316 | 131 | <binding action="layout_menu" label="cn" /> | ||
317 | 132 | </key> | ||
318 | 133 | <key style="special" width="large"> | ||
319 | 207 | <binding action="sym" label="符号" /> | 134 | <binding action="sym" label="符号" /> |
320 | 208 | </key> | 135 | </key> |
322 | 209 | <key id="emailUrlKey"> | 136 | <key id="emailUrlKey" width="small"> |
323 | 210 | <binding label="," /> | 137 | <binding label="," /> |
324 | 211 | </key> | 138 | </key> |
326 | 212 | <key width="stretched"> | 139 | <key width="xx-large"> |
327 | 213 | <binding action="space" label="" /> | 140 | <binding action="space" label="" /> |
328 | 214 | </key> | 141 | </key> |
330 | 215 | <key id="emailUrlDotKey"> | 142 | <key id="emailUrlDotKey" width="small"> |
331 | 216 | <binding label="。" /> | 143 | <binding label="。" /> |
332 | 217 | </key> | 144 | </key> |
333 | 218 | <key id="actionKey" style="special" width="x-large"> | 145 | <key id="actionKey" style="special" width="x-large"> |
335 | 219 | <binding action="compose" label="输入" /> | 146 | <binding action="return" label="输入" /> |
336 | 220 | </key> | 147 | </key> |
337 | 221 | </row> | 148 | </row> |
338 | 222 | </section> | 149 | </section> |
339 | @@ -226,72 +153,42 @@ | |||
340 | 226 | <row> | 153 | <row> |
341 | 227 | <key> | 154 | <key> |
342 | 228 | <binding label="q"> | 155 | <binding label="q"> |
343 | 229 | <modifiers keys="shift"> | ||
344 | 230 | <binding label="Q" /> | ||
345 | 231 | </modifiers> | ||
346 | 232 | </binding> | 156 | </binding> |
347 | 233 | </key> | 157 | </key> |
348 | 234 | <key> | 158 | <key> |
349 | 235 | <binding label="w"> | 159 | <binding label="w"> |
350 | 236 | <modifiers keys="shift"> | ||
351 | 237 | <binding label="W" /> | ||
352 | 238 | </modifiers> | ||
353 | 239 | </binding> | 160 | </binding> |
354 | 240 | </key> | 161 | </key> |
355 | 241 | <key> | 162 | <key> |
356 | 242 | <binding label="e"> | 163 | <binding label="e"> |
357 | 243 | <modifiers keys="shift"> | ||
358 | 244 | <binding label="E" /> | ||
359 | 245 | </modifiers> | ||
360 | 246 | </binding> | 164 | </binding> |
361 | 247 | </key> | 165 | </key> |
362 | 248 | <key> | 166 | <key> |
363 | 249 | <binding label="r"> | 167 | <binding label="r"> |
364 | 250 | <modifiers keys="shift"> | ||
365 | 251 | <binding label="R" /> | ||
366 | 252 | </modifiers> | ||
367 | 253 | </binding> | 168 | </binding> |
368 | 254 | </key> | 169 | </key> |
369 | 255 | <key> | 170 | <key> |
370 | 256 | <binding label="t"> | 171 | <binding label="t"> |
371 | 257 | <modifiers keys="shift"> | ||
372 | 258 | <binding label="T" /> | ||
373 | 259 | </modifiers> | ||
374 | 260 | </binding> | 172 | </binding> |
375 | 261 | </key> | 173 | </key> |
376 | 262 | <key> | 174 | <key> |
377 | 263 | <binding label="y"> | 175 | <binding label="y"> |
378 | 264 | <modifiers keys="shift"> | ||
379 | 265 | <binding label="Y" /> | ||
380 | 266 | </modifiers> | ||
381 | 267 | </binding> | 176 | </binding> |
382 | 268 | </key> | 177 | </key> |
383 | 269 | <key> | 178 | <key> |
384 | 270 | <binding label="u"> | 179 | <binding label="u"> |
385 | 271 | <modifiers keys="shift"> | ||
386 | 272 | <binding label="U" /> | ||
387 | 273 | </modifiers> | ||
388 | 274 | </binding> | 180 | </binding> |
389 | 275 | </key> | 181 | </key> |
390 | 276 | <key> | 182 | <key> |
391 | 277 | <binding label="i"> | 183 | <binding label="i"> |
392 | 278 | <modifiers keys="shift"> | ||
393 | 279 | <binding label="I" /> | ||
394 | 280 | </modifiers> | ||
395 | 281 | </binding> | 184 | </binding> |
396 | 282 | </key> | 185 | </key> |
397 | 283 | <key> | 186 | <key> |
398 | 284 | <binding label="o"> | 187 | <binding label="o"> |
399 | 285 | <modifiers keys="shift"> | ||
400 | 286 | <binding label="O" /> | ||
401 | 287 | </modifiers> | ||
402 | 288 | </binding> | 188 | </binding> |
403 | 289 | </key> | 189 | </key> |
404 | 290 | <key> | 190 | <key> |
405 | 291 | <binding label="p"> | 191 | <binding label="p"> |
406 | 292 | <modifiers keys="shift"> | ||
407 | 293 | <binding label="P" /> | ||
408 | 294 | </modifiers> | ||
409 | 295 | </binding> | 192 | </binding> |
410 | 296 | </key> | 193 | </key> |
411 | 297 | </row> | 194 | </row> |
412 | @@ -299,65 +196,38 @@ | |||
413 | 299 | <spacer /> | 196 | <spacer /> |
414 | 300 | <key> | 197 | <key> |
415 | 301 | <binding label="a"> | 198 | <binding label="a"> |
416 | 302 | <modifiers keys="shift"> | ||
417 | 303 | <binding label="A" /> | ||
418 | 304 | </modifiers> | ||
419 | 305 | </binding> | 199 | </binding> |
420 | 306 | </key> | 200 | </key> |
421 | 307 | <key> | 201 | <key> |
422 | 308 | <binding label="s"> | 202 | <binding label="s"> |
423 | 309 | <modifiers keys="shift"> | ||
424 | 310 | <binding label="S" /> | ||
425 | 311 | </modifiers> | ||
426 | 312 | </binding> | 203 | </binding> |
427 | 313 | </key> | 204 | </key> |
428 | 314 | <key> | 205 | <key> |
429 | 315 | <binding label="d"> | 206 | <binding label="d"> |
430 | 316 | <modifiers keys="shift"> | ||
431 | 317 | <binding label="D" /> | ||
432 | 318 | </modifiers> | ||
433 | 319 | </binding> | 207 | </binding> |
434 | 320 | </key> | 208 | </key> |
435 | 321 | <key> | 209 | <key> |
436 | 322 | <binding label="f"> | 210 | <binding label="f"> |
437 | 323 | <modifiers keys="shift"> | ||
438 | 324 | <binding label="F" /> | ||
439 | 325 | </modifiers> | ||
440 | 326 | </binding> | 211 | </binding> |
441 | 327 | </key> | 212 | </key> |
442 | 328 | <key> | 213 | <key> |
443 | 329 | <binding label="g"> | 214 | <binding label="g"> |
444 | 330 | <modifiers keys="shift"> | ||
445 | 331 | <binding label="G" /> | ||
446 | 332 | </modifiers> | ||
447 | 333 | </binding> | 215 | </binding> |
448 | 334 | </key> | 216 | </key> |
449 | 335 | <key> | 217 | <key> |
450 | 336 | <binding label="h"> | 218 | <binding label="h"> |
451 | 337 | <modifiers keys="shift"> | ||
452 | 338 | <binding label="H" /> | ||
453 | 339 | </modifiers> | ||
454 | 340 | </binding> | 219 | </binding> |
455 | 341 | </key> | 220 | </key> |
456 | 342 | <key> | 221 | <key> |
457 | 343 | <binding label="j"> | 222 | <binding label="j"> |
458 | 344 | <modifiers keys="shift"> | ||
459 | 345 | <binding label="J" /> | ||
460 | 346 | </modifiers> | ||
461 | 347 | </binding> | 223 | </binding> |
462 | 348 | </key> | 224 | </key> |
463 | 349 | <key> | 225 | <key> |
464 | 350 | <binding label="k"> | 226 | <binding label="k"> |
465 | 351 | <modifiers keys="shift"> | ||
466 | 352 | <binding label="K" /> | ||
467 | 353 | </modifiers> | ||
468 | 354 | </binding> | 227 | </binding> |
469 | 355 | </key> | 228 | </key> |
470 | 356 | <key> | 229 | <key> |
471 | 357 | <binding label="l"> | 230 | <binding label="l"> |
472 | 358 | <modifiers keys="shift"> | ||
473 | 359 | <binding label="L" /> | ||
474 | 360 | </modifiers> | ||
475 | 361 | </binding> | 231 | </binding> |
476 | 362 | </key> | 232 | </key> |
477 | 363 | <spacer /> | 233 | <spacer /> |
478 | @@ -369,73 +239,53 @@ | |||
479 | 369 | <spacer /> | 239 | <spacer /> |
480 | 370 | <key> | 240 | <key> |
481 | 371 | <binding label="z"> | 241 | <binding label="z"> |
482 | 372 | <modifiers keys="shift"> | ||
483 | 373 | <binding label="Z" /> | ||
484 | 374 | </modifiers> | ||
485 | 375 | </binding> | 242 | </binding> |
486 | 376 | </key> | 243 | </key> |
487 | 377 | <key> | 244 | <key> |
488 | 378 | <binding label="x"> | 245 | <binding label="x"> |
489 | 379 | <modifiers keys="shift"> | ||
490 | 380 | <binding label="X" /> | ||
491 | 381 | </modifiers> | ||
492 | 382 | </binding> | 246 | </binding> |
493 | 383 | </key> | 247 | </key> |
494 | 384 | <key> | 248 | <key> |
495 | 385 | <binding label="c"> | 249 | <binding label="c"> |
496 | 386 | <modifiers keys="shift"> | ||
497 | 387 | <binding label="C" /> | ||
498 | 388 | </modifiers> | ||
499 | 389 | </binding> | 250 | </binding> |
500 | 390 | </key> | 251 | </key> |
501 | 391 | <key> | 252 | <key> |
502 | 392 | <binding label="v"> | 253 | <binding label="v"> |
503 | 393 | <modifiers keys="shift"> | ||
504 | 394 | <binding label="V" /> | ||
505 | 395 | </modifiers> | ||
506 | 396 | </binding> | 254 | </binding> |
507 | 397 | </key> | 255 | </key> |
508 | 398 | <key> | 256 | <key> |
509 | 399 | <binding label="b"> | 257 | <binding label="b"> |
510 | 400 | <modifiers keys="shift"> | ||
511 | 401 | <binding label="B" /> | ||
512 | 402 | </modifiers> | ||
513 | 403 | </binding> | 258 | </binding> |
514 | 404 | </key> | 259 | </key> |
515 | 405 | <key> | 260 | <key> |
516 | 406 | <binding label="n"> | 261 | <binding label="n"> |
517 | 407 | <modifiers keys="shift"> | ||
518 | 408 | <binding label="N" /> | ||
519 | 409 | </modifiers> | ||
520 | 410 | </binding> | 262 | </binding> |
521 | 411 | </key> | 263 | </key> |
522 | 412 | <key> | 264 | <key> |
523 | 413 | <binding label="m"> | 265 | <binding label="m"> |
524 | 414 | <modifiers keys="shift"> | ||
525 | 415 | <binding label="M" /> | ||
526 | 416 | </modifiers> | ||
527 | 417 | </binding> | 266 | </binding> |
528 | 418 | </key> | 267 | </key> |
529 | 419 | <spacer /> | 268 | <spacer /> |
530 | 420 | <key style="special" width="large"> | 269 | <key style="special" width="large"> |
531 | 421 | <binding action="backspace" label="" /> | 270 | <binding action="backspace" label="" /> |
532 | 422 | </key> | 271 | </key> |
533 | 272 | <spacer /> | ||
534 | 423 | </row> | 273 | </row> |
535 | 424 | <row> | 274 | <row> |
537 | 425 | <key style="special" width="x-large"> | 275 | <key style="special" width="large"> |
538 | 426 | <binding action="sym" label="符号" /> | 276 | <binding action="sym" label="符号" /> |
539 | 427 | </key> | 277 | </key> |
541 | 428 | <key id="emailUrlKey"> | 278 | <key id="emailUrlKey" width="small"> |
542 | 429 | <binding label="," /> | 279 | <binding label="," /> |
543 | 430 | </key> | 280 | </key> |
545 | 431 | <key width="stretched"> | 281 | <key width="xx-large"> |
546 | 432 | <binding action="space" label="" /> | 282 | <binding action="space" label="" /> |
547 | 433 | </key> | 283 | </key> |
549 | 434 | <key id="emailUrlDotKey"> | 284 | <key id="emailUrlDotKey" width="small"> |
550 | 435 | <binding label="。" /> | 285 | <binding label="。" /> |
551 | 436 | </key> | 286 | </key> |
552 | 437 | <key id="actionKey" style="special" width="x-large"> | 287 | <key id="actionKey" style="special" width="x-large"> |
554 | 438 | <binding action="compose" label="输入" /> | 288 | <binding action="return" label="输入" /> |
555 | 439 | </key> | 289 | </key> |
556 | 440 | </row> | 290 | </row> |
557 | 441 | </section> | 291 | </section> |
558 | 442 | 292 | ||
559 | === modified file 'maliit-keyboard/lib/lib.pro' | |||
560 | --- maliit-keyboard/lib/lib.pro 2013-04-11 06:57:11 +0000 | |||
561 | +++ maliit-keyboard/lib/lib.pro 2013-06-17 15:53:36 +0000 | |||
562 | @@ -6,6 +6,11 @@ | |||
563 | 6 | QT += core gui quick | 6 | QT += core gui quick |
564 | 7 | CONFIG += staticlib | 7 | CONFIG += staticlib |
565 | 8 | 8 | ||
566 | 9 | CONFIG += link_pkgconfig | ||
567 | 10 | PKGCONFIG += glib-2.0 | ||
568 | 11 | PKGCONFIG += libpinyin | ||
569 | 12 | LIBS += libpinyin | ||
570 | 13 | |||
571 | 9 | include(models/models.pri) | 14 | include(models/models.pri) |
572 | 10 | include(logic/logic.pri) | 15 | include(logic/logic.pri) |
573 | 11 | include(parser/parser.pri) | 16 | include(parser/parser.pri) |
574 | 12 | 17 | ||
575 | === added file 'maliit-keyboard/lib/logic/chineselanguagefeatures.cpp' | |||
576 | --- maliit-keyboard/lib/logic/chineselanguagefeatures.cpp 1970-01-01 00:00:00 +0000 | |||
577 | +++ maliit-keyboard/lib/logic/chineselanguagefeatures.cpp 2013-06-17 15:53:36 +0000 | |||
578 | @@ -0,0 +1,42 @@ | |||
579 | 1 | /* | ||
580 | 2 | * Copyright 2013 Canonical Ltd. | ||
581 | 3 | * | ||
582 | 4 | * This program is free software; you can redistribute it and/or modify | ||
583 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
584 | 6 | * the Free Software Foundation; version 3. | ||
585 | 7 | * | ||
586 | 8 | * This program is distributed in the hope that it will be useful, | ||
587 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
588 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
589 | 11 | * GNU Lesser General Public License for more details. | ||
590 | 12 | * | ||
591 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
592 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
593 | 15 | */ | ||
594 | 16 | |||
595 | 17 | #include "chineselanguagefeatures.h" | ||
596 | 18 | |||
597 | 19 | namespace MaliitKeyboard { | ||
598 | 20 | namespace Logic { | ||
599 | 21 | |||
600 | 22 | ChineseLanguageFeatures::ChineseLanguageFeatures(QObject *parent) : | ||
601 | 23 | AbstractLanguageFeatures(parent) | ||
602 | 24 | { | ||
603 | 25 | } | ||
604 | 26 | |||
605 | 27 | ChineseLanguageFeatures::~ChineseLanguageFeatures() | ||
606 | 28 | { | ||
607 | 29 | } | ||
608 | 30 | |||
609 | 31 | bool ChineseLanguageFeatures::activateAutoCaps(const QString &preedit) const | ||
610 | 32 | { | ||
611 | 33 | return false; | ||
612 | 34 | } | ||
613 | 35 | |||
614 | 36 | QString ChineseLanguageFeatures::appendixForReplacedPreedit(const QString &preedit) const | ||
615 | 37 | { | ||
616 | 38 | return ""; | ||
617 | 39 | } | ||
618 | 40 | |||
619 | 41 | } // namespace Logic | ||
620 | 42 | } // namespace MaliitKeyboard | ||
621 | 0 | 43 | ||
622 | === added file 'maliit-keyboard/lib/logic/chineselanguagefeatures.h' | |||
623 | --- maliit-keyboard/lib/logic/chineselanguagefeatures.h 1970-01-01 00:00:00 +0000 | |||
624 | +++ maliit-keyboard/lib/logic/chineselanguagefeatures.h 2013-06-17 15:53:36 +0000 | |||
625 | @@ -0,0 +1,39 @@ | |||
626 | 1 | /* | ||
627 | 2 | * Copyright 2013 Canonical Ltd. | ||
628 | 3 | * | ||
629 | 4 | * This program is free software; you can redistribute it and/or modify | ||
630 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
631 | 6 | * the Free Software Foundation; version 3. | ||
632 | 7 | * | ||
633 | 8 | * This program is distributed in the hope that it will be useful, | ||
634 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
635 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
636 | 11 | * GNU Lesser General Public License for more details. | ||
637 | 12 | * | ||
638 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
639 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
640 | 15 | */ | ||
641 | 16 | |||
642 | 17 | #ifndef CHINESELANGUAGEFEATURES_H | ||
643 | 18 | #define CHINESELANGUAGEFEATURES_H | ||
644 | 19 | |||
645 | 20 | #include "abstractlanguagefeatures.h" | ||
646 | 21 | |||
647 | 22 | namespace MaliitKeyboard { | ||
648 | 23 | namespace Logic { | ||
649 | 24 | |||
650 | 25 | class ChineseLanguageFeatures : public AbstractLanguageFeatures | ||
651 | 26 | { | ||
652 | 27 | Q_OBJECT | ||
653 | 28 | public: | ||
654 | 29 | explicit ChineseLanguageFeatures(QObject *parent = 0); | ||
655 | 30 | virtual ~ChineseLanguageFeatures(); | ||
656 | 31 | |||
657 | 32 | virtual bool activateAutoCaps(const QString &preedit) const; | ||
658 | 33 | virtual QString appendixForReplacedPreedit(const QString &preedit) const; | ||
659 | 34 | }; | ||
660 | 35 | |||
661 | 36 | } // namespace Logic | ||
662 | 37 | } // namespace MaliitKeyboard | ||
663 | 38 | |||
664 | 39 | #endif // CHINESELANGUAGEFEATURES_H | ||
665 | 0 | 40 | ||
666 | === modified file 'maliit-keyboard/lib/logic/dynamiclayout.cpp' | |||
667 | --- maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-06-05 13:00:26 +0000 | |||
668 | +++ maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-06-17 15:53:36 +0000 | |||
669 | @@ -1,4 +1,18 @@ | |||
671 | 1 | 1 | /* | |
672 | 2 | * Copyright 2013 Canonical Ltd. | ||
673 | 3 | * | ||
674 | 4 | * This program is free software; you can redistribute it and/or modify | ||
675 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
676 | 6 | * the Free Software Foundation; version 3. | ||
677 | 7 | * | ||
678 | 8 | * This program is distributed in the hope that it will be useful, | ||
679 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
680 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
681 | 11 | * GNU Lesser General Public License for more details. | ||
682 | 12 | * | ||
683 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
684 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
685 | 15 | */ | ||
686 | 2 | 16 | ||
687 | 3 | #include "dynamiclayout.h" | 17 | #include "dynamiclayout.h" |
688 | 4 | #include "dynamiclayout_p.h" | 18 | #include "dynamiclayout_p.h" |
689 | 5 | 19 | ||
690 | === modified file 'maliit-keyboard/lib/logic/dynamiclayout.h' | |||
691 | --- maliit-keyboard/lib/logic/dynamiclayout.h 2013-06-05 13:00:26 +0000 | |||
692 | +++ maliit-keyboard/lib/logic/dynamiclayout.h 2013-06-17 15:53:36 +0000 | |||
693 | @@ -1,3 +1,19 @@ | |||
694 | 1 | /* | ||
695 | 2 | * Copyright 2013 Canonical Ltd. | ||
696 | 3 | * | ||
697 | 4 | * This program is free software; you can redistribute it and/or modify | ||
698 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
699 | 6 | * the Free Software Foundation; version 3. | ||
700 | 7 | * | ||
701 | 8 | * This program is distributed in the hope that it will be useful, | ||
702 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
703 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
704 | 11 | * GNU Lesser General Public License for more details. | ||
705 | 12 | * | ||
706 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
707 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
708 | 15 | */ | ||
709 | 16 | |||
710 | 1 | #ifndef DYNAMICLAYOUT_H | 17 | #ifndef DYNAMICLAYOUT_H |
711 | 2 | #define DYNAMICLAYOUT_H | 18 | #define DYNAMICLAYOUT_H |
712 | 3 | 19 | ||
713 | 4 | 20 | ||
714 | === modified file 'maliit-keyboard/lib/logic/eventhandler.cpp' | |||
715 | --- maliit-keyboard/lib/logic/eventhandler.cpp 2013-05-29 09:54:04 +0000 | |||
716 | +++ maliit-keyboard/lib/logic/eventhandler.cpp 2013-06-17 15:53:36 +0000 | |||
717 | @@ -206,4 +206,11 @@ | |||
718 | 206 | Q_EMIT wordCandidateReleased(candidate); | 206 | Q_EMIT wordCandidateReleased(candidate); |
719 | 207 | } | 207 | } |
720 | 208 | 208 | ||
721 | 209 | void EventHandler::onLanguageChangeRequested(QString languageId) | ||
722 | 210 | { | ||
723 | 211 | Q_D(EventHandler); | ||
724 | 212 | |||
725 | 213 | d->updater->setActiveKeyboardId(languageId); | ||
726 | 214 | } | ||
727 | 215 | |||
728 | 209 | }} // namespace Logic, MaliitKeyboard | 216 | }} // namespace Logic, MaliitKeyboard |
729 | 210 | 217 | ||
730 | === modified file 'maliit-keyboard/lib/logic/eventhandler.h' | |||
731 | --- maliit-keyboard/lib/logic/eventhandler.h 2013-05-24 11:16:27 +0000 | |||
732 | +++ maliit-keyboard/lib/logic/eventhandler.h 2013-06-17 15:53:36 +0000 | |||
733 | @@ -73,6 +73,7 @@ | |||
734 | 73 | 73 | ||
735 | 74 | Q_INVOKABLE void onWordCandidatePressed(QString word); | 74 | Q_INVOKABLE void onWordCandidatePressed(QString word); |
736 | 75 | Q_INVOKABLE void onWordCandidateReleased(QString word); | 75 | Q_INVOKABLE void onWordCandidateReleased(QString word); |
737 | 76 | Q_INVOKABLE void onLanguageChangeRequested(QString languageId); | ||
738 | 76 | 77 | ||
739 | 77 | // Key signals: | 78 | // Key signals: |
740 | 78 | Q_SIGNAL void keyPressed(const Key &key); | 79 | Q_SIGNAL void keyPressed(const Key &key); |
741 | @@ -84,6 +85,8 @@ | |||
742 | 84 | Q_SIGNAL void wordCandidatePressed(const WordCandidate &candidate); | 85 | Q_SIGNAL void wordCandidatePressed(const WordCandidate &candidate); |
743 | 85 | Q_SIGNAL void wordCandidateReleased(const WordCandidate &candidate); | 86 | Q_SIGNAL void wordCandidateReleased(const WordCandidate &candidate); |
744 | 86 | 87 | ||
745 | 88 | Q_SIGNAL void languageChangeRequested(QString languageId); | ||
746 | 89 | |||
747 | 87 | private: | 90 | private: |
748 | 88 | const QScopedPointer<EventHandlerPrivate> d_ptr; | 91 | const QScopedPointer<EventHandlerPrivate> d_ptr; |
749 | 89 | }; | 92 | }; |
750 | 90 | 93 | ||
751 | === modified file 'maliit-keyboard/lib/logic/layoutupdater.cpp' | |||
752 | --- maliit-keyboard/lib/logic/layoutupdater.cpp 2013-05-29 15:51:40 +0000 | |||
753 | +++ maliit-keyboard/lib/logic/layoutupdater.cpp 2013-06-17 15:53:36 +0000 | |||
754 | @@ -301,6 +301,7 @@ | |||
755 | 301 | { | 301 | { |
756 | 302 | Q_D(LayoutUpdater); | 302 | Q_D(LayoutUpdater); |
757 | 303 | d->loader.setActiveId(id); | 303 | d->loader.setActiveId(id); |
758 | 304 | Q_EMIT languageChanged(id); | ||
759 | 304 | } | 305 | } |
760 | 305 | 306 | ||
761 | 306 | QString LayoutUpdater::keyboardTitle(const QString &id) const | 307 | QString LayoutUpdater::keyboardTitle(const QString &id) const |
762 | 307 | 308 | ||
763 | === modified file 'maliit-keyboard/lib/logic/layoutupdater.h' | |||
764 | --- maliit-keyboard/lib/logic/layoutupdater.h 2013-03-22 16:40:29 +0000 | |||
765 | +++ maliit-keyboard/lib/logic/layoutupdater.h 2013-06-17 15:53:36 +0000 | |||
766 | @@ -104,6 +104,7 @@ | |||
767 | 104 | Q_SIGNAL void addToUserDictionary(); | 104 | Q_SIGNAL void addToUserDictionary(); |
768 | 105 | 105 | ||
769 | 106 | Q_SIGNAL void keyboardTitleChanged(const QString &title); | 106 | Q_SIGNAL void keyboardTitleChanged(const QString &title); |
770 | 107 | Q_SIGNAL void languageChanged(const QString& languageId); | ||
771 | 107 | 108 | ||
772 | 108 | private: | 109 | private: |
773 | 109 | Q_SIGNAL void shiftPressed(); | 110 | Q_SIGNAL void shiftPressed(); |
774 | 110 | 111 | ||
775 | === modified file 'maliit-keyboard/lib/logic/logic.pri' | |||
776 | --- maliit-keyboard/lib/logic/logic.pri 2013-06-03 12:20:12 +0000 | |||
777 | +++ maliit-keyboard/lib/logic/logic.pri 2013-06-17 15:53:36 +0000 | |||
778 | @@ -13,7 +13,9 @@ | |||
779 | 13 | logic/abstractlanguagefeatures.h \ | 13 | logic/abstractlanguagefeatures.h \ |
780 | 14 | logic/languagefeatures.h \ | 14 | logic/languagefeatures.h \ |
781 | 15 | logic/eventhandler.h \ | 15 | logic/eventhandler.h \ |
783 | 16 | logic/dynamiclayout.h | 16 | logic/dynamiclayout.h \ |
784 | 17 | logic/pinyinadapter.h \ | ||
785 | 18 | logic/chineselanguagefeatures.h | ||
786 | 17 | 19 | ||
787 | 18 | SOURCES += \ | 20 | SOURCES += \ |
788 | 19 | logic/hitlogic.cpp \ | 21 | logic/hitlogic.cpp \ |
789 | @@ -28,7 +30,9 @@ | |||
790 | 28 | logic/abstractlanguagefeatures.cpp \ | 30 | logic/abstractlanguagefeatures.cpp \ |
791 | 29 | logic/languagefeatures.cpp \ | 31 | logic/languagefeatures.cpp \ |
792 | 30 | logic/eventhandler.cpp \ | 32 | logic/eventhandler.cpp \ |
794 | 31 | logic/dynamiclayout.cpp | 33 | logic/dynamiclayout.cpp \ |
795 | 34 | logic/pinyinadapter.cpp \ | ||
796 | 35 | logic/chineselanguagefeatures.cpp | ||
797 | 32 | 36 | ||
798 | 33 | DEFINES += HUNSPELL_DICT_PATH=\\\"$$HUNSPELL_DICT_PATH\\\" | 37 | DEFINES += HUNSPELL_DICT_PATH=\\\"$$HUNSPELL_DICT_PATH\\\" |
799 | 34 | 38 | ||
800 | 35 | 39 | ||
801 | === added file 'maliit-keyboard/lib/logic/pinyinadapter.cpp' | |||
802 | --- maliit-keyboard/lib/logic/pinyinadapter.cpp 1970-01-01 00:00:00 +0000 | |||
803 | +++ maliit-keyboard/lib/logic/pinyinadapter.cpp 2013-06-17 15:53:36 +0000 | |||
804 | @@ -0,0 +1,103 @@ | |||
805 | 1 | /* | ||
806 | 2 | * Copyright 2013 Canonical Ltd. | ||
807 | 3 | * | ||
808 | 4 | * This program is free software; you can redistribute it and/or modify | ||
809 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
810 | 6 | * the Free Software Foundation; version 3. | ||
811 | 7 | * | ||
812 | 8 | * This program is distributed in the hope that it will be useful, | ||
813 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
814 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
815 | 11 | * GNU Lesser General Public License for more details. | ||
816 | 12 | * | ||
817 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
818 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
819 | 15 | */ | ||
820 | 16 | |||
821 | 17 | #ifdef HAVE_PINYIN | ||
822 | 18 | |||
823 | 19 | #include "pinyinadapter.h" | ||
824 | 20 | |||
825 | 21 | #include <iostream> | ||
826 | 22 | |||
827 | 23 | #include <iconv.h> | ||
828 | 24 | #include <string> | ||
829 | 25 | #include <string.h> | ||
830 | 26 | |||
831 | 27 | #include <QDebug> | ||
832 | 28 | |||
833 | 29 | PinyinAdapter::PinyinAdapter(QObject *parent) : | ||
834 | 30 | QObject(parent) | ||
835 | 31 | { | ||
836 | 32 | m_context = pinyin_init("/usr/lib/arm-linux-gnueabihf/libpinyin/data/", "."); | ||
837 | 33 | m_instance = pinyin_alloc_instance(m_context); | ||
838 | 34 | |||
839 | 35 | pinyin_set_options(m_context, IS_PINYIN | USE_DIVIDED_TABLE | USE_RESPLIT_TABLE); | ||
840 | 36 | } | ||
841 | 37 | |||
842 | 38 | PinyinAdapter::~PinyinAdapter() | ||
843 | 39 | { | ||
844 | 40 | g_array_free(m_array, TRUE); | ||
845 | 41 | pinyin_free_instance(m_instance); | ||
846 | 42 | pinyin_fini(m_context); | ||
847 | 43 | } | ||
848 | 44 | |||
849 | 45 | QString PinyinAdapter::parse(const QString& string) | ||
850 | 46 | { | ||
851 | 47 | pinyin_parse_more_full_pinyins(m_instance, string.toLatin1().data()); | ||
852 | 48 | |||
853 | 49 | int cursor = 0; | ||
854 | 50 | |||
855 | 51 | #ifdef PINYIN_DEBUG | ||
856 | 52 | for (int i = 0; i < m_instance->m_pinyin_keys->len; i ++) | ||
857 | 53 | { | ||
858 | 54 | PinyinKey* pykey = &g_array_index(m_instance->m_pinyin_keys, PinyinKey, i); | ||
859 | 55 | gchar* py = pykey->get_pinyin_string(); | ||
860 | 56 | std::cout << py << " "; | ||
861 | 57 | g_free(py); | ||
862 | 58 | } | ||
863 | 59 | std::cout << std::endl; | ||
864 | 60 | #endif | ||
865 | 61 | |||
866 | 62 | m_array = g_array_new(FALSE, FALSE, sizeof(lookup_candidate_t)); | ||
867 | 63 | pinyin_get_candidates(m_instance, 0, m_array); | ||
868 | 64 | |||
869 | 65 | pinyin_guess_sentence(m_instance); | ||
870 | 66 | |||
871 | 67 | char* sentence = NULL; | ||
872 | 68 | pinyin_get_sentence(m_instance, &sentence); | ||
873 | 69 | |||
874 | 70 | candidates.clear(); | ||
875 | 71 | for (int i = 0 ; i < m_array->len; i ++ ) | ||
876 | 72 | { | ||
877 | 73 | lookup_candidate_t token = g_array_index(m_array, lookup_candidate_t, i); | ||
878 | 74 | char* word = NULL; | ||
879 | 75 | // Translate the token to utf-8 phrase. | ||
880 | 76 | pinyin_translate_token(m_instance, token.m_token, &word); | ||
881 | 77 | if (word) { | ||
882 | 78 | candidates.append(QString(word)); | ||
883 | 79 | } | ||
884 | 80 | g_free(word); | ||
885 | 81 | } | ||
886 | 82 | |||
887 | 83 | QString unicode(sentence); | ||
888 | 84 | g_free(sentence); | ||
889 | 85 | return unicode; | ||
890 | 86 | } | ||
891 | 87 | |||
892 | 88 | QStringList PinyinAdapter::getWordCandidates() const | ||
893 | 89 | { | ||
894 | 90 | return candidates; | ||
895 | 91 | } | ||
896 | 92 | |||
897 | 93 | void PinyinAdapter::wordCandidateSelected(const QString& word) | ||
898 | 94 | { | ||
899 | 95 | pinyin_choose_candidate(m_instance, 0, &g_array_index(m_array, lookup_candidate_t, 1)); | ||
900 | 96 | } | ||
901 | 97 | |||
902 | 98 | void PinyinAdapter::reset() | ||
903 | 99 | { | ||
904 | 100 | pinyin_reset(m_instance); | ||
905 | 101 | } | ||
906 | 102 | |||
907 | 103 | #endif | ||
908 | 0 | 104 | ||
909 | === added file 'maliit-keyboard/lib/logic/pinyinadapter.h' | |||
910 | --- maliit-keyboard/lib/logic/pinyinadapter.h 1970-01-01 00:00:00 +0000 | |||
911 | +++ maliit-keyboard/lib/logic/pinyinadapter.h 2013-06-17 15:53:36 +0000 | |||
912 | @@ -0,0 +1,50 @@ | |||
913 | 1 | /* | ||
914 | 2 | * Copyright 2013 Canonical Ltd. | ||
915 | 3 | * | ||
916 | 4 | * This program is free software; you can redistribute it and/or modify | ||
917 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
918 | 6 | * the Free Software Foundation; version 3. | ||
919 | 7 | * | ||
920 | 8 | * This program is distributed in the hope that it will be useful, | ||
921 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
922 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
923 | 11 | * GNU Lesser General Public License for more details. | ||
924 | 12 | * | ||
925 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
926 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
927 | 15 | */ | ||
928 | 16 | |||
929 | 17 | #ifndef PINYINADAPTER_H | ||
930 | 18 | #define PINYINADAPTER_H | ||
931 | 19 | |||
932 | 20 | #ifdef HAVE_PINYIN | ||
933 | 21 | |||
934 | 22 | #include <QObject> | ||
935 | 23 | #include <QStringList> | ||
936 | 24 | |||
937 | 25 | #include "pinyin.h" | ||
938 | 26 | |||
939 | 27 | class PinyinAdapter : public QObject | ||
940 | 28 | { | ||
941 | 29 | Q_OBJECT | ||
942 | 30 | |||
943 | 31 | QStringList candidates; | ||
944 | 32 | |||
945 | 33 | pinyin_context_t* m_context; | ||
946 | 34 | pinyin_instance_t* m_instance; | ||
947 | 35 | |||
948 | 36 | GArray* m_array; | ||
949 | 37 | |||
950 | 38 | public: | ||
951 | 39 | explicit PinyinAdapter(QObject *parent = 0); | ||
952 | 40 | ~PinyinAdapter(); | ||
953 | 41 | |||
954 | 42 | QString parse(const QString& string); | ||
955 | 43 | QStringList getWordCandidates() const; | ||
956 | 44 | void wordCandidateSelected(const QString& word); | ||
957 | 45 | void reset(); | ||
958 | 46 | }; | ||
959 | 47 | |||
960 | 48 | #endif | ||
961 | 49 | |||
962 | 50 | #endif // PINYINADAPTER_H | ||
963 | 0 | 51 | ||
964 | === modified file 'maliit-keyboard/lib/logic/wordengine.cpp' | |||
965 | --- maliit-keyboard/lib/logic/wordengine.cpp 2012-07-25 09:49:30 +0000 | |||
966 | +++ maliit-keyboard/lib/logic/wordengine.cpp 2013-06-17 15:53:36 +0000 | |||
967 | @@ -36,6 +36,11 @@ | |||
968 | 36 | #include <presage.h> | 36 | #include <presage.h> |
969 | 37 | #endif | 37 | #endif |
970 | 38 | 38 | ||
971 | 39 | #ifdef HAVE_PINYIN | ||
972 | 40 | #include "pinyinadapter.h" | ||
973 | 41 | #include <iostream> | ||
974 | 42 | #endif | ||
975 | 43 | |||
976 | 39 | namespace MaliitKeyboard { | 44 | namespace MaliitKeyboard { |
977 | 40 | namespace Logic { | 45 | namespace Logic { |
978 | 41 | 46 | ||
979 | @@ -105,6 +110,14 @@ | |||
980 | 105 | class WordEnginePrivate | 110 | class WordEnginePrivate |
981 | 106 | { | 111 | { |
982 | 107 | public: | 112 | public: |
983 | 113 | |||
984 | 114 | enum PredictiveBackend { | ||
985 | 115 | PresageBackend = 1, | ||
986 | 116 | PinyinBackend | ||
987 | 117 | }; | ||
988 | 118 | |||
989 | 119 | PredictiveBackend predictiveBackend; | ||
990 | 120 | |||
991 | 108 | SpellChecker spell_checker; | 121 | SpellChecker spell_checker; |
992 | 109 | #ifdef HAVE_PRESAGE | 122 | #ifdef HAVE_PRESAGE |
993 | 110 | std::string candidates_context; | 123 | std::string candidates_context; |
994 | @@ -112,11 +125,16 @@ | |||
995 | 112 | Presage presage; | 125 | Presage presage; |
996 | 113 | #endif | 126 | #endif |
997 | 114 | 127 | ||
998 | 128 | // TODO there is too many ifdef in this class | ||
999 | 129 | #ifdef HAVE_PINYIN | ||
1000 | 130 | PinyinAdapter* pinyinAdapter; | ||
1001 | 131 | #endif | ||
1002 | 115 | explicit WordEnginePrivate(); | 132 | explicit WordEnginePrivate(); |
1003 | 116 | }; | 133 | }; |
1004 | 117 | 134 | ||
1005 | 118 | WordEnginePrivate::WordEnginePrivate() | 135 | WordEnginePrivate::WordEnginePrivate() |
1007 | 119 | : spell_checker() | 136 | : predictiveBackend(PresageBackend) |
1008 | 137 | , spell_checker() | ||
1009 | 120 | #ifdef HAVE_PRESAGE | 138 | #ifdef HAVE_PRESAGE |
1010 | 121 | , candidates_context() | 139 | , candidates_context() |
1011 | 122 | , presage_candidates(CandidatesCallback(candidates_context)) | 140 | , presage_candidates(CandidatesCallback(candidates_context)) |
1012 | @@ -128,6 +146,10 @@ | |||
1013 | 128 | presage.config("Presage.Selector.SUGGESTIONS", "6"); | 146 | presage.config("Presage.Selector.SUGGESTIONS", "6"); |
1014 | 129 | presage.config("Presage.Selector.REPEAT_SUGGESTIONS", "yes"); | 147 | presage.config("Presage.Selector.REPEAT_SUGGESTIONS", "yes"); |
1015 | 130 | #endif | 148 | #endif |
1016 | 149 | |||
1017 | 150 | #ifdef HAVE_PINYIN | ||
1018 | 151 | pinyinAdapter = new PinyinAdapter; | ||
1019 | 152 | #endif | ||
1020 | 131 | } | 153 | } |
1021 | 132 | 154 | ||
1022 | 133 | 155 | ||
1023 | @@ -159,6 +181,15 @@ | |||
1024 | 159 | AbstractWordEngine::setEnabled(enabled); | 181 | AbstractWordEngine::setEnabled(enabled); |
1025 | 160 | } | 182 | } |
1026 | 161 | 183 | ||
1027 | 184 | void WordEngine::onWordCandidateSelected(QString word) | ||
1028 | 185 | { | ||
1029 | 186 | Q_D(WordEngine); | ||
1030 | 187 | |||
1031 | 188 | #ifdef HAVE_PINYIN | ||
1032 | 189 | if (d->predictiveBackend == WordEnginePrivate::PinyinBackend) | ||
1033 | 190 | d->pinyinAdapter->wordCandidateSelected(word); | ||
1034 | 191 | #endif | ||
1035 | 192 | } | ||
1036 | 162 | 193 | ||
1037 | 163 | WordCandidateList WordEngine::fetchCandidates(Model::Text *text) | 194 | WordCandidateList WordEngine::fetchCandidates(Model::Text *text) |
1038 | 164 | { | 195 | { |
1039 | @@ -168,19 +199,33 @@ | |||
1040 | 168 | const QString &preedit(text->preedit()); | 199 | const QString &preedit(text->preedit()); |
1041 | 169 | const bool is_preedit_capitalized(not preedit.isEmpty() && preedit.at(0).isUpper()); | 200 | const bool is_preedit_capitalized(not preedit.isEmpty() && preedit.at(0).isUpper()); |
1042 | 170 | 201 | ||
1043 | 202 | #ifdef HAVE_PINYIN | ||
1044 | 203 | if (d->predictiveBackend == WordEnginePrivate::PinyinBackend) { | ||
1045 | 204 | QString sentence = d->pinyinAdapter->parse(preedit); | ||
1046 | 205 | |||
1047 | 206 | QStringList suggestions = d->pinyinAdapter->getWordCandidates(); | ||
1048 | 207 | |||
1049 | 208 | Q_FOREACH(const QString &suggestion, suggestions) { | ||
1050 | 209 | appendToCandidates(&candidates, WordCandidate::SourcePrediction, suggestion, is_preedit_capitalized); | ||
1051 | 210 | } | ||
1052 | 211 | } | ||
1053 | 212 | #endif | ||
1054 | 213 | |||
1055 | 171 | #ifdef HAVE_PRESAGE | 214 | #ifdef HAVE_PRESAGE |
1059 | 172 | const QString &context = (text->surroundingLeft() + preedit); | 215 | if (d->predictiveBackend == WordEnginePrivate::PresageBackend) { |
1060 | 173 | d->candidates_context = context.toStdString(); | 216 | const QString &context = (text->surroundingLeft() + preedit); |
1061 | 174 | const std::vector<std::string> predictions = d->presage.predict(); | 217 | d->candidates_context = context.toStdString(); |
1062 | 218 | const std::vector<std::string> predictions = d->presage.predict(); | ||
1063 | 175 | 219 | ||
1072 | 176 | // TODO: Fine-tune presage behaviour to also perform error correction, not just word prediction. | 220 | // TODO: Fine-tune presage behaviour to also perform error correction, not just word prediction. |
1073 | 177 | if (not context.isEmpty()) { | 221 | if (not context.isEmpty()) { |
1074 | 178 | // FIXME: max_candidates should come from style, too: | 222 | // FIXME: max_candidates should come from style, too: |
1075 | 179 | const static unsigned int max_candidates = 7; | 223 | const static unsigned int max_candidates = 7; |
1076 | 180 | const int count(qMin<int>(predictions.size(), max_candidates)); | 224 | const int count(qMin<int>(predictions.size(), max_candidates)); |
1077 | 181 | for (int index = 0; index < count; ++index) { | 225 | for (int index = 0; index < count; ++index) { |
1078 | 182 | appendToCandidates(&candidates, WordCandidate::SourcePrediction, QString::fromStdString(predictions.at(index)), | 226 | appendToCandidates(&candidates, WordCandidate::SourcePrediction, QString::fromStdString(predictions.at(index)), |
1079 | 183 | is_preedit_capitalized); | 227 | is_preedit_capitalized); |
1080 | 228 | } | ||
1081 | 184 | } | 229 | } |
1082 | 185 | } | 230 | } |
1083 | 186 | #endif | 231 | #endif |
1084 | @@ -210,4 +255,14 @@ | |||
1085 | 210 | d->spell_checker.addToUserWordlist(word); | 255 | d->spell_checker.addToUserWordlist(word); |
1086 | 211 | } | 256 | } |
1087 | 212 | 257 | ||
1088 | 258 | void WordEngine::onLanguageChanged(const QString &languageId) | ||
1089 | 259 | { | ||
1090 | 260 | Q_D(WordEngine); | ||
1091 | 261 | |||
1092 | 262 | if (languageId == "zh_cn_pinyin") | ||
1093 | 263 | d->predictiveBackend = WordEnginePrivate::PinyinBackend; | ||
1094 | 264 | else | ||
1095 | 265 | d->predictiveBackend = WordEnginePrivate::PresageBackend; | ||
1096 | 266 | } | ||
1097 | 267 | |||
1098 | 213 | }} // namespace Logic, MaliitKeyboard | 268 | }} // namespace Logic, MaliitKeyboard |
1099 | 214 | 269 | ||
1100 | === modified file 'maliit-keyboard/lib/logic/wordengine.h' | |||
1101 | --- maliit-keyboard/lib/logic/wordengine.h 2012-07-25 09:49:30 +0000 | |||
1102 | +++ maliit-keyboard/lib/logic/wordengine.h 2013-06-17 15:53:36 +0000 | |||
1103 | @@ -59,6 +59,9 @@ | |||
1104 | 59 | virtual void addToUserDictionary(const QString &word); | 59 | virtual void addToUserDictionary(const QString &word); |
1105 | 60 | //! \reimp_end | 60 | //! \reimp_end |
1106 | 61 | 61 | ||
1107 | 62 | Q_SLOT void onWordCandidateSelected(QString word); | ||
1108 | 63 | Q_SLOT void onLanguageChanged(const QString& languageId); | ||
1109 | 64 | |||
1110 | 62 | private: | 65 | private: |
1111 | 63 | //! \reimp | 66 | //! \reimp |
1112 | 64 | virtual WordCandidateList fetchCandidates(Model::Text *text); | 67 | virtual WordCandidateList fetchCandidates(Model::Text *text); |
1113 | 65 | 68 | ||
1114 | === modified file 'maliit-keyboard/plugin/editor.cpp' | |||
1115 | --- maliit-keyboard/plugin/editor.cpp 2012-08-06 12:58:44 +0000 | |||
1116 | +++ maliit-keyboard/plugin/editor.cpp 2013-06-17 15:53:36 +0000 | |||
1117 | @@ -36,6 +36,8 @@ | |||
1118 | 36 | #include <QTimer> | 36 | #include <QTimer> |
1119 | 37 | #include <maliit/namespace.h> | 37 | #include <maliit/namespace.h> |
1120 | 38 | 38 | ||
1121 | 39 | #include "logic/abstractlanguagefeatures.h" | ||
1122 | 40 | |||
1123 | 39 | namespace MaliitKeyboard { | 41 | namespace MaliitKeyboard { |
1124 | 40 | 42 | ||
1125 | 41 | Editor::Editor(const EditorOptions &options, | 43 | Editor::Editor(const EditorOptions &options, |
1126 | 42 | 44 | ||
1127 | === modified file 'maliit-keyboard/plugin/inputmethod.cpp' | |||
1128 | --- maliit-keyboard/plugin/inputmethod.cpp 2013-06-06 16:47:16 +0000 | |||
1129 | +++ maliit-keyboard/plugin/inputmethod.cpp 2013-06-17 15:53:36 +0000 | |||
1130 | @@ -225,6 +225,15 @@ | |||
1131 | 225 | QObject::connect(&editor, SIGNAL(preeditEnabledChanged(bool)), | 225 | QObject::connect(&editor, SIGNAL(preeditEnabledChanged(bool)), |
1132 | 226 | &layout.updater, SLOT(setWordRibbonVisible(bool))); | 226 | &layout.updater, SLOT(setWordRibbonVisible(bool))); |
1133 | 227 | 227 | ||
1134 | 228 | QObject::connect(&layout.updater, SIGNAL(wordCandidateSelected(QString)), | ||
1135 | 229 | editor.wordEngine(), SLOT(onWordCandidateSelected(QString))); | ||
1136 | 230 | |||
1137 | 231 | QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)), | ||
1138 | 232 | editor.wordEngine(), SLOT(onLanguageChanged(QString))); | ||
1139 | 233 | |||
1140 | 234 | QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)), | ||
1141 | 235 | &editor, SLOT(onLanguageChanged(const QString&))); | ||
1142 | 236 | |||
1143 | 228 | // just for now | 237 | // just for now |
1144 | 229 | layout.updater.setWordRibbonVisible(true); | 238 | layout.updater.setWordRibbonVisible(true); |
1145 | 230 | 239 | ||
1146 | @@ -441,6 +450,9 @@ | |||
1147 | 441 | connect(d->surface_factory, SIGNAL(screenSizeChanged(QSize)), | 450 | connect(d->surface_factory, SIGNAL(screenSizeChanged(QSize)), |
1148 | 442 | this, SLOT(onScreenSizeChange(QSize))); | 451 | this, SLOT(onScreenSizeChange(QSize))); |
1149 | 443 | 452 | ||
1150 | 453 | connect(&d->editor, SIGNAL(layoutMenuRequested()), | ||
1151 | 454 | this, SLOT(onLayoutMenuRequested())); | ||
1152 | 455 | |||
1153 | 444 | connect(this, SIGNAL(wordEngineEnabledChanged(bool)), uiConst, SLOT(onWordEngineSettingsChanged(bool))); | 456 | connect(this, SIGNAL(wordEngineEnabledChanged(bool)), uiConst, SLOT(onWordEngineSettingsChanged(bool))); |
1154 | 445 | 457 | ||
1155 | 446 | registerStyleSetting(host); | 458 | registerStyleSetting(host); |
1156 | @@ -913,4 +925,10 @@ | |||
1157 | 913 | d->updateKeyboardOrientation(); | 925 | d->updateKeyboardOrientation(); |
1158 | 914 | } | 926 | } |
1159 | 915 | 927 | ||
1160 | 928 | void InputMethod::onLayoutMenuRequested() | ||
1161 | 929 | { | ||
1162 | 930 | Q_D(InputMethod); | ||
1163 | 931 | d->qmlRootItem->setProperty("languageMenuVisible", true); | ||
1164 | 932 | } | ||
1165 | 933 | |||
1166 | 916 | } // namespace MaliitKeyboard | 934 | } // namespace MaliitKeyboard |
1167 | 917 | 935 | ||
1168 | === modified file 'maliit-keyboard/plugin/inputmethod.h' | |||
1169 | --- maliit-keyboard/plugin/inputmethod.h 2013-06-03 15:41:05 +0000 | |||
1170 | +++ maliit-keyboard/plugin/inputmethod.h 2013-06-17 15:53:36 +0000 | |||
1171 | @@ -104,6 +104,8 @@ | |||
1172 | 104 | Q_SLOT void onMagnifierLayoutOriginChanged(const QPoint &origin); | 104 | Q_SLOT void onMagnifierLayoutOriginChanged(const QPoint &origin); |
1173 | 105 | #endif | 105 | #endif |
1174 | 106 | 106 | ||
1175 | 107 | Q_SLOT void onLayoutMenuRequested(); | ||
1176 | 108 | |||
1177 | 107 | Q_SLOT void onHideAnimationFinished(); | 109 | Q_SLOT void onHideAnimationFinished(); |
1178 | 108 | Q_SIGNAL void wordEngineEnabledChanged(bool wordEngineEnabled); | 110 | Q_SIGNAL void wordEngineEnabledChanged(bool wordEngineEnabled); |
1179 | 109 | 111 | ||
1180 | 110 | 112 | ||
1181 | === modified file 'maliit-keyboard/qml/Keyboard.qml' | |||
1182 | --- maliit-keyboard/qml/Keyboard.qml 2013-06-06 16:47:16 +0000 | |||
1183 | +++ maliit-keyboard/qml/Keyboard.qml 2013-06-17 15:53:36 +0000 | |||
1184 | @@ -45,6 +45,8 @@ | |||
1185 | 45 | property int pressedKeyIndex: -1; | 45 | property int pressedKeyIndex: -1; |
1186 | 46 | property Item pressedKey; | 46 | property Item pressedKey; |
1187 | 47 | 47 | ||
1188 | 48 | property bool languageMenuVisible: false | ||
1189 | 49 | |||
1190 | 48 | RotationHelper { | 50 | RotationHelper { |
1191 | 49 | 51 | ||
1192 | 50 | Connections { | 52 | Connections { |
1193 | @@ -55,6 +57,17 @@ | |||
1194 | 55 | } | 57 | } |
1195 | 56 | } | 58 | } |
1196 | 57 | 59 | ||
1197 | 60 | LanguageMenu { | ||
1198 | 61 | id: languageMenu | ||
1199 | 62 | |||
1200 | 63 | visible: languageMenuVisible | ||
1201 | 64 | anchors.centerIn: parent | ||
1202 | 65 | width: 500 | ||
1203 | 66 | height: 600 | ||
1204 | 67 | |||
1205 | 68 | z: 20 | ||
1206 | 69 | } | ||
1207 | 70 | |||
1208 | 58 | MouseArea { | 71 | MouseArea { |
1209 | 59 | id: keyboardSurface | 72 | id: keyboardSurface |
1210 | 60 | property int jumpBackThreshold: 170 | 73 | property int jumpBackThreshold: 170 |
1211 | 61 | 74 | ||
1212 | === added file 'maliit-keyboard/qml/LanguageMenu.qml' | |||
1213 | --- maliit-keyboard/qml/LanguageMenu.qml 1970-01-01 00:00:00 +0000 | |||
1214 | +++ maliit-keyboard/qml/LanguageMenu.qml 2013-06-17 15:53:36 +0000 | |||
1215 | @@ -0,0 +1,53 @@ | |||
1216 | 1 | /* | ||
1217 | 2 | * Copyright 2013 Canonical Ltd. | ||
1218 | 3 | * | ||
1219 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1220 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1221 | 6 | * the Free Software Foundation; version 3. | ||
1222 | 7 | * | ||
1223 | 8 | * This program is distributed in the hope that it will be useful, | ||
1224 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1225 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1226 | 11 | * GNU Lesser General Public License for more details. | ||
1227 | 12 | * | ||
1228 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1229 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1230 | 15 | */ | ||
1231 | 16 | |||
1232 | 17 | import QtQuick 2.0 | ||
1233 | 18 | import Ubuntu.Components 0.1 | ||
1234 | 19 | import Ubuntu.Components.ListItems 0.1 as ListItem | ||
1235 | 20 | |||
1236 | 21 | Item { | ||
1237 | 22 | |||
1238 | 23 | Rectangle { | ||
1239 | 24 | anchors.fill: parent | ||
1240 | 25 | color: "lightGray" | ||
1241 | 26 | } | ||
1242 | 27 | |||
1243 | 28 | // tempor., will come from settings | ||
1244 | 29 | ListModel { | ||
1245 | 30 | id: availableLanguagesModel | ||
1246 | 31 | ListElement { language: "English - US"; languageId: "en_us"; } | ||
1247 | 32 | ListElement { language: "English - UK"; languageId: "en_gb"; } | ||
1248 | 33 | ListElement { language: "Chinese - Pinyin"; languageId: "zh_cn_pinyin"; } | ||
1249 | 34 | ListElement { language: "Spanish"; languageId: "es"; } | ||
1250 | 35 | ListElement { language: "German"; languageId: "de"; } | ||
1251 | 36 | } | ||
1252 | 37 | |||
1253 | 38 | ListView { | ||
1254 | 39 | id: menuList | ||
1255 | 40 | anchors.fill: parent | ||
1256 | 41 | interactive: false | ||
1257 | 42 | |||
1258 | 43 | model: availableLanguagesModel | ||
1259 | 44 | |||
1260 | 45 | delegate: ListItem.Standard { | ||
1261 | 46 | text: language | ||
1262 | 47 | onClicked: { | ||
1263 | 48 | event_handler.onLanguageChangeRequested(languageId); | ||
1264 | 49 | canvas.languageMenuVisible = false; | ||
1265 | 50 | } | ||
1266 | 51 | } | ||
1267 | 52 | } | ||
1268 | 53 | } | ||
1269 | 0 | 54 | ||
1270 | === modified file 'maliit-keyboard/qml/qml.pro' | |||
1271 | --- maliit-keyboard/qml/qml.pro 2013-06-05 14:58:50 +0000 | |||
1272 | +++ maliit-keyboard/qml/qml.pro 2013-06-17 15:53:36 +0000 | |||
1273 | @@ -14,6 +14,7 @@ | |||
1274 | 14 | Keyboard.qml \ | 14 | Keyboard.qml \ |
1275 | 15 | maliit-ui-constants.qml \ | 15 | maliit-ui-constants.qml \ |
1276 | 16 | RotationHelper.qml \ | 16 | RotationHelper.qml \ |
1278 | 17 | WordRibbon.qml | 17 | WordRibbon.qml \ |
1279 | 18 | LanguageMenu.qml | ||
1280 | 18 | Popper.qml | 19 | Popper.qml |
1281 | 19 | 20 | ||
1282 | 20 | 21 | ||
1283 | === modified file 'maliit-keyboard/view/abstracttexteditor.cpp' | |||
1284 | --- maliit-keyboard/view/abstracttexteditor.cpp 2012-11-21 15:19:50 +0000 | |||
1285 | +++ maliit-keyboard/view/abstracttexteditor.cpp 2013-06-17 15:53:36 +0000 | |||
1286 | @@ -32,6 +32,9 @@ | |||
1287 | 32 | #include "abstracttexteditor.h" | 32 | #include "abstracttexteditor.h" |
1288 | 33 | #include "models/wordribbon.h" | 33 | #include "models/wordribbon.h" |
1289 | 34 | 34 | ||
1290 | 35 | #include "logic/chineselanguagefeatures.h" | ||
1291 | 36 | #include "logic/languagefeatures.h" | ||
1292 | 37 | |||
1293 | 35 | namespace MaliitKeyboard { | 38 | namespace MaliitKeyboard { |
1294 | 36 | 39 | ||
1295 | 37 | //! \class EditorOptions | 40 | //! \class EditorOptions |
1296 | @@ -490,6 +493,10 @@ | |||
1297 | 490 | Q_EMIT rightLayoutSelected(); | 493 | Q_EMIT rightLayoutSelected(); |
1298 | 491 | break; | 494 | break; |
1299 | 492 | 495 | ||
1300 | 496 | case Key::ActionLayoutMenu: | ||
1301 | 497 | Q_EMIT layoutMenuRequested(); | ||
1302 | 498 | break; | ||
1303 | 499 | |||
1304 | 493 | default: | 500 | default: |
1305 | 494 | break; | 501 | break; |
1306 | 495 | } | 502 | } |
1307 | @@ -752,4 +759,17 @@ | |||
1308 | 752 | } | 759 | } |
1309 | 753 | } | 760 | } |
1310 | 754 | 761 | ||
1311 | 762 | //! \brief sets language features | ||
1312 | 763 | //! \param language id as string (as found in settings file) | ||
1313 | 764 | //! | ||
1314 | 765 | void AbstractTextEditor::onLanguageChanged(const QString& languageId) | ||
1315 | 766 | { | ||
1316 | 767 | Q_D(AbstractTextEditor); | ||
1317 | 768 | |||
1318 | 769 | if (languageId == "zh_cn_pinyin") | ||
1319 | 770 | d->language_features.reset(new Logic::ChineseLanguageFeatures); | ||
1320 | 771 | else | ||
1321 | 772 | d->language_features.reset(new Logic::LanguageFeatures); | ||
1322 | 773 | } | ||
1323 | 774 | |||
1324 | 755 | } // namespace MaliitKeyboard | 775 | } // namespace MaliitKeyboard |
1325 | 756 | 776 | ||
1326 | === modified file 'maliit-keyboard/view/abstracttexteditor.h' | |||
1327 | --- maliit-keyboard/view/abstracttexteditor.h 2012-11-21 15:19:50 +0000 | |||
1328 | +++ maliit-keyboard/view/abstracttexteditor.h 2013-06-17 15:53:36 +0000 | |||
1329 | @@ -138,6 +138,9 @@ | |||
1330 | 138 | Q_SIGNAL void autoCapsActivated(); | 138 | Q_SIGNAL void autoCapsActivated(); |
1331 | 139 | Q_SIGNAL void leftLayoutSelected(); | 139 | Q_SIGNAL void leftLayoutSelected(); |
1332 | 140 | Q_SIGNAL void rightLayoutSelected(); | 140 | Q_SIGNAL void rightLayoutSelected(); |
1333 | 141 | Q_SIGNAL void layoutMenuRequested(); | ||
1334 | 142 | |||
1335 | 143 | Q_SLOT virtual void onLanguageChanged(const QString& languageId); | ||
1336 | 141 | 144 | ||
1337 | 142 | private: | 145 | private: |
1338 | 143 | const QScopedPointer<AbstractTextEditorPrivate> d_ptr; | 146 | const QScopedPointer<AbstractTextEditorPrivate> d_ptr; |
1339 | 144 | 147 | ||
1340 | === modified file 'maliit-keyboard/word-prediction.pri' | |||
1341 | --- maliit-keyboard/word-prediction.pri 2012-07-23 09:40:25 +0000 | |||
1342 | +++ maliit-keyboard/word-prediction.pri 2013-06-17 15:53:36 +0000 | |||
1343 | @@ -13,3 +13,10 @@ | |||
1344 | 13 | disable-preedit|!enable-presage:!enable-hunspell { | 13 | disable-preedit|!enable-presage:!enable-hunspell { |
1345 | 14 | DEFINES += DISABLE_PREEDIT | 14 | DEFINES += DISABLE_PREEDIT |
1346 | 15 | } | 15 | } |
1347 | 16 | |||
1348 | 17 | enable-pinyin { | ||
1349 | 18 | CONFIG += link_pkgconfig | ||
1350 | 19 | PKGCONFIG += glib-2.0 | ||
1351 | 20 | PKGCONFIG += libpinyin | ||
1352 | 21 | DEFINES += HAVE_PINYIN | ||
1353 | 22 | } | ||
1354 | 16 | 23 | ||
1355 | === modified file 'maliit-plugins.pro' | |||
1356 | --- maliit-plugins.pro 2013-01-30 19:53:34 +0000 | |||
1357 | +++ maliit-plugins.pro 2013-06-17 15:53:36 +0000 | |||
1358 | @@ -13,6 +13,7 @@ | |||
1359 | 13 | \\n\\t enable-presage: Use presage to calculate word candidates (maliit-keyboard-plugin only) \ | 13 | \\n\\t enable-presage: Use presage to calculate word candidates (maliit-keyboard-plugin only) \ |
1360 | 14 | \\n\\t enable-hunspell: Use hunspell for error correction (maliit-keyboard-plugin only) \ | 14 | \\n\\t enable-hunspell: Use hunspell for error correction (maliit-keyboard-plugin only) \ |
1361 | 15 | \\n\\t disable-preedit: Always commit characters and never use preedit (maliit-keyboard-plugin only) \ | 15 | \\n\\t disable-preedit: Always commit characters and never use preedit (maliit-keyboard-plugin only) \ |
1362 | 16 | \\n\\t enable-pinyin: Use libpinyin as chinese input method \ | ||
1363 | 16 | \\n\\t enable-qt-mobility: Enable use of QtMobility (enables sound and haptic feedback) \ | 17 | \\n\\t enable-qt-mobility: Enable use of QtMobility (enables sound and haptic feedback) \ |
1364 | 17 | \\n\\t notests: Do not attempt to build tests \ | 18 | \\n\\t notests: Do not attempt to build tests \ |
1365 | 18 | \\n\\t nodoc: Do not build documentation \ | 19 | \\n\\t nodoc: Do not build documentation \ |
1366 | @@ -68,6 +69,10 @@ | |||
1367 | 68 | COVERAGE_CONFIG_STRING += CONFIG+=disable-preedit | 69 | COVERAGE_CONFIG_STRING += CONFIG+=disable-preedit |
1368 | 69 | } | 70 | } |
1369 | 70 | 71 | ||
1370 | 72 | enable-pinyin { | ||
1371 | 73 | COVERAGE_CONFIG_STRING += CONFIG+=enable-pinyin | ||
1372 | 74 | } | ||
1373 | 75 | |||
1374 | 71 | enable-qt-mobility { | 76 | enable-qt-mobility { |
1375 | 72 | COVERAGE_CONFIG_STRING += CONFIG+=enable-qt-mobility | 77 | COVERAGE_CONFIG_STRING += CONFIG+=enable-qt-mobility |
1376 | 73 | } | 78 | } |
work in progress