Merge lp:~andreas-pokorny/ubuntu-keyboard/shellRotation-2 into lp:ubuntu-keyboard

Proposed by Andreas Pokorny
Status: Work in progress
Proposed branch: lp:~andreas-pokorny/ubuntu-keyboard/shellRotation-2
Merge into: lp:ubuntu-keyboard
Diff against target: 516 lines (+213/-243)
4 files modified
qml/Keyboard.qml (+210/-237)
qml/keys/ActionKey.qml (+1/-1)
qml/keys/CharKey.qml (+1/-1)
src/plugin/inputmethod.cpp (+1/-4)
To merge this branch: bzr merge lp:~andreas-pokorny/ubuntu-keyboard/shellRotation-2
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+251356@code.launchpad.net

Commit message

rotation support for keyboard

Description of the change

updated shellRotation MP

To post a comment you must log in.

Unmerged revisions

245. By Andreas Pokorny

merge lp:ubuntu_keyboard

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Keyboard.qml'
2--- qml/Keyboard.qml 2015-02-18 14:31:24 +0000
3+++ qml/Keyboard.qml 2015-02-28 07:01:52 +0000
4@@ -40,260 +40,233 @@
5 id: fullScreenItem
6 objectName: "fullScreenItem"
7
8+ property bool landscape: width > height
9+
10 property variant input_method: maliit_input_method
11 property variant event_handler: maliit_event_handler
12
13- onHeightChanged: calculateSize();
14-
15- OrientationHelper {
16- id: orientationHelper
17- automaticOrientation: false
18- transitionEnabled: false
19-
20- orientationAngle: Screen.angleBetween(Screen.primaryOrientation, canvas.contentOrientation);
21-
22- onOrientationAngleChanged: {
23- calculateSize();
24- }
25+ onXChanged: fullScreenItem.reportKeyboardVisibleRect();
26+ onYChanged: fullScreenItem.reportKeyboardVisibleRect();
27+ onWidthChanged: fullScreenItem.reportKeyboardVisibleRect();
28+ onHeightChanged: fullScreenItem.reportKeyboardVisibleRect();
29+
30+ Item {
31+ id: canvas
32+ objectName: "ubuntuKeyboard" // Allow us to specify a specific keyboard within autopilot.
33+
34+ anchors.bottom: parent.bottom
35+ anchors.left: parent.left
36+
37+ width: parent.width
38+ height: fullScreenItem.landscape ? (fullScreenItem.height * UI.phoneKeyboardHeightLandscape) + wordRibbon.height
39+ : (fullScreenItem.height * UI.phoneKeyboardHeightPortrait) + wordRibbon.height
40+
41+ property int keypadHeight: height;
42+
43+ visible: true
44+
45+ property int contentOrientation: maliit_geometry.orientation
46+ onContentOrientationChanged: fullScreenItem.reportKeyboardVisibleRect();
47+
48+ property bool wordribbon_visible: maliit_word_engine.enabled
49+ onWordribbon_visibleChanged: fullScreenItem.reportKeyboardVisibleRect();
50+
51+ property bool languageMenuShown: false
52+ property bool extendedKeysShown: false
53+
54+ property bool firstShow: true
55+ property bool hidingComplete: true
56+
57+ property string layoutId: "freetext"
58+
59 onXChanged: fullScreenItem.reportKeyboardVisibleRect();
60 onYChanged: fullScreenItem.reportKeyboardVisibleRect();
61 onWidthChanged: fullScreenItem.reportKeyboardVisibleRect();
62 onHeightChanged: fullScreenItem.reportKeyboardVisibleRect();
63
64- Item {
65- id: canvas
66- objectName: "ubuntuKeyboard" // Allow us to specify a specific keyboard within autopilot.
67-
68- anchors.bottom: parent.bottom
69+ MouseArea {
70+ id: swipeArea
71+
72+ property int jumpBackThreshold: units.gu(10)
73+
74 anchors.left: parent.left
75-
76- width: parent.width
77- height: 0
78-
79- property int keypadHeight: height;
80-
81- onRotationChanged: console.log("now rotation has changed!!" + rotation)
82-
83- visible: true
84-
85- property int contentOrientation: maliit_geometry.orientation
86- onContentOrientationChanged: fullScreenItem.reportKeyboardVisibleRect();
87-
88- property bool wordribbon_visible: maliit_word_engine.enabled
89- onWordribbon_visibleChanged: calculateSize();
90-
91- property bool languageMenuShown: false
92- property bool extendedKeysShown: false
93-
94- property bool firstShow: true
95- property bool hidingComplete: true
96-
97- property string layoutId: "freetext"
98-
99- onXChanged: fullScreenItem.reportKeyboardVisibleRect();
100- onYChanged: fullScreenItem.reportKeyboardVisibleRect();
101- onWidthChanged: fullScreenItem.reportKeyboardVisibleRect();
102- onHeightChanged: fullScreenItem.reportKeyboardVisibleRect();
103-
104- MouseArea {
105- id: swipeArea
106-
107- property int jumpBackThreshold: units.gu(10)
108-
109- anchors.left: parent.left
110- anchors.right: parent.right
111- anchors.top: parent.top
112- height: (parent.height - canvas.keypadHeight) + wordRibbon.height +
113- borderTop.height + units.gu(UI.top_margin)
114-
115- drag.target: keyboardSurface
116- drag.axis: Drag.YAxis;
117- drag.minimumY: 0
118- drag.maximumY: parent.height
119- //fix for lp:1277186
120- //only filter children when wordRibbon visible
121- drag.filterChildren: wordRibbon.visible
122- // Avoid conflict with extended key swipe selection
123- enabled: !canvas.extendedKeysShown
124-
125- onReleased: {
126- if (keyboardSurface.y > jumpBackThreshold) {
127- maliit_geometry.shown = false;
128- } else {
129- bounceBackAnimation.from = keyboardSurface.y
130- bounceBackAnimation.start();
131- }
132+ anchors.right: parent.right
133+ anchors.top: parent.top
134+ height: (parent.height - canvas.keypadHeight) + wordRibbon.height +
135+ borderTop.height + units.gu(UI.top_margin)
136+
137+ drag.target: keyboardSurface
138+ drag.axis: Drag.YAxis;
139+ drag.minimumY: 0
140+ drag.maximumY: parent.height
141+ //fix for lp:1277186
142+ //only filter children when wordRibbon visible
143+ drag.filterChildren: wordRibbon.visible
144+ // Avoid conflict with extended key swipe selection
145+ enabled: !canvas.extendedKeysShown
146+
147+ onReleased: {
148+ if (keyboardSurface.y > jumpBackThreshold) {
149+ maliit_geometry.shown = false;
150+ } else {
151+ bounceBackAnimation.from = keyboardSurface.y
152+ bounceBackAnimation.start();
153+ }
154+ }
155+
156+ Item {
157+ id: keyboardSurface
158+ objectName: "keyboardSurface"
159+
160+ x:0
161+ y:0
162+ width: parent.width
163+ height: canvas.height
164+
165+ onXChanged: fullScreenItem.reportKeyboardVisibleRect();
166+ onYChanged: fullScreenItem.reportKeyboardVisibleRect();
167+ onWidthChanged: fullScreenItem.reportKeyboardVisibleRect();
168+ onHeightChanged: fullScreenItem.reportKeyboardVisibleRect();
169+
170+ WordRibbon {
171+ id: wordRibbon
172+ objectName: "wordRibbon"
173+
174+ visible: canvas.wordribbon_visible
175+
176+ anchors.bottom: keyboardComp.top
177+ width: parent.width;
178+
179+ height: canvas.wordribbon_visible ? units.gu(UI.wordribbonHeight) : 0
180+ onHeightChanged: fullScreenItem.reportKeyboardVisibleRect();
181 }
182
183 Item {
184- id: keyboardSurface
185- objectName: "keyboardSurface"
186+ id: keyboardComp
187+ objectName: "keyboardComp"
188
189- x:0
190- y:0
191+ height: canvas.keypadHeight - wordRibbon.height
192 width: parent.width
193- height: canvas.height
194+ anchors.bottom: parent.bottom
195
196- onXChanged: fullScreenItem.reportKeyboardVisibleRect();
197- onYChanged: fullScreenItem.reportKeyboardVisibleRect();
198- onWidthChanged: fullScreenItem.reportKeyboardVisibleRect();
199 onHeightChanged: fullScreenItem.reportKeyboardVisibleRect();
200
201- WordRibbon {
202- id: wordRibbon
203- objectName: "wordRibbon"
204-
205- visible: canvas.wordribbon_visible
206-
207- anchors.bottom: keyboardComp.top
208- width: parent.width;
209-
210- height: canvas.wordribbon_visible ? units.gu(UI.wordribbonHeight) : 0
211- onHeightChanged: calculateSize();
212- }
213-
214- Item {
215- id: keyboardComp
216- objectName: "keyboardComp"
217-
218- height: canvas.keypadHeight - wordRibbon.height
219- width: parent.width
220- anchors.bottom: parent.bottom
221-
222- onHeightChanged: fullScreenItem.reportKeyboardVisibleRect();
223-
224- Rectangle {
225- id: background
226-
227- anchors.fill: parent
228-
229- color: UI.backgroundColor
230- }
231-
232- Image {
233- id: borderTop
234- source: "styles/ubuntu/images/border_top.png"
235- width: parent.width
236- anchors.top: parent.top.bottom
237- }
238-
239- KeyboardContainer {
240- id: keypad
241-
242- anchors.top: borderTop.bottom
243- anchors.bottom: background.bottom
244- anchors.topMargin: units.gu( UI.top_margin )
245- anchors.bottomMargin: units.gu( UI.bottom_margin )
246- width: parent.width
247-
248- onPopoverEnabledChanged: fullScreenItem.reportKeyboardVisibleRect();
249- }
250-
251- LanguageMenu {
252- id: languageMenu
253- objectName: "languageMenu"
254- anchors.centerIn: parent
255- height: contentHeight > keypad.height ? keypad.height : contentHeight
256- width: units.gu(30);
257- enabled: canvas.languageMenuShown
258- visible: canvas.languageMenuShown
259- }
260- } // keyboardComp
261- }
262- }
263-
264- PropertyAnimation {
265- id: bounceBackAnimation
266- target: keyboardSurface
267- properties: "y"
268- easing.type: Easing.OutBounce;
269- easing.overshoot: 2.0
270- to: 0
271- }
272-
273- state: "HIDDEN"
274-
275- states: [
276- State {
277- name: "SHOWN"
278- PropertyChanges { target: keyboardSurface; y: 0; }
279- onCompleted: {
280- canvas.firstShow = false;
281- canvas.hidingComplete = false;
282- }
283- when: maliit_geometry.shown === true
284- },
285-
286- State {
287- name: "HIDDEN"
288- PropertyChanges { target: keyboardSurface; y: canvas.height }
289- onCompleted: {
290- canvas.languageMenuShown = false;
291- keypad.closeExtendedKeys();
292- keypad.activeKeypadState = "NORMAL";
293- keypad.state = "CHARACTERS";
294- maliit_input_method.close();
295- canvas.hidingComplete = true;
296- reportKeyboardVisibleRect();
297- }
298- // Wait for the first show operation to complete before
299- // allowing hiding, as the conditions when the keyboard
300- // has never been visible can trigger a hide operation
301- when: maliit_geometry.shown === false && canvas.firstShow === false
302- }
303- ]
304- transitions: Transition {
305- UbuntuNumberAnimation { target: keyboardSurface; properties: "y"; }
306- }
307-
308- Connections {
309- target: input_method
310- onActivateAutocaps: {
311- if (keypad.state == "CHARACTERS") {
312- keypad.activeKeypadState = "SHIFTED";
313- keypad.autoCapsTriggered = true;
314- } else {
315- keypad.delayedAutoCaps = true;
316- }
317- }
318-
319- onActiveLanguageChanged: {
320- keypad.justChangedLanguage = true
321- }
322- onKeyboardReset: {
323- keypad.state = "CHARACTERS"
324- if (keypad.switchBack && maliit_input_method.previousLanguage && !keypad.justChangedLanguage) {
325- keypad.switchBack = false;
326- maliit_input_method.activeLanguage = maliit_input_method.previousLanguage;
327- }
328- keypad.justChangedLanguage = false;
329- }
330- onDeactivateAutocaps: {
331- if(keypad.autoCapsTriggered) {
332- keypad.activeKeypadState = "NORMAL";
333- keypad.autoCapsTriggered = false;
334- }
335- keypad.delayedAutoCaps = false;
336- }
337- }
338-
339- } // canvas
340- } // OrientationHelper
341-
342- function calculateSize() {
343- // TODO tablet
344- if (orientationHelper.orientationAngle == 270 ||
345- orientationHelper.orientationAngle == 90) {
346- canvas.height = (fullScreenItem.width * UI.phoneKeyboardHeightLandscape) + wordRibbon.height
347- } else if (orientationHelper.orientationAngle == 0 ||
348- orientationHelper.orientationAngle == 180) {
349- canvas.height = (fullScreenItem.height * UI.phoneKeyboardHeightPortrait) + wordRibbon.height
350- } else { // fallback
351- canvas.height = (fullScreenItem.height * UI.phoneKeyboardHeightPortrait) + wordRibbon.height
352- }
353-
354- reportKeyboardVisibleRect();
355- }
356+ Rectangle {
357+ id: background
358+
359+ anchors.fill: parent
360+
361+ color: UI.backgroundColor
362+ }
363+
364+ Image {
365+ id: borderTop
366+ source: "styles/ubuntu/images/border_top.png"
367+ width: parent.width
368+ anchors.top: parent.top.bottom
369+ }
370+
371+ KeyboardContainer {
372+ id: keypad
373+
374+ anchors.top: borderTop.bottom
375+ anchors.bottom: background.bottom
376+ anchors.topMargin: units.gu( UI.top_margin )
377+ anchors.bottomMargin: units.gu( UI.bottom_margin )
378+ width: parent.width
379+
380+ onPopoverEnabledChanged: fullScreenItem.reportKeyboardVisibleRect();
381+ }
382+
383+ LanguageMenu {
384+ id: languageMenu
385+ objectName: "languageMenu"
386+ anchors.centerIn: parent
387+ height: contentHeight > keypad.height ? keypad.height : contentHeight
388+ width: units.gu(30);
389+ enabled: canvas.languageMenuShown
390+ visible: canvas.languageMenuShown
391+ }
392+ } // keyboardComp
393+ }
394+ }
395+
396+ PropertyAnimation {
397+ id: bounceBackAnimation
398+ target: keyboardSurface
399+ properties: "y"
400+ easing.type: Easing.OutBounce;
401+ easing.overshoot: 2.0
402+ to: 0
403+ }
404+
405+ state: "HIDDEN"
406+
407+ states: [
408+ State {
409+ name: "SHOWN"
410+ PropertyChanges { target: keyboardSurface; y: 0; }
411+ onCompleted: {
412+ canvas.firstShow = false;
413+ canvas.hidingComplete = false;
414+ }
415+ when: maliit_geometry.shown === true
416+ },
417+
418+ State {
419+ name: "HIDDEN"
420+ PropertyChanges { target: keyboardSurface; y: canvas.height }
421+ onCompleted: {
422+ canvas.languageMenuShown = false;
423+ keypad.closeExtendedKeys();
424+ keypad.activeKeypadState = "NORMAL";
425+ keypad.state = "CHARACTERS";
426+ maliit_input_method.close();
427+ canvas.hidingComplete = true;
428+ reportKeyboardVisibleRect();
429+ }
430+ // Wait for the first show operation to complete before
431+ // allowing hiding, as the conditions when the keyboard
432+ // has never been visible can trigger a hide operation
433+ when: maliit_geometry.shown === false && canvas.firstShow === false
434+ }
435+ ]
436+ transitions: Transition {
437+ UbuntuNumberAnimation { target: keyboardSurface; properties: "y"; }
438+ }
439+
440+ Connections {
441+ target: input_method
442+ onActivateAutocaps: {
443+ if (keypad.state == "CHARACTERS") {
444+ keypad.activeKeypadState = "SHIFTED";
445+ keypad.autoCapsTriggered = true;
446+ } else {
447+ keypad.delayedAutoCaps = true;
448+ }
449+ }
450+
451+ onActiveLanguageChanged: {
452+ keypad.justChangedLanguage = true
453+ }
454+ onKeyboardReset: {
455+ keypad.state = "CHARACTERS"
456+ if (keypad.switchBack && maliit_input_method.previousLanguage && !keypad.justChangedLanguage) {
457+ keypad.switchBack = false;
458+ maliit_input_method.activeLanguage = maliit_input_method.previousLanguage;
459+ }
460+ keypad.justChangedLanguage = false;
461+ }
462+ onDeactivateAutocaps: {
463+ if(keypad.autoCapsTriggered) {
464+ keypad.activeKeypadState = "NORMAL";
465+ keypad.autoCapsTriggered = false;
466+ }
467+ keypad.delayedAutoCaps = false;
468+ }
469+ }
470+
471+ } // canvas
472
473 function reportKeyboardVisibleRect() {
474
475
476=== modified file 'qml/keys/ActionKey.qml'
477--- qml/keys/ActionKey.qml 2014-09-16 12:39:01 +0000
478+++ qml/keys/ActionKey.qml 2015-02-28 07:01:52 +0000
479@@ -55,7 +55,7 @@
480 name: actionKeyRoot.iconNormal
481 color: actionKeyRoot.colorNormal
482 anchors.centerIn: parent
483- anchors.verticalCenterOffset: orientationHelper.orientationAngle == 0 || orientationHelper.orientationAngle == 180 ? -units.gu(UI.row_margin/2) - units.gu(0.15) : -units.dp( UI.keyMargins )
484+ anchors.verticalCenterOffset: fullScreenItem.landscape ? -units.dp( UI.keyMargins ) : -units.gu(UI.row_margin/2) - units.gu(0.15)
485
486 visible: (label == "")
487 width: units.gu(2.5)
488
489=== modified file 'qml/keys/CharKey.qml'
490--- qml/keys/CharKey.qml 2015-02-13 20:14:07 +0000
491+++ qml/keys/CharKey.qml 2015-02-28 07:01:52 +0000
492@@ -119,7 +119,7 @@
493 anchors.fill: parent
494 anchors.leftMargin: key.leftSide ? (parent.width - panel.keyWidth) + units.dp(UI.keyMargins) : units.dp(UI.keyMargins)
495 anchors.rightMargin: key.rightSide ? (parent.width - panel.keyWidth) + units.dp(UI.keyMargins) : units.dp(UI.keyMargins)
496- anchors.bottomMargin: orientationHelper.orientationAngle == 0 || orientationHelper.orientationAngle == 180 ? units.gu(UI.row_margin) : units.dp( UI.keyMargins ) * 2;
497+ anchors.bottomMargin: fullScreenItem.landscape ? units.dp( UI.keyMargins ) * 2 : units.gu(UI.row_margin);
498 source: key.imgNormal
499
500 BorderImage {
501
502=== modified file 'src/plugin/inputmethod.cpp'
503--- src/plugin/inputmethod.cpp 2015-02-09 21:14:15 +0000
504+++ src/plugin/inputmethod.cpp 2015-02-28 07:01:52 +0000
505@@ -599,10 +599,7 @@
506 {
507 Q_D(InputMethod);
508
509- QRect visibleRect = qGuiApp->primaryScreen()->mapBetween(
510- d->m_geometry->orientation(),
511- qGuiApp->primaryScreen()->primaryOrientation(),
512- d->m_geometry->visibleRect().toRect());
513+ QRect visibleRect = d->m_geometry->visibleRect().toRect();
514
515 inputMethodHost()->setScreenRegion(QRegion(visibleRect));
516 inputMethodHost()->setInputMethodArea(visibleRect, d->view);

Subscribers

People subscribed via source and target branches