make animation groups work again in javascript by subclassing the Qt classes and making the interesting methods scriptable in the subclasses and calling the parent class implementations.
svn path=/trunk/KDE/kdebase/runtime/; revision=1062484
This commit is contained in:
parent
49f3bb58da
commit
52aaea24e7
@ -2,6 +2,7 @@
|
||||
|
||||
set(simple_javascript_engine_SRCS
|
||||
simplejavascriptapplet.cpp
|
||||
simplebindings/animationgroup.cpp
|
||||
simplebindings/appletinterface.cpp
|
||||
simplebindings/anchorlayout.cpp
|
||||
simplebindings/color.cpp
|
||||
|
85
scriptengines/javascript/simplebindings/animationgroup.cpp
Normal file
85
scriptengines/javascript/simplebindings/animationgroup.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
#include "animationgroup.h"
|
||||
|
||||
|
||||
ParallelAnimationGroup::ParallelAnimationGroup(QObject *parent)
|
||||
: QParallelAnimationGroup(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void ParallelAnimationGroup::addAnimation(QAbstractAnimation *animation)
|
||||
{
|
||||
QParallelAnimationGroup::addAnimation(animation);
|
||||
}
|
||||
|
||||
QAbstractAnimation *ParallelAnimationGroup::animationAt(int index) const
|
||||
{
|
||||
return QParallelAnimationGroup::animationAt(index);
|
||||
}
|
||||
|
||||
int ParallelAnimationGroup::animationCount() const
|
||||
{
|
||||
return QParallelAnimationGroup::animationCount();
|
||||
}
|
||||
|
||||
void ParallelAnimationGroup::clearAnimations()
|
||||
{
|
||||
QParallelAnimationGroup::clearAnimations();
|
||||
}
|
||||
|
||||
int ParallelAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const
|
||||
{
|
||||
return QParallelAnimationGroup::indexOfAnimation(animation);
|
||||
}
|
||||
|
||||
void ParallelAnimationGroup::insertAnimationAt(int index, QAbstractAnimation *animation)
|
||||
{
|
||||
QParallelAnimationGroup::insertAnimationAt(index, animation);
|
||||
}
|
||||
|
||||
void ParallelAnimationGroup::removeAnimation(QAbstractAnimation *animation)
|
||||
{
|
||||
QParallelAnimationGroup::removeAnimation(animation);
|
||||
}
|
||||
|
||||
|
||||
SequentialAnimationGroup::SequentialAnimationGroup(QObject *parent)
|
||||
: QSequentialAnimationGroup(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void SequentialAnimationGroup::addAnimation(QAbstractAnimation *animation)
|
||||
{
|
||||
QSequentialAnimationGroup::addAnimation(animation);
|
||||
}
|
||||
|
||||
QAbstractAnimation *SequentialAnimationGroup::animationAt(int index) const
|
||||
{
|
||||
return QSequentialAnimationGroup::animationAt(index);
|
||||
}
|
||||
|
||||
int SequentialAnimationGroup::animationCount() const
|
||||
{
|
||||
return QSequentialAnimationGroup::animationCount();
|
||||
}
|
||||
|
||||
void SequentialAnimationGroup::clearAnimations()
|
||||
{
|
||||
QSequentialAnimationGroup::clearAnimations();
|
||||
}
|
||||
|
||||
int SequentialAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const
|
||||
{
|
||||
return QSequentialAnimationGroup::indexOfAnimation(animation);
|
||||
}
|
||||
|
||||
void SequentialAnimationGroup::insertAnimationAt(int index, QAbstractAnimation *animation)
|
||||
{
|
||||
QSequentialAnimationGroup::insertAnimationAt(index, animation);
|
||||
}
|
||||
|
||||
void SequentialAnimationGroup::removeAnimation(QAbstractAnimation *animation)
|
||||
{
|
||||
QSequentialAnimationGroup::removeAnimation(animation);
|
||||
}
|
||||
|
||||
#include "animationgroup.moc"
|
42
scriptengines/javascript/simplebindings/animationgroup.h
Normal file
42
scriptengines/javascript/simplebindings/animationgroup.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef ANIMATIONGROUP_H
|
||||
#define ANIMATIONGROUP_H
|
||||
|
||||
#include <QParallelAnimationGroup>
|
||||
#include <QSequentialAnimationGroup>
|
||||
|
||||
class ParallelAnimationGroup : public QParallelAnimationGroup
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ParallelAnimationGroup(QObject *parent);
|
||||
|
||||
public Q_SLOTS:
|
||||
void addAnimation(QAbstractAnimation * animation);
|
||||
QAbstractAnimation *animationAt(int index) const;
|
||||
int animationCount() const;
|
||||
void clearAnimations();
|
||||
int indexOfAnimation(QAbstractAnimation *animation) const;
|
||||
void insertAnimationAt(int index, QAbstractAnimation * animation);
|
||||
void removeAnimation(QAbstractAnimation * animation);
|
||||
};
|
||||
|
||||
class SequentialAnimationGroup : public QSequentialAnimationGroup
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SequentialAnimationGroup(QObject *parent);
|
||||
|
||||
public Q_SLOTS:
|
||||
void addAnimation(QAbstractAnimation * animation);
|
||||
QAbstractAnimation *animationAt(int index) const;
|
||||
int animationCount() const;
|
||||
void clearAnimations();
|
||||
int indexOfAnimation(QAbstractAnimation *animation) const;
|
||||
void insertAnimationAt(int index, QAbstractAnimation * animation);
|
||||
void removeAnimation(QAbstractAnimation * animation);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <Plasma/Package>
|
||||
#include <Plasma/VideoWidget>
|
||||
|
||||
#include "simplebindings/animationgroup.h"
|
||||
#include "simplebindings/appletinterface.h"
|
||||
#include "simplebindings/filedialogproxy.h"
|
||||
|
||||
@ -740,14 +741,14 @@ QScriptValue SimpleJavaScriptApplet::animation(QScriptContext *context, QScriptE
|
||||
QScriptValue SimpleJavaScriptApplet::animationGroup(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
QGraphicsWidget *parent = extractParent(context, engine);
|
||||
QSequentialAnimationGroup *group = new QSequentialAnimationGroup(parent);
|
||||
SequentialAnimationGroup *group = new SequentialAnimationGroup(parent);
|
||||
return engine->newQObject(group);
|
||||
}
|
||||
|
||||
QScriptValue SimpleJavaScriptApplet::parallelAnimationGroup(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
QGraphicsWidget *parent = extractParent(context, engine);
|
||||
QParallelAnimationGroup *group = new QParallelAnimationGroup(parent);
|
||||
ParallelAnimationGroup *group = new ParallelAnimationGroup(parent);
|
||||
return engine->newQObject(group);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user