Merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-content-orientation into lp:phablet-extras/maliit-plugins

Proposed by Thomas Moenicke
Status: Merged
Approved by: Thomas Moenicke
Approved revision: 2138
Merged at revision: 2136
Proposed branch: lp:~thomas-moenicke/phablet-extras/maliit-plugins-content-orientation
Merge into: lp:phablet-extras/maliit-plugins
Diff against target: 458 lines (+154/-71)
8 files modified
maliit-keyboard/lib/logic/dynamiclayout.cpp (+57/-35)
maliit-keyboard/lib/logic/dynamiclayout.h (+1/-0)
maliit-keyboard/lib/logic/dynamiclayout_p.h (+37/-1)
maliit-keyboard/lib/logic/keyareaconverter.cpp (+1/-1)
maliit-keyboard/plugin/inputmethod.cpp (+46/-27)
maliit-keyboard/plugin/inputmethod.h (+3/-0)
maliit-keyboard/qml/Keyboard.qml (+2/-0)
maliit-keyboard/qml/RotationHelper.qml (+7/-7)
To merge this branch: bzr merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-content-orientation
Reviewer Review Type Date Requested Status
Thomas Moenicke (community) Approve
Günter Schwann (community) Approve
PS Jenkins bot continuous-integration Approve
Bill Filler (community) Needs Fixing
Review via email: mp+176737@code.launchpad.net

Commit message

switched to content-orientation changes for orientation handling. For testing

Description of the change

switched to content-orientation changes for orientation handling.

For testing

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

translating maliit angle to Qt::ScreenOrientation

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

forwaring contentOrientation to the rotationHelper QML Item

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 :

it requires the patch from Florian. I have tested with a test app and phone-app, where it rotates. In the shell, apps -> search lens it does not rotate, because it does not support rotation.

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

Doesn't work for me. The keyboard never rotates. I'm using the latest maliit-framework that is now in archive:
maliit-framework 0.99.0+git20130615+97e8335-0ubuntu2
libmaliit-plugins0 0.99.0+git20130615+97e8335-0ubuntu2

Using this deb. And using Florian's patch + the changes you proposed to it Thomas. I made an MR for that and installed the deb from here:
https://code.launchpad.net/~bfiller/ubuntu-ui-toolkit/ubuntu-sdk-report-content-orientation/+merge/177048

The behavior I see is keyboard never rotate.

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

tested with browser and notes and keyboard doesn't rotate when the apps rotate

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

The app guys probably need to use or adapt to the API. If they use the component from Florian, a MainWindow() without doing any magic, it should work.
I have tested it with the phone-app and a test app where it works. I have noticed it does not work for the browser, so we need to ping Olivier about this.

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

I fixed it for the Webbrowser. Unfort. I get an error from LP when doing a MR:
https://code.launchpad.net/~thomas-moenicke/phablet-extras/webbrowser-app-content-orientation

What happens here is the following: the property contentOrientation is a property of QWindow and can be set as shown in this QML example:

Window {
  contentOrientation: like Screen.orientation
}

The browser app has such a component instantiated. Not all apps do, that's where Florian's patch comes in: it exposes the window to QML space so people can set the property even if they don't have a Window {}. The OrientationHelper does that automatically.
If a Window {} is present, it should be set there to make it work.

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

Couple of remaining issues:
1) remove all the temp ifdefs from the code
2) A bigger issue is that with all the MR's from above installed I'm seeing the keyboard not repainted/layout properly after rotating back and forth. The buttons are the wrong size and don't fit correctly on the screen. Please ensure to do a complete relayout/resize after getting the rotation event.

review: Needs Fixing
2137. By Thomas Moenicke

merge against master branch

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

- fixed issue when rotating: sometimes the layout seemed to be calculated in a wrong way. This happened because osk
got the signal contentOrientationChanged(), but parts of the calculating code used the API of the primary screen do determine the current orientation.
This was not in sync with contentOrientation and lead to calculating keysizes/margins for portrait mode instead of landscape mode.
- caching values of calculations
- removed TEMP_DISABLED code

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
Günter Schwann (schwann) wrote :

Seems to work fine

Revision history for this message
Günter Schwann (schwann) wrote :

code looks good as well

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

succ. tested on 20130731 with this package and webbrowser package from the MR mentioned above
Notes-App does rotate as expected, Webbrowser does rotate as expected, shell does not rotate as expected

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'maliit-keyboard/lib/logic/dynamiclayout.cpp'
--- maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-06-17 10:53:15 +0000
+++ maliit-keyboard/lib/logic/dynamiclayout.cpp 2013-07-30 16:18:26 +0000
@@ -36,30 +36,37 @@
36QVector<int> DynamicLayout::calculateMargins(LayoutHelper::Orientation orientation,36QVector<int> DynamicLayout::calculateMargins(LayoutHelper::Orientation orientation,
37 Keyboard& kb)37 Keyboard& kb)
38{38{
39 const qreal keyboardWidth = uiConst->windowGeometryRect(qGuiApp->primaryScreen()->orientation()).size().width();39 if (d->marginsCachedOrientation != orientation)
4040 d->invalidateMarginsCache();
41 QVector<int> margins;41
4242 if (!d->marginsCacheValid) {
43 int spaceTakenByKeys = 0;43 const qreal keyboardWidth = windowWidth(orientation);
44 int numberOfKeysInRow = 0;44
45 for (int index = 0; index < kb.keys.count(); ++index) {45 QVector<int> margins;
46 const KeyDescription &desc(kb.key_descriptions.at(index));46 int spaceTakenByKeys = 0;
47 int width = uiConst->keyWidth(orientation, desc.width);47 int numberOfKeysInRow = 0;
48 spaceTakenByKeys += width;48 for (int index = 0; index < kb.keys.count(); ++index) {
49 numberOfKeysInRow++;49 const KeyDescription &desc(kb.key_descriptions.at(index));
5050 int width = uiConst->keyWidth(orientation, desc.width);
51 bool at_row_end((index + 1 == kb.keys.count())51 spaceTakenByKeys += width;
52 || (index + 1 < kb.keys.count()52 numberOfKeysInRow++;
53 && kb.key_descriptions.at(index + 1).row > desc.row));53
5454 bool at_row_end((index + 1 == kb.keys.count())
55 if (at_row_end) {55 || (index + 1 < kb.keys.count()
56 int marginThisRow = ( (keyboardWidth - spaceTakenByKeys) / (numberOfKeysInRow-1) ) / 2;56 && kb.key_descriptions.at(index + 1).row > desc.row));
57 margins.append(marginThisRow);57
58 spaceTakenByKeys = 0;58 if (at_row_end) {
59 int marginThisRow = ( (keyboardWidth - spaceTakenByKeys) / (numberOfKeysInRow-1) ) / 2;
60 d->marginsCached.append(marginThisRow);
61 spaceTakenByKeys = 0;
62 }
59 }63 }
64
65 d->marginsCachedOrientation = orientation;
66 d->marginsCacheValid = true;
60 }67 }
6168
62 return margins;69 return d->marginsCached;
63}70}
6471
65void DynamicLayout::calculateNumberOfRows(Keyboard& kb)72void DynamicLayout::calculateNumberOfRows(Keyboard& kb)
@@ -90,27 +97,39 @@
90 d->initDynamicLayout();97 d->initDynamicLayout();
91}98}
9299
100int DynamicLayout::windowWidth(LayoutHelper::Orientation orientation)
101{
102 return d->storage(orientation)->windowGeometryRect.width();
103}
104
93QRect DynamicLayout::windowGeometryRect(Qt::ScreenOrientation orientation)105QRect DynamicLayout::windowGeometryRect(Qt::ScreenOrientation orientation)
94{106{
95 LayoutHelper::Orientation maliitOrientation = LayoutHelper::Landscape;107 if (orientation != d->cachedOrientation)
96108 d->invalidateWindowGeometryCache();
97 if (orientation == Qt::PortraitOrientation || orientation == Qt::InvertedPortraitOrientation)109
110 if ( !d->windowGeometryCacheValid ) {
111 LayoutHelper::Orientation maliitOrientation = LayoutHelper::Landscape;
112
113 if (orientation == Qt::PortraitOrientation || orientation == Qt::InvertedPortraitOrientation)
98 maliitOrientation = LayoutHelper::Portrait;114 maliitOrientation = LayoutHelper::Portrait;
99115
100 if (orientation == Qt::InvertedLandscapeOrientation || orientation == Qt::InvertedPortraitOrientation) {116 if (orientation == Qt::InvertedLandscapeOrientation || orientation == Qt::InvertedPortraitOrientation) {
101 if (!d->wordRibbonEnabled) {117 if (!d->wordRibbonEnabled) {
102 return d->storage(maliitOrientation)->windowGeometryRectInverted118 return d->writeCache( orientation, d->storage(maliitOrientation)->windowGeometryRectInverted
103 .adjusted (0, wordRibbonHeight(maliitOrientation), 0, 0)119 .adjusted (0, wordRibbonHeight(maliitOrientation), 0, 0)
104 .translated(0,-wordRibbonHeight(maliitOrientation));120 .translated(0,-wordRibbonHeight(maliitOrientation)) );
105 } else {121 } else {
106 return d->storage(maliitOrientation)->windowGeometryRectInverted;122 return d->writeCache( orientation, d->storage(maliitOrientation)->windowGeometryRectInverted );
123 }
107 }124 }
125
126 if (!d->wordRibbonEnabled)
127 return d->writeCache( orientation, d->storage(maliitOrientation)->windowGeometryRect.adjusted(0, d->storage(maliitOrientation)->wordRibbonHeight, 0, 0) );
128
129 return d->writeCache( orientation, d->storage(maliitOrientation)->windowGeometryRect );
108 }130 }
109131
110 if (!d->wordRibbonEnabled)132 return d->windowGeometryRectCached;
111 return d->storage(maliitOrientation)->windowGeometryRect.adjusted(0, d->storage(maliitOrientation)->wordRibbonHeight, 0, 0);
112
113 return d->storage(maliitOrientation)->windowGeometryRect;
114}133}
115134
116qreal DynamicLayout::keyWidth(LayoutHelper::Orientation orientation, KeyDescription::Width requestedSize)135qreal DynamicLayout::keyWidth(LayoutHelper::Orientation orientation, KeyDescription::Width requestedSize)
@@ -285,7 +304,10 @@
285304
286void DynamicLayout::onWordEngineSettingsChanged(bool wordEngineEnabled)305void DynamicLayout::onWordEngineSettingsChanged(bool wordEngineEnabled)
287{306{
288 d->wordRibbonEnabled = wordEngineEnabled;307 if (d->wordRibbonEnabled != wordEngineEnabled) {
308 d->wordRibbonEnabled = wordEngineEnabled;
309 d->invalidateWindowGeometryCache();
310 }
289}311}
290312
291}} // namespaces313}} // namespaces
292314
=== modified file 'maliit-keyboard/lib/logic/dynamiclayout.h'
--- maliit-keyboard/lib/logic/dynamiclayout.h 2013-06-17 10:53:15 +0000
+++ maliit-keyboard/lib/logic/dynamiclayout.h 2013-07-30 16:18:26 +0000
@@ -51,6 +51,7 @@
51 void initDynamicLayout();51 void initDynamicLayout();
5252
53 int keypadHeight(LayoutHelper::Orientation orientation);53 int keypadHeight(LayoutHelper::Orientation orientation);
54 int windowWidth(LayoutHelper::Orientation orientation);
54 QRect windowGeometryRect(Qt::ScreenOrientation orientation);55 QRect windowGeometryRect(Qt::ScreenOrientation orientation);
55 qreal keyboardScreenWidthRatio(LayoutHelper::Orientation orientation);56 qreal keyboardScreenWidthRatio(LayoutHelper::Orientation orientation);
5657
5758
=== modified file 'maliit-keyboard/lib/logic/dynamiclayout_p.h'
--- maliit-keyboard/lib/logic/dynamiclayout_p.h 2013-07-04 10:57:47 +0000
+++ maliit-keyboard/lib/logic/dynamiclayout_p.h 2013-07-30 16:18:26 +0000
@@ -1,5 +1,7 @@
11
2//#include "dynamiclayout.h"2#include <QtCore>
3
4#include "layouthelper.h"
35
4namespace MaliitKeyboard {6namespace MaliitKeyboard {
5namespace Logic {7namespace Logic {
@@ -97,6 +99,15 @@
97 bool initialized;99 bool initialized;
98 bool wordRibbonEnabled;100 bool wordRibbonEnabled;
99101
102 // short term-caching in memory
103 Qt::ScreenOrientation cachedOrientation;
104 bool windowGeometryCacheValid;
105 QRect windowGeometryRectCached;
106
107 LayoutHelper::Orientation marginsCachedOrientation;
108 bool marginsCacheValid;
109 QVector<int> marginsCached;
110
100 DynamicLayoutStorage* portraitStorage;111 DynamicLayoutStorage* portraitStorage;
101 DynamicLayoutStorage* landscapeStorage;112 DynamicLayoutStorage* landscapeStorage;
102 DynamicLayoutStorage* genericStorage;113 DynamicLayoutStorage* genericStorage;
@@ -105,6 +116,15 @@
105 q(_q),116 q(_q),
106 initialized(false),117 initialized(false),
107 wordRibbonEnabled(false),118 wordRibbonEnabled(false),
119
120 cachedOrientation(Qt::PortraitOrientation),
121 windowGeometryCacheValid(false),
122 windowGeometryRectCached(QRect(0,0,0,0)),
123
124 marginsCachedOrientation(LayoutHelper::Portrait),
125 marginsCacheValid(false),
126 marginsCached(0),
127
108 portraitStorage(new DynamicLayoutStorage),128 portraitStorage(new DynamicLayoutStorage),
109 landscapeStorage(new DynamicLayoutStorage),129 landscapeStorage(new DynamicLayoutStorage),
110 genericStorage(new DynamicLayoutStorage)130 genericStorage(new DynamicLayoutStorage)
@@ -279,6 +299,22 @@
279 qDebug() << "portrait inverted " << rInvertedPortrait << portraitStorage->windowGeometryRectInverted;299 qDebug() << "portrait inverted " << rInvertedPortrait << portraitStorage->windowGeometryRectInverted;
280 }300 }
281 }301 }
302
303 const QRect& writeCache( Qt::ScreenOrientation orientation, const QRect& cachedRect ) {
304 windowGeometryCacheValid = true;
305 cachedOrientation = orientation;
306 windowGeometryRectCached = cachedRect;
307 return windowGeometryRectCached;
308 }
309
310 void invalidateWindowGeometryCache() {
311 windowGeometryCacheValid = false;
312 }
313
314 void invalidateMarginsCache() {
315 marginsCacheValid = false;
316 marginsCached.clear();
317 }
282};318};
283319
284}320}
285321
=== modified file 'maliit-keyboard/lib/logic/keyareaconverter.cpp'
--- maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-07-19 11:31:55 +0000
+++ maliit-keyboard/lib/logic/keyareaconverter.cpp 2013-07-30 16:18:26 +0000
@@ -86,7 +86,7 @@
8686
87 static const QMargins bg_margins( uiConst->keyAreaBorders() );87 static const QMargins bg_margins( uiConst->keyAreaBorders() );
8888
89 const qreal max_width( uiConst->windowGeometryRect(qGuiApp->primaryScreen()->orientation()).width() );89 const qreal max_width( uiConst->windowWidth(orientation) );
90 const qreal key_height(uiConst->keyHeight(orientation));90 const qreal key_height(uiConst->keyHeight(orientation));
91 const qreal keypadHeight = uiConst->keypadHeight(orientation);91 const qreal keypadHeight = uiConst->keypadHeight(orientation);
9292
9393
=== modified file 'maliit-keyboard/plugin/inputmethod.cpp'
--- maliit-keyboard/plugin/inputmethod.cpp 2013-07-29 14:12:09 +0000
+++ maliit-keyboard/plugin/inputmethod.cpp 2013-07-30 16:18:26 +0000
@@ -172,7 +172,7 @@
172172
173 explicit InputMethodPrivate(InputMethod * const q,173 explicit InputMethodPrivate(InputMethod * const q,
174 MAbstractInputMethodHost *host);174 MAbstractInputMethodHost *host);
175 void setLayoutOrientation(Logic::LayoutHelper::Orientation orientation);175 void setLayoutOrientation(Qt::ScreenOrientation qtOrientation);
176 void updateKeyboardOrientation();176 void updateKeyboardOrientation();
177 void updateWordRibbon();177 void updateWordRibbon();
178178
@@ -190,6 +190,7 @@
190 , extended_surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_extended_surface_options, surface)))190 , extended_surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_extended_surface_options, surface)))
191 , magnifier_surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_extended_surface_options, surface)))191 , magnifier_surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_extended_surface_options, surface)))
192#endif192#endif
193 , qmlRootItem(0)
193 , editor(EditorOptions(), new Model::Text, new Logic::WordEngine, new Logic::LanguageFeatures)194 , editor(EditorOptions(), new Model::Text, new Logic::WordEngine, new Logic::LanguageFeatures)
194 , feedback()195 , feedback()
195 , style(new Style)196 , style(new Style)
@@ -263,7 +264,8 @@
263 engine->addImportPath(MALIIT_KEYBOARD_DATA_DIR);264 engine->addImportPath(MALIIT_KEYBOARD_DATA_DIR);
264 setContextProperties(engine->rootContext());265 setContextProperties(engine->rootContext());
265266
266 view->setSource(QUrl::fromLocalFile(g_maliit_keyboard_qml));267 QObject::connect(view, SIGNAL(statusChanged(QQuickView::Status)),
268 q, SLOT(onQQuickViewStatusChanged(QQuickView::Status)));
267269
268#ifdef EXTENDED_SURFACE_TEMP_DISABLED270#ifdef EXTENDED_SURFACE_TEMP_DISABLED
269 QQmlEngine *const extended_engine(extended_surface->view()->engine());271 QQmlEngine *const extended_engine(extended_surface->view()->engine());
@@ -280,22 +282,6 @@
280#endif282#endif
281 view->setProperty("role", 7);283 view->setProperty("role", 7);
282284
283 qmlRootItem = view->rootObject();
284
285 QObject::connect(
286 qmlRootItem,
287 SIGNAL(hideAnimationFinishedChanged()),
288 q,
289 SLOT(onHideAnimationFinished()));
290
291 // workaround: contentOrientationChanged signal not fired by app/sdk
292 // http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop
293 // this is normally handled by qmallitplatforminputcontextplugin in QtBase plugins
294 QObject::connect(view->screen(),
295 SIGNAL(orientationChanged(Qt::ScreenOrientation)),
296 q,
297 SLOT(deviceOrientationChanged(Qt::ScreenOrientation)));
298
299 // workaround: resizeMode not working in current qpa imlementation285 // workaround: resizeMode not working in current qpa imlementation
300 // http://qt-project.org/doc/qt-5.0/qtquick/qquickview.html#ResizeMode-enum286 // http://qt-project.org/doc/qt-5.0/qtquick/qquickview.html#ResizeMode-enum
301 view->setResizeMode(QQuickView::SizeRootObjectToView);287 view->setResizeMode(QQuickView::SizeRootObjectToView);
@@ -310,18 +296,20 @@
310 updateKeyboardOrientation();296 updateKeyboardOrientation();
311}297}
312298
313void InputMethodPrivate::setLayoutOrientation(Logic::LayoutHelper::Orientation orientation)299void InputMethodPrivate::setLayoutOrientation(Qt::ScreenOrientation screenOrientation)
314{300{
301 Logic::LayoutHelper::Orientation orientation = uiConst->screenToMaliitOrientation(screenOrientation);
302
315 layout.updater.setOrientation(orientation);303 layout.updater.setOrientation(orientation);
316 extended_layout.updater.setOrientation(orientation);304 extended_layout.updater.setOrientation(orientation);
317305
318 windowGeometryRect = uiConst->windowGeometryRect(view->screen()->orientation());306 windowGeometryRect = uiConst->windowGeometryRect( screenOrientation );
319307
320 keyboardVisibleRect = windowGeometryRect.adjusted(0,uiConst->invisibleTouchAreaHeight(orientation),0,0);308 keyboardVisibleRect = windowGeometryRect.adjusted(0,uiConst->invisibleTouchAreaHeight(orientation),0,0);
321309
322 // qpa does not rotate the coordinate system310 // qpa does not rotate the coordinate system
323 windowGeometryRect = qGuiApp->primaryScreen()->mapBetween(311 windowGeometryRect = qGuiApp->primaryScreen()->mapBetween(
324 view->screen()->orientation(),312 screenOrientation,
325 qGuiApp->primaryScreen()->primaryOrientation(),313 qGuiApp->primaryScreen()->primaryOrientation(),
326 windowGeometryRect);314 windowGeometryRect);
327315
@@ -336,6 +324,8 @@
336 host->setInputMethodArea(rect, view);324 host->setInputMethodArea(rect, view);
337 }325 }
338326
327 qmlRootItem->setProperty("contentOrientation", screenOrientation);
328
339#ifdef HAVE_UBUNTU_PLATFORM_API329#ifdef HAVE_UBUNTU_PLATFORM_API
340 if (qmlRootItem->property("shown").toBool()) {330 if (qmlRootItem->property("shown").toBool()) {
341 ubuntu_ui_report_osk_invisible();331 ubuntu_ui_report_osk_invisible();
@@ -366,7 +356,7 @@
366356
367void InputMethodPrivate::updateKeyboardOrientation()357void InputMethodPrivate::updateKeyboardOrientation()
368{358{
369 setLayoutOrientation(uiConst->screenToMaliitOrientation(QGuiApplication::primaryScreen()->orientation()));359 setLayoutOrientation(QGuiApplication::primaryScreen()->orientation());
370}360}
371361
372void InputMethodPrivate::connectToNotifier()362void InputMethodPrivate::connectToNotifier()
@@ -396,6 +386,8 @@
396{386{
397 Q_D(InputMethod);387 Q_D(InputMethod);
398388
389 d->view->setSource(QUrl::fromLocalFile(g_maliit_keyboard_qml));
390
399 // FIXME: Reconnect feedback instance.391 // FIXME: Reconnect feedback instance.
400 Setup::connectAll(&d->layout.event_handler, &d->layout.updater, &d->editor);392 Setup::connectAll(&d->layout.event_handler, &d->layout.updater, &d->editor);
401 Setup::connectAll(&d->extended_layout.event_handler, &d->extended_layout.updater, &d->editor);393 Setup::connectAll(&d->extended_layout.event_handler, &d->extended_layout.updater, &d->editor);
@@ -585,12 +577,22 @@
585577
586void InputMethod::handleAppOrientationChanged(int angle)578void InputMethod::handleAppOrientationChanged(int angle)
587{579{
588 Q_UNUSED(angle);
589
590#ifdef DISABLED_AS_CONTENT_ORIENTATION_NOT_WORKING
591 Q_D(InputMethod);580 Q_D(InputMethod);
592 d->updateKeyboardOrientation();581
593#endif582 Qt::ScreenOrientation orientation = Qt::PortraitOrientation;
583 switch (angle) {
584 case 0:
585 orientation = Qt::LandscapeOrientation; break;
586 case 90:
587 orientation = Qt::InvertedPortraitOrientation; break;
588 case 180:
589 orientation = Qt::InvertedLandscapeOrientation; break;
590 case 270:
591 default:
592 orientation = Qt::PortraitOrientation; break;
593 }
594
595 d->setLayoutOrientation(orientation);
594}596}
595597
596bool InputMethod::imExtensionEvent(MImExtensionEvent *event)598bool InputMethod::imExtensionEvent(MImExtensionEvent *event)
@@ -738,7 +740,9 @@
738 d->layout.helper.setScreenSize(size);740 d->layout.helper.setScreenSize(size);
739 d->extended_layout.helper.setScreenSize(d->layout.helper.screenSize());741 d->extended_layout.helper.setScreenSize(d->layout.helper.screenSize());
740742
743#ifdef TEMP_DISABLED
741 d->updateKeyboardOrientation();744 d->updateKeyboardOrientation();
745#endif
742}746}
743747
744void InputMethod::onStyleSettingChanged()748void InputMethod::onStyleSettingChanged()
@@ -927,5 +931,20 @@
927 return d->predictionEnabled;931 return d->predictionEnabled;
928}932}
929933
934void InputMethod::onQQuickViewStatusChanged(QQuickView::Status status)
935{
936 Q_D(InputMethod);
937
938 switch (status) {
939 case QQuickView::Ready:
940 {
941 d->qmlRootItem = qobject_cast<QQuickItem*> (d->view->rootObject());
942 QObject::connect(d->qmlRootItem, SIGNAL(hideAnimationFinishedChanged()), this, SLOT(onHideAnimationFinished()));
943 }
944 break;
945 default:
946 break;
947 }
948}
930949
931} // namespace MaliitKeyboard950} // namespace MaliitKeyboard
932951
=== modified file 'maliit-keyboard/plugin/inputmethod.h'
--- maliit-keyboard/plugin/inputmethod.h 2013-07-29 11:52:26 +0000
+++ maliit-keyboard/plugin/inputmethod.h 2013-07-30 16:18:26 +0000
@@ -35,7 +35,9 @@
35#include <maliit/plugins/abstractinputmethod.h>35#include <maliit/plugins/abstractinputmethod.h>
36#include <maliit/plugins/abstractinputmethodhost.h>36#include <maliit/plugins/abstractinputmethodhost.h>
37#include <maliit/plugins/keyoverride.h>37#include <maliit/plugins/keyoverride.h>
38
38#include <QtGui>39#include <QtGui>
40#include <QtQuick/QQuickView>
3941
40namespace MaliitKeyboard {42namespace MaliitKeyboard {
4143
@@ -75,6 +77,7 @@
75 Q_SLOT void deviceOrientationChanged(Qt::ScreenOrientation orientation);77 Q_SLOT void deviceOrientationChanged(Qt::ScreenOrientation orientation);
7678
77 Q_SLOT void updateWordEngine();79 Q_SLOT void updateWordEngine();
80 Q_SLOT void onQQuickViewStatusChanged(QQuickView::Status status);
7881
79 Q_PROPERTY(bool predictionEnabled READ predictionEnabled NOTIFY predictionEnabledChanged)82 Q_PROPERTY(bool predictionEnabled READ predictionEnabled NOTIFY predictionEnabledChanged)
8083
8184
=== modified file 'maliit-keyboard/qml/Keyboard.qml'
--- maliit-keyboard/qml/Keyboard.qml 2013-07-16 16:22:34 +0000
+++ maliit-keyboard/qml/Keyboard.qml 2013-07-30 16:18:26 +0000
@@ -40,6 +40,8 @@
4040
41 visible: layout.visible41 visible: layout.visible
4242
43 property int contentOrientation: Qt.PrimaryOrientation
44
43 property bool shown: false;45 property bool shown: false;
44 property bool wordribbon_visible: true;46 property bool wordribbon_visible: true;
4547
4648
=== modified file 'maliit-keyboard/qml/RotationHelper.qml'
--- maliit-keyboard/qml/RotationHelper.qml 2013-05-16 17:32:04 +0000
+++ maliit-keyboard/qml/RotationHelper.qml 2013-07-30 16:18:26 +0000
@@ -18,11 +18,11 @@
18import QtQuick.Window 2.018import QtQuick.Window 2.0
1919
20Item {20Item {
21 id: orientationHelper21 id: rotationHelper
2222
23 property string __rotationString: Screen.angleBetween(Screen.primaryOrientation, Screen.orientation).toString();23 property string __rotationString: Screen.angleBetween(Screen.primaryOrientation, contentOrientation).toString();
2424
25 rotation: Screen.angleBetween(Screen.primaryOrientation, Screen.orientation);25 rotation: Screen.angleBetween(Screen.primaryOrientation, contentOrientation);
2626
27 anchors.fill: parent27 anchors.fill: parent
2828
@@ -33,7 +33,7 @@
33 State {33 State {
34 name: "270"34 name: "270"
35 PropertyChanges {35 PropertyChanges {
36 target: orientationHelper36 target: rotationHelper
37 anchors {37 anchors {
38 leftMargin: (parent.width - parent.height) / 238 leftMargin: (parent.width - parent.height) / 2
39 rightMargin: anchors.leftMargin39 rightMargin: anchors.leftMargin
@@ -45,7 +45,7 @@
45 State {45 State {
46 name: "90"46 name: "90"
47 PropertyChanges {47 PropertyChanges {
48 target: orientationHelper48 target: rotationHelper
49 anchors {49 anchors {
50 leftMargin: (parent.width - parent.height) / 250 leftMargin: (parent.width - parent.height) / 2
51 rightMargin: anchors.leftMargin51 rightMargin: anchors.leftMargin

Subscribers

People subscribed via source and target branches