summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-10-20 23:29:13 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-10-21 01:43:24 (GMT)
commitb8c939903b8afc0abe38ab2e315a5bda32221aae (patch)
tree5141e7492c6374795a392bfca825281a1de0a337 /src/corelib
parent4b36e00eba66eab873d3fe15aa3ceedd5dd18ae0 (diff)
downloadQt-b8c939903b8afc0abe38ab2e315a5bda32221aae.zip
Qt-b8c939903b8afc0abe38ab2e315a5bda32221aae.tar.gz
Qt-b8c939903b8afc0abe38ab2e315a5bda32221aae.tar.bz2
Manually apply proper animation fixes.
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index f23ad3c..0d5f278 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -278,11 +278,11 @@ void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopL
void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation)
{
- unregisterRunningAnimation(animation);
-
if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer)
return;
+ unregisterRunningAnimation(animation);
+
int idx = animations.indexOf(animation);
if (idx != -1) {
animations.removeAt(idx);
@@ -318,6 +318,7 @@ void QUnifiedTimer::unregisterRunningAnimation(QAbstractAnimation *animation)
runningPauseAnimations.removeOne(animation);
else
runningLeafAnimations--;
+ Q_ASSERT(runningLeafAnimations >= 0);
}
int QUnifiedTimer::closestPauseAnimationTimeToFinish()
@@ -328,9 +329,9 @@ int QUnifiedTimer::closestPauseAnimationTimeToFinish()
int timeToFinish;
if (animation->direction() == QAbstractAnimation::Forward)
- timeToFinish = animation->duration() - QAbstractAnimationPrivate::get(animation)->currentTime;
+ timeToFinish = animation->duration() - animation->currentTime();
else
- timeToFinish = QAbstractAnimationPrivate::get(animation)->totalCurrentTime;
+ timeToFinish = animation->currentTime();
if (timeToFinish < closestTimeToFinish)
closestTimeToFinish = timeToFinish;
@@ -648,13 +649,13 @@ int QAbstractAnimation::currentLoop() const
*/
int QAbstractAnimation::totalDuration() const
{
- Q_D(const QAbstractAnimation);
- if (d->loopCount < 0)
- return -1;
int dura = duration();
- if (dura == -1)
+ if (dura <= 0)
+ return dura;
+ int loopcount = loopCount();
+ if (loopcount < 0)
return -1;
- return dura * d->loopCount;
+ return dura * loopcount;
}
/*!
@@ -685,7 +686,7 @@ void QAbstractAnimation::setCurrentTime(int msecs)
// Calculate new time and loop.
int dura = duration();
- int totalDura = (d->loopCount < 0 || dura == -1) ? -1 : dura * d->loopCount;
+ int totalDura = dura <= 0 ? dura : ((d->loopCount < 0) ? -1 : dura * d->loopCount);
if (totalDura != -1)
msecs = qMin(totalDura, msecs);
d->totalCurrentTime = msecs;