* constness in create method signature

* use the create method for javascript from the create method for stock anims when the stock anim is mapped to a js anim

svn path=/trunk/KDE/kdelibs/; revision=1120245
This commit is contained in:
Aaron J. Seigo 2010-04-28 17:45:24 +00:00
parent dbd43adad7
commit 0cf62abb09
2 changed files with 6 additions and 9 deletions

View File

@ -63,19 +63,15 @@ void AnimatorPrivate::mapAnimation(Animator::Animation from, const QString &to)
Plasma::Animation* Animator::create(Animator::Animation type, QObject *parent)
{
Plasma::Animation *result = 0;
if (AnimatorPrivate::s_stockAnimMappings.contains(type)) {
return create(AnimatorPrivate::s_stockAnimMappings.value(type));
} else if (AnimatorPrivate::s_loadableAnimMappings.contains(type)) {
const QString anim = AnimatorPrivate::s_loadableAnimMappings.value(type);
if (AnimationScriptEngine::isAnimationRegistered(anim)) {
result = new JavascriptAnimation(anim, parent);
}
return result;
return create(anim, parent);
}
Plasma::Animation *result = 0;
switch (type) {
case FadeAnimation:
result = new Plasma::FadeAnimation(parent);
@ -157,7 +153,7 @@ QEasingCurve Animator::create(Animator::CurveShape type)
return result;
}
Plasma::Animation *Animator::create(QString &anim, QObject *parent)
Plasma::Animation *Animator::create(const QString &anim, QObject *parent)
{
if (!AnimationScriptEngine::isAnimationRegistered(anim)) {
const QString path = Theme::defaultTheme()->animationPath(anim);
@ -165,6 +161,7 @@ Plasma::Animation *Animator::create(QString &anim, QObject *parent)
kError() << "failed to find script file for animation" << anim;
return 0;
}
QFile file(path);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
kError() << "failed to open script file" << path;

View File

@ -101,7 +101,7 @@ public:
* check \ref AbstractAnimation properties.
* @since 4.5
**/
static Plasma::Animation *create(QString &animationName, QObject *parent = 0);
static Plasma::Animation *create(const QString &animationName, QObject *parent = 0);
/**
* Factory to build new custom easing curves.