From a661ba66d69640a3275dcab9ac88ec74f09ac80b Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Da Silva Date: Thu, 15 Oct 2009 20:19:02 +0000 Subject: [PATCH] Moving private members to a private class. svn path=/trunk/KDE/kdelibs/; revision=1035762 --- animations/animation.cpp | 39 ++++++++++++++++++++++++++++----------- animations/animation.h | 23 +++++++---------------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/animations/animation.cpp b/animations/animation.cpp index d453ce1f0..09a81d021 100644 --- a/animations/animation.cpp +++ b/animations/animation.cpp @@ -30,24 +30,41 @@ namespace Plasma { +class AnimationPrivate { + +public: + + /** + * Parent owner object to use in generated animations. + */ + QObject* m_parent; + + /** + * Duration of the animation. Default is 1000ms. + */ + int m_duration; + +}; + Animation::Animation(QObject* parent) - : m_parent(parent), - m_duration(250) { + d = new AnimationPrivate; + d->m_parent = parent; + d->m_duration = 250; + } -Animation::~Animation(){} +Animation::~Animation() +{ + delete d; +} void Animation::setDuration(int duration){ - m_duration = duration; -} - -int Animation::duration() const { - return m_duration; + d->m_duration = duration; } void Animation::start(){ - QAbstractAnimation* anim = getQtAnimation(m_parent); + QAbstractAnimation* anim = getQtAnimation(d->m_parent); if (anim){ anim->start(QAbstractAnimation::DeleteWhenStopped); } @@ -65,14 +82,14 @@ QAbstractAnimation* Animation::getQtAnimation(QObject* parent){ if (parent){ return render(parent); } else { - return render(m_parent); + return render(d->m_parent); } } int Animation::getDuration() { - return m_duration; + return d->m_duration; } diff --git a/animations/animation.h b/animations/animation.h index c5cd7bd88..3f000fd36 100644 --- a/animations/animation.h +++ b/animations/animation.h @@ -35,6 +35,8 @@ namespace Plasma { +class AnimationPrivate; + /** * Abstract representation of a single animation. */ @@ -48,12 +50,6 @@ public: Animation(QObject* parent = 0); virtual ~Animation() = 0; - /** - * Get the animation duration. - * @return duration in ms. - */ - virtual int duration() const; - /** * Start the animation. */ @@ -82,20 +78,15 @@ protected: */ virtual QAbstractAnimation* render(QObject* parent = 0) = 0; + /** + * Get the animation duration. + * @return duration in ms. + */ int getDuration(); private: - /** - * Parent owner object to use in generated animations. - */ - QObject* m_parent; - - /** - * Duration of the animation. Default is 1000ms. - */ - int m_duration; - + AnimationPrivate *d; }; } //namespace Plasma