2009-10-21 03:51:31 +02:00
|
|
|
/*
|
2009-12-27 23:16:11 +01:00
|
|
|
Copyright (C) 2009 Adenilson Cavalcanti <adenilson.silva@idnt.org.br>
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library 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
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2009-10-21 03:51:31 +02:00
|
|
|
|
|
|
|
#include "animator.h"
|
|
|
|
|
2010-04-28 19:51:46 +02:00
|
|
|
#include <kdebug.h>
|
2009-10-21 03:51:31 +02:00
|
|
|
|
|
|
|
#include "animations/animation.h"
|
2009-10-22 21:46:16 +02:00
|
|
|
#include "animations/fade_p.h"
|
|
|
|
#include "animations/grow_p.h"
|
|
|
|
#include "animations/pulser_p.h"
|
|
|
|
#include "animations/rotation_p.h"
|
|
|
|
#include "animations/slide_p.h"
|
2009-12-08 00:26:24 +01:00
|
|
|
#include "animations/rotationstacked_p.h"
|
2009-12-08 10:22:51 +01:00
|
|
|
#include "animations/geometry_p.h"
|
2009-12-05 21:23:13 +01:00
|
|
|
#include "animations/zoom_p.h"
|
2010-01-21 08:23:18 +01:00
|
|
|
#include "animations/pixmaptransition_p.h"
|
2010-04-23 22:55:46 +02:00
|
|
|
#include "animations/pendulumcurve_p.h"
|
2010-04-28 19:41:16 +02:00
|
|
|
#include "theme.h"
|
2010-04-26 23:30:55 +02:00
|
|
|
|
2010-04-28 19:41:16 +02:00
|
|
|
namespace Plasma
|
|
|
|
{
|
2010-04-26 23:30:55 +02:00
|
|
|
|
2011-05-26 23:30:58 +02:00
|
|
|
Animator::Animator(QObject *parent)
|
|
|
|
: QObject(parent),
|
|
|
|
d(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-12-03 20:30:02 +01:00
|
|
|
Plasma::Animation* Animator::create(Animator::Animation type, QObject *parent)
|
2009-10-21 03:51:31 +02:00
|
|
|
{
|
2010-04-28 19:45:24 +02:00
|
|
|
Plasma::Animation *result = 0;
|
|
|
|
|
2009-10-21 03:51:31 +02:00
|
|
|
switch (type) {
|
|
|
|
case FadeAnimation:
|
2011-11-17 14:40:53 +01:00
|
|
|
result = new Plasma::FadeAnimation(parent);
|
2009-10-21 03:51:31 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GrowAnimation:
|
2011-11-17 14:40:53 +01:00
|
|
|
result = new Plasma::GrowAnimation(parent);
|
2009-10-21 03:51:31 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PulseAnimation:
|
2011-11-17 14:40:53 +01:00
|
|
|
result = new Plasma::PulseAnimation(parent);
|
2009-10-21 03:51:31 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RotationAnimation:
|
2011-11-17 14:40:53 +01:00
|
|
|
result = new Plasma::RotationAnimation(parent);
|
2009-10-21 03:51:31 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RotationStackedAnimation:
|
2011-11-17 14:40:53 +01:00
|
|
|
result = new Plasma::RotationStackedAnimation(parent);
|
2009-10-21 03:51:31 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SlideAnimation:
|
2011-11-17 14:40:53 +01:00
|
|
|
result = new Plasma::SlideAnimation(parent);
|
2009-10-21 03:51:31 +02:00
|
|
|
break;
|
2009-12-08 10:22:51 +01:00
|
|
|
|
|
|
|
case GeometryAnimation:
|
2011-11-17 14:40:53 +01:00
|
|
|
result = new Plasma::GeometryAnimation(parent);
|
2009-12-05 20:54:27 +01:00
|
|
|
break;
|
2009-12-08 10:22:51 +01:00
|
|
|
|
2009-12-05 21:23:13 +01:00
|
|
|
case ZoomAnimation:
|
2011-11-17 14:40:53 +01:00
|
|
|
result = new Plasma::ZoomAnimation(parent);
|
2009-12-05 21:23:13 +01:00
|
|
|
break;
|
2009-10-21 03:51:31 +02:00
|
|
|
|
2010-01-21 08:23:18 +01:00
|
|
|
case PixmapTransitionAnimation:
|
2011-11-17 14:40:53 +01:00
|
|
|
result = new Plasma::PixmapTransition(parent);
|
2010-04-19 17:09:36 +02:00
|
|
|
break;
|
|
|
|
|
2009-10-21 03:51:31 +02:00
|
|
|
default:
|
2010-04-28 20:10:01 +02:00
|
|
|
//kDebug() << "Unsupported animation type.";
|
|
|
|
break;
|
2009-10-21 03:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-04-24 00:36:17 +02:00
|
|
|
QEasingCurve Animator::create(Animator::CurveShape type)
|
2010-04-23 22:55:46 +02:00
|
|
|
{
|
|
|
|
QEasingCurve result;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case EaseInCurve:
|
|
|
|
result.setType(QEasingCurve::InQuad);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EaseOutCurve:
|
|
|
|
result.setType(QEasingCurve::OutQuad);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EaseInOutCurve:
|
|
|
|
result.setType(QEasingCurve::InOutQuad);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LinearCurve:
|
|
|
|
result.setType(QEasingCurve::Linear);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PendularCurve:
|
|
|
|
result = PendulumCurve();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-07-29 15:46:52 +02:00
|
|
|
#ifndef NDEBUG
|
2010-04-23 22:55:46 +02:00
|
|
|
kDebug() << "Unsupported easing curve type.";
|
2011-07-29 15:46:52 +02:00
|
|
|
#endif
|
2010-04-23 22:55:46 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2009-10-21 03:51:31 +02:00
|
|
|
} // namespace Plasma
|
|
|
|
|
2012-02-08 23:33:03 +01:00
|
|
|
#include "moc_animator.cpp"
|