diff --git a/animations/abstractanimation.cpp b/animations/abstractanimation.cpp index 20917a6fa..5fb9baa5b 100644 --- a/animations/abstractanimation.cpp +++ b/animations/abstractanimation.cpp @@ -28,8 +28,8 @@ namespace Plasma { AbstractAnimationPrivate::AbstractAnimationPrivate() - : easingCurve(QEasingCurve::Linear), - animVisible(true), + : animVisible(true), + easingCurve(QEasingCurve::Linear), forwards(true) { } @@ -105,37 +105,6 @@ bool AbstractAnimation::isVisible() const return d->animVisible; } - -Qt::Axis AbstractAnimation::axis() const -{ - return d->axis; -} - -void AbstractAnimation::setAxis(const Qt::Axis &axis) -{ - d->axis = axis; -} - -qint8 AbstractAnimation::reference() const -{ - return d->reference; -} - -void AbstractAnimation::setReference(const qint8 &reference) -{ - d->reference = reference; -} - -qreal AbstractAnimation::angle() const -{ - return d->angle; -} - -void AbstractAnimation::setAngle(const qreal &angle) -{ - d->angle = angle; -} - void AbstractAnimation::start() { QAbstractAnimation* anim = toQAbstractAnimation(parent()); diff --git a/animations/abstractanimation.h b/animations/abstractanimation.h index c2c42e7b5..207a992c9 100644 --- a/animations/abstractanimation.h +++ b/animations/abstractanimation.h @@ -53,14 +53,6 @@ class PLASMA_EXPORT AbstractAnimation : public QObject Q_PROPERTY(QGraphicsWidget *widgetToAnimate READ widgetToAnimate WRITE setWidgetToAnimate) Q_PROPERTY(bool forwards READ forwards WRITE setForwards) - /** - * TODO: add missing properties (e.g. angle, axis, reference, etc) - */ - Q_PROPERTY(Qt::Axis axis READ axis WRITE setAxis) - Q_PROPERTY(qint8 reference READ reference WRITE setReference) - Q_PROPERTY(qreal angle READ angle WRITE setAngle) - - public: /* FIXME: find a better place and name for it. */ @@ -147,42 +139,6 @@ public: */ bool isVisible() const; - /** - * get animation rotation axis (e.g. YAxis, ZAxis, XAxis) - */ - Qt::Axis axis() const; - - /** - * set animation rotation axis - * @arg axis Rotation (e.g. YAxis, ZAxis, XAxis) - */ - void setAxis(const Qt::Axis &axis); - - /** - * Rotation reference (e.g. Center, Up, Down, Left, Right) can - * be combined (i.e. Center|Up) - */ - qint8 reference() const; - - /** - * Set rotation reference (e.g. Center, Up, Down, Left, Right) can - * be combined (i.e. Center|Up) - * @arg reference The reference - */ - void setReference(const qint8 &reference); - - /** - * Animation rotation angle (e.g. 45, 180, etc) - */ - qreal angle() const; - - /** - * Set animation rotation angle (e.g. 45, 180, etc) - * @arg angle The angle - */ - void setAngle(const qreal &angle); - - public slots: /** diff --git a/animations/rotation.cpp b/animations/rotation.cpp index 59baf7858..b7e0a0f83 100644 --- a/animations/rotation.cpp +++ b/animations/rotation.cpp @@ -35,6 +35,24 @@ public: * when the animation runs */ QGraphicsRotation *rotation; + + /** + * Animation rotation angle (e.g. 45, 180, etc) + */ + qreal angle; + + /** + * Rotation axis (e.g. X, Y, Z) + */ + Qt::Axis axis; + + /** + * Rotation reference (e.g. Center, Up, Down, Left, Right) can + * be combined (i.e. Center|Up) + */ + qint8 reference; + + }; @@ -133,4 +151,34 @@ QPropertyAnimation *RotationAnimation::render(QObject *parent) return rotationAnimation; } +Qt::Axis RotationAnimation::axis() const +{ + return d->axis; +} + +void RotationAnimation::setAxis(const Qt::Axis &axis) +{ + d->axis = axis; +} + +qint8 RotationAnimation::reference() const +{ + return d->reference; +} + +void RotationAnimation::setReference(const qint8 &reference) +{ + d->reference = reference; +} + +qreal RotationAnimation::angle() const +{ + return d->angle; +} + +void RotationAnimation::setAngle(const qreal &angle) +{ + d->angle = angle; +} + } diff --git a/animations/rotation.h b/animations/rotation.h index b2d45cf86..7531012de 100644 --- a/animations/rotation.h +++ b/animations/rotation.h @@ -31,12 +31,57 @@ class RotationAnimationPrivate; class RotationAnimation : public Animation { - public: - RotationAnimation(const qint8 &reference = Center, - const Qt::Axis &axis = Qt::ZAxis, const qreal &angle = 180); - ~RotationAnimation(); - QPropertyAnimation* render(QObject* parent = 0); + Q_OBJECT + Q_PROPERTY(Qt::Axis axis READ axis WRITE setAxis) + Q_PROPERTY(qint8 reference READ reference WRITE setReference) + Q_PROPERTY(qreal angle READ angle WRITE setAngle) + +public: + RotationAnimation(const qint8 &reference = Center, + const Qt::Axis &axis = Qt::ZAxis, + const qreal &angle = 180); + + ~RotationAnimation(); + + QPropertyAnimation* render(QObject* parent = 0); + + /** + * get animation rotation axis (e.g. YAxis, ZAxis, XAxis) + */ + Qt::Axis axis() const; + + /** + * set animation rotation axis + * @arg axis Rotation (e.g. YAxis, ZAxis, XAxis) + */ + void setAxis(const Qt::Axis &axis); + + /** + * Rotation reference (e.g. Center, Up, Down, Left, Right) can + * be combined (i.e. Center|Up) + */ + qint8 reference() const; + + /** + * Set rotation reference (e.g. Center, Up, Down, Left, Right) can + * be combined (i.e. Center|Up) + * @arg reference The reference + */ + void setReference(const qint8 &reference); + + /** + * Animation rotation angle (e.g. 45, 180, etc) + */ + qreal angle() const; + + /** + * Set animation rotation angle (e.g. 45, 180, etc) + * @arg angle The angle + */ + void setAngle(const qreal &angle); + + private: RotationAnimationPrivate *const d; diff --git a/private/abstractanimationprivate_p.h b/private/abstractanimationprivate_p.h index 56ced6d1d..8d0b9536e 100644 --- a/private/abstractanimationprivate_p.h +++ b/private/abstractanimationprivate_p.h @@ -60,23 +60,7 @@ public: QEasingCurve::Type easingCurve; /** - * Animation rotation angle (e.g. 45, 180, etc) - */ - qreal angle; - - /** - * Rotation axis (e.g. X, Y, Z) - */ - Qt::Axis axis; - - /** - * Rotation reference (e.g. Center, Up, Down, Left, Right) can - * be combined (i.e. Center|Up) - */ - qint8 reference; - - /** - * Animation direction, I supose that the idea is to offer a way + * Animation direction, the idea is to offer a way * to rewind the animation by setDirection(QAbstractAnimation::Backward). */ bool forwards;