-AbstractClipItem::AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps): QGraphicsRectItem(rect), m_track(0), m_fps(fps), m_editedKeyframe(-1), m_selectedKeyframe(0) {
- setFlags(QGraphicsItem::ItemClipsToShape | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
- setTrack(info.track);
- m_startPos = info.startPos;
- m_cropDuration = info.endPos - info.startPos;
-}
-
-void AbstractClipItem::moveTo(int x, double scale, int offset, int newTrack) {
- double origX = rect().x();
- double origY = rect().y();
- bool success = true;
- if (x < 0) return;
- setRect(x * scale, origY + offset, rect().width(), rect().height());
- QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
- if (collisionList.size() == 0) m_track = newTrack;
- for (int i = 0; i < collisionList.size(); ++i) {
- QGraphicsItem *item = collisionList.at(i);
- if (item->type() == type()) {
- if (offset == 0) {
- QRectF other = ((QGraphicsRectItem *)item)->rect();
- if (x < m_startPos.frames(m_fps)) {
- kDebug() << "COLLISION, MOVING TO------";
- m_startPos = ((AbstractClipItem *)item)->endPos();
- origX = m_startPos.frames(m_fps) * scale;
- } else if (x > m_startPos.frames(m_fps)) {
- //kDebug() << "COLLISION, MOVING TO+++: "<<x<<", CLIP CURR POS: "<<m_startPos.frames(m_fps)<<", COLLIDING START: "<<((AbstractClipItem *)item)->startPos().frames(m_fps);
- m_startPos = ((AbstractClipItem *)item)->startPos() - m_cropDuration;
- origX = m_startPos.frames(m_fps) * scale;
- }
- }
- setRect(origX, origY, rect().width(), rect().height());
- offset = 0;
- origX = rect().x();
- success = false;
- break;
- }
- }
- if (success) {
- m_track = newTrack;
- m_startPos = GenTime(x, m_fps);
+void AbstractClipItem::closeAnimation()
+{
+#if QT_VERSION >= 0x040600
+ if (!isEnabled()) return;
+ setEnabled(false);
+ setFlag(QGraphicsItem::ItemIsSelectable, false);
+ if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) {
+ // animation disabled
+ deleteLater();
+ return;