#include <KDebug>
#include <KLocale>
+#include <KGlobalSettings>
#include <QPainter>
#include <QToolTip>
m_keyframeFactor(1),
m_keyframeOffset(0),
m_fps(fps)
-#if QT_VERSION >= 0x040600
- , m_closeAnimation(NULL)
-#endif
{
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
#if QT_VERSION >= 0x040600
AbstractClipItem::~AbstractClipItem()
{
-#if QT_VERSION >= 0x040600
- if (m_closeAnimation) delete m_closeAnimation;
-#endif
}
void AbstractClipItem::closeAnimation()
{
#if QT_VERSION >= 0x040600
- if (m_closeAnimation) return;
+ if (!isEnabled()) return;
setEnabled(false);
- m_closeAnimation = new QPropertyAnimation(this, "rect");
- connect(m_closeAnimation, SIGNAL(finished()), this, SLOT(deleteLater()));
- m_closeAnimation->setDuration(200);
+ if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) {
+ // animation disabled
+ deleteLater();
+ return;
+ }
+ QPropertyAnimation *closeAnimation = new QPropertyAnimation(this, "rect");
+ connect(closeAnimation, SIGNAL(finished()), this, SLOT(deleteLater()));
+ closeAnimation->setDuration(200);
QRectF r = rect();
QRectF r2 = r;
r2.setLeft(r.left() + r.width() / 2);
r2.setTop(r.top() + r.height() / 2);
r2.setWidth(1);
r2.setHeight(1);
- m_closeAnimation->setStartValue(r);
- m_closeAnimation->setEndValue(r2);
- m_closeAnimation->setEasingCurve(QEasingCurve::InQuad);
- m_closeAnimation->start();
+ closeAnimation->setStartValue(r);
+ closeAnimation->setEndValue(r2);
+ closeAnimation->setEasingCurve(QEasingCurve::InQuad);
+ closeAnimation->start(QAbstractAnimation::DeleteWhenStopped);
#endif
}
int mouseOverKeyFrames(QPointF pos, double maxOffset);
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
-private:
-#if QT_VERSION >= 0x040600
- QPropertyAnimation *m_closeAnimation;
-#endif
};
#endif
#include <QDomElement>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
+#include <QPropertyAnimation>
Transition::Transition(const ItemInfo &info, int transitiontrack, double fps, QDomElement params, bool automaticTransition) :
setPos(info.startPos.frames(fps), (int)(info.track * KdenliveSettings::trackheight() + itemOffset() + 1));
#if QT_VERSION >= 0x040600
- m_startAnimation = new QPropertyAnimation(this, "rect");
- m_startAnimation->setDuration(200);
- QRectF r(0, 0, m_info.cropDuration.frames(fps) - 0.02, (qreal) itemHeight() / 2);
- QRectF r2(0, 0, m_info.cropDuration.frames(fps) - 0.02, (qreal)itemHeight());
- m_startAnimation->setStartValue(r);
- m_startAnimation->setEndValue(r2);
- m_startAnimation->setEasingCurve(QEasingCurve::OutQuad);
- m_startAnimation->start();
+ if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) {
+ // animation disabled
+ setRect(0, 0, m_info.cropDuration.frames(fps) - 0.02, (qreal) itemHeight());
+ }
+ else {
+ QPropertyAnimation *startAnimation = new QPropertyAnimation(this, "rect");
+ startAnimation->setDuration(200);
+ QRectF r(0, 0, m_info.cropDuration.frames(fps) - 0.02, (qreal) itemHeight() / 2);
+ QRectF r2(0, 0, m_info.cropDuration.frames(fps) - 0.02, (qreal)itemHeight());
+ startAnimation->setStartValue(r);
+ startAnimation->setEndValue(r2);
+ startAnimation->setEasingCurve(QEasingCurve::OutQuad);
+ startAnimation->start(QAbstractAnimation::DeleteWhenStopped);
+ }
#else
setRect(0, 0, m_info.cropDuration.frames(fps) - 0.02, (qreal) itemHeight());
#endif
Transition::~Transition()
{
blockSignals(true);
-#if QT_VERSION >= 0x040600
- delete m_startAnimation;
-#endif
if (scene()) scene()->removeItem(this);
}
int defaultZValue() const;
/** @brief When a transition is resized, check if keyframes are out of the transition and fix if necessary. */
bool updateKeyframes();
-
+ void animate();
protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
/** @brief Returns the transition type for a given name. */
TRANSITIONTYPE getTransitionForName(const QString & type);
-
-#if QT_VERSION >= 0x040600
- QPropertyAnimation *m_startAnimation;
-#endif
};
#endif