aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Kapusta <dominik.kapusta@teleca.com>2010-04-21 12:05:20 +0200
committerDaniel d'Andrada <daniel.dandrada@nokia.com>2010-04-27 07:35:02 +0300
commit37c988d53afcab916e402e910017eaea2f9e01ba (patch)
treed065ffc19f4a7277f0fa82ef8c36d7c36cf6c26c
parentd5e278e2613e2375b34fbf54b4e37ac4a9ff8060 (diff)
Fixes: NB#164850 - orientationFinished signals are sent even without change in orientation
RevBy: Daniel d'Andrada Details: It makes sure that MSceneManager::orientationChangeFinished() is emitted with every orientation angle change. - Documentation updated to state that the signal comes after *every* rotation. - Internal MSceneManager::_q_changeGlobalOrientation() renamed to MSceneManager::_q_changeGlobalOrientationAngle() to tell precisely what does it do. - Test case updated.
-rw-r--r--src/corelib/scene/mscenemanager.cpp11
-rw-r--r--src/corelib/scene/mscenemanager.h4
-rw-r--r--src/corelib/scene/mscenemanager_p.h2
-rw-r--r--src/corelib/widgets/mwindow.h4
-rw-r--r--tests/ut_mscenemanager/ut_mscenemanager.cpp8
5 files changed, 16 insertions, 13 deletions
diff --git a/src/corelib/scene/mscenemanager.cpp b/src/corelib/scene/mscenemanager.cpp
index a5215773..d375e2e9 100644
--- a/src/corelib/scene/mscenemanager.cpp
+++ b/src/corelib/scene/mscenemanager.cpp
@@ -118,7 +118,7 @@ void MSceneManagerPrivate::init(MScene *scene)
//TODO: get this from theme
orientationAnimation = new MBasicOrientationAnimation(q->visibleSceneSize(M::Landscape));
orientationAnimation->setRootElement(rootElement);
- q->connect(orientationAnimation, SIGNAL(orientationChanged()), SLOT(_q_changeGlobalOrientation()));
+ q->connect(orientationAnimation, SIGNAL(orientationChanged()), SLOT(_q_changeGlobalOrientationAngle()));
q->connect(orientationAnimation, SIGNAL(finished()), SLOT(_q_emitOrientationChangeFinished()));
q->connect(orientationAnimation, SIGNAL(finished()), SLOT(_q_applyQueuedSceneWindowTransitions()));
q->connect(orientationAnimation, SIGNAL(finished()), SLOT(_q_triggerAsyncPendingOrientationChange()));
@@ -218,7 +218,7 @@ void MSceneManagerPrivate::_q_setSenderGeometry()
setSceneWindowGeometry(window);
}
-void MSceneManagerPrivate::_q_changeGlobalOrientation()
+void MSceneManagerPrivate::_q_changeGlobalOrientationAngle()
{
Q_Q(MSceneManager);
@@ -602,9 +602,8 @@ void MSceneManagerPrivate::setOrientationAngleWithoutAnimation(M::OrientationAng
{
Q_Q(MSceneManager);
- M::Orientation oldOrientation = orientation(angle);
this->newAngle = newAngle;
- _q_changeGlobalOrientation();
+ _q_changeGlobalOrientationAngle();
QSize landscapeScreenSize = q->visibleSceneSize(M::Landscape);
@@ -620,9 +619,7 @@ void MSceneManagerPrivate::setOrientationAngleWithoutAnimation(M::OrientationAng
landscapeScreenSize.width() / 2);
}
- M::Orientation newOrientation = orientation(angle);
- if (oldOrientation != newOrientation)
- emit q->orientationChangeFinished(newOrientation);
+ emit q->orientationChangeFinished(orientation(angle));
}
bool MSceneManagerPrivate::onApplicationPage(QGraphicsItem *item)
diff --git a/src/corelib/scene/mscenemanager.h b/src/corelib/scene/mscenemanager.h
index e4d9d4bc..9cf0b392 100644
--- a/src/corelib/scene/mscenemanager.h
+++ b/src/corelib/scene/mscenemanager.h
@@ -278,6 +278,8 @@ Q_SIGNALS:
/*!
* This signal is emitted when the rotation animation has finished.
*
+ * \note It's emitted with every orientation angle change.
+ *
* \param orientation New orientation of the viewport
*/
void orientationChangeFinished(M::Orientation orientation);
@@ -309,7 +311,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_onSceneWindowAppeared())
Q_PRIVATE_SLOT(d_func(), void _q_onSceneWindowDisappeared())
Q_PRIVATE_SLOT(d_func(), void _q_setSenderGeometry())
- Q_PRIVATE_SLOT(d_func(), void _q_changeGlobalOrientation())
+ Q_PRIVATE_SLOT(d_func(), void _q_changeGlobalOrientationAngle())
Q_PRIVATE_SLOT(d_func(), void _q_emitOrientationChangeFinished())
Q_PRIVATE_SLOT(d_func(), void _q_restoreSceneWindow())
Q_PRIVATE_SLOT(d_func(), void _q_relocateWindowByInputPanel(const QRect &inputPanelRect))
diff --git a/src/corelib/scene/mscenemanager_p.h b/src/corelib/scene/mscenemanager_p.h
index e5163dd0..234a1a07 100644
--- a/src/corelib/scene/mscenemanager_p.h
+++ b/src/corelib/scene/mscenemanager_p.h
@@ -129,7 +129,7 @@ public:
void createDisappearanceAnimationForSceneWindow(MSceneWindow *sceneWindow);
void _q_setSenderGeometry();
- void _q_changeGlobalOrientation();
+ void _q_changeGlobalOrientationAngle();
void _q_emitOrientationChangeFinished();
void _q_pageShowAnimationFinished();
void _q_onSceneWindowAppeared();
diff --git a/src/corelib/widgets/mwindow.h b/src/corelib/widgets/mwindow.h
index 88caba47..db79594f 100644
--- a/src/corelib/widgets/mwindow.h
+++ b/src/corelib/widgets/mwindow.h
@@ -379,11 +379,13 @@ Q_SIGNALS:
/*!
This signal is emitted when the rotation animation (if any) has finished.
- It's emitted in tandem with MSceneManager::orientationChangeComplete().
+ It's emitted in tandem with MSceneManager::orientationChangeFinished().
If window doesn't have the scene manager, this signal is emitted together with
orientationChanged().
+ \note This signal is emitted with every orientation angle change.
+
\sa orientationChanged()
*/
void orientationChangeFinished(M::Orientation);
diff --git a/tests/ut_mscenemanager/ut_mscenemanager.cpp b/tests/ut_mscenemanager/ut_mscenemanager.cpp
index df25bebf..48a5699b 100644
--- a/tests/ut_mscenemanager/ut_mscenemanager.cpp
+++ b/tests/ut_mscenemanager/ut_mscenemanager.cpp
@@ -205,7 +205,8 @@ void Ut_MSceneManager::testOrientationChangedSignal()
void Ut_MSceneManager::testNoOrientationChangedSignalWhenRotatingBy180Degrees()
{
- QSignalSpy changedSpy(sm, SIGNAL(orientationChanged(M::Orientation)));
+ QSignalSpy orientationChangedSpy(sm, SIGNAL(orientationChanged(M::Orientation)));
+ QSignalSpy angleChangedSpy(sm, SIGNAL(orientationAngleChanged(M::OrientationAngle)));
QSignalSpy finishedSpy(sm, SIGNAL(orientationChangeFinished(M::Orientation)));
int newAngle = sm->orientationAngle() + M::Angle180;
@@ -214,8 +215,9 @@ void Ut_MSceneManager::testNoOrientationChangedSignalWhenRotatingBy180Degrees()
sm->setOrientationAngle((M::OrientationAngle) newAngle,
MSceneManager::ImmediateTransition);
- QCOMPARE(changedSpy.count(), 0);
- QCOMPARE(finishedSpy.count(), 0);
+ QCOMPARE(orientationChangedSpy.count(), 0);
+ QCOMPARE(angleChangedSpy.count(), 1);
+ QCOMPARE(finishedSpy.count(), 1);
}
// Test uses non-exported symbol "MDockWidget".