Merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-pinyin into lp:~penk/phablet-extras/maliit-plugins-qml-candidates

Proposed by Penk Chen
Status: Needs review
Proposed branch: lp:~thomas-moenicke/phablet-extras/maliit-plugins-pinyin
Merge into: lp:~penk/phablet-extras/maliit-plugins-qml-candidates
Diff against target: 717 lines (+160/-183) (has conflicts)
11 files modified
debian/control (+2/-1)
maliit-keyboard/data/languages/zh_cn_pinyin.xml (+16/-179)
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/logic.pri (+4/-2)
maliit-keyboard/plugin/editor.cpp (+2/-0)
maliit-keyboard/plugin/inputmethod.cpp (+6/-0)
maliit-keyboard/view/abstracttexteditor.cpp (+16/-0)
maliit-keyboard/view/abstracttexteditor.h (+2/-0)
Text conflict in maliit-keyboard/plugin/inputmethod.cpp
To merge this branch: bzr merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-pinyin
Reviewer Review Type Date Requested Status
Thomas Moenicke Pending
Review via email: mp+169753@code.launchpad.net

Description of the change

Added a method onQmlCandidateChanged(QStringList) for event handler. For input method logic in QML/JavaScript side it can append candidates into WordRibbon by something like: event_handler.onQmlCandidateChanged(['test', '123', 'abc']);

To post a comment you must log in.
2135. By Thomas Moenicke

added chinese language features: no space after word suggestion, no upper/lowercase

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

Unmerged revisions

2137. By Thomas Moenicke

polished layout:
- removed uppercase, not needed for pinyin
- removed redundant return key
- fixed spacing

2136. By Thomas Moenicke

adding dependency to glib-2.0-dev

2135. By Thomas Moenicke

added chinese language features: no space after word suggestion, no upper/lowercase

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2013-06-13 10:28:10 +0000
3+++ debian/control 2013-06-17 15:53:35 +0000
4@@ -15,7 +15,8 @@
5 libhunspell-dev,
6 libpresage-dev,
7 libubuntu-platform-api1-dev,
8- libpinyin2-dev
9+ libpinyin2-dev,
10+ libglib2.0-dev
11 Standards-Version: 3.9.3
12
13 Package: nemo-keyboard
14
15=== modified file 'maliit-keyboard/data/languages/zh_cn_pinyin.xml'
16--- maliit-keyboard/data/languages/zh_cn_pinyin.xml 2013-06-13 15:35:36 +0000
17+++ maliit-keyboard/data/languages/zh_cn_pinyin.xml 2013-06-17 15:53:35 +0000
18@@ -7,72 +7,42 @@
19 <row>
20 <key>
21 <binding label="q">
22- <modifiers keys="shift">
23- <binding label="Q" />
24- </modifiers>
25 </binding>
26 </key>
27 <key>
28 <binding label="w">
29- <modifiers keys="shift">
30- <binding label="W" />
31- </modifiers>
32 </binding>
33 </key>
34 <key>
35 <binding label="e">
36- <modifiers keys="shift">
37- <binding label="E" />
38- </modifiers>
39 </binding>
40 </key>
41 <key>
42 <binding label="r">
43- <modifiers keys="shift">
44- <binding label="R" />
45- </modifiers>
46 </binding>
47 </key>
48 <key>
49 <binding label="t">
50- <modifiers keys="shift">
51- <binding label="T" />
52- </modifiers>
53 </binding>
54 </key>
55 <key>
56 <binding label="y">
57- <modifiers keys="shift">
58- <binding label="Y" />
59- </modifiers>
60 </binding>
61 </key>
62 <key>
63 <binding label="u">
64- <modifiers keys="shift">
65- <binding label="U" />
66- </modifiers>
67 </binding>
68 </key>
69 <key>
70 <binding label="i">
71- <modifiers keys="shift">
72- <binding label="I" />
73- </modifiers>
74 </binding>
75 </key>
76 <key>
77 <binding label="o">
78- <modifiers keys="shift">
79- <binding label="O" />
80- </modifiers>
81 </binding>
82 </key>
83 <key>
84 <binding label="p">
85- <modifiers keys="shift">
86- <binding label="P" />
87- </modifiers>
88 </binding>
89 </key>
90 </row>
91@@ -80,151 +50,101 @@
92 <spacer />
93 <key>
94 <binding label="a">
95- <modifiers keys="shift">
96- <binding label="A" />
97- </modifiers>
98 </binding>
99 </key>
100 <key>
101 <binding label="s">
102- <modifiers keys="shift">
103- <binding label="S" />
104- </modifiers>
105 </binding>
106 </key>
107 <key>
108 <binding label="d">
109- <modifiers keys="shift">
110- <binding label="D" />
111- </modifiers>
112 </binding>
113 </key>
114 <key>
115 <binding label="f">
116- <modifiers keys="shift">
117- <binding label="F" />
118- </modifiers>
119 </binding>
120 </key>
121 <key>
122 <binding label="g">
123- <modifiers keys="shift">
124- <binding label="G" />
125- </modifiers>
126 </binding>
127 </key>
128 <key>
129 <binding label="h">
130- <modifiers keys="shift">
131- <binding label="H" />
132- </modifiers>
133 </binding>
134 </key>
135 <key>
136 <binding label="j">
137- <modifiers keys="shift">
138- <binding label="J" />
139- </modifiers>
140 </binding>
141 </key>
142 <key>
143 <binding label="k">
144- <modifiers keys="shift">
145- <binding label="K" />
146- </modifiers>
147 </binding>
148 </key>
149 <key>
150 <binding label="l">
151- <modifiers keys="shift">
152- <binding label="L" />
153- </modifiers>
154 </binding>
155 </key>
156 <spacer />
157 </row>
158 <row>
159- <key style="special" width="large">
160+<!-- <key style="special" width="large">
161 <binding action="shift" label="" />
162- </key>
163+ </key>//-->
164+ <spacer />
165 <spacer />
166 <key>
167 <binding label="z">
168- <modifiers keys="shift">
169- <binding label="Z" />
170- </modifiers>
171 </binding>
172 </key>
173 <key>
174 <binding label="x">
175- <modifiers keys="shift">
176- <binding label="X" />
177- </modifiers>
178 </binding>
179 </key>
180 <key>
181 <binding label="c">
182- <modifiers keys="shift">
183- <binding label="C" />
184- </modifiers>
185 </binding>
186 </key>
187 <key>
188 <binding label="v">
189- <modifiers keys="shift">
190- <binding label="V" />
191- </modifiers>
192 </binding>
193 </key>
194 <key>
195 <binding label="b">
196- <modifiers keys="shift">
197- <binding label="B" />
198- </modifiers>
199 </binding>
200 </key>
201 <key>
202 <binding label="n">
203- <modifiers keys="shift">
204- <binding label="N" />
205- </modifiers>
206 </binding>
207 </key>
208 <key>
209 <binding label="m">
210- <modifiers keys="shift">
211- <binding label="M" />
212- </modifiers>
213 </binding>
214 </key>
215 <spacer />
216 <key style="special" width="large">
217 <binding action="backspace" label="" />
218 </key>
219+ <spacer />
220 </row>
221 <row>
222 <key id="actionKey" style="special" width="large">
223 <binding action="layout_menu" label="cn" />
224 </key>
225- <key style="special" width="x-large">
226+ <key style="special" width="large">
227 <binding action="sym" label="符号" />
228 </key>
229- <key id="emailUrlKey">
230+ <key id="emailUrlKey" width="small">
231 <binding label="," />
232 </key>
233- <key width="x-large">
234+ <key width="xx-large">
235 <binding action="space" label="" />
236 </key>
237- <key id="emailUrlDotKey">
238+ <key id="emailUrlDotKey" width="small">
239 <binding label="。" />
240 </key>
241 <key id="actionKey" style="special" width="x-large">
242- <binding action="compose" label="输入" />
243- </key>
244- <key id="actionKey" style="special" width="x-large">
245- <binding action="return" />
246- </key>
247-
248+ <binding action="return" label="输入" />
249+ </key>
250 </row>
251 </section>
252 </layout>
253@@ -233,72 +153,42 @@
254 <row>
255 <key>
256 <binding label="q">
257- <modifiers keys="shift">
258- <binding label="Q" />
259- </modifiers>
260 </binding>
261 </key>
262 <key>
263 <binding label="w">
264- <modifiers keys="shift">
265- <binding label="W" />
266- </modifiers>
267 </binding>
268 </key>
269 <key>
270 <binding label="e">
271- <modifiers keys="shift">
272- <binding label="E" />
273- </modifiers>
274 </binding>
275 </key>
276 <key>
277 <binding label="r">
278- <modifiers keys="shift">
279- <binding label="R" />
280- </modifiers>
281 </binding>
282 </key>
283 <key>
284 <binding label="t">
285- <modifiers keys="shift">
286- <binding label="T" />
287- </modifiers>
288 </binding>
289 </key>
290 <key>
291 <binding label="y">
292- <modifiers keys="shift">
293- <binding label="Y" />
294- </modifiers>
295 </binding>
296 </key>
297 <key>
298 <binding label="u">
299- <modifiers keys="shift">
300- <binding label="U" />
301- </modifiers>
302 </binding>
303 </key>
304 <key>
305 <binding label="i">
306- <modifiers keys="shift">
307- <binding label="I" />
308- </modifiers>
309 </binding>
310 </key>
311 <key>
312 <binding label="o">
313- <modifiers keys="shift">
314- <binding label="O" />
315- </modifiers>
316 </binding>
317 </key>
318 <key>
319 <binding label="p">
320- <modifiers keys="shift">
321- <binding label="P" />
322- </modifiers>
323 </binding>
324 </key>
325 </row>
326@@ -306,65 +196,38 @@
327 <spacer />
328 <key>
329 <binding label="a">
330- <modifiers keys="shift">
331- <binding label="A" />
332- </modifiers>
333 </binding>
334 </key>
335 <key>
336 <binding label="s">
337- <modifiers keys="shift">
338- <binding label="S" />
339- </modifiers>
340 </binding>
341 </key>
342 <key>
343 <binding label="d">
344- <modifiers keys="shift">
345- <binding label="D" />
346- </modifiers>
347 </binding>
348 </key>
349 <key>
350 <binding label="f">
351- <modifiers keys="shift">
352- <binding label="F" />
353- </modifiers>
354 </binding>
355 </key>
356 <key>
357 <binding label="g">
358- <modifiers keys="shift">
359- <binding label="G" />
360- </modifiers>
361 </binding>
362 </key>
363 <key>
364 <binding label="h">
365- <modifiers keys="shift">
366- <binding label="H" />
367- </modifiers>
368 </binding>
369 </key>
370 <key>
371 <binding label="j">
372- <modifiers keys="shift">
373- <binding label="J" />
374- </modifiers>
375 </binding>
376 </key>
377 <key>
378 <binding label="k">
379- <modifiers keys="shift">
380- <binding label="K" />
381- </modifiers>
382 </binding>
383 </key>
384 <key>
385 <binding label="l">
386- <modifiers keys="shift">
387- <binding label="L" />
388- </modifiers>
389 </binding>
390 </key>
391 <spacer />
392@@ -376,79 +239,53 @@
393 <spacer />
394 <key>
395 <binding label="z">
396- <modifiers keys="shift">
397- <binding label="Z" />
398- </modifiers>
399 </binding>
400 </key>
401 <key>
402 <binding label="x">
403- <modifiers keys="shift">
404- <binding label="X" />
405- </modifiers>
406 </binding>
407 </key>
408 <key>
409 <binding label="c">
410- <modifiers keys="shift">
411- <binding label="C" />
412- </modifiers>
413 </binding>
414 </key>
415 <key>
416 <binding label="v">
417- <modifiers keys="shift">
418- <binding label="V" />
419- </modifiers>
420 </binding>
421 </key>
422 <key>
423 <binding label="b">
424- <modifiers keys="shift">
425- <binding label="B" />
426- </modifiers>
427 </binding>
428 </key>
429 <key>
430 <binding label="n">
431- <modifiers keys="shift">
432- <binding label="N" />
433- </modifiers>
434 </binding>
435 </key>
436 <key>
437 <binding label="m">
438- <modifiers keys="shift">
439- <binding label="M" />
440- </modifiers>
441 </binding>
442 </key>
443 <spacer />
444 <key style="special" width="large">
445 <binding action="backspace" label="" />
446 </key>
447+ <spacer />
448 </row>
449 <row>
450- <key style="special" width="x-large">
451+ <key style="special" width="large">
452 <binding action="sym" label="符号" />
453 </key>
454- <key id="emailUrlKey">
455+ <key id="emailUrlKey" width="small">
456 <binding label="," />
457 </key>
458- <key width="stretched">
459+ <key width="xx-large">
460 <binding action="space" label="" />
461 </key>
462- <key id="emailUrlDotKey">
463+ <key id="emailUrlDotKey" width="small">
464 <binding label="。" />
465 </key>
466 <key id="actionKey" style="special" width="x-large">
467- <binding action="compose" label="输入" />
468- </key>
469- <key width="xx-large">
470- <binding action="space" />
471- </key>
472- <key id="actionKey" style="special" width="x-large">
473- <binding action="return" />
474+ <binding action="return" label="输入" />
475 </key>
476 </row>
477 </section>
478
479=== added file 'maliit-keyboard/lib/logic/chineselanguagefeatures.cpp'
480--- maliit-keyboard/lib/logic/chineselanguagefeatures.cpp 1970-01-01 00:00:00 +0000
481+++ maliit-keyboard/lib/logic/chineselanguagefeatures.cpp 2013-06-17 15:53:35 +0000
482@@ -0,0 +1,42 @@
483+/*
484+ * Copyright 2013 Canonical Ltd.
485+ *
486+ * This program is free software; you can redistribute it and/or modify
487+ * it under the terms of the GNU Lesser General Public License as published by
488+ * the Free Software Foundation; version 3.
489+ *
490+ * This program is distributed in the hope that it will be useful,
491+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
492+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
493+ * GNU Lesser General Public License for more details.
494+ *
495+ * You should have received a copy of the GNU Lesser General Public License
496+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
497+ */
498+
499+#include "chineselanguagefeatures.h"
500+
501+namespace MaliitKeyboard {
502+namespace Logic {
503+
504+ChineseLanguageFeatures::ChineseLanguageFeatures(QObject *parent) :
505+ AbstractLanguageFeatures(parent)
506+{
507+}
508+
509+ChineseLanguageFeatures::~ChineseLanguageFeatures()
510+{
511+}
512+
513+bool ChineseLanguageFeatures::activateAutoCaps(const QString &preedit) const
514+{
515+ return false;
516+}
517+
518+QString ChineseLanguageFeatures::appendixForReplacedPreedit(const QString &preedit) const
519+{
520+ return "";
521+}
522+
523+} // namespace Logic
524+} // namespace MaliitKeyboard
525
526=== added file 'maliit-keyboard/lib/logic/chineselanguagefeatures.h'
527--- maliit-keyboard/lib/logic/chineselanguagefeatures.h 1970-01-01 00:00:00 +0000
528+++ maliit-keyboard/lib/logic/chineselanguagefeatures.h 2013-06-17 15:53:35 +0000
529@@ -0,0 +1,39 @@
530+/*
531+ * Copyright 2013 Canonical Ltd.
532+ *
533+ * This program is free software; you can redistribute it and/or modify
534+ * it under the terms of the GNU Lesser General Public License as published by
535+ * the Free Software Foundation; version 3.
536+ *
537+ * This program is distributed in the hope that it will be useful,
538+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
539+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
540+ * GNU Lesser General Public License for more details.
541+ *
542+ * You should have received a copy of the GNU Lesser General Public License
543+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
544+ */
545+
546+#ifndef CHINESELANGUAGEFEATURES_H
547+#define CHINESELANGUAGEFEATURES_H
548+
549+#include "abstractlanguagefeatures.h"
550+
551+namespace MaliitKeyboard {
552+namespace Logic {
553+
554+class ChineseLanguageFeatures : public AbstractLanguageFeatures
555+{
556+ Q_OBJECT
557+public:
558+ explicit ChineseLanguageFeatures(QObject *parent = 0);
559+ virtual ~ChineseLanguageFeatures();
560+
561+ virtual bool activateAutoCaps(const QString &preedit) const;
562+ virtual QString appendixForReplacedPreedit(const QString &preedit) const;
563+};
564+
565+} // namespace Logic
566+} // namespace MaliitKeyboard
567+
568+#endif // CHINESELANGUAGEFEATURES_H
569
570=== modified file 'maliit-keyboard/lib/logic/dynamiclayout.cpp'
571--- maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-06-05 13:00:26 +0000
572+++ maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-06-17 15:53:35 +0000
573@@ -1,4 +1,18 @@
574-
575+/*
576+ * Copyright 2013 Canonical Ltd.
577+ *
578+ * This program is free software; you can redistribute it and/or modify
579+ * it under the terms of the GNU Lesser General Public License as published by
580+ * the Free Software Foundation; version 3.
581+ *
582+ * This program is distributed in the hope that it will be useful,
583+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
584+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
585+ * GNU Lesser General Public License for more details.
586+ *
587+ * You should have received a copy of the GNU Lesser General Public License
588+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
589+ */
590
591 #include "dynamiclayout.h"
592 #include "dynamiclayout_p.h"
593
594=== modified file 'maliit-keyboard/lib/logic/dynamiclayout.h'
595--- maliit-keyboard/lib/logic/dynamiclayout.h 2013-06-05 13:00:26 +0000
596+++ maliit-keyboard/lib/logic/dynamiclayout.h 2013-06-17 15:53:35 +0000
597@@ -1,3 +1,19 @@
598+/*
599+ * Copyright 2013 Canonical Ltd.
600+ *
601+ * This program is free software; you can redistribute it and/or modify
602+ * it under the terms of the GNU Lesser General Public License as published by
603+ * the Free Software Foundation; version 3.
604+ *
605+ * This program is distributed in the hope that it will be useful,
606+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
607+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
608+ * GNU Lesser General Public License for more details.
609+ *
610+ * You should have received a copy of the GNU Lesser General Public License
611+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
612+ */
613+
614 #ifndef DYNAMICLAYOUT_H
615 #define DYNAMICLAYOUT_H
616
617
618=== modified file 'maliit-keyboard/lib/logic/logic.pri'
619--- maliit-keyboard/lib/logic/logic.pri 2013-06-13 10:28:10 +0000
620+++ maliit-keyboard/lib/logic/logic.pri 2013-06-17 15:53:35 +0000
621@@ -14,7 +14,8 @@
622 logic/languagefeatures.h \
623 logic/eventhandler.h \
624 logic/dynamiclayout.h \
625- logic/pinyinadapter.h
626+ logic/pinyinadapter.h \
627+ logic/chineselanguagefeatures.h
628
629 SOURCES += \
630 logic/hitlogic.cpp \
631@@ -30,7 +31,8 @@
632 logic/languagefeatures.cpp \
633 logic/eventhandler.cpp \
634 logic/dynamiclayout.cpp \
635- logic/pinyinadapter.cpp
636+ logic/pinyinadapter.cpp \
637+ logic/chineselanguagefeatures.cpp
638
639 DEFINES += HUNSPELL_DICT_PATH=\\\"$$HUNSPELL_DICT_PATH\\\"
640
641
642=== modified file 'maliit-keyboard/plugin/editor.cpp'
643--- maliit-keyboard/plugin/editor.cpp 2012-08-06 12:58:44 +0000
644+++ maliit-keyboard/plugin/editor.cpp 2013-06-17 15:53:35 +0000
645@@ -36,6 +36,8 @@
646 #include <QTimer>
647 #include <maliit/namespace.h>
648
649+#include "logic/abstractlanguagefeatures.h"
650+
651 namespace MaliitKeyboard {
652
653 Editor::Editor(const EditorOptions &options,
654
655=== modified file 'maliit-keyboard/plugin/inputmethod.cpp'
656--- maliit-keyboard/plugin/inputmethod.cpp 2013-06-15 23:11:34 +0000
657+++ maliit-keyboard/plugin/inputmethod.cpp 2013-06-17 15:53:35 +0000
658@@ -231,9 +231,15 @@
659 QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)),
660 editor.wordEngine(), SLOT(onLanguageChanged(QString)));
661
662+<<<<<<< TREE
663 QObject::connect(&layout.event_handler, SIGNAL(qmlCandidateChanged(QStringList)),
664 editor.wordEngine(), SLOT(updateQmlCandidates(QStringList)));
665
666+=======
667+ QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)),
668+ &editor, SLOT(onLanguageChanged(const QString&)));
669+
670+>>>>>>> MERGE-SOURCE
671 // just for now
672 layout.updater.setWordRibbonVisible(true);
673
674
675=== modified file 'maliit-keyboard/view/abstracttexteditor.cpp'
676--- maliit-keyboard/view/abstracttexteditor.cpp 2013-06-13 15:35:36 +0000
677+++ maliit-keyboard/view/abstracttexteditor.cpp 2013-06-17 15:53:35 +0000
678@@ -32,6 +32,9 @@
679 #include "abstracttexteditor.h"
680 #include "models/wordribbon.h"
681
682+#include "logic/chineselanguagefeatures.h"
683+#include "logic/languagefeatures.h"
684+
685 namespace MaliitKeyboard {
686
687 //! \class EditorOptions
688@@ -756,4 +759,17 @@
689 }
690 }
691
692+//! \brief sets language features
693+//! \param language id as string (as found in settings file)
694+//!
695+void AbstractTextEditor::onLanguageChanged(const QString& languageId)
696+{
697+ Q_D(AbstractTextEditor);
698+
699+ if (languageId == "zh_cn_pinyin")
700+ d->language_features.reset(new Logic::ChineseLanguageFeatures);
701+ else
702+ d->language_features.reset(new Logic::LanguageFeatures);
703+}
704+
705 } // namespace MaliitKeyboard
706
707=== modified file 'maliit-keyboard/view/abstracttexteditor.h'
708--- maliit-keyboard/view/abstracttexteditor.h 2013-06-13 15:35:36 +0000
709+++ maliit-keyboard/view/abstracttexteditor.h 2013-06-17 15:53:35 +0000
710@@ -140,6 +140,8 @@
711 Q_SIGNAL void rightLayoutSelected();
712 Q_SIGNAL void layoutMenuRequested();
713
714+ Q_SLOT virtual void onLanguageChanged(const QString& languageId);
715+
716 private:
717 const QScopedPointer<AbstractTextEditorPrivate> d_ptr;
718

Subscribers

People subscribed via source and target branches

to all changes: