diff --git a/animations/slide.cpp b/animations/slide.cpp index e507c95af..03dedbce2 100644 --- a/animations/slide.cpp +++ b/animations/slide.cpp @@ -18,20 +18,23 @@ */ #include "slide.h" +#include "private/animationprivate_p.h" #include - #include - namespace Plasma { SlideAnimation::SlideAnimation(AnimationDirection direction, qreal distance) - : m_direction(direction), - m_distance(distance), - m_end_visibility(true) { + AnimationPrivate *obj = getAnimationPrivate(); + obj->animDirection = direction; + //: m_direction(direction), + obj->animDistance = distance; + //m_distance(distance), + obj->animVisible = true; + //m_end_visibility(true) } @@ -45,23 +48,24 @@ QAbstractAnimation* SlideAnimation::render(QObject* parent){ qreal newX = x; qreal newY = y; + AnimationPrivate *obj = getAnimationPrivate(); //compute new geometry values - switch (m_direction){ + switch (obj->animDirection) { case MoveUp: - newY = y - m_distance; + newY = y - obj->animDistance; break; case MoveRight: - newX = x + m_distance; + newX = x + obj->animDistance; break; case MoveDown: - newY = y + m_distance; + newY = y + obj->animDistance; break; case MoveLeft: - newX = x - m_distance; + newX = x - obj->animDistance; break; case MoveUpRight: @@ -81,7 +85,7 @@ UpLeft) are not supported\n"; //QObject::connect(anim, SIGNAL(finished()), anim, SLOT(deleteLater())); - if(m_end_visibility){ + if (obj->animVisible) { QObject::connect(anim, SIGNAL(finished()), m_object, SLOT(show())); } else { QObject::connect(anim, SIGNAL(finished()), m_object, SLOT(hide())); @@ -92,7 +96,7 @@ UpLeft) are not supported\n"; } void SlideAnimation::setVisibleAtEnd(bool visibility){ - m_end_visibility = visibility; + getAnimationPrivate()->animVisible = visibility; } } //namespace Plasma diff --git a/animations/slide.h b/animations/slide.h index 23912f1af..a48f2a2b5 100644 --- a/animations/slide.h +++ b/animations/slide.h @@ -33,7 +33,7 @@ namespace Plasma /** * @class Slide plasma/animations/slide.h * @short Slide effect - * + * * Effect that moves the object a specific distance in a given direction. The * object is optionally made invisible at the beginning or at the end. */ @@ -53,12 +53,6 @@ public: protected: virtual QAbstractAnimation* render(QObject* parent = 0); -private: - AnimationDirection m_direction; - qreal m_distance; - //bool m_beginning_visibility; - bool m_end_visibility; - }; } diff --git a/private/animationprivate_p.h b/private/animationprivate_p.h index 544634d4b..b86b6593e 100644 --- a/private/animationprivate_p.h +++ b/private/animationprivate_p.h @@ -49,6 +49,12 @@ public: */ qreal animDistance; + /** + * Animation visibility: whether to end the animation being visible + * or not. + */ + bool animVisible; + }; }