summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-09-28 13:52:32 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-09-28 13:57:39 (GMT)
commit7626109da40a91cb38fbe3f23e08b50a04d2194a (patch)
treeb53358c91c08ecde5f4d12d5f20e1f6609fa17e7
parent124b4a1a5832d21d63722ee5ac68007083a4f8ae (diff)
downloadQt-7626109da40a91cb38fbe3f23e08b50a04d2194a.zip
Qt-7626109da40a91cb38fbe3f23e08b50a04d2194a.tar.gz
Qt-7626109da40a91cb38fbe3f23e08b50a04d2194a.tar.bz2
Animations: updateCurrentTime now receives the currentTime as paramater
Reviewed-by: Leo
-rw-r--r--examples/animation/easing/animation.h6
-rw-r--r--src/corelib/animation/qabstractanimation.cpp4
-rw-r--r--src/corelib/animation/qabstractanimation.h2
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp14
-rw-r--r--src/corelib/animation/qparallelanimationgroup.h2
-rw-r--r--src/corelib/animation/qpauseanimation.cpp2
-rw-r--r--src/corelib/animation/qpauseanimation.h2
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.h2
-rw-r--r--src/corelib/animation/qvariantanimation.cpp2
-rw-r--r--src/corelib/animation/qvariantanimation.h2
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp6
-rw-r--r--tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp6
-rw-r--r--tests/benchmarks/qanimation/rectanimation.cpp4
-rw-r--r--tests/benchmarks/qanimation/rectanimation.h2
15 files changed, 30 insertions, 30 deletions
diff --git a/examples/animation/easing/animation.h b/examples/animation/easing/animation.h
index 78fdc14..bd58be0 100644
--- a/examples/animation/easing/animation.h
+++ b/examples/animation/easing/animation.h
@@ -68,7 +68,7 @@ public:
m_path = QPainterPath();
}
- void updateCurrentTime()
+ void updateCurrentTime(int currentTime)
{
if (m_pathType == CirclePath) {
if (m_path.isEmpty()) {
@@ -78,7 +78,7 @@ public:
m_path.addEllipse(QRectF(from, to));
}
int dura = duration();
- const qreal progress = ((dura == 0) ? 1 : ((((currentTime() - 1) % dura) + 1) / qreal(dura)));
+ const qreal progress = ((dura == 0) ? 1 : ((((currentTime - 1) % dura) + 1) / qreal(dura)));
qreal easedProgress = easingCurve().valueForProgress(progress);
if (easedProgress > 1.0) {
@@ -90,7 +90,7 @@ public:
updateCurrentValue(pt);
emit valueChanged(pt);
} else {
- QPropertyAnimation::updateCurrentTime();
+ QPropertyAnimation::updateCurrentTime(currentTime);
}
}
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;
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index f86e81d..51ef2da 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -55,10 +55,10 @@ public:
int duration() const { return -1; /* not time driven */ }
protected:
- void updateCurrentTime()
+ void updateCurrentTime(int currentTime)
{
- QPropertyAnimation::updateCurrentTime();
- if (currentTime() >= QPropertyAnimation::duration() || currentLoop() >= 1)
+ QPropertyAnimation::updateCurrentTime(currentTime);
+ if (currentTime >= QPropertyAnimation::duration() || currentLoop() >= 1)
stop();
}
};
diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
index b14d6f8..aa6801a 100644
--- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -169,10 +169,10 @@ public:
int duration() const { return -1; /* not time driven */ }
protected:
- void updateCurrentTime()
+ void updateCurrentTime(int currentTime)
{
- QPropertyAnimation::updateCurrentTime();
- if (currentTime() >= QPropertyAnimation::duration())
+ QPropertyAnimation::updateCurrentTime(currentTime);
+ if (currentTime >= QPropertyAnimation::duration())
stop();
}
};
diff --git a/tests/benchmarks/qanimation/rectanimation.cpp b/tests/benchmarks/qanimation/rectanimation.cpp
index 5522847..ab381f4 100644
--- a/tests/benchmarks/qanimation/rectanimation.cpp
+++ b/tests/benchmarks/qanimation/rectanimation.cpp
@@ -73,9 +73,9 @@ int RectAnimation::duration() const
}
-void RectAnimation::updateCurrentTime()
+void RectAnimation::updateCurrentTime(int currentTime)
{
- qreal progress = m_easing.valueForProgress( currentTime() / qreal(m_dura) );
+ qreal progress = m_easing.valueForProgress( currentTime / qreal(m_dura) );
QRect now;
now.setCoords(interpolateInteger(m_start.left(), m_end.left(), progress),
interpolateInteger(m_start.top(), m_end.top(), progress),
diff --git a/tests/benchmarks/qanimation/rectanimation.h b/tests/benchmarks/qanimation/rectanimation.h
index 995becb..ea1f804 100644
--- a/tests/benchmarks/qanimation/rectanimation.h
+++ b/tests/benchmarks/qanimation/rectanimation.h
@@ -58,7 +58,7 @@ public:
void setDuration(int d);
int duration() const;
- virtual void updateCurrentTime();
+ virtual void updateCurrentTime(int currentTime);
virtual void updateState(QAbstractAnimation::State state);
private: