Moving rotation related only parameters back to RotationAnimation.

The idea is to keep in AbstractAnimationPrivate only what is shared by all
(or at least most) of animations.


svn path=/trunk/KDE/kdelibs/; revision=1039035
This commit is contained in:
Adenilson Cavalcanti Da Silva 2009-10-22 15:35:08 +00:00
parent d82ac07001
commit 8a930cbaca
5 changed files with 101 additions and 99 deletions

View File

@ -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());

View File

@ -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:
/**

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;