aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickanimation.cpp
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/quick/util/qquickanimation.cpp
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/quick/util/qquickanimation.cpp')
-rw-r--r--src/quick/util/qquickanimation.cpp60
1 files changed, 60 insertions, 0 deletions
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)