Merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-layout-context into lp:phablet-extras/maliit-plugins

Proposed by Thomas Moenicke
Status: Merged
Approved by: Bill Filler
Approved revision: 2148
Merged at revision: 2135
Proposed branch: lp:~thomas-moenicke/phablet-extras/maliit-plugins-layout-context
Merge into: lp:phablet-extras/maliit-plugins
Diff against target: 1131 lines (+702/-88)
18 files modified
debian/changelog (+1/-1)
maliit-keyboard/data/languages/url.xml (+484/-0)
maliit-keyboard/lib/logic/keyareaconverter.cpp (+1/-0)
maliit-keyboard/lib/logic/layoutupdater.cpp (+3/-8)
maliit-keyboard/lib/models/wordribbon.cpp (+2/-2)
maliit-keyboard/lib/models/wordribbon.h (+1/-1)
maliit-keyboard/maliit-keyboard.pro (+1/-0)
maliit-keyboard/plugin/inputmethod.cpp (+31/-65)
maliit-keyboard/plugin/inputmethod.h (+1/-2)
maliit-keyboard/qml/Keyboard.qml (+5/-2)
maliit-keyboard/tests/common/inputmethodhostprobe.cpp (+15/-0)
maliit-keyboard/tests/common/inputmethodhostprobe.h (+5/-2)
maliit-keyboard/tests/editor/editor.pro (+5/-4)
maliit-keyboard/tests/tests.pro (+2/-1)
maliit-keyboard/tests/wordengine/.bzrignore (+4/-0)
maliit-keyboard/tests/wordengine/main.cpp (+114/-0)
maliit-keyboard/tests/wordengine/wordengine.pro (+16/-0)
unittests.sh (+11/-0)
To merge this branch: bzr merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-layout-context
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+175228@code.launchpad.net

Commit message

support for inputmethod hints: ImhNoPredictiveText implemented
switching wordribbon on/off at runtime

Description of the change

support for inputmethod hints: ImhNoPredictiveText implemented
switching wordribbon on/off at runtime

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
2139. By Thomas Moenicke

fix merge conflict

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2140. By Thomas Moenicke

fixed a race condition that could crash the plugin when wordengine was enabled
changed debian package dependency to 0.99 (instead of 0.99+git...)

Revision history for this message
Thomas Moenicke (thomas-moenicke) wrote :

tested on GN

Revision history for this message
Thomas Moenicke (thomas-moenicke) wrote :

in order to not see an empty word ribbon, we should enable the word engine in the settings file:
https://code.launchpad.net/~thomas-moenicke/phablet-extras/maliit-framework-wordengine-on/+merge/175813

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomas Moenicke (thomas-moenicke) wrote :

tested again, downloaded these jenkins packages and flashed the phone with -b
also, /etc/xdg/maliit.org/server.conf needs to set wordeninge to true:

pluginsettings\libmaliit-keyboard-plugin.so\word_engine_enabled = true

Notepad shows wordribbon, while browser does not: Qt.ImhNoPredicitveText flag is set

Revision history for this message
Bill Filler (bfiller) wrote :

get rid of the changelog entry that bumps the version because we can't release this until the new maliit-framework gets released as it only works with the new maliit-framework. But we can merge it if we remove the changelog entry. Seems to work well with the new maliit-framework but incorrectly shows a blank word ribbon bar with the old framework when predictive text is disabled.

review: Needs Fixing
2141. By Thomas Moenicke

remove changelog bump

Revision history for this message
Thomas Moenicke (thomas-moenicke) wrote :

done

it should work with both maliit-framework verions as I changed the version
check to this:
Depends: maliit-framework (>= 0.99),

Anyways I removed it

On Mon, Jul 22, 2013 at 6:47 PM, Bill Filler <email address hidden>wrote:

> Review: Needs Fixing
>
> get rid of the changelog entry that bumps the version because we can't
> release this until the new maliit-framework gets released as it only works
> with the new maliit-framework. But we can merge it if we remove the
> changelog entry. Seems to work well with the new maliit-framework but
> incorrectly shows a blank word ribbon bar with the old framework when
> predictive text is disabled.
> --
>
> https://code.launchpad.net/~thomas-moenicke/phablet-extras/maliit-plugins-layout-context/+merge/175228
> You are the owner of
> lp:~thomas-moenicke/phablet-extras/maliit-plugins-layout-context.
>

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2142. By Thomas Moenicke

fixed an issue that showed text blue even if word engine is off

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2143. By Thomas Moenicke

fixed issue of not showing wordribbon after using the browser: LayoutUpdater created a new instance of WordRibbon on every setWordRibbonVisible
improved Model: not resetting model when appending a wordcandidate

2144. By Thomas Moenicke

merge: no change rebuild against maliit-framework in archive

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2145. By Thomas Moenicke

adding unittests for WordRibbon

2146. By Thomas Moenicke

adding unittest runner script
removed debug output from unittest

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2147. By Thomas Moenicke

enabled editor unittests

2148. By Thomas Moenicke

server.conf settings overwrite inputMethodHints
e.g. word_engine_enabled = false hides the wordribbon/engine no matter what the inputMethodFlag says

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

tested and working pretty well. going to approve but a few things need fixing. do that in another MR
1) the url layout never gets enabled
 +
722 + if (d->host->contentType(valid) == Maliit::UrlContentType)
723 + setActiveSubView("url");
724 +

I never see this code being executed and the layout changing with the .com key showing

2) It's nice in notepad with word prediction turned on it auto-capatilizes the first letter after typing a period. We should try and always auto-capatilize after the period even in word prediction turned off.

Revision history for this message
Bill Filler (bfiller) wrote :

approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-07-25 15:41:34 +0000
3+++ debian/changelog 2013-07-29 14:19:29 +0000
4@@ -8,7 +8,7 @@
5
6 * fix reporting wrong keyboard rectangle
7
8- -- Thomas Moenicke <thomas@pachamama> Wed, 10 Jul 2013 14:10:11 +0200
9+ -- Thomas Moenicke <thomas@pachamama> Fri, 05 Jul 2013 11:45:27 +0200
10
11 maliit-plugins (0.99.trunk.phablet0) saucy; urgency=low
12
13
14=== added file 'maliit-keyboard/data/languages/url.xml'
15--- maliit-keyboard/data/languages/url.xml 1970-01-01 00:00:00 +0000
16+++ maliit-keyboard/data/languages/url.xml 2013-07-29 14:19:29 +0000
17@@ -0,0 +1,484 @@
18+<?xml version="1.0" encoding="utf-8"?>
19+<!DOCTYPE keyboard SYSTEM "VirtualKeyboardLayout.dtd">
20+
21+<keyboard catalog="en_us" language="en_us" title="English (US)" version="1.0">
22+ <layout type="general">
23+ <section id="main">
24+ <row>
25+ <key>
26+ <binding label="q">
27+ <modifiers keys="shift">
28+ <binding label="Q" />
29+ </modifiers>
30+ </binding>
31+ </key>
32+ <key>
33+ <binding label="w">
34+ <modifiers keys="shift">
35+ <binding label="W" />
36+ </modifiers>
37+ </binding>
38+ </key>
39+ <key>
40+ <extended>
41+ <row>
42+ <key>
43+ <binding label="è">
44+ <modifiers keys="shift">
45+ <binding label="È" />
46+ </modifiers>
47+ </binding>
48+ </key>
49+ <key>
50+ <binding label="é">
51+ <modifiers keys="shift">
52+ <binding label="É" />
53+ </modifiers>
54+ </binding>
55+ </key>
56+ <key>
57+ <binding label="ê">
58+ <modifiers keys="shift">
59+ <binding label="Ê" />
60+ </modifiers>
61+ </binding>
62+ </key>
63+ <key>
64+ <binding label="ë">
65+ <modifiers keys="shift">
66+ <binding label="Ë" />
67+ </modifiers>
68+ </binding>
69+ </key>
70+ <key>
71+ <binding label="€">
72+ <modifiers keys="shift">
73+ <binding label="€" />
74+ </modifiers>
75+ </binding>
76+ </key>
77+ </row>
78+ </extended>
79+ <binding label="e">
80+ <modifiers keys="shift">
81+ <binding label="E" />
82+ </modifiers>
83+ </binding>
84+ </key>
85+ <key>
86+ <binding label="r">
87+ <modifiers keys="shift">
88+ <binding label="R" />
89+ </modifiers>
90+ </binding>
91+ </key>
92+ <key>
93+ <extended>
94+ <row>
95+ <key>
96+ <binding label="þ">
97+ <modifiers keys="shift">
98+ <binding label="Þ" />
99+ </modifiers>
100+ </binding>
101+ </key>
102+ </row>
103+ </extended>
104+ <binding label="t">
105+ <modifiers keys="shift">
106+ <binding label="T" />
107+ </modifiers>
108+ </binding>
109+ </key>
110+ <key>
111+ <extended>
112+ <row>
113+ <key>
114+ <binding label="ý">
115+ <modifiers keys="shift">
116+ <binding label="Ý" />
117+ </modifiers>
118+ </binding>
119+ </key>
120+ <key>
121+ <binding label="¥">
122+ <modifiers keys="shift">
123+ <binding label="¥" />
124+ </modifiers>
125+ </binding>
126+ </key>
127+ </row>
128+ </extended>
129+ <binding label="y">
130+ <modifiers keys="shift">
131+ <binding label="Y" />
132+ </modifiers>
133+ </binding>
134+ </key>
135+ <key>
136+ <extended>
137+ <row>
138+ <key>
139+ <binding label="û">
140+ <modifiers keys="shift">
141+ <binding label="Û" />
142+ </modifiers>
143+ </binding>
144+ </key>
145+ <key>
146+ <binding label="ù">
147+ <modifiers keys="shift">
148+ <binding label="Ù" />
149+ </modifiers>
150+ </binding>
151+ </key>
152+ <key>
153+ <binding label="ú">
154+ <modifiers keys="shift">
155+ <binding label="Ú" />
156+ </modifiers>
157+ </binding>
158+ </key>
159+ <key>
160+ <binding label="ü">
161+ <modifiers keys="shift">
162+ <binding label="Ü" />
163+ </modifiers>
164+ </binding>
165+ </key>
166+ </row>
167+ </extended>
168+ <binding label="u">
169+ <modifiers keys="shift">
170+ <binding label="U" />
171+ </modifiers>
172+ </binding>
173+ </key>
174+ <key>
175+ <extended>
176+ <row>
177+ <key>
178+ <binding label="î">
179+ <modifiers keys="shift">
180+ <binding label="Î" />
181+ </modifiers>
182+ </binding>
183+ </key>
184+ <key>
185+ <binding label="ï">
186+ <modifiers keys="shift">
187+ <binding label="Ï" />
188+ </modifiers>
189+ </binding>
190+ </key>
191+ <key>
192+ <binding label="ì">
193+ <modifiers keys="shift">
194+ <binding label="Ì" />
195+ </modifiers>
196+ </binding>
197+ </key>
198+ <key>
199+ <binding label="í">
200+ <modifiers keys="shift">
201+ <binding label="Í" />
202+ </modifiers>
203+ </binding>
204+ </key>
205+ </row>
206+ </extended>
207+ <binding label="i">
208+ <modifiers keys="shift">
209+ <binding label="I" />
210+ </modifiers>
211+ </binding>
212+ </key>
213+ <key>
214+ <extended>
215+ <row>
216+ <key>
217+ <binding label="ö">
218+ <modifiers keys="shift">
219+ <binding label="Ö" />
220+ </modifiers>
221+ </binding>
222+ </key>
223+ <key>
224+ <binding label="ô">
225+ <modifiers keys="shift">
226+ <binding label="Ô" />
227+ </modifiers>
228+ </binding>
229+ </key>
230+ <key>
231+ <binding label="ò">
232+ <modifiers keys="shift">
233+ <binding label="Ò" />
234+ </modifiers>
235+ </binding>
236+ </key>
237+ <key>
238+ <binding label="ó">
239+ <modifiers keys="shift">
240+ <binding label="Ó" />
241+ </modifiers>
242+ </binding>
243+ </key>
244+ </row>
245+ </extended>
246+ <binding label="o">
247+ <modifiers keys="shift">
248+ <binding label="O" />
249+ </modifiers>
250+ </binding>
251+ </key>
252+ <key>
253+ <binding label="p">
254+ <modifiers keys="shift">
255+ <binding label="P" />
256+ </modifiers>
257+ </binding>
258+ </key>
259+ </row>
260+ <row>
261+ <spacer />
262+ <key>
263+ <extended>
264+ <row>
265+ <key>
266+ <binding label="ä">
267+ <modifiers keys="shift">
268+ <binding label="Ä" />
269+ </modifiers>
270+ </binding>
271+ </key>
272+ <key>
273+ <binding label="à">
274+ <modifiers keys="shift">
275+ <binding label="À" />
276+ </modifiers>
277+ </binding>
278+ </key>
279+ <key>
280+ <binding label="â">
281+ <modifiers keys="shift">
282+ <binding label="Â" />
283+ </modifiers>
284+ </binding>
285+ </key>
286+ <key>
287+ <binding label="á">
288+ <modifiers keys="shift">
289+ <binding label="Á" />
290+ </modifiers>
291+ </binding>
292+ </key>
293+ <key>
294+ <binding label="ã">
295+ <modifiers keys="shift">
296+ <binding label="Ã" />
297+ </modifiers>
298+ </binding>
299+ </key>
300+ <key>
301+ <binding label="å">
302+ <modifiers keys="shift">
303+ <binding label="Å" />
304+ </modifiers>
305+ </binding>
306+ </key>
307+ </row>
308+ </extended>
309+ <binding label="a">
310+ <modifiers keys="shift">
311+ <binding label="A" />
312+ </modifiers>
313+ </binding>
314+ </key>
315+ <key>
316+ <extended>
317+ <row>
318+ <key>
319+ <binding label="ß">
320+ <modifiers keys="shift">
321+ <binding label="$" />
322+ </modifiers>
323+ </binding>
324+ </key>
325+ <key>
326+ <binding label="$" />
327+ </key>
328+ </row>
329+ </extended>
330+ <binding label="s">
331+ <modifiers keys="shift">
332+ <binding label="S" />
333+ </modifiers>
334+ </binding>
335+ </key>
336+ <key>
337+ <extended>
338+ <row>
339+ <key>
340+ <binding label="ð">
341+ <modifiers keys="shift">
342+ <binding label="Ð" />
343+ </modifiers>
344+ </binding>
345+ </key>
346+ </row>
347+ </extended>
348+ <binding label="d">
349+ <modifiers keys="shift">
350+ <binding label="D" />
351+ </modifiers>
352+ </binding>
353+ </key>
354+ <key>
355+ <binding label="f">
356+ <modifiers keys="shift">
357+ <binding label="F" />
358+ </modifiers>
359+ </binding>
360+ </key>
361+ <key>
362+ <binding label="g">
363+ <modifiers keys="shift">
364+ <binding label="G" />
365+ </modifiers>
366+ </binding>
367+ </key>
368+ <key>
369+ <binding label="h">
370+ <modifiers keys="shift">
371+ <binding label="H" />
372+ </modifiers>
373+ </binding>
374+ </key>
375+ <key>
376+ <binding label="j">
377+ <modifiers keys="shift">
378+ <binding label="J" />
379+ </modifiers>
380+ </binding>
381+ </key>
382+ <key>
383+ <binding label="k">
384+ <modifiers keys="shift">
385+ <binding label="K" />
386+ </modifiers>
387+ </binding>
388+ </key>
389+ <key>
390+ <binding label="l">
391+ <modifiers keys="shift">
392+ <binding label="L" />
393+ </modifiers>
394+ </binding>
395+ </key>
396+ <spacer />
397+ </row>
398+ <row>
399+ <key style="special" width="large">
400+ <binding action="shift" />
401+ </key>
402+ <spacer />
403+ <key>
404+ <binding label="z">
405+ <modifiers keys="shift">
406+ <binding label="Z" />
407+ </modifiers>
408+ </binding>
409+ </key>
410+ <key>
411+ <binding label="x">
412+ <modifiers keys="shift">
413+ <binding label="X" />
414+ </modifiers>
415+ </binding>
416+ </key>
417+ <key>
418+ <extended>
419+ <row>
420+ <key>
421+ <binding label="ç">
422+ <modifiers keys="shift">
423+ <binding label="Ç" />
424+ </modifiers>
425+ </binding>
426+ </key>
427+ </row>
428+ </extended>
429+ <binding label="c">
430+ <modifiers keys="shift">
431+ <binding label="C" />
432+ </modifiers>
433+ </binding>
434+ </key>
435+ <key>
436+ <binding label="v">
437+ <modifiers keys="shift">
438+ <binding label="V" />
439+ </modifiers>
440+ </binding>
441+ </key>
442+ <key>
443+ <binding label="b">
444+ <modifiers keys="shift">
445+ <binding label="B" />
446+ </modifiers>
447+ </binding>
448+ </key>
449+ <key>
450+ <extended>
451+ <row>
452+ <key>
453+ <binding label="ñ">
454+ <modifiers keys="shift">
455+ <binding label="Ñ" />
456+ </modifiers>
457+ </binding>
458+ </key>
459+ </row>
460+ </extended>
461+ <binding label="n">
462+ <modifiers keys="shift">
463+ <binding label="N" />
464+ </modifiers>
465+ </binding>
466+ </key>
467+ <key>
468+ <binding label="m">
469+ <modifiers keys="shift">
470+ <binding label="M" />
471+ </modifiers>
472+ </binding>
473+ </key>
474+ <spacer />
475+ <key style="special" width="large">
476+ <binding action="backspace" />
477+ </key>
478+ </row>
479+ <row>
480+ <key style="special" width="x-large">
481+ <binding action="sym" label="?123" />
482+ </key>
483+ <spacer />
484+ <key id="emailUrlKey">
485+ <binding label=".com" />
486+ </key>
487+ <key width="xx-large">
488+ <binding action="space" />
489+ </key>
490+ <key>
491+ <binding label="." />
492+ </key>
493+ <spacer />
494+ <key id="actionKey" style="special" width="x-large">
495+ <binding action="return" />
496+ </key>
497+ </row>
498+ </section>
499+ </layout>
500+ <import file="symbols_en.xml" />
501+</keyboard>
502
503=== modified file 'maliit-keyboard/lib/logic/keyareaconverter.cpp'
504--- maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-06-05 13:00:26 +0000
505+++ maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-07-29 14:19:29 +0000
506@@ -100,6 +100,7 @@
507 qreal consumed_width = 0;
508
509 QVector<int> margins = uiConst->calculateMargins(orientation, kb);
510+ Q_ASSERT(margins.size() > 0);
511 qreal margin = margins[0];
512
513 int row = 0;
514
515=== modified file 'maliit-keyboard/lib/logic/layoutupdater.cpp'
516--- maliit-keyboard/lib/logic/layoutupdater.cpp 2013-06-14 09:55:01 +0000
517+++ maliit-keyboard/lib/logic/layoutupdater.cpp 2013-07-29 14:19:29 +0000
518@@ -34,7 +34,6 @@
519 #include "style.h"
520
521 #include "models/area.h"
522-#include "models/keyboard.h"
523 #include "models/keydescription.h"
524 #include "models/wordribbon.h"
525 #include "models/wordcandidate.h"
526@@ -333,6 +332,8 @@
527 d->layout->setCenterPanel(d->inShiftedState() ? converter.shiftedKeyArea()
528 : converter.keyArea());
529
530+ converter.keyArea();
531+ d->layout->setCenterPanel(converter.keyArea());
532 if (isWordRibbonVisible())
533 applyStyleToWordRibbon(d->layout->wordRibbon(), d->style, orientation);
534
535@@ -359,13 +360,7 @@
536 if (d->word_ribbon_visible != visible) {
537 d->word_ribbon_visible = visible;
538
539- if (d->layout && d->style && d->word_ribbon_visible) {
540- WordRibbon* ribbon = new WordRibbon;
541- applyStyleToWordRibbon(ribbon, d->style, d->layout->orientation());
542- d->layout->setWordRibbon(ribbon);
543- } else if (d->layout) {
544- d->layout->setWordRibbon(new WordRibbon);
545- }
546+ d->layout->wordRibbon()->clearCandidates();
547
548 Q_EMIT wordRibbonVisibleChanged(visible);
549 }
550
551=== modified file 'maliit-keyboard/lib/models/wordribbon.cpp'
552--- maliit-keyboard/lib/models/wordribbon.cpp 2013-05-31 16:09:14 +0000
553+++ maliit-keyboard/lib/models/wordribbon.cpp 2013-07-29 14:19:29 +0000
554@@ -65,9 +65,9 @@
555
556 void WordRibbon::appendCandidate(const WordCandidate &candidate)
557 {
558- beginResetModel();
559+ beginInsertRows(QModelIndex(), rowCount(), rowCount());
560 m_candidates.append(candidate);
561- endResetModel();
562+ endInsertRows(); // fires signal rowsInserted()
563 }
564
565 QVector<WordCandidate> WordRibbon::candidates() const
566
567=== modified file 'maliit-keyboard/lib/models/wordribbon.h'
568--- maliit-keyboard/lib/models/wordribbon.h 2013-05-31 16:09:14 +0000
569+++ maliit-keyboard/lib/models/wordribbon.h 2013-07-29 14:19:29 +0000
570@@ -61,7 +61,7 @@
571 };
572
573 virtual QVariant data(const QModelIndex &index, int role) const;
574- virtual int rowCount(const QModelIndex &parent) const;
575+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
576 virtual QHash<int, QByteArray> roleNames() const;
577
578 bool valid() const;
579
580=== modified file 'maliit-keyboard/maliit-keyboard.pro'
581--- maliit-keyboard/maliit-keyboard.pro 2013-03-22 16:40:29 +0000
582+++ maliit-keyboard/maliit-keyboard.pro 2013-07-29 14:19:29 +0000
583@@ -6,6 +6,7 @@
584 plugin \
585 data \
586 qml \
587+ tests \
588 benchmark \
589
590
591
592=== modified file 'maliit-keyboard/plugin/inputmethod.cpp'
593--- maliit-keyboard/plugin/inputmethod.cpp 2013-07-10 14:26:09 +0000
594+++ maliit-keyboard/plugin/inputmethod.cpp 2013-07-29 14:19:29 +0000
595@@ -110,7 +110,6 @@
596 ScopedSetting auto_correct;
597 ScopedSetting auto_caps;
598 ScopedSetting word_engine;
599- ScopedSetting hide_word_ribbon_in_portrait_mode;
600 };
601
602 class LayoutGroup
603@@ -148,6 +147,7 @@
604 class InputMethodPrivate
605 {
606 public:
607+ InputMethod* q;
608 QQuickItem* qmlRootItem;
609 #ifdef EXTENDED_SURFACE_TEMP_DISABLED
610 SharedSurface extended_surface;
611@@ -174,22 +174,23 @@
612 MAbstractInputMethodHost *host);
613 void setLayoutOrientation(Logic::LayoutHelper::Orientation orientation);
614 void updateKeyboardOrientation();
615- void syncWordEngine(Logic::LayoutHelper::Orientation orientation);
616+ void updateWordRibbon();
617
618 void connectToNotifier();
619 void setContextProperties(QQmlContext *qml_context);
620 };
621
622
623-InputMethodPrivate::InputMethodPrivate(InputMethod *const q,
624+InputMethodPrivate::InputMethodPrivate(InputMethod *const _q,
625 MAbstractInputMethodHost *host)
626 // : surface_factory(host->surfaceFactory())
627 // , surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_surface_options)))
628+ : q(_q)
629 #ifdef EXTENDED_SURFACE_TEMP_DISABLED
630 , extended_surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_extended_surface_options, surface)))
631 , magnifier_surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_extended_surface_options, surface)))
632 #endif
633- : editor(EditorOptions(), new Model::Text, new Logic::WordEngine, new Logic::LanguageFeatures)
634+ , editor(EditorOptions(), new Model::Text, new Logic::WordEngine, new Logic::LanguageFeatures)
635 , feedback()
636 , style(new Style)
637 , notifier()
638@@ -238,9 +239,6 @@
639 QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)),
640 &editor, SLOT(onLanguageChanged(const QString&)));
641
642- // just for now
643- layout.updater.setWordRibbonVisible(true);
644-
645 #ifdef EXTENDED_SURFACE_TEMP_DISABLED
646 QObject::connect(&layout.event_handler, SIGNAL(extendedKeysShown(Key)),
647 &extended_layout.event_handler, SLOT(onExtendedKeysShown(Key)));
648@@ -303,9 +301,17 @@
649 view->setResizeMode(QQuickView::SizeRootObjectToView);
650 }
651
652+void InputMethodPrivate::updateWordRibbon()
653+{
654+ layout.helper.wordRibbon()->setEnabled( predictionEnabled );
655+ Q_EMIT q->wordRibbonEnabledChanged( predictionEnabled );
656+ qmlRootItem->setProperty("wordribbon_visible", predictionEnabled );
657+
658+ updateKeyboardOrientation();
659+}
660+
661 void InputMethodPrivate::setLayoutOrientation(Logic::LayoutHelper::Orientation orientation)
662 {
663- syncWordEngine(orientation);
664 layout.updater.setOrientation(orientation);
665 extended_layout.updater.setOrientation(orientation);
666
667@@ -363,23 +369,6 @@
668 setLayoutOrientation(uiConst->screenToMaliitOrientation(QGuiApplication::primaryScreen()->orientation()));
669 }
670
671-void InputMethodPrivate::syncWordEngine(Logic::LayoutHelper::Orientation orientation)
672-{
673- // hide_word_ribbon_in_potrait_mode_setting overrides word_engine_setting:
674-#ifndef DISABLE_PREEDIT
675- const bool override_activation(settings.hide_word_ribbon_in_portrait_mode->value().toBool()
676- && orientation == Logic::LayoutHelper::Portrait);
677-#else
678- Q_UNUSED(orientation)
679- const bool override_activation = true;
680-#endif
681-
682-
683- editor.wordEngine()->setEnabled(override_activation
684- ? false
685- : settings.word_engine->value().toBool());
686-}
687-
688 void InputMethodPrivate::connectToNotifier()
689 {
690 #ifdef TEMP_DISABLED
691@@ -452,7 +441,7 @@
692 connect(&d->editor, SIGNAL(rightLayoutSelected()),
693 this, SLOT(onRightLayoutSelected()));
694
695- connect(this, SIGNAL(wordEngineEnabledChanged(bool)), uiConst, SLOT(onWordEngineSettingsChanged(bool)));
696+ connect(this, SIGNAL(wordRibbonEnabledChanged(bool)), uiConst, SLOT(onWordEngineSettingsChanged(bool)));
697
698 connect(this, SIGNAL(predictionEnabledChanged()), this, SLOT(updateWordEngine()));
699
700@@ -462,13 +451,11 @@
701 registerAutoCorrectSetting(host);
702 registerAutoCapsSetting(host);
703 registerWordEngineSetting(host);
704- registerHideWordRibbonInPortraitModeSetting(host);
705
706 setActiveSubView("en_us");
707
708 // Setting layout orientation depends on word engine and hide word ribbon
709 // settings to be initialized first:
710-
711 d->updateKeyboardOrientation();
712 }
713
714@@ -478,8 +465,13 @@
715 void InputMethod::show()
716 {
717 Q_D(InputMethod);
718+ bool valid = true;
719
720 d->view->setVisible(true);
721+
722+ if (d->host->contentType(valid) == Maliit::UrlContentType)
723+ setActiveSubView("url");
724+
725 #ifdef EXTENDED_SURFACE_TEMP_DISABLED
726 d->surface->show();
727 d->extended_surface->show();
728@@ -706,35 +698,17 @@
729 attributes));
730
731 connect(d->settings.word_engine.data(), SIGNAL(valueChanged()),
732- this, SLOT(onWordEngineSettingChanged()));
733+ this, SLOT(updateWordEngine()));
734
735 Q_EMIT wordEngineEnabledChanged( d->settings.word_engine.data()->value().toBool() );
736
737 #ifndef DISABLE_PREEDIT
738- d->layout.helper.wordRibbon()->setEnabled(d->settings.word_engine->value().toBool());
739 d->editor.wordEngine()->setEnabled(d->settings.word_engine->value().toBool());
740 #else
741 d->editor.wordEngine()->setEnabled(false);
742 #endif
743 }
744
745-void InputMethod::registerHideWordRibbonInPortraitModeSetting(MAbstractInputMethodHost *host)
746-{
747- Q_D(InputMethod);
748-
749- QVariantMap attributes;
750- attributes[Maliit::SettingEntryAttributes::defaultValue] = false;
751-
752- d->settings.hide_word_ribbon_in_portrait_mode.reset(
753- host->registerPluginSetting("hide_word_ribbon_in_potrait_mode",
754- QT_TR_NOOP("Disable word engine in portrait mode"),
755- Maliit::BoolType,
756- attributes));
757-
758- connect(d->settings.hide_word_ribbon_in_portrait_mode.data(), SIGNAL(valueChanged()),
759- this, SLOT(onHideWordRibbonInPortraitModeSettingChanged()));
760-}
761-
762 void InputMethod::onLeftLayoutSelected()
763 {
764 // This API smells real bad.
765@@ -794,21 +768,6 @@
766 d->editor.setAutoCapsEnabled(d->settings.auto_caps->value().toBool());
767 }
768
769-void InputMethod::onWordEngineSettingChanged()
770-{
771- // FIXME: Renderer doesn't seem to update graphics properly. Word ribbon
772- // is still visible until next VKB show/hide.
773- Q_D(InputMethod);
774- Q_EMIT wordEngineEnabledChanged( d->settings.word_engine.data()->value().toBool() );
775- d->syncWordEngine(d->layout.helper.orientation());
776-}
777-
778-void InputMethod::onHideWordRibbonInPortraitModeSettingChanged()
779-{
780- Q_D(InputMethod);
781- d->setLayoutOrientation(d->layout.helper.orientation());
782-}
783-
784 void InputMethod::setKeyOverrides(const QMap<QString, QSharedPointer<MKeyOverride> > &overrides)
785 {
786 Q_D(InputMethod);
787@@ -941,18 +900,25 @@
788 if (!valid)
789 newPredictionEnabled = true;
790
791- if (newPredictionEnabled != d->predictionEnabled) {
792+ if (d->predictionEnabled != newPredictionEnabled) {
793 d->predictionEnabled = newPredictionEnabled;
794 emitPredictionEnabled = true;
795 }
796-
797 if (emitPredictionEnabled)
798 Q_EMIT predictionEnabledChanged();
799+
800 }
801
802 void InputMethod::updateWordEngine()
803 {
804- // FIXME stub
805+ Q_D(InputMethod);
806+
807+ if (!d->settings.word_engine.data()->value().toBool())
808+ d->predictionEnabled = false;
809+
810+ d->editor.clearPreedit();
811+ d->editor.wordEngine()->setEnabled( d->predictionEnabled );
812+ d->updateWordRibbon();
813 }
814
815 bool InputMethod::predictionEnabled()
816
817=== modified file 'maliit-keyboard/plugin/inputmethod.h'
818--- maliit-keyboard/plugin/inputmethod.h 2013-07-04 08:33:23 +0000
819+++ maliit-keyboard/plugin/inputmethod.h 2013-07-29 14:19:29 +0000
820@@ -97,8 +97,6 @@
821 Q_SLOT void onFeedbackSettingChanged();
822 Q_SLOT void onAutoCorrectSettingChanged();
823 Q_SLOT void onAutoCapsSettingChanged();
824- Q_SLOT void onWordEngineSettingChanged();
825- Q_SLOT void onHideWordRibbonInPortraitModeSettingChanged();
826 Q_SLOT void updateKey(const QString &key_id,
827 const MKeyOverride::KeyOverrideAttributes changed_attributes);
828 Q_SLOT void onKeyboardClosed();
829@@ -116,6 +114,7 @@
830
831 Q_SLOT void onHideAnimationFinished();
832 Q_SIGNAL void wordEngineEnabledChanged(bool wordEngineEnabled);
833+ Q_SIGNAL void wordRibbonEnabledChanged(bool wordRibbonEnabled);
834
835 const QScopedPointer<InputMethodPrivate> d_ptr;
836 };
837
838=== modified file 'maliit-keyboard/qml/Keyboard.qml'
839--- maliit-keyboard/qml/Keyboard.qml 2013-07-04 08:32:31 +0000
840+++ maliit-keyboard/qml/Keyboard.qml 2013-07-29 14:19:29 +0000
841@@ -41,6 +41,8 @@
842 visible: layout.visible
843
844 property bool shown: false;
845+ property bool wordribbon_visible: true;
846+
847 property bool hideAnimationFinished: false;
848 property int pressedKeyIndex: -1;
849 property Item pressedKey;
850@@ -77,16 +79,17 @@
851 anchors.bottom: keypadMouseArea.top
852 width: parent.width;
853
854- height: maliit_wordribbon.enabled ? layout.wordribbon_height : 0
855+ height: wordribbon_visible ? layout.wordribbon_height : 0
856 }
857
858 MouseArea {
859 id: keypadMouseArea
860 preventStealing: true
861+
862 anchors {
863 top: wordRibbon.bottom
864 fill: parent
865- topMargin: layout.invisible_toucharea_height + (maliit_wordribbon.enabled ? layout.wordribbon_height : 0);
866+ topMargin: layout.invisible_toucharea_height + (wordribbon_visible ? layout.wordribbon_height : 0);
867 }
868
869 Item {
870
871=== modified file 'maliit-keyboard/tests/common/inputmethodhostprobe.cpp'
872--- maliit-keyboard/tests/common/inputmethodhostprobe.cpp 2012-11-21 15:19:50 +0000
873+++ maliit-keyboard/tests/common/inputmethodhostprobe.cpp 2013-07-29 14:19:29 +0000
874@@ -121,3 +121,18 @@
875 {
876 return m_last_preedit_text_format_list;
877 }
878+
879+void InputMethodHostProbe::registerWindow(QWindow*, Maliit::Position)
880+{
881+
882+}
883+
884+void InputMethodHostProbe::setScreenRegion(const QRegion&, QWindow*)
885+{
886+
887+}
888+
889+void InputMethodHostProbe::setInputMethodArea(const QRegion&, QWindow*)
890+{
891+
892+}
893
894=== modified file 'maliit-keyboard/tests/common/inputmethodhostprobe.h'
895--- maliit-keyboard/tests/common/inputmethodhostprobe.h 2012-11-21 15:19:50 +0000
896+++ maliit-keyboard/tests/common/inputmethodhostprobe.h 2013-07-29 14:19:29 +0000
897@@ -96,7 +96,6 @@
898 void setRedirectKeys(bool) {}
899 void setDetectableAutoRepeat(bool) {}
900 void setGlobalCorrectionEnabled(bool) {}
901- void setInputModeIndicator(Maliit::InputModeIndicator) {}
902 void switchPlugin(Maliit::SwitchDirection) {}
903 void switchPlugin(const QString&) {}
904 void setScreenRegion(const QRegion&) {}
905@@ -104,13 +103,17 @@
906 void setSelection(int, int) {}
907 void setOrientationAngleLocked(bool) {}
908 QList<MImPluginDescription> pluginDescriptions(Maliit::HandlerState) const {return QList<MImPluginDescription>();}
909- Maliit::Plugins::AbstractSurfaceFactory* surfaceFactory() { return 0; }
910 Maliit::Plugins::AbstractPluginSetting* registerPluginSetting(const QString &,
911 const QString &,
912 Maliit::SettingEntryType ,
913 const QVariantMap &) { return 0; }
914 void invokeAction(const QString &,
915 const QKeySequence &) {}
916+
917+ virtual void registerWindow(QWindow*, Maliit::Position);
918+ virtual void setScreenRegion(const QRegion&, QWindow*);
919+ virtual void setInputMethodArea(const QRegion&, QWindow*);
920+
921 };
922
923 #endif // INPUTMETHODHOSTPROBE_H
924
925=== modified file 'maliit-keyboard/tests/editor/editor.pro'
926--- maliit-keyboard/tests/editor/editor.pro 2012-07-25 06:52:40 +0000
927+++ maliit-keyboard/tests/editor/editor.pro 2013-07-29 14:19:29 +0000
928@@ -2,14 +2,15 @@
929 include(../common-check.pri)
930 include(../../config-plugin.pri)
931
932-TOP_BUILDDIR = $${OUT_PWD}/../../..
933-TARGET = editor
934+TARGET = ut_editor
935 TEMPLATE = app
936 QT = core testlib gui
937
938 INCLUDEPATH += ../ ../../lib ../../
939-LIBS += $${TOP_BUILDDIR}/$${MALIIT_KEYBOARD_PLUGIN_LIB} $${TOP_BUILDDIR}/$${MALIIT_KEYBOARD_VIEW_LIB} $${TOP_BUILDDIR}/$${MALIIT_KEYBOARD_LIB}
940-PRE_TARGETDEPS += $${TOP_BUILDDIR}/$${MALIIT_KEYBOARD_PLUGIN_LIB} $${TOP_BUILDDIR}/$${MALIIT_KEYBOARD_VIEW_LIB} $${TOP_BUILDDIR}/$${MALIIT_KEYBOARD_LIB}
941+
942+TOP_BUILDDIR = $${OUT_PWD}/../..
943+LIBS += -L$${TOP_BUILDDIR}/plugin -lmaliit-keyboard-plugin
944+
945
946 HEADERS += \
947 wordengineprobe.h \
948
949=== modified file 'maliit-keyboard/tests/tests.pro'
950--- maliit-keyboard/tests/tests.pro 2013-04-18 13:33:13 +0000
951+++ maliit-keyboard/tests/tests.pro 2013-07-29 14:19:29 +0000
952@@ -3,11 +3,12 @@
953 common \
954 editor \
955 language-layout-switching \
956- preedit-string \
957+# preedit-string \
958 repeat-backspace \
959 word-candidates \
960 language-layout-loading \
961 qml-test-app \
962+ wordengine \
963
964 CONFIG += ordered
965 QMAKE_EXTRA_TARGETS += check
966
967=== added directory 'maliit-keyboard/tests/wordengine'
968=== added file 'maliit-keyboard/tests/wordengine/.bzrignore'
969--- maliit-keyboard/tests/wordengine/.bzrignore 1970-01-01 00:00:00 +0000
970+++ maliit-keyboard/tests/wordengine/.bzrignore 2013-07-29 14:19:29 +0000
971@@ -0,0 +1,4 @@
972+ut_wordengine
973+Makefile
974+*.moc
975+*.o
976
977=== added file 'maliit-keyboard/tests/wordengine/main.cpp'
978--- maliit-keyboard/tests/wordengine/main.cpp 1970-01-01 00:00:00 +0000
979+++ maliit-keyboard/tests/wordengine/main.cpp 2013-07-29 14:19:29 +0000
980@@ -0,0 +1,114 @@
981+
982+
983+#include "models/wordribbon.h"
984+#include "plugin/inputmethod.h"
985+#include "common/inputmethodhostprobe.h"
986+
987+#include <maliit/plugins/abstractinputmethodhost.h>
988+
989+#include <QtTest/QtTest>
990+
991+using namespace MaliitKeyboard;
992+
993+
994+class TestWordEngine: public QObject
995+{
996+ Q_OBJECT
997+private:
998+
999+ Q_SLOT void wordRibbon() {
1000+
1001+ // WordRibbon is a QAbstractListModel, exposed to QML
1002+
1003+ WordRibbon wr;
1004+
1005+ QCOMPARE(wr.candidates().size(), 0);
1006+
1007+
1008+ QHash<int, QByteArray> roles;
1009+ roles.insert(WordRibbon::WordRole, "word");
1010+ QCOMPARE( wr.roleNames(), roles );
1011+
1012+
1013+ WordCandidate wc1(WordCandidate::SourceUnknown, "word_1");
1014+ WordCandidate wc2(WordCandidate::SourceUnknown, "word_2");
1015+ WordCandidate wc3(WordCandidate::SourceUnknown, "word_3");
1016+
1017+ wr.appendCandidate(wc1);
1018+ wr.appendCandidate(wc2);
1019+ wr.appendCandidate(wc3);
1020+
1021+ QCOMPARE( wr.data( wr.index(0,0), WordRibbon::WordRole ), QVariant("word_1"));
1022+ QCOMPARE( wr.data( wr.index(1,0), WordRibbon::WordRole ), QVariant("word_2"));
1023+ QCOMPARE( wr.data( wr.index(2,0), WordRibbon::WordRole ), QVariant("word_3"));
1024+
1025+ QCOMPARE( wr.rowCount(), 3 );
1026+
1027+
1028+ QVector<WordCandidate> candidates = wr.candidates();
1029+ QCOMPARE( candidates.size(), 3 );
1030+ QCOMPARE( candidates[0], wc1 );
1031+ QCOMPARE( candidates[1], wc2 );
1032+ QCOMPARE( candidates[2], wc3 );
1033+
1034+ wr.clearCandidates();
1035+ QCOMPARE( wr.rowCount(), 0 );
1036+
1037+ wr.appendCandidate(wc1);
1038+ wr.appendCandidate(wc2);
1039+ wr.appendCandidate(wc3);
1040+
1041+ QCOMPARE( wr.rowCount(), 3 );
1042+
1043+ // initially set to false
1044+ QCOMPARE( wr.enabled(), false );
1045+
1046+ wr.setEnabled(true);
1047+ QCOMPARE( wr.enabled(), true );
1048+
1049+ wr.setEnabled(false);
1050+ QCOMPARE( wr.enabled(), false );
1051+
1052+ // later
1053+ QCOMPARE( wr.valid(), false );
1054+
1055+ WordCandidate w4(WordCandidate::SourceUnknown, "another_word");
1056+
1057+ // make sure model-related signals work
1058+ QSignalSpy modelAboutToBeResetSpy(&wr, SIGNAL( modelAboutToBeReset() ));
1059+ QSignalSpy rowsInsertedSpy(&wr, SIGNAL( rowsInserted(QModelIndex, int, int) ) );
1060+
1061+ QVERIFY(modelAboutToBeResetSpy.isValid());
1062+ QVERIFY(rowsInsertedSpy.isValid());
1063+
1064+ wr.appendCandidate(w4);
1065+
1066+ QCOMPARE(rowsInsertedSpy.count(), 1);
1067+
1068+ wr.clearCandidates();
1069+
1070+ QCOMPARE( modelAboutToBeResetSpy.count(), 1 );
1071+
1072+ QList<QVariant> arguments = rowsInsertedSpy.takeFirst();
1073+ QVERIFY(arguments[1].toInt() == 3);
1074+ QVERIFY(arguments[2].toInt() == 3);
1075+
1076+ /*
1077+ this API should be reviewed and refactored where appropriate:
1078+
1079+ valid
1080+ rect
1081+ origin/setOrigin - currently not used
1082+ rCandidates - returns reference, not copy. no const. not documented
1083+ area/rArea/setArea - currently not used
1084+ Q_PROPERTY enabled - currently not used
1085+ operator==
1086+ operator!=
1087+ */
1088+ }
1089+
1090+};
1091+
1092+
1093+QTEST_MAIN(TestWordEngine)
1094+#include "main.moc"
1095
1096=== added file 'maliit-keyboard/tests/wordengine/wordengine.pro'
1097--- maliit-keyboard/tests/wordengine/wordengine.pro 1970-01-01 00:00:00 +0000
1098+++ maliit-keyboard/tests/wordengine/wordengine.pro 2013-07-29 14:19:29 +0000
1099@@ -0,0 +1,16 @@
1100+include(../../config.pri)
1101+include(../common-check.pri)
1102+include(../../config-plugin.pri)
1103+
1104+CONFIG += testlib
1105+TEMPLATE = app
1106+TARGET = ut_wordengine
1107+INCLUDEPATH += . ../ ../../lib ../../
1108+QT = core testlib gui
1109+
1110+
1111+TOP_BUILDDIR = $${OUT_PWD}/../..
1112+LIBS += -L$${TOP_BUILDDIR}/plugin -lmaliit-keyboard-plugin
1113+
1114+
1115+SOURCES += main.cpp
1116
1117=== added file 'unittests.sh'
1118--- unittests.sh 1970-01-01 00:00:00 +0000
1119+++ unittests.sh 2013-07-29 14:19:29 +0000
1120@@ -0,0 +1,11 @@
1121+
1122+
1123+adb push maliit-keyboard/plugin/libmaliit-keyboard-plugin.so /data/ubuntu/usr/lib/maliit/plugins/libmaliit-keyboard-plugin.so
1124+adb push maliit-keyboard/tests/wordengine/ut_wordengine /data/ubuntu/usr/bin
1125+adb push maliit-keyboard/tests/editor/ut_editor /data/ubuntu/usr/bin
1126+
1127+adb shell QT_QPA_PLATFORM=minimal LD_LIBRARY_PATH=/usr/lib/maliit/plugins:$_LD_LIBRARY_PATH /usr/bin/ut_editor
1128+adb shell QT_QPA_PLATFORM=minimal LD_LIBRARY_PATH=/usr/lib/maliit/plugins:$_LD_LIBRARY_PATH /usr/bin/ut_wordengine
1129+
1130+
1131+

Subscribers

People subscribed via source and target branches