summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-02-26 02:38:57 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-02-26 02:40:06 (GMT)
commitb5700759da7bccf0ccd6e20b1727950532894ad2 (patch)
treead92537f4089dbcb6cb66202b14ab1d63aa5277d
parent4d4ca01e59a151494e76d150ef8ad3fdab8aeea1 (diff)
downloadQt-b5700759da7bccf0ccd6e20b1727950532894ad2.zip
Qt-b5700759da7bccf0ccd6e20b1727950532894ad2.tar.gz
Qt-b5700759da7bccf0ccd6e20b1727950532894ad2.tar.bz2
Some animation cleanup/refactoring.
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp11
-rw-r--r--src/declarative/util/qdeclarativeanimation_p_p.h21
2 files changed, 20 insertions, 12 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 8af8fc2..6dc91de 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -1567,7 +1567,8 @@ QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(QObject *parent
QDeclarativeAnimationGroup(parent)
{
Q_D(QDeclarativeAnimationGroup);
- d->ag = new QSequentialAnimationGroup(this);
+ d->ag = new QSequentialAnimationGroup;
+ QDeclarativeGraphics_setParent_noEvent(d->ag, this);
}
QDeclarativeSequentialAnimation::~QDeclarativeSequentialAnimation()
@@ -1632,7 +1633,8 @@ QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) :
QDeclarativeAnimationGroup(parent)
{
Q_D(QDeclarativeAnimationGroup);
- d->ag = new QParallelAnimationGroup(this);
+ d->ag = new QParallelAnimationGroup;
+ QDeclarativeGraphics_setParent_noEvent(d->ag, this);
}
QDeclarativeParallelAnimation::~QDeclarativeParallelAnimation()
@@ -1791,7 +1793,7 @@ QDeclarativePropertyAnimation::~QDeclarativePropertyAnimation()
void QDeclarativePropertyAnimationPrivate::init()
{
Q_Q(QDeclarativePropertyAnimation);
- va = new QDeclarativeTimeLineValueAnimator;
+ va = new QDeclarativeBulkValueAnimator;
QDeclarativeGraphics_setParent_noEvent(va, q);
}
@@ -2207,7 +2209,7 @@ QAbstractAnimation *QDeclarativePropertyAnimation::qtAnimation()
return d->va;
}
-struct PropertyUpdater : public QDeclarativeTimeLineValue
+struct PropertyUpdater : public QDeclarativeBulkValueUpdater
{
QDeclarativeStateActions actions;
int interpolatorType; //for Number/ColorAnimation
@@ -2225,7 +2227,6 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue
wasDeleted = &deleted;
if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1
v = 1 - v;
- QDeclarativeTimeLineValue::setValue(v);
for (int ii = 0; ii < actions.count(); ++ii) {
QDeclarativeAction &action = actions[ii];
diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h
index e582066..ae82a90 100644
--- a/src/declarative/util/qdeclarativeanimation_p_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p_p.h
@@ -149,14 +149,21 @@ private:
bool running;
};
-//animates QDeclarativeTimeLineValue (assumes start and end values will be reals or compatible)
-class QDeclarativeTimeLineValueAnimator : public QVariantAnimation
+class QDeclarativeBulkValueUpdater
+{
+public:
+ virtual ~QDeclarativeBulkValueUpdater() {}
+ virtual void setValue(qreal value) = 0;
+};
+
+//animates QDeclarativeBulkValueUpdater (assumes start and end values will be reals or compatible)
+class QDeclarativeBulkValueAnimator : public QVariantAnimation
{
Q_OBJECT
public:
- QDeclarativeTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {}
- ~QDeclarativeTimeLineValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } }
- void setAnimValue(QDeclarativeTimeLineValue *value, DeletionPolicy p)
+ QDeclarativeBulkValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {}
+ ~QDeclarativeBulkValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } }
+ void setAnimValue(QDeclarativeBulkValueUpdater *value, DeletionPolicy p)
{
if (state() == Running)
stop();
@@ -193,7 +200,7 @@ protected:
}
private:
- QDeclarativeTimeLineValue *animValue;
+ QDeclarativeBulkValueUpdater *animValue;
bool *fromSourced;
DeletionPolicy policy;
};
@@ -352,7 +359,7 @@ public:
int interpolatorType;
QVariantAnimation::Interpolator interpolator;
- QDeclarativeTimeLineValueAnimator *va;
+ QDeclarativeBulkValueAnimator *va;
static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress);
static void convertVariant(QVariant &variant, int type);