don't need our own anim group anymore

svn path=/trunk/KDE/kdelibs/; revision=1059422
This commit is contained in:
Aaron J. Seigo 2009-12-06 15:42:41 +00:00
parent 51bd953798
commit 9d8e2eec4d
3 changed files with 0 additions and 272 deletions

View File

@ -45,7 +45,6 @@ set(plasma_LIB_SRCS
abstracttoolbox.cpp
animator.cpp
animations/animation.cpp
animations/animationgroup.cpp
animations/fade.cpp
animations/grow.cpp
animations/slide.cpp
@ -255,7 +254,6 @@ set(plasma_LIB_INCLUDES
abstracttoolbox.h
animationdriver.h
animations/animation.h
animations/animationgroup.h
animator.h
applet.h
configloader.h
@ -355,7 +353,6 @@ endif(PHONON_FOUND)
install(FILES
animations/animation.h
animations/animationgroup.h
animations/rotationstacked.h
DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/animations COMPONENT Devel)

View File

@ -1,163 +0,0 @@
/*
* Copyright 2009 Mehmet Ali Akmanalp <makmanalp@wpi.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "animationgroup.h"
#include <QMapIterator>
#include <QParallelAnimationGroup>
#include <QSequentialAnimationGroup>
#include <QDebug>
namespace Plasma
{
class AnimationGroupPrivate
{
public:
AnimationGroupPrivate()
: parallel(false),
duration(0),
anim(0)
{ }
bool parallel;
int duration;
QAnimationGroup *anim;
};
AnimationGroup::AnimationGroup(QObject* parent)
: QAbstractAnimation(parent),
d(new AnimationGroupPrivate)
{
d->anim = new QSequentialAnimationGroup(this);
}
AnimationGroup::~AnimationGroup()
{
delete d;
}
void AnimationGroup::setParallel(bool parallel)
{
if (isParallel() == parallel) {
return;
}
d->parallel = parallel;
QAnimationGroup *newGroup;
if (parallel) {
newGroup = new QParallelAnimationGroup(this);
} else {
newGroup = new QSequentialAnimationGroup(this);
}
while (d->anim->animationCount()) {
newGroup->addAnimation(d->anim->takeAnimation(0));
}
delete d->anim;
d->anim = newGroup;
}
bool AnimationGroup::isParallel() const
{
return d->parallel;
}
int AnimationGroup::add(QAbstractAnimation* elem)
{
d->anim->addAnimation(elem);
calculateGroupDuration();
return d->anim->animationCount();
}
void AnimationGroup::remove(QAbstractAnimation* elem)
{
d->anim->removeAnimation(elem);
calculateGroupDuration();
}
QAbstractAnimation* AnimationGroup::at(int id) const
{
return d->anim->animationAt(id);
}
void AnimationGroup::remove(int id)
{
d->anim->removeAnimation(d->anim->animationAt(id));
calculateGroupDuration();
}
void AnimationGroup::updateCurrentTime(int currentTime)
{
Q_UNUSED(currentTime)
}
void AnimationGroup::calculateGroupDuration()
{
QAbstractAnimation *tmp;
d->duration = 0;
if (d->parallel) {
for (int i = 0; i < d->anim->animationCount(); ++i) {
tmp = d->anim->animationAt(i);
if (d->duration < tmp->duration()) {
d->duration = tmp->duration();
}
}
} else {
for (int i = 0; i < d->anim->animationCount(); ++i) {
tmp = d->anim->animationAt(i);
d->duration += tmp->duration();
}
}
}
int AnimationGroup::duration() const
{
return d->duration;
}
void AnimationGroup::updateDirection(QAbstractAnimation::Direction direction)
{
d->anim->setDirection(direction);
}
void AnimationGroup::updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState)
{
Q_UNUSED(oldState)
switch (newState) {
case Running:
d->anim->start();
break;
case Paused:
d->anim->pause();
break;
case Stopped:
d->anim->stop();
break;
}
}
} //namespace Plasma
#include <../animationgroup.moc>

View File

@ -1,106 +0,0 @@
/*
* Copyright 2009 Mehmet Ali Akmanalp <makmanalp@wpi.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* @file This file contains the class for animation groups in plasma.
*/
#ifndef PLASMA_ANIMATIONGROUP_H
#define PLASMA_ANIMATIONGROUP_H
#include <QAbstractAnimation>
#include <QAnimationGroup>
#include <QGraphicsWidget>
#include <QList>
#include <QObject>
#include <plasma/animations/animation.h>
#include <plasma/plasma_export.h>
namespace Plasma
{
class AnimationGroupPrivate;
/**
* @brief A group of Animations and / or AnimationGroups.
* @since 4.4
*/
class PLASMA_EXPORT AnimationGroup : public QAbstractAnimation
{
Q_OBJECT
Q_PROPERTY(bool parallel READ isParallel WRITE setParallel)
public:
explicit AnimationGroup(QObject* parent = 0);
virtual ~AnimationGroup();
int duration() const;
/**
* @arg parallelness whether the animation should be in parallel or not,
* by default, it is not parallel
*/
void setParallel(bool parallelness);
/**
* @return whether the current animation is parallel or not
*/
bool isParallel() const;
public Q_SLOTS:
/**
* Add an Animation or AnimationGroup to the group
* @arg elem element to add
* @return id of element added
*/
Q_INVOKABLE int add(QAbstractAnimation* elem);
/**
* Remove an Animation or AnimationGroup from this group
* @arg eleme element to remove
*/
Q_INVOKABLE void remove(QAbstractAnimation* elem);
/**
* Return element with given id
* @return id of element to get
*/
Q_INVOKABLE QAbstractAnimation* at(int id) const;
/**
* Remove element with given id
* @arg id id of element to remove
*/
Q_INVOKABLE void remove(int id);
protected:
void updateCurrentTime(int currentTime);
void calculateGroupDuration();
void updateDirection(QAbstractAnimation::Direction direction);
void updateState(QAbstractAnimation::State oldState,
QAbstractAnimation::State newState);
private:
AnimationGroupPrivate *const d;
};
} //namespace Plasma
#endif