diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-28 13:52:32 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-28 13:57:39 (GMT) |
commit | 7626109da40a91cb38fbe3f23e08b50a04d2194a (patch) | |
tree | b53358c91c08ecde5f4d12d5f20e1f6609fa17e7 /src/corelib/animation | |
parent | 124b4a1a5832d21d63722ee5ac68007083a4f8ae (diff) | |
download | Qt-7626109da40a91cb38fbe3f23e08b50a04d2194a.zip Qt-7626109da40a91cb38fbe3f23e08b50a04d2194a.tar.gz Qt-7626109da40a91cb38fbe3f23e08b50a04d2194a.tar.bz2 |
Animations: updateCurrentTime now receives the currentTime as paramater
Reviewed-by: Leo
Diffstat (limited to 'src/corelib/animation')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 4 | ||||
-rw-r--r-- | src/corelib/animation/qabstractanimation.h | 2 | ||||
-rw-r--r-- | src/corelib/animation/qparallelanimationgroup.cpp | 14 | ||||
-rw-r--r-- | src/corelib/animation/qparallelanimationgroup.h | 2 | ||||
-rw-r--r-- | src/corelib/animation/qpauseanimation.cpp | 2 | ||||
-rw-r--r-- | src/corelib/animation/qpauseanimation.h | 2 | ||||
-rw-r--r-- | src/corelib/animation/qsequentialanimationgroup.cpp | 4 | ||||
-rw-r--r-- | src/corelib/animation/qsequentialanimationgroup.h | 2 | ||||
-rw-r--r-- | src/corelib/animation/qvariantanimation.cpp | 2 | ||||
-rw-r--r-- | src/corelib/animation/qvariantanimation.h | 2 |
10 files changed, 18 insertions, 18 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 9027be0..6489cdc 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -604,7 +604,7 @@ void QAbstractAnimation::setCurrentTime(int msecs) } } - updateCurrentTime(); + updateCurrentTime(d->currentTime); if (d->currentLoop != oldLoop) emit currentLoopChanged(d->currentLoop); @@ -705,7 +705,7 @@ bool QAbstractAnimation::event(QEvent *event) } /*! - \fn virtual void QAbstractAnimation::updateCurrentTime() = 0; + \fn virtual void QAbstractAnimation::updateCurrentTime(int currentTime) = 0; This pure virtual function is called every time the animation's current time changes. diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h index 516f5e9..50b07d7 100644 --- a/src/corelib/animation/qabstractanimation.h +++ b/src/corelib/animation/qabstractanimation.h @@ -119,7 +119,7 @@ protected: QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = 0); bool event(QEvent *event); - virtual void updateCurrentTime() = 0; + virtual void updateCurrentTime(int currentTime) = 0; virtual void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); virtual void updateDirection(QAbstractAnimation::Direction direction); diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 82d5224..5b7fd22 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -125,7 +125,7 @@ int QParallelAnimationGroup::duration() const /*! \reimp */ -void QParallelAnimationGroup::updateCurrentTime() +void QParallelAnimationGroup::updateCurrentTime(int currentTime) { Q_D(QParallelAnimationGroup); if (d->animations.isEmpty()) @@ -148,7 +148,7 @@ void QParallelAnimationGroup::updateCurrentTime() } } - bool timeFwd = ((d->currentLoop == d->lastLoop && d->currentTime >= d->lastCurrentTime) + bool timeFwd = ((d->currentLoop == d->lastLoop && currentTime >= d->lastCurrentTime) || d->currentLoop > d->lastLoop); #ifdef QANIMATION_DEBUG qDebug("QParallellAnimationGroup %5d: setCurrentTime(%d), loop:%d, last:%d, timeFwd:%d, lastcurrent:%d, %d", @@ -160,7 +160,7 @@ void QParallelAnimationGroup::updateCurrentTime() const int dura = animation->totalDuration(); if (dura == -1 && d->isUncontrolledAnimationFinished(animation)) continue; - if (dura == -1 || (d->currentTime <= dura && dura != 0) + if (dura == -1 || (currentTime <= dura && dura != 0) || (dura == 0 && d->currentLoop != d->lastLoop)) { switch (state()) { case Running: @@ -177,18 +177,18 @@ void QParallelAnimationGroup::updateCurrentTime() if (dura <= 0) { if (dura == -1) - animation->setCurrentTime(d->currentTime); + animation->setCurrentTime(currentTime); continue; } if ((timeFwd && d->lastCurrentTime <= dura) || (!timeFwd && d->currentTime <= dura)) - animation->setCurrentTime(d->currentTime); - if (d->currentTime > dura) + animation->setCurrentTime(currentTime); + if (currentTime > dura) animation->stop(); } d->lastLoop = d->currentLoop; - d->lastCurrentTime = d->currentTime; + d->lastCurrentTime = currentTime; } /*! diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h index 6afe4a7..1cab91e 100644 --- a/src/corelib/animation/qparallelanimationgroup.h +++ b/src/corelib/animation/qparallelanimationgroup.h @@ -67,7 +67,7 @@ protected: QParallelAnimationGroup(QParallelAnimationGroupPrivate &dd, QObject *parent); bool event(QEvent *event); - void updateCurrentTime(); + void updateCurrentTime(int currentTime); void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); void updateDirection(QAbstractAnimation::Direction direction); diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp index c382b19..2fd12aa 100644 --- a/src/corelib/animation/qpauseanimation.cpp +++ b/src/corelib/animation/qpauseanimation.cpp @@ -141,7 +141,7 @@ bool QPauseAnimation::event(QEvent *e) /*! \reimp */ -void QPauseAnimation::updateCurrentTime() +void QPauseAnimation::updateCurrentTime(int) { } diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h index caac9e9..1b81472 100644 --- a/src/corelib/animation/qpauseanimation.h +++ b/src/corelib/animation/qpauseanimation.h @@ -68,7 +68,7 @@ public: protected: bool event(QEvent *e); - void updateCurrentTime(); + void updateCurrentTime(int); private: Q_DISABLE_COPY(QPauseAnimation) diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 9ad433f..5ca560a 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -334,7 +334,7 @@ int QSequentialAnimationGroup::duration() const /*! \reimp */ -void QSequentialAnimationGroup::updateCurrentTime() +void QSequentialAnimationGroup::updateCurrentTime(int currentTime) { Q_D(QSequentialAnimationGroup); if (!d->currentAnimation) @@ -359,7 +359,7 @@ void QSequentialAnimationGroup::updateCurrentTime() d->setCurrentAnimation(newAnimationIndex.index); - const int newCurrentTime = d->currentTime - newAnimationIndex.timeOffset; + const int newCurrentTime = currentTime - newAnimationIndex.timeOffset; if (d->currentAnimation) { d->currentAnimation->setCurrentTime(newCurrentTime); diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h index 1c9e4cc..f30f851 100644 --- a/src/corelib/animation/qsequentialanimationgroup.h +++ b/src/corelib/animation/qsequentialanimationgroup.h @@ -77,7 +77,7 @@ protected: QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd, QObject *parent); bool event(QEvent *event); - void updateCurrentTime(); + void updateCurrentTime(int); void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); void updateDirection(QAbstractAnimation::Direction direction); diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index ae8bf2f..de8185b 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -656,7 +656,7 @@ QVariant QVariantAnimation::interpolated(const QVariant &from, const QVariant &t /*! \reimp */ -void QVariantAnimation::updateCurrentTime() +void QVariantAnimation::updateCurrentTime(int) { d_func()->recalculateCurrentInterval(); } diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h index 98c1aec..bc57b1c 100644 --- a/src/corelib/animation/qvariantanimation.h +++ b/src/corelib/animation/qvariantanimation.h @@ -102,7 +102,7 @@ protected: QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = 0); bool event(QEvent *event); - void updateCurrentTime(); + void updateCurrentTime(int); void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); virtual void updateCurrentValue(const QVariant &value) = 0; |