From eb8c97dcaef8e2144ea0c83b3b7c9fa2a8c6a31a Mon Sep 17 00:00:00 2001 From: Igor Trindade Oliveira Date: Thu, 21 Jan 2010 20:15:03 +0000 Subject: [PATCH] fixes a small bug on RotationStackedAnimation which uses a wrong delta for the back widget rotation animation angle. The back widget was rotating from 90 (0.25 * 360) degrees to 180 (0.5 * 360), but the correct rotation is from 270 (0.75 * 360) to 360 (1.00 * 360). This patch also fixes code indentation. Patch by: Bruno Abinader svn path=/trunk/KDE/kdelibs/; revision=1078228 --- animations/rotationstacked.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/animations/rotationstacked.cpp b/animations/rotationstacked.cpp index 1c2acc168..0b49d8ac2 100644 --- a/animations/rotationstacked.cpp +++ b/animations/rotationstacked.cpp @@ -133,26 +133,25 @@ void RotationStackedAnimation::updateState( if (oldState == Stopped && newState == Running) { m_frontRotation->setAngle(direction() == Forward ? m_frontStartAngle : m_frontEndAngle); m_backRotation->setAngle(direction() == Forward ? m_backStartAngle : m_backEndAngle); - } else if(newState == Stopped) { - m_frontRotation->setAngle(direction() == Forward ? m_frontEndAngle : m_frontStartAngle); - m_backRotation->setAngle(direction() == Forward ? m_backEndAngle : m_backStartAngle); -} + } else if (newState == Stopped) { + m_frontRotation->setAngle(direction() == Forward ? m_frontEndAngle : m_frontStartAngle); + m_backRotation->setAngle(direction() == Forward ? m_backEndAngle : m_backStartAngle); + } } void RotationStackedAnimation::updateCurrentTime(int currentTime) { -QGraphicsWidget *w = targetWidget(); -if(w) { - qreal delta; - if (currentTime <= duration()/2) { - delta = Animation::easingCurve().valueForProgress( - (currentTime * 2) / qreal(duration())); - m_sLayout->setCurrentWidgetIndex(0); - delta = m_frontEndAngle * delta; + QGraphicsWidget *w = targetWidget(); + + if (w) { + qreal delta; + if (currentTime <= duration()/2) { + delta = Animation::easingCurve().valueForProgress((currentTime * 2) / qreal(duration())); + m_sLayout->setCurrentWidgetIndex(0); + delta = m_frontEndAngle * delta; m_frontRotation->setAngle(delta); } else { - delta = Animation::easingCurve().valueForProgress( - (currentTime/2) / qreal(duration())); + delta = 0.5 + Animation::easingCurve().valueForProgress((currentTime/2) / qreal(duration())); m_sLayout->setCurrentWidgetIndex(1); delta = m_backEndAngle * delta; m_backRotation->setAngle(delta);