From a708f07b593359b6bf5732ec444336956e194cda Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 6 Nov 2009 09:55:08 +0100 Subject: add slow mode in private API for testing this was suggested by Michael B --- src/corelib/animation/qabstractanimation.cpp | 6 ++++-- src/corelib/animation/qabstractanimation_p.h | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 3b98152..93ac840 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -165,8 +165,8 @@ Q_GLOBAL_STATIC(QThreadStorage, unifiedTimer) QUnifiedTimer::QUnifiedTimer() : QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), - currentAnimationIdx(0), consistentTiming(false), isPauseTimerActive(false), - runningLeafAnimations(0) + currentAnimationIdx(0), consistentTiming(false), slowMode(false), + isPauseTimerActive(false), runningLeafAnimations(0) { } @@ -193,6 +193,8 @@ void QUnifiedTimer::updateAnimationsTime() // ignore consistentTiming in case the pause timer is active const int delta = (consistentTiming && !isPauseTimerActive) ? timingInterval : time.elapsed() - lastTick; + if slowMode) + delta /= 5; lastTick = time.elapsed(); //we make sure we only call update time if the time has actually changed diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index f989bce..720e68d 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -138,6 +138,9 @@ public: */ void setConsistentTiming(bool consistent) { consistentTiming = consistent; } + //this facilitates fine-tuning of complex animations + void setSlowModeEnabled(bool enabled) { slowMode = enabled; } + /* this is used for updating the currentTime of all animations in case the pause timer is active or, otherwise, only of the animation passed as parameter. @@ -164,6 +167,7 @@ private: int timingInterval; int currentAnimationIdx; bool consistentTiming; + bool slowMode; // bool to indicate that only pause animations are active bool isPauseTimerActive; -- cgit v0.12