aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@jollamobile.com>2014-03-28 11:43:47 -0500
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-08 01:39:37 +0200
commit02ad96fa8870630c6b77327098c712d6418b8fda (patch)
tree7f9557c1f00d80e3f16deb4e447cc34863b0a884 /src
parent0a74379a57bcf68328ab167121c2dd16fc2d47c3 (diff)
Support dumping of animation jobs via QML_ANIMATION_TICK_DUMP.
Change-Id: I0b444321667691be3e1037164d02f29ed4dfc13e Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/animations/qabstractanimationjob.cpp23
-rw-r--r--src/qml/animations/qabstractanimationjob_p.h5
-rw-r--r--src/qml/animations/qanimationgroupjob.cpp12
-rw-r--r--src/qml/animations/qanimationgroupjob_p.h2
-rw-r--r--src/qml/animations/qcontinuinganimationgroupjob.cpp7
-rw-r--r--src/qml/animations/qcontinuinganimationgroupjob_p.h1
-rw-r--r--src/qml/animations/qparallelanimationgroupjob.cpp7
-rw-r--r--src/qml/animations/qparallelanimationgroupjob_p.h1
-rw-r--r--src/qml/animations/qpauseanimationjob.cpp5
-rw-r--r--src/qml/animations/qpauseanimationjob_p.h1
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob.cpp7
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob_p.h1
-rw-r--r--src/quick/util/qquickanimation.cpp60
-rw-r--r--src/quick/util/qquickanimation_p_p.h14
-rw-r--r--src/quick/util/qquicksmoothedanimation.cpp7
-rw-r--r--src/quick/util/qquicksmoothedanimation_p_p.h1
-rw-r--r--src/quick/util/qquickspringanimation.cpp10
-rw-r--r--src/quick/util/qquicktimeline.cpp5
-rw-r--r--src/quick/util/qquicktimeline_p_p.h1
19 files changed, 167 insertions, 3 deletions
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp
index b6222a541c..0928c0efc1 100644
--- a/src/qml/animations/qabstractanimationjob.cpp
+++ b/src/qml/animations/qabstractanimationjob.cpp
@@ -45,6 +45,7 @@
#include "private/qanimationgroupjob_p.h"
#include "private/qanimationjobutil_p.h"
#include "private/qqmlengine_p.h"
+#include "private/qqmlglobal_p.h"
#define DEFAULT_TIMER_INTERVAL 16
@@ -54,6 +55,8 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QThreadStorage<QQmlAnimationTimer *>, animationTimer)
#endif
+DEFINE_BOOL_CONFIG_OPTION(animationTickDump, QML_ANIMATION_TICK_DUMP);
+
QAnimationJobChangeListener::~QAnimationJobChangeListener()
{
}
@@ -115,6 +118,11 @@ void QQmlAnimationTimer::updateAnimationsTime(qint64 delta)
+ (animation->direction() == QAbstractAnimationJob::Forward ? delta : -delta);
animation->setCurrentTime(elapsed);
}
+ if (animationTickDump()) {
+ qDebug() << "***** Dumping Animation Tree ***** ( tick:" << lastTick << "delta:" << delta << ")";
+ for (int i = 0; i < animations.count(); ++i)
+ qDebug() << animations.at(i);
+ }
insideTick = false;
currentAnimationIdx = 0;
}
@@ -647,6 +655,21 @@ void QAbstractAnimationJob::removeAnimationChangeListener(QAnimationJobChangeLis
}
}
+void QAbstractAnimationJob::debugAnimation(QDebug d) const
+{
+ d << "AbstractAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << duration();
+}
+
+QDebug operator<<(QDebug d, const QAbstractAnimationJob *job)
+{
+ if (!job) {
+ d << "AbstractAnimationJob(null)";
+ return d;
+ }
+ job->debugAnimation(d);
+ return d;
+}
+
QT_END_NAMESPACE
//#include "moc_qabstractanimation2_p.cpp"
diff --git a/src/qml/animations/qabstractanimationjob_p.h b/src/qml/animations/qabstractanimationjob_p.h
index e8745c8c92..c905fca0d7 100644
--- a/src/qml/animations/qabstractanimationjob_p.h
+++ b/src/qml/animations/qabstractanimationjob_p.h
@@ -123,6 +123,8 @@ protected:
virtual void updateDirection(QAbstractAnimationJob::Direction direction);
virtual void topLevelAnimationLoopChanged() {}
+ virtual void debugAnimation(QDebug d) const;
+
void fireTopLevelAnimationLoopChanged();
void setState(QAbstractAnimationJob::State state);
@@ -169,6 +171,7 @@ protected:
friend class QQmlAnimationTimer;
friend class QAnimationGroupJob;
+ friend QDebug operator<<(QDebug, const QAbstractAnimationJob *job);
};
class Q_QML_PRIVATE_EXPORT QAnimationJobChangeListener
@@ -237,6 +240,8 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractAnimationJob::ChangeTypes)
+QDebug operator<<(QDebug, const QAbstractAnimationJob *job);
+
QT_END_NAMESPACE
#endif // QABSTRACTANIMATIONJOB_P_H
diff --git a/src/qml/animations/qanimationgroupjob.cpp b/src/qml/animations/qanimationgroupjob.cpp
index afdf07639b..a8b1b28e3e 100644
--- a/src/qml/animations/qanimationgroupjob.cpp
+++ b/src/qml/animations/qanimationgroupjob.cpp
@@ -167,4 +167,16 @@ void QAnimationGroupJob::animationRemoved(QAbstractAnimationJob* anim, QAbstract
}
}
+void QAnimationGroupJob::debugChildren(QDebug d) const
+{
+ int indentLevel = 1;
+ const QAnimationGroupJob *group = this;
+ while ((group = group->m_group))
+ ++indentLevel;
+
+ QByteArray ind(indentLevel, ' ');
+ for (QAbstractAnimationJob *child = firstChild(); child; child = child->nextSibling())
+ d << "\n" << ind.constData() << child;
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h
index 0f62194656..45bf32fd36 100644
--- a/src/qml/animations/qanimationgroupjob_p.h
+++ b/src/qml/animations/qanimationgroupjob_p.h
@@ -76,6 +76,8 @@ protected:
int uncontrolledAnimationFinishTime(QAbstractAnimationJob *anim) const { return anim->m_uncontrolledFinishTime; }
void setUncontrolledAnimationFinishTime(QAbstractAnimationJob *anim, int time);
+ void debugChildren(QDebug d) const;
+
private:
//definition
QAbstractAnimationJob *m_firstChild;
diff --git a/src/qml/animations/qcontinuinganimationgroupjob.cpp b/src/qml/animations/qcontinuinganimationgroupjob.cpp
index 17ab071bf2..432ed8c692 100644
--- a/src/qml/animations/qcontinuinganimationgroupjob.cpp
+++ b/src/qml/animations/qcontinuinganimationgroupjob.cpp
@@ -121,5 +121,12 @@ void QContinuingAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimat
stop();
}
+void QContinuingAnimationGroupJob::debugAnimation(QDebug d) const
+{
+ d << "ContinuingAnimationGroupJob(" << hex << (void *) this << dec << ")";
+
+ debugChildren(d);
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qcontinuinganimationgroupjob_p.h b/src/qml/animations/qcontinuinganimationgroupjob_p.h
index 7578ab9709..c84ff3ca10 100644
--- a/src/qml/animations/qcontinuinganimationgroupjob_p.h
+++ b/src/qml/animations/qcontinuinganimationgroupjob_p.h
@@ -60,6 +60,7 @@ protected:
void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
void updateDirection(QAbstractAnimationJob::Direction direction);
void uncontrolledAnimationFinished(QAbstractAnimationJob *animation);
+ void debugAnimation(QDebug d) const;
};
QT_END_NAMESPACE
diff --git a/src/qml/animations/qparallelanimationgroupjob.cpp b/src/qml/animations/qparallelanimationgroupjob.cpp
index 85a8527c6b..80538432ef 100644
--- a/src/qml/animations/qparallelanimationgroupjob.cpp
+++ b/src/qml/animations/qparallelanimationgroupjob.cpp
@@ -232,5 +232,12 @@ void QParallelAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimatio
}
}
+void QParallelAnimationGroupJob::debugAnimation(QDebug d) const
+{
+ d << "ParallelAnimationGroupJob(" << hex << (void *) this << dec << ")";
+
+ debugChildren(d);
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qparallelanimationgroupjob_p.h b/src/qml/animations/qparallelanimationgroupjob_p.h
index 8e29402f33..8cad1c993f 100644
--- a/src/qml/animations/qparallelanimationgroupjob_p.h
+++ b/src/qml/animations/qparallelanimationgroupjob_p.h
@@ -60,6 +60,7 @@ protected:
void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
void updateDirection(QAbstractAnimationJob::Direction direction);
void uncontrolledAnimationFinished(QAbstractAnimationJob *animation);
+ void debugAnimation(QDebug d) const;
private:
bool shouldAnimationStart(QAbstractAnimationJob *animation, bool startIfAtEnd) const;
diff --git a/src/qml/animations/qpauseanimationjob.cpp b/src/qml/animations/qpauseanimationjob.cpp
index b6b081d39d..f185b12750 100644
--- a/src/qml/animations/qpauseanimationjob.cpp
+++ b/src/qml/animations/qpauseanimationjob.cpp
@@ -68,4 +68,9 @@ void QPauseAnimationJob::updateCurrentTime(int)
{
}
+void QPauseAnimationJob::debugAnimation(QDebug d) const
+{
+ d << "PauseAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << m_duration;
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qpauseanimationjob_p.h b/src/qml/animations/qpauseanimationjob_p.h
index f84143d9bf..a2ec71f373 100644
--- a/src/qml/animations/qpauseanimationjob_p.h
+++ b/src/qml/animations/qpauseanimationjob_p.h
@@ -58,6 +58,7 @@ public:
protected:
void updateCurrentTime(int);
+ void debugAnimation(QDebug d) const;
private:
//definition
diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp
index ec9b2ba906..135760b3cb 100644
--- a/src/qml/animations/qsequentialanimationgroupjob.cpp
+++ b/src/qml/animations/qsequentialanimationgroupjob.cpp
@@ -413,4 +413,11 @@ void QSequentialAnimationGroupJob::animationRemoved(QAbstractAnimationJob *anim,
m_totalCurrentTime = m_currentTime + m_loopCount * duration();
}
+void QSequentialAnimationGroupJob::debugAnimation(QDebug d) const
+{
+ d << "SequentialAnimationGroupJob(" << hex << (void *) this << dec << ")" << "currentAnimation:" << (void *)m_currentAnimation;
+
+ debugChildren(d);
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h
index 18dc6fcc7b..7d4b933bd5 100644
--- a/src/qml/animations/qsequentialanimationgroupjob_p.h
+++ b/src/qml/animations/qsequentialanimationgroupjob_p.h
@@ -63,6 +63,7 @@ protected:
void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
void updateDirection(QAbstractAnimationJob::Direction direction);
void uncontrolledAnimationFinished(QAbstractAnimationJob *animation);
+ void debugAnimation(QDebug d) const;
private:
struct AnimationIndex
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp
index e46eb77ce2..10d2176d0a 100644
--- a/src/quick/util/qquickanimation.cpp
+++ b/src/quick/util/qquickanimation.cpp
@@ -873,6 +873,19 @@ void QActionAnimation::updateState(State newState, State oldState)
}
}
+void QActionAnimation::debugAnimation(QDebug d) const
+{
+ d << "ActionAnimation(" << hex << (void *) this << dec << ")";
+
+ if (animAction) {
+ int indentLevel = 1;
+ const QAbstractAnimationJob *job = this;
+ while ((job = job->group()))
+ ++indentLevel;
+ animAction->debugAction(d, indentLevel);
+ }
+}
+
/*!
\qmltype ScriptAction
\instantiates QQuickScriptAction
@@ -957,6 +970,22 @@ QAbstractAnimationAction* QQuickScriptActionPrivate::createAction()
return new Proxy(this);
}
+void QQuickScriptActionPrivate::debugAction(QDebug d, int indentLevel) const
+{
+ QQmlScriptString scriptStr = hasRunScriptScript ? runScriptScript : script;
+
+ if (!scriptStr.isEmpty()) {
+ QQmlExpression expr(scriptStr);
+
+ QByteArray ind(indentLevel, ' ');
+ QString exprStr = expr.expression();
+ int endOfFirstLine = exprStr.indexOf('\n');
+ d << "\n" << ind.constData() << exprStr.left(endOfFirstLine);
+ if (endOfFirstLine != -1 && endOfFirstLine < exprStr.length())
+ d << "...";
+ }
+}
+
void QQuickScriptActionPrivate::execute()
{
Q_Q(QQuickScriptAction);
@@ -1170,6 +1199,14 @@ QAbstractAnimationJob* QQuickPropertyAction::transition(QQuickStateActions &acti
QQmlPropertyPrivate::write(action.property, action.toValue, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
}
}
+ virtual void debugAction(QDebug d, int indentLevel) const {
+ QByteArray ind(indentLevel, ' ');
+ for (int ii = 0; ii < actions.count(); ++ii) {
+ const QQuickStateAction &action = actions.at(ii);
+ d << "\n" << ind.constData() << "target:" << action.property.object() << "property:" << action.property.name()
+ << "value:" << action.toValue;
+ }
+ }
};
QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
@@ -1929,6 +1966,19 @@ void QQuickBulkValueAnimator::topLevelAnimationLoopChanged()
QAbstractAnimationJob::topLevelAnimationLoopChanged();
}
+void QQuickBulkValueAnimator::debugAnimation(QDebug d) const
+{
+ d << "BulkValueAnimation(" << hex << (void *) this << dec << ")" << "duration:" << duration();
+
+ if (animValue) {
+ int indentLevel = 1;
+ const QAbstractAnimationJob *job = this;
+ while ((job = job->group()))
+ ++indentLevel;
+ animValue->debugUpdater(d, indentLevel);
+ }
+}
+
/*!
\qmltype PropertyAnimation
\instantiates QQuickPropertyAnimation
@@ -2502,6 +2552,16 @@ void QQuickAnimationPropertyUpdater::setValue(qreal v)
fromSourced = true;
}
+void QQuickAnimationPropertyUpdater::debugUpdater(QDebug d, int indentLevel) const
+{
+ QByteArray ind(indentLevel, ' ');
+ for (int i = 0; i < actions.count(); ++i) {
+ const QQuickStateAction &action = actions.at(i);
+ d << "\n" << ind.constData() << "target:" << action.property.object() << "property:" << action.property.name()
+ << "from:" << action.fromValue << "to:" << action.toValue;
+ }
+}
+
QQuickStateActions QQuickPropertyAnimation::createTransitionActions(QQuickStateActions &actions,
QQmlProperties &modified,
QObject *defaultTarget)
diff --git a/src/quick/util/qquickanimation_p_p.h b/src/quick/util/qquickanimation_p_p.h
index 127f447e5d..f2b5f6388f 100644
--- a/src/quick/util/qquickanimation_p_p.h
+++ b/src/quick/util/qquickanimation_p_p.h
@@ -79,18 +79,19 @@ class QAbstractAnimationAction
public:
virtual ~QAbstractAnimationAction() {}
virtual void doAction() = 0;
+ virtual void debugAction(QDebug, int) const {}
};
//templated animation action
//allows us to specify an action that calls a function of a class.
//(so that class doesn't have to inherit QQuickAbstractAnimationAction)
-template<class T, void (T::*method)()>
+template<class T, void (T::*method)(), void (T::*debugMethod)(QDebug, int) const>
class QAnimationActionProxy : public QAbstractAnimationAction
{
public:
QAnimationActionProxy(T *instance) : m_instance(instance) {}
virtual void doAction() { (m_instance->*method)(); }
-
+ virtual void debugAction(QDebug d, int indentLevel) const { (m_instance->*debugMethod)(d, indentLevel); }
private:
T *m_instance;
};
@@ -111,6 +112,7 @@ public:
protected:
virtual void updateCurrentTime(int);
virtual void updateState(State newState, State oldState);
+ void debugAnimation(QDebug d) const;
private:
QAbstractAnimationAction *animAction;
@@ -121,6 +123,7 @@ class QQuickBulkValueUpdater
public:
virtual ~QQuickBulkValueUpdater() {}
virtual void setValue(qreal value) = 0;
+ virtual void debugUpdater(QDebug, int) const {}
};
//animates QQuickBulkValueUpdater (assumes start and end values will be reals or compatible)
@@ -145,6 +148,7 @@ public:
protected:
void updateCurrentTime(int currentTime);
void topLevelAnimationLoopChanged();
+ void debugAnimation(QDebug d) const;
private:
QQuickBulkValueUpdater *animValue;
@@ -224,8 +228,10 @@ public:
void execute();
QAbstractAnimationAction* createAction();
+ void debugAction(QDebug d, int indentLevel) const;
typedef QAnimationActionProxy<QQuickScriptActionPrivate,
- &QQuickScriptActionPrivate::execute> Proxy;
+ &QQuickScriptActionPrivate::execute,
+ &QQuickScriptActionPrivate::debugAction> Proxy;
};
class QQuickPropertyActionPrivate : public QQuickAbstractAnimationPrivate
@@ -307,6 +313,8 @@ public:
void setValue(qreal v);
+ void debugUpdater(QDebug d, int indentLevel) const;
+
QQuickStateActions actions;
int interpolatorType; //for Number/ColorAnimation
QVariantAnimation::Interpolator interpolator;
diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp
index a0e6c36830..a23f7a5df6 100644
--- a/src/quick/util/qquicksmoothedanimation.cpp
+++ b/src/quick/util/qquicksmoothedanimation.cpp
@@ -313,6 +313,13 @@ void QSmoothedAnimation::init()
}
}
+void QSmoothedAnimation::debugAnimation(QDebug d) const
+{
+ d << "SmoothedAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << userDuration
+ << "velocity:" << velocity << "target:" << target.object() << "property:" << target.name()
+ << "to:" << to << "current velocity:" << trackVelocity;
+}
+
/*!
\qmltype SmoothedAnimation
\instantiates QQuickSmoothedAnimation
diff --git a/src/quick/util/qquicksmoothedanimation_p_p.h b/src/quick/util/qquicksmoothedanimation_p_p.h
index 7835d0328b..3c85f09b04 100644
--- a/src/quick/util/qquicksmoothedanimation_p_p.h
+++ b/src/quick/util/qquicksmoothedanimation_p_p.h
@@ -105,6 +105,7 @@ public:
protected:
virtual void updateCurrentTime(int);
virtual void updateState(QAbstractAnimationJob::State, QAbstractAnimationJob::State);
+ void debugAnimation(QDebug d) const;
private:
qreal easeFollow(qreal);
diff --git a/src/quick/util/qquickspringanimation.cpp b/src/quick/util/qquickspringanimation.cpp
index f237c09bf9..4b1abcef8c 100644
--- a/src/quick/util/qquickspringanimation.cpp
+++ b/src/quick/util/qquickspringanimation.cpp
@@ -101,6 +101,7 @@ public:
protected:
virtual void updateCurrentTime(int time);
virtual void updateState(QAbstractAnimationJob::State, QAbstractAnimationJob::State);
+ void debugAnimation(QDebug d) const;
private:
QQuickSpringAnimationPrivate *animationTemplate;
@@ -320,6 +321,15 @@ void QSpringAnimation::updateState(QAbstractAnimationJob::State newState, QAbstr
init();
}
+void QSpringAnimation::debugAnimation(QDebug d) const
+{
+ d << "SpringAnimationJob(" << hex << (void *) this << dec << ")" << "velocity:" << maxVelocity
+ << "spring:" << spring << "damping:" << damping << "epsilon:" << epsilon << "modulus:" << modulus
+ << "mass:" << mass << "target:" << target.object() << "property:" << target.name()
+ << "to:" << to << "current velocity:" << velocity;
+}
+
+
void QQuickSpringAnimationPrivate::updateMode()
{
if (spring == 0. && maxVelocity == 0.)
diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp
index 94e1f30215..f9928c4d00 100644
--- a/src/quick/util/qquicktimeline.cpp
+++ b/src/quick/util/qquicktimeline.cpp
@@ -723,6 +723,11 @@ void QQuickTimeLine::updateCurrentTime(int v)
}
}
+void QQuickTimeLine::debugAnimation(QDebug d) const
+{
+ d << "QuickTimeLine(" << hex << (void *) this << dec << ")";
+}
+
bool operator<(const QPair<int, Update> &lhs,
const QPair<int, Update> &rhs)
{
diff --git a/src/quick/util/qquicktimeline_p_p.h b/src/quick/util/qquicktimeline_p_p.h
index a99a515f0a..0172ecbfcf 100644
--- a/src/quick/util/qquicktimeline_p_p.h
+++ b/src/quick/util/qquicktimeline_p_p.h
@@ -109,6 +109,7 @@ Q_SIGNALS:
protected:
virtual void updateCurrentTime(int);
+ void debugAnimation(QDebug d) const;
private:
void remove(QQuickTimeLineObject *);