19#include "private/animator_p.h"
24#include "animations/animationscriptengine_p.h"
25#include "animations/fade_p.h"
26#include "animations/grow_p.h"
27#include "animations/pulser_p.h"
28#include "animations/rotation_p.h"
29#include "animations/slide_p.h"
30#include "animations/rotationstacked_p.h"
31#include "animations/geometry_p.h"
32#include "animations/zoom_p.h"
33#include "animations/pixmaptransition_p.h"
34#include "animations/water_p.h"
35#include "animations/pendulumcurve_p.h"
36#include "animations/javascriptanimation_p.h"
42QHash<Animator::Animation, Animator::Animation> AnimatorPrivate::s_stockAnimMappings;
43QHash<Animator::Animation, QString> AnimatorPrivate::s_loadableAnimMappings;
45void AnimatorPrivate::mapAnimation(Animator::Animation from, Animator::Animation to)
51 s_loadableAnimMappings.remove(from);
52 s_stockAnimMappings.insert(from, to);
55void AnimatorPrivate::mapAnimation(Animator::Animation from,
const QString &to)
57 s_stockAnimMappings.remove(from);
58 s_loadableAnimMappings.insert(from, to);
63 if (AnimatorPrivate::s_stockAnimMappings.contains(
type)) {
64 return create(AnimatorPrivate::s_stockAnimMappings.value(
type));
65 }
else if (AnimatorPrivate::s_loadableAnimMappings.contains(
type)) {
66 const QString anim = AnimatorPrivate::s_loadableAnimMappings.value(
type);
67 return create(anim, parent);
74 result =
create(
"FadeAnimation", parent);
76 result =
new Plasma::FadeAnimation(parent);
81 result =
create(
"GrowAnimation", parent);
83 result =
new Plasma::GrowAnimation(parent);
88 result =
create(
"PulseAnimation", parent);
90 result =
new Plasma::PulseAnimation(parent);
95 result =
create(
"RotationAnimation", parent);
97 result =
new Plasma::RotationAnimation(parent);
102 result =
create(
"RotationStackedAnimation", parent);
104 result =
new Plasma::RotationStackedAnimation(parent);
109 result =
create(
"SlideAnimation", parent);
111 result =
new Plasma::SlideAnimation(parent);
116 result =
create(
"GeometryAnimation", parent);
118 result =
new Plasma::GeometryAnimation(parent);
123 result =
create(
"ZoomAnimation", parent);
125 result =
new Plasma::ZoomAnimation(parent);
130 result =
create(
"PixmapTransitionAnimation", parent);
132 result =
new Plasma::PixmapTransition(parent);
137 result =
create(
"WaterAnimation", parent);
139 result =
new Plasma::WaterAnimation(parent);
157 result.setType(QEasingCurve::InQuad);
161 result.setType(QEasingCurve::OutQuad);
165 result.setType(QEasingCurve::InOutQuad);
169 result.setType(QEasingCurve::Linear);
173 result = PendulumCurve();
177 kDebug() <<
"Unsupported easing curve type.";
192 if (path.isEmpty()) {
210 return new Plasma::JavascriptAnimation(anim, parent);
215#include <animator.moc>
Abstract representation of a single animation.
static Plasma::Animation * create(Animator::Animation type, QObject *parent=0)
Factory to build new animation objects.
@ RotationStackedAnimation
@ PixmapTransitionAnimation
Q_INVOKABLE QString animationPath(const QString &name) const
Retrieves the path for the script file that contains a given Javascript animation.
static Theme * defaultTheme()
Singleton pattern accessor.
bool loadScript(const QString &path, const QString &prefix)
bool animationFailedToLoad(const QString &anim)
bool isAnimationRegistered(const QString &anim)
void addToLoadFailures(const QString &anim)
Namespace for everything in libplasma.
static QScriptValue type(QScriptContext *ctx, QScriptEngine *eng)