aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNing Chi <ext-chi.ning@nokia.com>2010-12-16 14:15:52 +0200
committerPekka Vuorela <pekka.ta.vuorela@nokia.com>2011-01-25 18:41:19 +0200
commit18c48e5afdfb5df7aee1161eb761dd1cd5692870 (patch)
tree64564f2f52cefc355308de359017e563fdd84f08
parent6c961cc994a0330fe83bf943fc9638a77213c9d9 (diff)
Changes: New signal activeWindowOrientationAngleAboutToChange() in MInputMethodState
RevBy: Pekka Vuorela, Kimmo Surakka Details: A new signal activeWindowOrientationAngleAboutToChange() in MInputMethodState to notify input method the orientation changing begin, the old signal activeWindowOrientationAngleChanged is used when changing is finished. And add a new slot startActiveWindowOrientationAngleChange().
-rw-r--r--src/corelib/core/mcomponentdata.cpp55
-rw-r--r--src/corelib/core/mcomponentdata.h2
-rw-r--r--src/corelib/core/mcomponentdata_p.h3
-rw-r--r--src/corelib/core/minputmethodstate.cpp28
-rw-r--r--src/corelib/core/minputmethodstate.h33
-rw-r--r--src/corelib/core/minputmethodstate_p.h7
6 files changed, 104 insertions, 24 deletions
diff --git a/src/corelib/core/mcomponentdata.cpp b/src/corelib/core/mcomponentdata.cpp
index 092522f3..f6c2eb3d 100644
--- a/src/corelib/core/mcomponentdata.cpp
+++ b/src/corelib/core/mcomponentdata.cpp
@@ -798,6 +798,23 @@ void MComponentDataPrivate::registerDefaultService(const QString &appIdentifier)
#endif
}
+void MComponentDataPrivate::_q_notifyInputMethodActiveWindowOrientationChangeStarted()
+{
+ MWindow *activeWindow = MComponentData::activeWindow();
+ MSceneManager *sceneManager = (activeWindow) ? activeWindow->sceneManager() : NULL;
+ if (sceneManager) {
+ MInputMethodState::instance()->startActiveWindowOrientationAngleChange(sceneManager->orientationAngle());
+ }
+}
+
+void MComponentDataPrivate::_q_notifyInputMethodActiveWindowOrientationChangeFinished()
+{
+ MWindow *activeWindow = MComponentData::activeWindow();
+ if (activeWindow) {
+ MInputMethodState::instance()->setActiveWindowOrientationAngle(activeWindow->orientationAngle());
+ }
+}
+
void MComponentData::reinit(int &argc, char **argv, const QString &appIdentifier, MApplicationService *newService)
{
Q_D(MComponentData);
@@ -1117,17 +1134,30 @@ void MComponentData::setActiveWindow(MWindow *w)
}
MWindow *activeWindow = MComponentData::activeWindow();
-
- if (activeWindow) {
- QObject::disconnect(activeWindow,
- SIGNAL(orientationAngleChanged(M::OrientationAngle)),
- MInputMethodState::instance(),
- SLOT(setActiveWindowOrientationAngle(M::OrientationAngle)));
- }
- if (w) {
- QObject::connect(w, SIGNAL(orientationAngleChanged(M::OrientationAngle)),
- MInputMethodState::instance(),
- SLOT(setActiveWindowOrientationAngle(M::OrientationAngle)));
+ MSceneManager *oldSceneManager = (activeWindow) ? activeWindow->sceneManager() : NULL;
+ MSceneManager *newSceneManager = (w) ? w->sceneManager() : NULL;
+
+ if (oldSceneManager) {
+ QObject::disconnect(oldSceneManager,
+ SIGNAL(orientationAboutToChange(M::Orientation)),
+ MComponentData::instance(),
+ SLOT(_q_notifyInputMethodActiveWindowOrientationChangeStarted()));
+ QObject::disconnect(oldSceneManager,
+ SIGNAL(orientationChangeFinished(M::Orientation)),
+ MComponentData::instance(),
+ SLOT(_q_notifyInputMethodActiveWindowOrientationChangeFinished()));
+ }
+ if (newSceneManager) {
+ QObject::connect(newSceneManager,
+ SIGNAL(orientationAboutToChange(M::Orientation)),
+ MComponentData::instance(),
+ SLOT(_q_notifyInputMethodActiveWindowOrientationChangeStarted()),
+ Qt::DirectConnection);
+ QObject::connect(newSceneManager,
+ SIGNAL(orientationChangeFinished(M::Orientation)),
+ MComponentData::instance(),
+ SLOT(_q_notifyInputMethodActiveWindowOrientationChangeFinished()),
+ Qt::DirectConnection);
MInputMethodState::instance()->setActiveWindowOrientationAngle(w->orientationAngle());
}
int oldIndex = gMComponentDataPrivate->windows.indexOf(w);
@@ -1315,3 +1345,6 @@ bool MComponentData::chainDataStackIsEmpty()
return retVal;
}
#endif // Q_WS_X11
+
+
+#include "moc_mcomponentdata.cpp"
diff --git a/src/corelib/core/mcomponentdata.h b/src/corelib/core/mcomponentdata.h
index 577ac8a7..39cb8f6c 100644
--- a/src/corelib/core/mcomponentdata.h
+++ b/src/corelib/core/mcomponentdata.h
@@ -255,6 +255,8 @@ private:
Q_DECLARE_PRIVATE(MComponentData)
Q_DISABLE_COPY(MComponentData)
+ Q_PRIVATE_SLOT(d_func(), void _q_notifyInputMethodActiveWindowOrientationChangeStarted())
+ Q_PRIVATE_SLOT(d_func(), void _q_notifyInputMethodActiveWindowOrientationChangeFinished())
friend class MWindow;
friend class MApplicationWindow;
diff --git a/src/corelib/core/mcomponentdata_p.h b/src/corelib/core/mcomponentdata_p.h
index 4de40a73..c6939742 100644
--- a/src/corelib/core/mcomponentdata_p.h
+++ b/src/corelib/core/mcomponentdata_p.h
@@ -49,6 +49,9 @@ public:
void parseArguments(int &argc, char **argv,
MTheme::ThemeService &themeService);
+ void _q_notifyInputMethodActiveWindowOrientationChangeStarted();
+ void _q_notifyInputMethodActiveWindowOrientationChangeFinished();
+
bool softwareRendering;
bool fullScreen;
bool showBoundingRect;
diff --git a/src/corelib/core/minputmethodstate.cpp b/src/corelib/core/minputmethodstate.cpp
index 4beaf09a..8e76863c 100644
--- a/src/corelib/core/minputmethodstate.cpp
+++ b/src/corelib/core/minputmethodstate.cpp
@@ -28,7 +28,8 @@
MInputMethodStatePrivate::MInputMethodStatePrivate()
- : orientation(M::Angle0),
+ : orientationAngle(M::Angle0),
+ rotationInProgress(false),
q_ptr(NULL)
{
}
@@ -79,13 +80,28 @@ QRect MInputMethodState::inputMethodArea() const
return d->region;
}
-void MInputMethodState::setActiveWindowOrientationAngle(M::OrientationAngle newOrientation)
+void MInputMethodState::startActiveWindowOrientationAngleChange(M::OrientationAngle newOrientationAngle)
{
Q_D(MInputMethodState);
- if (d->orientation != newOrientation) {
- d->orientation = newOrientation;
- emit activeWindowOrientationAngleChanged(newOrientation);
+ if (d->orientationAngle != newOrientationAngle) {
+ d->orientationAngle = newOrientationAngle;
+ d->rotationInProgress = true;
+ emit activeWindowOrientationAngleAboutToChange(newOrientationAngle);
+ }
+}
+
+void MInputMethodState::setActiveWindowOrientationAngle(M::OrientationAngle newOrientationAngle)
+{
+ Q_D(MInputMethodState);
+
+ if (d->orientationAngle != newOrientationAngle) {
+ d->orientationAngle = newOrientationAngle;
+ d->rotationInProgress = true;
+ }
+ if (d->rotationInProgress) {
+ d->rotationInProgress = false;
+ emit activeWindowOrientationAngleChanged(newOrientationAngle);
}
}
@@ -93,7 +109,7 @@ M::OrientationAngle MInputMethodState::activeWindowOrientationAngle() const
{
Q_D(const MInputMethodState);
- return d->orientation;
+ return d->orientationAngle;
}
void MInputMethodState::requestSoftwareInputPanel()
diff --git a/src/corelib/core/minputmethodstate.h b/src/corelib/core/minputmethodstate.h
index 60b1e7ec..84eaff67 100644
--- a/src/corelib/core/minputmethodstate.h
+++ b/src/corelib/core/minputmethodstate.h
@@ -89,8 +89,19 @@ public:
//! \internal_end
public Q_SLOTS:
- //! \brief Set the orientation of application's active window to \a newOrientation
- void setActiveWindowOrientationAngle(M::OrientationAngle newOrientation);
+ /*!
+ * \brief Application's active window start to rotate to \a newOrientationAngle.
+ *
+ * \note This method should be called when active window start rotation animation.
+ */
+ void startActiveWindowOrientationAngleChange(M::OrientationAngle newOrientationAngle);
+
+ /*!
+ * \brief Set the orientation angle of application's active window to \a newOrientationAngle
+ *
+ * \note This method should be called when active window already finished the rotation animation.
+ */
+ void setActiveWindowOrientationAngle(M::OrientationAngle newOrientationAngle);
//! \brief Set input method area to \a newRegion
void setInputMethodArea(const QRect &newRegion);
@@ -125,9 +136,21 @@ Q_SIGNALS:
//! \param region new input method area
void inputMethodAreaChanged(const QRect &region);
- //! Emitted when the orientation of application's active window is changed
- //! \param orientation new orientation angle
- void activeWindowOrientationAngleChanged(M::OrientationAngle orientation);
+ /*!
+ * \brief This signal is emitted before the orientation angle of the application's active window is changed.
+ * \param orientationAngle New orientation angle which is about to change.
+ *
+ * \note It is emitted at the start of the rotation animation.
+ */
+ void activeWindowOrientationAngleAboutToChange(M::OrientationAngle orientationAngle);
+
+ /*!
+ * \brief This signal is emitted when the orientation angle of application's active window is changed
+ * \param orientationAngle new orientation angle
+ *
+ * \note It's emitted with every orientation angle change finished.
+ */
+ void activeWindowOrientationAngleChanged(M::OrientationAngle orientationAngle);
//! Emitted when an input method toolbar which is defined in \a fileName with an unique identifier \a id is registered.
void toolbarRegistered(int id, const QString &fileName);
diff --git a/src/corelib/core/minputmethodstate_p.h b/src/corelib/core/minputmethodstate_p.h
index 936ec07f..e32fdc1a 100644
--- a/src/corelib/core/minputmethodstate_p.h
+++ b/src/corelib/core/minputmethodstate_p.h
@@ -53,8 +53,11 @@ public:
//! Current input method area
QRect region;
- //! Current orientation of application's active window
- M::OrientationAngle orientation;
+ //! Current orientation angle of application's active window
+ M::OrientationAngle orientationAngle;
+
+ //! Indicate during rotation changing.
+ bool rotationInProgress;
QMap<int, ToolbarInfo*> toolbars;