Merge lp://staging/~cosmos-door/ubuntu-keyboard/japanese-keyboard-rebooted into lp://staging/ubuntu-keyboard

Proposed by Mitsuya Shibata
Status: Merged
Approved by: Michael Sheldon
Approved revision: 418
Merged at revision: 447
Proposed branch: lp://staging/~cosmos-door/ubuntu-keyboard/japanese-keyboard-rebooted
Merge into: lp://staging/ubuntu-keyboard
Diff against target: 2321 lines (+1925/-4)
38 files modified
debian/control (+11/-0)
debian/server.conf (+1/-0)
debian/ubuntu-keyboard-japanese.install (+1/-0)
plugins/ja/ja.pro (+9/-0)
plugins/ja/qml/Keyboard_ja.qml (+118/-0)
plugins/ja/qml/Keyboard_ja_email.qml (+121/-0)
plugins/ja/qml/Keyboard_ja_url.qml (+121/-0)
plugins/ja/qml/Keyboard_ja_url_search.qml (+121/-0)
plugins/ja/qml/keys/CommitKey.qml (+40/-0)
plugins/ja/qml/keys/CursorKey.qml (+58/-0)
plugins/ja/qml/keys/DomainKey.qml (+42/-0)
plugins/ja/qml/keys/FlickArea.qml (+79/-0)
plugins/ja/qml/keys/FlickCharKey.qml (+178/-0)
plugins/ja/qml/keys/FlickPop.qml (+70/-0)
plugins/ja/qml/keys/FlickPopKey.qml (+42/-0)
plugins/ja/qml/keys/KanaSwitchKey.qml (+85/-0)
plugins/ja/qml/keys/ModifierKey.qml (+79/-0)
plugins/ja/qml/keys/UndoKey.qml (+25/-0)
plugins/ja/qml/keys/key_constants.js (+31/-0)
plugins/ja/qml/keys/modifier.js (+102/-0)
plugins/ja/qml/qml.pro (+31/-0)
plugins/ja/src/anthyadapter.cpp (+117/-0)
plugins/ja/src/anthyadapter.h (+45/-0)
plugins/ja/src/japaneselanguagefeatures.cpp (+92/-0)
plugins/ja/src/japaneselanguagefeatures.h (+42/-0)
plugins/ja/src/japaneseplugin.cpp (+59/-0)
plugins/ja/src/japaneseplugin.h (+43/-0)
plugins/ja/src/japaneseplugin.json (+7/-0)
plugins/ja/src/src.pro (+39/-0)
plugins/plugins.pro (+1/-0)
qml/keys/languages.js (+1/-0)
src/lib/logic/abstractlanguagefeatures.h (+2/-0)
src/lib/logic/eventhandler.cpp (+2/-0)
src/plugin/inputmethod.cpp (+29/-0)
src/plugin/inputmethod.h (+9/-0)
src/plugin/inputmethod_p.h (+3/-0)
src/view/abstracttexteditor.cpp (+65/-4)
src/view/abstracttexteditor.h (+4/-0)
To merge this branch: bzr merge lp://staging/~cosmos-door/ubuntu-keyboard/japanese-keyboard-rebooted
Reviewer Review Type Date Requested Status
Michael Sheldon (community) Approve
Mitsuya Shibata (community) Needs Resubmitting
Ken VanDine packaging Approve
Review via email: mp+268158@code.staging.launchpad.net

Commit message

Implement Japanese keyboard layout

Description of the change

This is rewrite code to input Japanese from ubuntu-keyboard.

How to try it:

1. install ubuntu-keyboard this branch

2. setup japanese environment and enable japanese input method
    1. launch System Settings and select Language & Text
    2. set "Display language" to "日本語(日本)" (most bottom in list)
    3. set "Keyboard layouts" to "[Ja] 日本語"

3. return to home scope and tap search icon

4. enjoy japanese input!
    - Japanese input method use "Flick input" which is commonly used japanese
      smartphones.
    - please refer following video about how to input.
      http://www.youtube.com/watch?v=pbGdEeHzFnk

Note about this branch:

1. support single kana-kanji conversion only
    - does not support resize segment.

2. publish preedit and cursor_position property to QML
    - Japanese input method use preedit hardly.
    - So needs to edit preedit from QML before commit it.
    - This branch add properties preedit and cursor_position to maliit_input_method.
    - And emit signal by changed this property from abstracttexteditor.
      src/plugin/inputmethod.{h,cpp}
      src/plugin/inputmethod_p.h
      src/view/abstracttexteditor.cpp
      src/view/abstracttexteditor.{h,cpp}
      src/lib/logic/eventhandler.cpp

Thanks!

To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Hi Mitsuya,

 Thanks for updating this, I've only just started reviewing it so there'll be some more comments to come later, but the most immediate issue with this branch is that it doesn't install the japanese plugin's "keys" directory (plugins/ja/qml/keys).

 I've also made a couple of inline comments at locations where it's still using the old relative path imports for the global keys directory, this should now be done as "import keys 1.0" as this we allow the plugin to be installed separately from the rest of maliit in the future (e.g. as part of a custom tarball, or possibly as a click package at some point)

Thanks!

review: Needs Fixing
404. By Mitsuya Shibata

Install customized qml files for Japanese layout.

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Hi Michael,

> Thanks for updating this, I've only just started reviewing it so there'll be
> some more comments to come later, but the most immediate issue with this
> branch is that it doesn't install the japanese plugin's "keys" directory
> (plugins/ja/qml/keys).

oh, sorry... I fixed qml.pro, it will install plugins/ja/qml/keys too.

> I've also made a couple of inline comments at locations where it's still
> using the old relative path imports for the global keys directory, this should
> now be done as "import keys 1.0" as this we allow the plugin to be installed
> separately from the rest of maliit in the future (e.g. as part of a custom
> tarball, or possibly as a click package at some point)

Changed to "import keys 1.0".

Thank you for your review!

review: Needs Resubmitting
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Looking really good, just a few small things needing fixing:

1) The cursor keys move two characters at a time (it looks like they're moving the cursor on both the press and release events)

2) In the character selection pop-over the characters that aren't currently selected should use the same colour as the selection pop-over on the other keyboard layouts (this is done by setting the opacity to 0.6 when not selected)

3) If touch feedback is enabled in settings then sliding between characters on the selection pop-over should trigger haptic feedback via pressEffect.start() (same as on other keyboard layouts)

4) The copyright year on a lot of the added files is listed as 2012/2013/2014, this should be 2015 since these are new files

5) Is it correct that the URL and email layouts should be a non-Japanese qwerty layout? (If so it might be worth populating the URL key with useful Japanese TLDs like .jp, .co.jp, etc.)

6) Could you add a comment to the modifier.js explaining the purpose of the map and normalize arrays?

review: Needs Fixing
405. By Mitsuya Shibata

fixes copyright year and add some comments

406. By Mitsuya Shibata

fixes double key released for cursor keys

407. By Mitsuya Shibata

set the text opacity to 0.6 when not selected in the selection pop-over

408. By Mitsuya Shibata

trigger haptic feedback on the selection pop-over too.

409. By Mitsuya Shibata

add email/url layout for japanese.

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Thank you for more reviewing!

I fixed all of your pointed out. Please check it.

> 1) The cursor keys move two characters at a time (it looks like they're moving
> the cursor on both the press and release events)

Fixed typo (s/Released/Pressed/)

> 2) In the character selection pop-over the characters that aren't currently
> selected should use the same colour as the selection pop-over on the other
> keyboard layouts (this is done by setting the opacity to 0.6 when not
> selected)

Set opacity for unselected Text element.

> 3) If touch feedback is enabled in settings then sliding between characters on
> the selection pop-over should trigger haptic feedback via pressEffect.start()
> (same as on other keyboard layouts)

Add haptic feedback and not audio feedback (same as original extended key).

> 4) The copyright year on a lot of the added files is listed as 2012/2013/2014,
> this should be 2015 since these are new files

Set all 2015.

> 5) Is it correct that the URL and email layouts should be a non-Japanese
> qwerty layout? (If so it might be worth populating the URL key with useful
> Japanese TLDs like .jp, .co.jp, etc.)

Change email/url layout to same as normal Japanese layout.
Commonly used Japanese TLD is ".com" and ".jp".
Indeed ".co.jp" is used too, but doesn't manual typewith frequently as url/email .

Additionally to this, set email/url default layout alphabet instead of kana.

> 6) Could you add a comment to the modifier.js explaining the purpose of the
> map and normalize arrays?

Add comment.

Thanks!

review: Needs Resubmitting
Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Hi Michael,

Is there any chance to be merged for OTA-8 or OTA-9?

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Hi Mitsuya,

 Sorry for the delay in replying, I hadn't spotted your updates; I'll try to get it re-reviewed and included for OTA-9

Cheers,
 Mike

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Hi Mitsuya,

 I've just been re-reviewing this, and it looks great; but I've found one last issue, whereby the cursor keys don't work correctly whilst still in pre-edit. I'm wondering if it might be best to simply call Qt.inputMethod.commit() when pressing the cursor keys?

review: Needs Fixing
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

It looks like the cursor does get moved internally within maliit (so deletions and insertions occur in the correct place) but the visual cursor doesn't move. I think just committing the text prior to moving the cursor would be the simplest solution for this.

410. By Mitsuya Shibata

Merge upstream's changes

411. By Mitsuya Shibata

Switch to Ubuntu.Components 1.3 and QtQuick 2.4

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Hi Michael,

I rebased newer ubuntu-keyboard code.

About cursor key:
I think "commit" is just commit current preedit, then clear preedit and predictions.
In this means, a preedit in Japanese should not be cleared by cursor key,
should be moved just cursor position.

Can I move visible cursor position without commit?

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Perhaps I can use cursor_pos_override argument of setPreedit() in src/lib/models/text.h.

However AbstractTextEditor::replacePreedit() uses text->setPreedit() without 2nd argument.
I will try to customize replacePreedit().

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Umm... cursor_pos_override just updates m_cursor_position...
Anyway, when exists preedit, press twice left and insert any character, then update cursor position.
I hope there are any hint in this behaviour.

412. By Mitsuya Shibata

fix moving cursor position in preedit by cursor key

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Hi Michael,

Finally fixed cursor key problem in rev412. Could you review it?

IMPORTANT NOTE:
Revision 412 modify code in singleBackspace() in src/view/abstracttexteditor.cpp.
It will affect other language not only Japanese.
I believe this modification does not change behaviours of backspace.

review: Needs Resubmitting
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Hi Mitsuya,

 The changes appear to have fixed the cursor issue nicely, and I haven't seen any negative effects on other layouts, so that's looking good, great work :).

 Unfortunately I've found one more issue: if an ideographic space character (second function from the normal space) is inserted and then committed without any other characters, all predictions are broken until the user switches to another layout and back (effectively unloading and then reloading the Japanese word engine).

 One other quick question, is it normal in Japanese input methods for the return key to be used for committing pre-edit strings? For all other layouts this is done by the space key. I'm happy to leave it with the return key if that's what most Japanese users would already expect, but otherwise it would be good to keep consistent with other layouts if possible.

Thanks!
 Mike.

review: Needs Fixing
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Actually after a bit of further testing it doesn't appear to be directly related to the ideographic space, it seems it can happen with any string if you type it quickly and the commit (presumably whilst anthy is still processing predictions?)

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Thank you your review!

> quickly typing problem

I can't reproduce yet. Could you tell me any typing sample word (and any apps)?

> enter key

Yes, Japanese users expect return key as "commit preedit".
Additionally, in desktop, space key means "change next candidate of the preedit".
I think return key label should not be changed.

More generally, Japanese input method change label of return key
to "確定" ("commit" in Japanease) if in preedit.
I would like to implement this feature in the future.

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Hmm... it seems that plugins/ja/src/anthyadapter.cpp isn't reentrant.
I'll check more deeply. Thanks!

413. By Mitsuya Shibata

fix problem with parsePredictionText signal on parse()

If parsePredictionText signal is issued when AnthyAdapter::parse() in
procedure, new preedit is saved to JapanesePlugin::m_nextWord then return back.

When AnthyAdapter::parse() is finished, JapanesePlugin::finishedProcessing() is
called. And if parsed text is differ from m_nextWord, retry to parse().

This commit fix to pass wrong old word to new parse() call.

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Hi Micahel,

I found a problem in plugins/ja/src/japaneseplugin.cpp and fixed it.
Perhaps it will be related you found quickly typing problem.
Could you retry it?

review: Needs Resubmitting
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Hi Mitsuya,

 That seems to have fixed it, great work! I'm just waiting on some fixes to unity8 that are causing some issues with the autopilot tests and then we can see about getting your branch landed :)

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Hi Mitsuya,

 I'm afraid during my final run through the test plan for this I spotted another issue, the bottom row of keys isn't positioned correctly in the landscape view, here's a screenshot showing the issue: http://mikeasoft.com/~mike/jp-landscape.png

 Once that's fixed we should be able to land this :)

Cheers,
 Mike.

review: Needs Fixing
Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

OK, I can reproduce it. However layout is changed English layout then back to Japanese layout, bottom row is positioned correctly. Umm...

414. By Mitsuya Shibata

fix layout in landscape mode.

The height of Language key should be keyHeight.

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Ah, OK. Language key is wrong height. Fixed.

review: Needs Resubmitting
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Great, thanks, one last little thing I spotted, the backspace icon is offset slightly, this actually looks like a bug in the leftSide/rightSide handling for action keys, so for now I'd suggest you just set the width of that key to "panel.keyWidth". Then as a separate task I'll fix the action key icon positioning at a later date and also update all the existing layouts to use leftSide/rightSide for shift and backspace (which they don't currently do).

review: Needs Fixing
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

One other thing, would it not make more sense for the "." to be the primary key on the URL layout's url key instead of the ","?

Revision history for this message
Ken VanDine (ken-vandine) wrote :

packaging looks good

review: Approve (packaging)
Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Hi Michael,

> I'd suggest you just set the width of that key to "panel.keyWidth".

If set width or remove "rightSide", then first row will be right offset.
This is caused by no rightMargin in CharKey.
Should I push the code to remain the layout corruption?

https://goo.gl/photos/bG5ZxHxfyMhExc926

> would it not make more sense for the "." to be the primary key on the URL layout's url key instead of the ","?

Indeed. To operation coherency, I will swap "," and "." at all keyboard.

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Hi Mitsuya,

 Just did a quick test, you can work around that by setting the width on the UndoKey as well as the width on the BackspaceKey, then everything will align correctly.

Cheers,
 Mike.

415. By Mitsuya Shibata

add workaround for backspace icon misalignment

416. By Mitsuya Shibata

swap "," and "." which is mainly used to input url and email.

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Hi Michael,

Thanks you for nice advice!
I pushed codes to fix problems which you pointed out.

Thanks,

review: Needs Resubmitting
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Great, thanks; I'll run that through the test plan one last time on Monday and then hopefully we can get it landed :)

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Hey Mitsuya,

 Sorry! Spotted another issue, you must be getting really tired of me saying "one last thing..." ;)

 The commit key isn't inserting the primary candidate (the bold candidate) when in auto-complete mode, instead it inserts the user's input unmodified. Is this deliberate (i.e. does the Japanese keyboard not really support auto-complete at all)? If so then we shouldn't be highlighting a primary candidate for Japanese, otherwise pressing the commit key should input the primary candidate instead of the user input.

review: Needs Fixing
417. By Mitsuya Shibata

set primary candidate to user input string

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Hi Michael,

Indeed. Generally in Japanese, the commit key should insert the preedit string (primary purpose to input Hiragana).
To clarify which candidate will be committed, I set the primary candidate to the preedit string.

Is it okay?

review: Needs Resubmitting
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Okay, that sounds good; I'll kick off a rebuild now and retest when it's done

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Unfortunately I found an extra issue, one of the changes made to the core breaks both the email detection and mid-word insertion based disabling of pre-edit for all the other plugins.

const bool enablePreeditAtInsertion = d->word_engine->languageFeature()->wordEngineAvailable();

^ wordEngineAvailable isn't really an appropriate feature to check for this, as that's going to be true for pretty much all plugins. I think you really need to explicitly add a new language feature for this (which could be called enablePreeditAtInsertion), that's true for Japanese but false for all other plugins.

review: Needs Fixing
418. By Mitsuya Shibata

fix calling wrong method

Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Sorry for my numerous failure...

I fixed wordEngineAvailable() bug. Could you check it?

review: Needs Resubmitting
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

That's great thanks, and no are apologies necessary :) This is by far the most advanced keyboard we've had contributed, so it's natural that there be a few issues in the review.

I've completed a full test now and everything looks good, so I'll propose it for landing now :)

Thanks for all your hard work on this!

review: Approve
Revision history for this message
Mitsuya Shibata (cosmos-door) wrote :

Thank you for your review and merge!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches