diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-06-03 08:06:20 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-06-03 08:06:20 (GMT) |
commit | 66c24c2efad5c8784b92a7b9872d2732ebd8a446 (patch) | |
tree | 0e2010da243422ffabd0f7d1f9601d62b6d39ab0 /src/declarative/util | |
parent | 26d65a844b20a0056820c15188532b3895a3e091 (diff) | |
download | Qt-66c24c2efad5c8784b92a7b9872d2732ebd8a446.zip Qt-66c24c2efad5c8784b92a7b9872d2732ebd8a446.tar.gz Qt-66c24c2efad5c8784b92a7b9872d2732ebd8a446.tar.bz2 |
Add more Q_AUTOTEST_EXPORTs
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qdeclarativeanimation.cpp | 73 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativeanimation_p.h | 2 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativeanimation_p_p.h | 20 |
3 files changed, 49 insertions, 46 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 0eae136..1447532 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2132,52 +2132,39 @@ QAbstractAnimation *QDeclarativePropertyAnimation::qtAnimation() return d->va; } -struct PropertyUpdater : public QDeclarativeBulkValueUpdater +void QDeclarativeAnimationPropertyUpdater::setValue(qreal v) { - QDeclarativeStateActions actions; - int interpolatorType; //for Number/ColorAnimation - int prevInterpolatorType; //for generic - QVariantAnimation::Interpolator interpolator; - bool reverse; - bool fromSourced; - bool fromDefined; - bool *wasDeleted; - PropertyUpdater() : prevInterpolatorType(0), wasDeleted(0) {} - ~PropertyUpdater() { if (wasDeleted) *wasDeleted = true; } - void setValue(qreal v) - { - bool deleted = false; - wasDeleted = &deleted; - if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1 - v = 1 - v; - for (int ii = 0; ii < actions.count(); ++ii) { - QDeclarativeAction &action = actions[ii]; - - if (v == 1.) - QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); - else { - if (!fromSourced && !fromDefined) { - action.fromValue = action.property.read(); - if (interpolatorType) - QDeclarativePropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType); - } - if (!interpolatorType) { - int propType = action.property.propertyType(); - if (!prevInterpolatorType || prevInterpolatorType != propType) { - prevInterpolatorType = propType; - interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType); - } + bool deleted = false; + wasDeleted = &deleted; + if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1 + v = 1 - v; + for (int ii = 0; ii < actions.count(); ++ii) { + QDeclarativeAction &action = actions[ii]; + + if (v == 1.) + QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + else { + if (!fromSourced && !fromDefined) { + action.fromValue = action.property.read(); + if (interpolatorType) + QDeclarativePropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType); + } + if (!interpolatorType) { + int propType = action.property.propertyType(); + if (!prevInterpolatorType || prevInterpolatorType != propType) { + prevInterpolatorType = propType; + interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType); } - if (interpolator) - QDeclarativePropertyPrivate::write(action.property, interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } - if (deleted) - return; + if (interpolator) + QDeclarativePropertyPrivate::write(action.property, interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } - wasDeleted = 0; - fromSourced = true; + if (deleted) + return; } -}; + wasDeleted = 0; + fromSourced = true; +} void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, @@ -2207,7 +2194,7 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions props << d->defaultProperties.split(QLatin1Char(',')); } - PropertyUpdater *data = new PropertyUpdater; + QDeclarativeAnimationPropertyUpdater *data = new QDeclarativeAnimationPropertyUpdater; data->interpolatorType = d->interpolatorType; data->interpolator = d->interpolator; data->reverse = direction == Backward ? true : false; @@ -2786,7 +2773,7 @@ void QDeclarativeAnchorAnimation::transition(QDeclarativeStateActions &actions, { Q_UNUSED(modified); Q_D(QDeclarativeAnchorAnimation); - PropertyUpdater *data = new PropertyUpdater; + QDeclarativeAnimationPropertyUpdater *data = new QDeclarativeAnimationPropertyUpdater; data->interpolatorType = QMetaType::QReal; data->interpolator = d->interpolator; diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h index e7cd8a8..3f8fbdd 100644 --- a/src/declarative/util/qdeclarativeanimation_p.h +++ b/src/declarative/util/qdeclarativeanimation_p.h @@ -384,7 +384,7 @@ Q_SIGNALS: }; class QDeclarativeAnimationGroupPrivate; -class QDeclarativeAnimationGroup : public QDeclarativeAbstractAnimation +class Q_AUTOTEST_EXPORT QDeclarativeAnimationGroup : public QDeclarativeAbstractAnimation { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeAnimationGroup) diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index 3b0f52e..b6d6bbb 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -96,7 +96,7 @@ private: }; //performs an action of type QAbstractAnimationAction -class QActionAnimation : public QAbstractAnimation +class Q_AUTOTEST_EXPORT QActionAnimation : public QAbstractAnimation { Q_OBJECT public: @@ -143,7 +143,7 @@ public: }; //animates QDeclarativeBulkValueUpdater (assumes start and end values will be reals or compatible) -class QDeclarativeBulkValueAnimator : public QVariantAnimation +class Q_AUTOTEST_EXPORT QDeclarativeBulkValueAnimator : public QVariantAnimation { Q_OBJECT public: @@ -378,6 +378,22 @@ public: QList<QDeclarativeItem*> targets; }; +class Q_AUTOTEST_EXPORT QDeclarativeAnimationPropertyUpdater : public QDeclarativeBulkValueUpdater +{ +public: + QDeclarativeStateActions actions; + int interpolatorType; //for Number/ColorAnimation + int prevInterpolatorType; //for generic + QVariantAnimation::Interpolator interpolator; + bool reverse; + bool fromSourced; + bool fromDefined; + bool *wasDeleted; + QDeclarativeAnimationPropertyUpdater() : prevInterpolatorType(0), wasDeleted(0) {} + ~QDeclarativeAnimationPropertyUpdater() { if (wasDeleted) *wasDeleted = true; } + void setValue(qreal v); +}; + QT_END_NAMESPACE #endif // QDECLARATIVEANIMATION_P_H |