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 <brunoabinader@gmail.com>

svn path=/trunk/KDE/kdelibs/; revision=1078228
This commit is contained in:
Igor Trindade Oliveira 2010-01-21 20:15:03 +00:00
parent 323d93a0b1
commit eb8c97dcae

View File

@ -133,26 +133,25 @@ void RotationStackedAnimation::updateState(
if (oldState == Stopped && newState == Running) { if (oldState == Stopped && newState == Running) {
m_frontRotation->setAngle(direction() == Forward ? m_frontStartAngle : m_frontEndAngle); m_frontRotation->setAngle(direction() == Forward ? m_frontStartAngle : m_frontEndAngle);
m_backRotation->setAngle(direction() == Forward ? m_backStartAngle : m_backEndAngle); m_backRotation->setAngle(direction() == Forward ? m_backStartAngle : m_backEndAngle);
} else if(newState == Stopped) { } else if (newState == Stopped) {
m_frontRotation->setAngle(direction() == Forward ? m_frontEndAngle : m_frontStartAngle); m_frontRotation->setAngle(direction() == Forward ? m_frontEndAngle : m_frontStartAngle);
m_backRotation->setAngle(direction() == Forward ? m_backEndAngle : m_backStartAngle); m_backRotation->setAngle(direction() == Forward ? m_backEndAngle : m_backStartAngle);
} }
} }
void RotationStackedAnimation::updateCurrentTime(int currentTime) void RotationStackedAnimation::updateCurrentTime(int currentTime)
{ {
QGraphicsWidget *w = targetWidget(); QGraphicsWidget *w = targetWidget();
if(w) {
qreal delta; if (w) {
if (currentTime <= duration()/2) { qreal delta;
delta = Animation::easingCurve().valueForProgress( if (currentTime <= duration()/2) {
(currentTime * 2) / qreal(duration())); delta = Animation::easingCurve().valueForProgress((currentTime * 2) / qreal(duration()));
m_sLayout->setCurrentWidgetIndex(0); m_sLayout->setCurrentWidgetIndex(0);
delta = m_frontEndAngle * delta; delta = m_frontEndAngle * delta;
m_frontRotation->setAngle(delta); m_frontRotation->setAngle(delta);
} else { } else {
delta = Animation::easingCurve().valueForProgress( delta = 0.5 + Animation::easingCurve().valueForProgress((currentTime/2) / qreal(duration()));
(currentTime/2) / qreal(duration()));
m_sLayout->setCurrentWidgetIndex(1); m_sLayout->setCurrentWidgetIndex(1);
delta = m_backEndAngle * delta; delta = m_backEndAngle * delta;
m_backRotation->setAngle(delta); m_backRotation->setAngle(delta);