diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-04-27 02:49:18 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-04-27 02:49:18 (GMT) |
commit | ecf0a1937d81e047e25ac551703a77f75767d881 (patch) | |
tree | c89fe2890d96fd65713951403c28714c5ab48f05 /src/declarative/timeline | |
parent | f1326b02c582b5044b8a2f491eed649020846111 (diff) | |
download | Qt-ecf0a1937d81e047e25ac551703a77f75767d881.zip Qt-ecf0a1937d81e047e25ac551703a77f75767d881.tar.gz Qt-ecf0a1937d81e047e25ac551703a77f75767d881.tar.bz2 |
Rename GfxValue to QmlTimeLineValue.
Diffstat (limited to 'src/declarative/timeline')
-rw-r--r-- | src/declarative/timeline/qmltimeline.cpp | 140 | ||||
-rw-r--r-- | src/declarative/timeline/qmltimeline.h | 30 | ||||
-rw-r--r-- | src/declarative/timeline/qmltimelinevalueproxy.h (renamed from src/declarative/timeline/gfxvalueproxy.h) | 18 | ||||
-rw-r--r-- | src/declarative/timeline/timeline.pri | 2 |
4 files changed, 95 insertions, 95 deletions
diff --git a/src/declarative/timeline/qmltimeline.cpp b/src/declarative/timeline/qmltimeline.cpp index 7cbb3ce..fc901eb 100644 --- a/src/declarative/timeline/qmltimeline.cpp +++ b/src/declarative/timeline/qmltimeline.cpp @@ -56,12 +56,12 @@ QT_BEGIN_NAMESPACE // struct Update { - Update(GfxValue *_g, qreal _v) + Update(QmlTimeLineValue *_g, qreal _v) : g(_g), v(_v) {} Update(const QmlTimeLineEvent &_e) : g(0), v(0), e(_e) {} - GfxValue *g; + QmlTimeLineValue *g; qreal v; QmlTimeLineEvent e; }; @@ -142,7 +142,7 @@ QmlTimeLinePrivate::QmlTimeLinePrivate(QmlTimeLine *parent) void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o) { if(g._t && g._t != q) { - qWarning() << "QmlTimeLine: Cannot modify a GfxValue owned by" + qWarning() << "QmlTimeLine: Cannot modify a QmlTimeLineValue owned by" << "another timeline."; return; } @@ -263,22 +263,22 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change QmlTimeLine is similar to QTimeLine except: \list - \i It updates GfxValue instances directly, rather than maintaining a single + \i It updates QmlTimeLineValue instances directly, rather than maintaining a single current value. For example, the following animates a simple value over 200 milliseconds: \code - GfxValue v(<starting value>); + QmlTimeLineValue v(<starting value>); QmlTimeLine tl; tl.move(v, 100., 200); tl.start() \endcode If your program needs to know when values are changed, it can either - connect to the QmlTimeLine's updated() signal, or inherit from GfxValue - and reimplement the GfxValue::setValue() method. + connect to the QmlTimeLine's updated() signal, or inherit from QmlTimeLineValue + and reimplement the QmlTimeLineValue::setValue() method. - \i Supports multiple GfxValue, arbitrary start and end values and allows + \i Supports multiple QmlTimeLineValue, arbitrary start and end values and allows animations to be strung together for more complex effects. For example, the following animation moves the x and y coordinates of @@ -287,8 +287,8 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change milliseconds: \code - GfxValue x(<starting value>); - GfxValue y(<starting value>); + QmlTimeLineValue x(<starting value>); + QmlTimeLineValue y(<starting value>); QmlTimeLine tl; tl.start(); @@ -355,7 +355,7 @@ void QmlTimeLine::setSyncMode(SyncMode syncMode) } /*! - Pause \a gfxValue for \a time milliseconds. + Pause \a obj for \a time milliseconds. */ void QmlTimeLine::pause(QmlTimeLineObject &obj, int time) { @@ -374,21 +374,21 @@ void QmlTimeLine::execute(const QmlTimeLineEvent &event) } /*! - Set the \a value of \a gfxValue. + Set the \a value of \a timeLineValue. */ -void QmlTimeLine::set(GfxValue &gfxValue, qreal value) +void QmlTimeLine::set(QmlTimeLineValue &timeLineValue, qreal value) { QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Set, 0, value, 0., d->order++); - d->add(gfxValue, op); + d->add(timeLineValue, op); } /*! - Decelerate \a gfxValue from the starting \a velocity to zero at the + Decelerate \a timeLineValue from the starting \a velocity to zero at the given \a acceleration rate. Although the \a acceleration is technically a deceleration, it should always be positive. The QmlTimeLine will ensure that the deceleration is in the opposite direction to the initial velocity. */ -int QmlTimeLine::accel(GfxValue &gfxValue, qreal velocity, qreal acceleration) +int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal acceleration) { if((velocity > 0.0f) == (acceleration > 0.0f)) acceleration = acceleration * -1.0f; @@ -396,7 +396,7 @@ int QmlTimeLine::accel(GfxValue &gfxValue, qreal velocity, qreal acceleration) int time = static_cast<int>(-1000 * velocity / acceleration); QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Accel, time, velocity, acceleration, d->order++); - d->add(gfxValue, op); + d->add(timeLineValue, op); return time; } @@ -404,14 +404,14 @@ int QmlTimeLine::accel(GfxValue &gfxValue, qreal velocity, qreal acceleration) /*! \overload - Decelerate \a gfxValue from the starting \a velocity to zero at the + Decelerate \a timeLineValue from the starting \a velocity to zero at the given \a acceleration rate over a maximum distance of maxDistance. If necessary, QmlTimeLine will reduce the acceleration to ensure that the entire operation does not require a move of more than \a maxDistance. \a maxDistance should always be positive. */ -int QmlTimeLine::accel(GfxValue &gfxValue, qreal velocity, qreal acceleration, qreal maxDistance) +int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal acceleration, qreal maxDistance) { Q_ASSERT(acceleration >= 0.0f && maxDistance >= 0.0f); @@ -425,19 +425,19 @@ int QmlTimeLine::accel(GfxValue &gfxValue, qreal velocity, qreal acceleration, q int time = static_cast<int>(-1000 * velocity / acceleration); QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Accel, time, velocity, acceleration, d->order++); - d->add(gfxValue, op); + d->add(timeLineValue, op); return time; } /*! - Decelerate \a gfxValue from the starting \a velocity to zero over the given + Decelerate \a timeLineValue from the starting \a velocity to zero over the given \a distance. This is like accel(), but the QmlTimeLine calculates the exact deceleration to use. \a distance should be positive. */ -int QmlTimeLine::accelDistance(GfxValue &gfxValue, qreal velocity, qreal distance) +int QmlTimeLine::accelDistance(QmlTimeLineValue &timeLineValue, qreal velocity, qreal distance) { if (distance == 0.0f || velocity == 0.0f) return -1; @@ -446,68 +446,68 @@ int QmlTimeLine::accelDistance(GfxValue &gfxValue, qreal velocity, qreal distanc int time = static_cast<int>(1000 * (2.0f * distance) / velocity); QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::AccelDistance, time, velocity, distance, d->order++); - d->add(gfxValue, op); + d->add(timeLineValue, op); return time; } /*! - Linearly change the \a gfxValue from its current value to the given + Linearly change the \a timeLineValue from its current value to the given \a destination value over \a time milliseconds. */ -void QmlTimeLine::move(GfxValue &gfxValue, qreal destination, int time) +void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, int time) { if(time <= 0) return; QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++); - d->add(gfxValue, op); + d->add(timeLineValue, op); } /*! - Change the \a gfxValue from its current value to the given \a destination + Change the \a timeLineValue from its current value to the given \a destination value over \a time milliseconds using the \a easing curve. */ -void QmlTimeLine::move(GfxValue &gfxValue, qreal destination, const QEasingCurve &easing, int time) +void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, const QEasingCurve &easing, int time) { if(time <= 0) return; QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++, QmlTimeLineEvent(), easing); - d->add(gfxValue, op); + d->add(timeLineValue, op); } /*! - Linearly change the \a gfxValue from its current value by the \a change amount + Linearly change the \a timeLineValue from its current value by the \a change amount over \a time milliseconds. */ -void QmlTimeLine::moveBy(GfxValue &gfxValue, qreal change, int time) +void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, int time) { if(time <= 0) return; QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++); - d->add(gfxValue, op); + d->add(timeLineValue, op); } /*! - Change the \a gfxValue from its current value by the \a change amount over + Change the \a timeLineValue from its current value by the \a change amount over \a time milliseconds using the \a easing curve. */ -void QmlTimeLine::moveBy(GfxValue &gfxValue, qreal change, const QEasingCurve &easing, int time) +void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, const QEasingCurve &easing, int time) { if(time <= 0) return; QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++, QmlTimeLineEvent(), easing); - d->add(gfxValue, op); + d->add(timeLineValue, op); } /*! - Cancel (but don't complete) all scheduled actions for \a gfxValue. + Cancel (but don't complete) all scheduled actions for \a timeLineValue. */ -void QmlTimeLine::reset(GfxValue &gfxValue) +void QmlTimeLine::reset(QmlTimeLineValue &timeLineValue) { - if(!gfxValue._t) + if(!timeLineValue._t) return; - if(gfxValue._t != this) { - qWarning() << "QmlTimeLine: Cannot reset a GfxValue owned by another timeline."; + if(timeLineValue._t != this) { + qWarning() << "QmlTimeLine: Cannot reset a QmlTimeLineValue owned by another timeline."; return; } - remove(&gfxValue); - gfxValue._t = 0; + remove(&timeLineValue); + timeLineValue._t = 0; } int QmlTimeLine::duration() const @@ -516,48 +516,48 @@ int QmlTimeLine::duration() const } /*! - Synchronize the end point of \a gfxValue to the endpoint of \a syncTo + Synchronize the end point of \a timeLineValue to the endpoint of \a syncTo within this timeline. - Following operations on \a gfxValue in this timeline will be scheduled after + Following operations on \a timeLineValue in this timeline will be scheduled after all the currently scheduled actions on \a syncTo are complete. In psuedo-code this is equivalent to: \code - QmlTimeLine::pause(gfxValue, min(0, length_of(syncTo) - length_of(gfxValue))) + QmlTimeLine::pause(timeLineValue, min(0, length_of(syncTo) - length_of(timeLineValue))) \endcode */ -void QmlTimeLine::sync(GfxValue &gfxValue, GfxValue &syncTo) +void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue, QmlTimeLineValue &syncTo) { QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(&syncTo); if(iter == d->ops.end()) return; int length = iter->length; - iter = d->ops.find(&gfxValue); + iter = d->ops.find(&timeLineValue); if(iter == d->ops.end()) { - pause(gfxValue, length); + pause(timeLineValue, length); } else { int glength = iter->length; - pause(gfxValue, length - glength); + pause(timeLineValue, length - glength); } } /*! - Synchronize the end point of \a gfxValue to the endpoint of the longest - action currently scheduled in the timeline. + Synchronize the end point of \a timeLineValue to the endpoint of the longest + action cursrently scheduled in the timeline. In psuedo-code, this is equivalent to: \code - QmlTimeLine::pause(gfxValue, length_of(timeline) - length_of(gfxValue)) + QmlTimeLine::pause(timeLineValue, length_of(timeline) - length_of(timeLineValue)) \endcode */ -void QmlTimeLine::sync(GfxValue &gfxValue) +void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue) { - QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(&gfxValue); + QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(&timeLineValue); if(iter == d->ops.end()) { - pause(gfxValue, d->length); + pause(timeLineValue, d->length); } else { - pause(gfxValue, d->length - iter->length); + pause(timeLineValue, d->length - iter->length); } } @@ -620,7 +620,7 @@ int QmlTimeLine::syncPoint() const /*! Returns true if the timeline is active. An active timeline is one where - GfxValue actions are still pending. + QmlTimeLineValue actions are still pending. */ bool QmlTimeLine::isActive() const { @@ -630,7 +630,7 @@ bool QmlTimeLine::isActive() const /*! Completes the timeline. All queued actions are played to completion, and then discarded. For example, \code - GfxValue v(0.); + QmlTimeLineValue v(0.); QmlTimeLine tl; tl.move(v, 100., 1000.); // 500 ms passes @@ -645,9 +645,9 @@ void QmlTimeLine::complete() } /*! - Resets the timeline. All queued actions are discarded and GfxValue's retain their current value. For example, + Resets the timeline. All queued actions are discarded and QmlTimeLineValue's retain their current value. For example, \code - GfxValue v(0.); + QmlTimeLineValue v(0.); QmlTimeLine tl; tl.move(v, 100., 1000.); // 500 ms passes @@ -674,8 +674,8 @@ int QmlTimeLine::time() const /*! \fn void QmlTimeLine::updated() - Emitted each time the timeline modifies GfxValues. Even if multiple - GfxValues are changed, this signal is only emitted once for each clock tick. + Emitted each time the timeline modifies QmlTimeLineValues. Even if multiple + QmlTimeLineValues are changed, this signal is only emitted once for each clock tick. */ void QmlTimeLine::updateCurrentTime(int v) @@ -747,7 +747,7 @@ int QmlTimeLinePrivate::advance(int t) QList<QPair<int, Update> > updates; for(Ops::Iterator iter = ops.begin(); iter != ops.end(); ) { - GfxValue *v = static_cast<GfxValue *>(iter.key()); + QmlTimeLineValue *v = static_cast<QmlTimeLineValue *>(iter.key()); TimeLine &tl = *iter; Q_ASSERT(!tl.ops.isEmpty()); @@ -868,31 +868,31 @@ void QmlTimeLine::remove(QmlTimeLineObject *v) } /*! - \class GfxValue + \class QmlTimeLineValue \ingroup group_animation - \brief The GfxValue class is modified by QmlTimeLine. + \brief The QmlTimeLineValue class is modified by QmlTimeLine. */ /*! - \fn GfxValue::GfxValue(qreal value = 0) + \fn QmlTimeLineValue::QmlTimeLineValue(qreal value = 0) - Construct a new GfxValue with an initial \a value. + Construct a new QmlTimeLineValue with an initial \a value. */ /*! - \fn qreal GfxValue::value() const + \fn qreal QmlTimeLineValue::value() const Return the current value. */ /*! - \fn void GfxValue::setValue(qreal value) + \fn void QmlTimeLineValue::setValue(qreal value) Set the current \a value. */ /*! - \fn QmlTimeLine *GfxValue::timeLine() const + \fn QmlTimeLine *QmlTimeLineValue::timeLine() const If a QmlTimeLine is operating on this value, return a pointer to it, otherwise return null. diff --git a/src/declarative/timeline/qmltimeline.h b/src/declarative/timeline/qmltimeline.h index 603669c..ce9d1f2 100644 --- a/src/declarative/timeline/qmltimeline.h +++ b/src/declarative/timeline/qmltimeline.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QEasingCurve; -class GfxValue; +class QmlTimeLineValue; class QmlTimeLineEvent; struct QmlTimeLinePrivate; class QmlTimeLineObject; @@ -70,25 +70,25 @@ public: void pause(QmlTimeLineObject &, int); void execute(const QmlTimeLineEvent &); - void set(GfxValue &, qreal); + void set(QmlTimeLineValue &, qreal); - int accel(GfxValue &, qreal velocity, qreal accel); - int accel(GfxValue &, qreal velocity, qreal accel, qreal maxDistance); - int accelDistance(GfxValue &, qreal velocity, qreal distance); + int accel(QmlTimeLineValue &, qreal velocity, qreal accel); + int accel(QmlTimeLineValue &, qreal velocity, qreal accel, qreal maxDistance); + int accelDistance(QmlTimeLineValue &, qreal velocity, qreal distance); - void move(GfxValue &, qreal destination, int time = 500); - void move(GfxValue &, qreal destination, const QEasingCurve &, int time = 500); - void moveBy(GfxValue &, qreal change, int time = 500); - void moveBy(GfxValue &, qreal change, const QEasingCurve &, int time = 500); + void move(QmlTimeLineValue &, qreal destination, int time = 500); + void move(QmlTimeLineValue &, qreal destination, const QEasingCurve &, int time = 500); + void moveBy(QmlTimeLineValue &, qreal change, int time = 500); + void moveBy(QmlTimeLineValue &, qreal change, const QEasingCurve &, int time = 500); void sync(); void setSyncPoint(int); int syncPoint() const; - void sync(GfxValue &); - void sync(GfxValue &, GfxValue &); + void sync(QmlTimeLineValue &); + void sync(QmlTimeLineValue &, QmlTimeLineValue &); - void reset(GfxValue &); + void reset(QmlTimeLineValue &); void complete(); void clear(); @@ -123,10 +123,10 @@ protected: QmlTimeLine *_t; }; -class Q_DECLARATIVE_EXPORT GfxValue : public QmlTimeLineObject +class Q_DECLARATIVE_EXPORT QmlTimeLineValue : public QmlTimeLineObject { public: - GfxValue(qreal v = 0.) : _v(v) {} + QmlTimeLineValue(qreal v = 0.) : _v(v) {} qreal value() const { return _v; } virtual void setValue(qreal v) { _v = v; } @@ -134,7 +134,7 @@ public: QmlTimeLine *timeLine() const { return _t; } operator qreal() const { return _v; } - GfxValue &operator=(qreal v) { setValue(v); return *this; } + QmlTimeLineValue &operator=(qreal v) { setValue(v); return *this; } private: friend class QmlTimeLine; friend struct QmlTimeLinePrivate; diff --git a/src/declarative/timeline/gfxvalueproxy.h b/src/declarative/timeline/qmltimelinevalueproxy.h index 1bb716c..add45dd 100644 --- a/src/declarative/timeline/gfxvalueproxy.h +++ b/src/declarative/timeline/qmltimelinevalueproxy.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef GFXVALUEPROXY_H -#define GFXVALUEPROXY_H +#ifndef QMLTIMELINEVALUEPROXY_H +#define QMLTIMELINEVALUEPROXY_H #include "qmltimeline.h" @@ -51,24 +51,24 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) template<class T> -class GfxValueProxy : public GfxValue +class QmlTimeLineValueProxy : public QmlTimeLineValue { public: - GfxValueProxy(T *cls, void (T::*func)(qreal), qreal v = 0.) - : GfxValue(v), _class(cls), _setFunctionReal(func), _setFunctionInt(0) + QmlTimeLineValueProxy(T *cls, void (T::*func)(qreal), qreal v = 0.) + : QmlTimeLineValue(v), _class(cls), _setFunctionReal(func), _setFunctionInt(0) { Q_ASSERT(_class); } - GfxValueProxy(T *cls, void (T::*func)(int), qreal v = 0.) - : GfxValue(v), _class(cls), _setFunctionReal(0), _setFunctionInt(func) + QmlTimeLineValueProxy(T *cls, void (T::*func)(int), qreal v = 0.) + : QmlTimeLineValue(v), _class(cls), _setFunctionReal(0), _setFunctionInt(func) { Q_ASSERT(_class); } virtual void setValue(qreal v) { - GfxValue::setValue(v); + QmlTimeLineValue::setValue(v); if(_setFunctionReal) (_class->*_setFunctionReal)(v); else if(_setFunctionInt) (_class->*_setFunctionInt)((int)v); } @@ -83,4 +83,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif//GFXVALUEPROXY +#endif//QMLTIMELINEVALUEPROXY_H diff --git a/src/declarative/timeline/timeline.pri b/src/declarative/timeline/timeline.pri index 0a0875c..a7b3cb9 100644 --- a/src/declarative/timeline/timeline.pri +++ b/src/declarative/timeline/timeline.pri @@ -3,5 +3,5 @@ SOURCES += \ HEADERS += \ timeline/qmltimeline.h \ - timeline/gfxvalueproxy.h \ + timeline/qmltimelinevalueproxy.h \ |