]> git.sesse.net Git - kdenlive/commitdiff
Several fixes for keyframes, fix bug in clip resize start undo and cleanup
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 29 Aug 2009 00:09:52 +0000 (00:09 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 29 Aug 2009 00:09:52 +0000 (00:09 +0000)
svn path=/trunk/kdenlive/; revision=3851

28 files changed:
src/abstractclipitem.cpp
src/abstractclipitem.h
src/clipitem.cpp
src/clipitem.h
src/customtrackview.cpp
src/customtrackview.h
src/editeffectcommand.cpp
src/editeffectcommand.h
src/editkeyframecommand.cpp
src/effectslist.cpp
src/effectslist.h
src/effectstackedit.cpp
src/effectstackedit.h
src/effectstackview.cpp
src/keyframeedit.cpp
src/keyframeedit.h
src/moveclipcommand.cpp
src/moveclipcommand.h
src/movetransitioncommand.cpp
src/movetransitioncommand.h
src/projectlist.cpp
src/projectlist.h
src/renderwidget.cpp
src/renderwidget.h
src/resizeclipcommand.cpp
src/resizeclipcommand.h
src/transition.cpp
src/transitionsettings.cpp

index 32c2d3c9459bee8b8161916cdc9a88fd3ab72ec2..fd6828bc0ceeda6dddcce8e6014fe73a86fe96cc 100644 (file)
@@ -142,7 +142,7 @@ void AbstractClipItem::resizeStart(int posx, double speed)
         }*/
 }
 
-void AbstractClipItem::resizeEnd(int posx, double speed, bool /*updateKeyFrames*/)
+void AbstractClipItem::resizeEnd(int posx, double speed)
 {
     GenTime durationDiff = GenTime(posx, m_fps) - endPos();
     if (durationDiff == GenTime()) return;
@@ -294,7 +294,7 @@ void AbstractClipItem::updateKeyFramePos(const GenTime pos, const double value)
     if (!m_keyframes.contains(m_selectedKeyframe)) return;
     int newpos = (int) pos.frames(m_fps);
     int start = cropStart().frames(m_fps);
-    int end = (cropStart() + cropDuration()).frames(m_fps);
+    int end = (cropStart() + cropDuration()).frames(m_fps) - 1;
     newpos = qMax(newpos, start);
     newpos = qMin(newpos, end);
     if (value < -50 && m_selectedKeyframe != start && m_selectedKeyframe != end) {
@@ -330,7 +330,7 @@ void AbstractClipItem::addKeyFrame(const GenTime pos, const double value)
     QRectF br = sceneBoundingRect();
     double maxh = 100.0 / br.height() / m_keyframeFactor;
     int newval = (br.bottom() - value) * maxh;
-    kDebug() << "Rect: " << br << "/ SCENE: " << sceneBoundingRect() << ", VALUE: " << value << ", MAX: " << maxh << ", NEWVAL: " << newval;
+    //kDebug() << "Rect: " << br << "/ SCENE: " << sceneBoundingRect() << ", VALUE: " << value << ", MAX: " << maxh << ", NEWVAL: " << newval;
     int newpos = (int) pos.frames(m_fps) ;
     m_keyframes[newpos] = newval;
     m_selectedKeyframe = newpos;
index 231cf94659701b2885c08cc65f632d551196b30b..f2b3afdba2ac7349de7a919767218f821cbdcb90 100644 (file)
@@ -55,7 +55,7 @@ public:
     virtual GenTime cropStart() const ;
     virtual GenTime cropDuration() const ;
     virtual void resizeStart(int posx, double speed = 1.0);
-    virtual void resizeEnd(int posx, double speed = 1.0, bool updateKeyFrames = true);
+    virtual void resizeEnd(int posx, double speed = 1.0);
     virtual double fps() const;
     virtual GenTime maxDuration() const;
     virtual void setCropStart(GenTime pos);
index 0b1439964e6747fcfa4f37bfdeb20bc33f1f79f7..0902037f39408b6a9b508bea4abd390017d44664 100644 (file)
@@ -305,7 +305,7 @@ bool ClipItem::checkKeyFrames()
 
 void ClipItem::setKeyframes(const int ix, const QString keyframes)
 {
-    QDomElement effect = effectAt(ix);
+    QDomElement effect = getEffectAt(ix);
     if (effect.attribute("disabled") == "1") return;
     QDomNodeList params = effect.elementsByTagName("parameter");
     for (int i = 0; i < params.count(); i++) {
@@ -1074,7 +1074,6 @@ void ClipItem::resizeStart(int posx, double /*speed*/)
     const int previous = cropStart().frames(m_fps);
     AbstractClipItem::resizeStart(posx, m_speed);
     if ((int) cropStart().frames(m_fps) != previous) {
-        checkEffectsKeyframesPos(previous, cropStart().frames(m_fps), true);
         if (m_hasThumbs && KdenliveSettings::videothumbnails()) {
             /*connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));*/
             m_startThumbTimer.start(150);
@@ -1082,16 +1081,16 @@ void ClipItem::resizeStart(int posx, double /*speed*/)
     }
 }
 
-void ClipItem::resizeEnd(int posx, double /*speed*/, bool updateKeyFrames)
+void ClipItem::resizeEnd(int posx, double /*speed*/)
 {
     const int max = (startPos() - cropStart() + maxDuration()).frames(m_fps);
     if (posx > max && maxDuration() != GenTime()) posx = max;
     if (posx == endPos().frames(m_fps)) return;
     //kDebug() << "// NEW POS: " << posx << ", OLD END: " << endPos().frames(m_fps);
-    const int previous = (cropStart() + cropDuration()).frames(m_fps);
+    const int previous = (int)(cropStart() + cropDuration()).frames(m_fps) - 1;
     AbstractClipItem::resizeEnd(posx, m_speed);
-    if ((int)(cropStart() + cropDuration()).frames(m_fps) != previous) {
-        if (updateKeyFrames) checkEffectsKeyframesPos(previous, (cropStart() + cropDuration()).frames(m_fps), false);
+    const int current = (int)(cropStart() + cropDuration()).frames(m_fps) - 1;
+    if (current != previous) {
         if (m_hasThumbs && KdenliveSettings::videothumbnails()) {
             /*connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));*/
             m_endThumbTimer.start(150);
@@ -1100,8 +1099,9 @@ void ClipItem::resizeEnd(int posx, double /*speed*/, bool updateKeyFrames)
 }
 
 
-void ClipItem::checkEffectsKeyframesPos(const int previous, const int current, bool fromStart)
+bool ClipItem::checkEffectsKeyframesPos(const int previous, const int current, bool fromStart)
 {
+    bool modified = false;
     for (int i = 0; i < m_effectList.count(); i++) {
         QDomElement effect = m_effectList.at(i);
         QDomNodeList params = effect.elementsByTagName("parameter");
@@ -1116,24 +1116,31 @@ void ClipItem::checkEffectsKeyframesPos(const int previous, const int current, b
                 foreach(const QString &str, keyframes) {
                     pos = str.section(':', 0, 0).toInt();
                     val = str.section(':', 1, 1).toDouble();
-                    if (pos == previous) kfr[current] = val;
-                    else {
-                        if (fromStart && pos >= current) kfr[pos] = val;
-                        else if (!fromStart && pos <= current) kfr[pos] = val;
+                    if (pos == previous) {
+                        kfr[current] = val;
+                        modified = true;
+                    } else {
+                        if ((fromStart && pos >= current) || (!fromStart && pos <= current)) {
+                            kfr[pos] = val;
+                            modified = true;
+                        }
                     }
                 }
-                QString newkfr;
-                QMap<int, double>::const_iterator k = kfr.constBegin();
-                while (k != kfr.constEnd()) {
-                    newkfr.append(QString::number(k.key()) + ':' + QString::number(k.value()) + ';');
-                    ++k;
+                if (modified) {
+                    QString newkfr;
+                    QMap<int, double>::const_iterator k = kfr.constBegin();
+                    while (k != kfr.constEnd()) {
+                        newkfr.append(QString::number(k.key()) + ':' + QString::number(k.value()) + ';');
+                        ++k;
+                    }
+                    e.setAttribute("keyframes", newkfr);
+                    break;
                 }
-                e.setAttribute("keyframes", newkfr);
-                break;
             }
         }
     }
-    if (m_selectedEffect >= 0) setSelectedEffect(m_selectedEffect);
+    if (modified && m_selectedEffect >= 0) setSelectedEffect(m_selectedEffect);
+    return modified;
 }
 
 //virtual
@@ -1248,8 +1255,7 @@ void ClipItem::setEffectAt(int ix, QDomElement effect)
     }
     //kDebug() << "CHange EFFECT AT: " << ix << ", CURR: " << m_effectList.at(ix).attribute("tag") << ", NEW: " << effect.attribute("tag");
     effect.setAttribute("kdenlive_ix", ix + 1);
-    m_effectList.insert(ix, effect);
-    m_effectList.removeAt(ix + 1);
+    m_effectList.replace(ix, effect);
     m_effectNames = m_effectList.effectNames().join(" / ");
     QString id = effect.attribute("id");
     if (id == "fadein" || id == "fadeout" || id == "fade_from_black" || id == "fade_to_black")
index f66586ab0b34630e0a2871edfb43ddf81bc378c1..0522c4bbaea62367478f8c8fe5427e40c07d38bb 100644 (file)
@@ -48,7 +48,7 @@ public:
                        QWidget *);
     virtual int type() const;
     void resizeStart(int posx, double speed = 1.0);
-    void resizeEnd(int posx, double speed = 1.0, bool updateKeyFrames = true);
+    void resizeEnd(int posx, double speed = 1.0);
     OPERATIONTYPE operationMode(QPointF pos);
     const QString clipProducer() const;
     int clipType() const;
@@ -112,6 +112,8 @@ public:
     void setAudioOnly(bool force);
     bool isVideoOnly() const;
     bool isAudioOnly() const;
+    /** Called when clip start is resized, adjust keyframes values */
+    bool checkEffectsKeyframesPos(const int previous, const int current, bool fromStart);
 
 protected:
     //virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
@@ -153,8 +155,7 @@ private:
     QMap<int, QPixmap> m_audioThumbCachePic;
     bool m_audioThumbReady;
     double m_framePixelWidth;
-    /** Called when clip start is resized, adjust keyframes values */
-    void checkEffectsKeyframesPos(const int previous, const int current, bool fromStart);
+
     QPixmap m_videoPix;
     QPixmap m_audioPix;
 
index 162967c70fe3d7498957b18cd7cefdce5bbe3e59..b3e6d58cece1ce9cc0fa7f1053a682d24cf76f79 100644 (file)
@@ -1134,7 +1134,7 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
                     ItemInfo startInfo = clipInfo;
                     clipInfo.endPos = clipInfo.startPos + d.duration();
                     clipInfo.cropStart = d.cropStart();
-                    new ResizeClipCommand(this, startInfo, clipInfo, true, moveCommand);
+                    new ResizeClipCommand(this, startInfo, clipInfo, true, false, moveCommand);
                 }
                 if (d.startPos() != clipInfo.startPos) {
                     ItemInfo startInfo = clipInfo;
@@ -1147,7 +1147,7 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
                     ItemInfo startInfo = clipInfo;
                     clipInfo.endPos = clipInfo.startPos + d.duration();
                     clipInfo.cropStart = d.cropStart();
-                    new ResizeClipCommand(this, startInfo, clipInfo, true, moveCommand);
+                    new ResizeClipCommand(this, startInfo, clipInfo, true, false, moveCommand);
                 }
                 m_commandStack->push(moveCommand);
             }
@@ -1167,7 +1167,7 @@ void CustomTrackView::editKeyFrame(const GenTime pos, const int track, const int
     ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), track);
     if (clip) {
         clip->setKeyframes(index, keyframes);
-        updateEffect(m_document->tracksCount() - clip->track(), clip->startPos(), clip->effectAt(index), index);
+        updateEffect(m_document->tracksCount() - clip->track(), clip->startPos(), clip->effectAt(index), index, false);
     } else emit displayMessage(i18n("Cannot find clip with keyframe"), ErrorMessage);
 }
 
@@ -1496,11 +1496,11 @@ void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect)
     setDocumentModified();
 }
 
-void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect, int ix, bool triggeredByUser)
+void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedEffect, int ix, bool triggeredByUser)
 {
     ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_document->tracksCount() - track);
+    QDomElement effect = insertedEffect.cloneNode().toElement();
     if (clip) {
-
         // Special case: speed effect
         if (effect.attribute("id") == "speed") {
             ItemInfo info = clip->info();
@@ -2709,8 +2709,40 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
                         new MoveTransitionCommand(this, trInfo, newTrInfo, true, resizeCommand);
                     }
                 }
-                updateClipFade(static_cast <ClipItem *>(m_dragItem));
-                new ResizeClipCommand(this, m_dragItemInfo, info, false, resizeCommand);
+
+                ClipItem *clip = static_cast < ClipItem * >(m_dragItem);
+                updateClipFade(clip);
+
+                // check keyframes
+                QDomDocument doc;
+                QDomElement root = doc.createElement("list");
+                doc.appendChild(root);
+                QList <int> indexes;
+                for (int i = 0; i < clip->effectsCount(); i++) {
+                    QDomElement effect = clip->effectAt(i);
+                    if (EffectsList::hasKeyFrames(effect)) {
+                        doc.appendChild(doc.importNode(effect, true));
+                        indexes.append(i);
+                    }
+                }
+
+                if (clip->checkEffectsKeyframesPos(m_dragItemInfo.cropStart.frames(m_document->fps()), clip->cropStart().frames(m_document->fps()), true)) {
+                    // Keyframes were modified, updateClip
+                    QDomNodeList effs = doc.elementsByTagName("effect");
+                    // Hack:
+                    // Since we must always resize clip before updating the keyframes, we
+                    // put a resize command before & after checking keyframes so that
+                    // we are sure the resize is performed before whenever we do or undo the action
+
+                    new ResizeClipCommand(this, m_dragItemInfo, info, false, true, resizeCommand);
+                    for (int i = 0; i < indexes.count(); i++) {
+                        new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effs.at(i).cloneNode().toElement(), clip->effectAt(indexes.at(i)), indexes.at(i), false, resizeCommand);
+                        updateEffect(m_document->tracksCount() - clip->track(), clip->startPos(), clip->effectAt(indexes.at(i)), indexes.at(i));
+                    }
+                    new ResizeClipCommand(this, m_dragItemInfo, info, false, true, resizeCommand);
+                    emit clipItemSelected(clip);
+                } else new ResizeClipCommand(this, m_dragItemInfo, info, false, false, resizeCommand);
+
                 m_commandStack->push(resizeCommand);
             } else {
                 m_dragItem->resizeStart((int) m_dragItemInfo.startPos.frames(m_document->fps()));
@@ -2771,9 +2803,39 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
                     }
                 }
 
-                new ResizeClipCommand(this, m_dragItemInfo, info, false, resizeCommand);
+                // check keyframes
+                ClipItem *clip = static_cast < ClipItem * >(m_dragItem);
+                QDomDocument doc;
+                QDomElement root = doc.createElement("list");
+                doc.appendChild(root);
+                QList <int> indexes;
+                for (int i = 0; i < clip->effectsCount(); i++) {
+                    QDomElement effect = clip->effectAt(i);
+                    if (EffectsList::hasKeyFrames(effect)) {
+                        doc.appendChild(doc.importNode(effect, true));
+                        indexes.append(i);
+                    }
+                }
+
+                if (clip->checkEffectsKeyframesPos((m_dragItemInfo.cropStart + m_dragItemInfo.endPos - m_dragItemInfo.startPos).frames(m_document->fps()) - 1, (clip->cropStart() + clip->cropDuration()).frames(m_document->fps()) - 1, false)) {
+                    // Keyframes were modified, updateClip
+                    QDomNodeList effs = doc.elementsByTagName("effect");
+                    // Hack:
+                    // Since we must always resize clip before updating the keyframes, we
+                    // put a resize command before & after checking keyframes so that
+                    // we are sure the resize is performed before whenever we do or undo the action
+
+                    new ResizeClipCommand(this, m_dragItemInfo, info, false, true, resizeCommand);
+                    for (int i = 0; i < indexes.count(); i++) {
+                        new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effs.at(i).cloneNode().toElement(), clip->effectAt(indexes.at(i)), indexes.at(i), false, resizeCommand);
+                        updateEffect(m_document->tracksCount() - clip->track(), clip->startPos(), clip->effectAt(indexes.at(i)), indexes.at(i));
+                    }
+                    new ResizeClipCommand(this, m_dragItemInfo, info, false, true, resizeCommand);
+                    emit clipItemSelected(clip);
+                } else new ResizeClipCommand(this, m_dragItemInfo, info, false, false, resizeCommand);
+
                 m_commandStack->push(resizeCommand);
-                updateClipFade(static_cast <ClipItem *>(m_dragItem));
+                updateClipFade(clip);
             } else {
                 m_dragItem->resizeEnd((int) m_dragItemInfo.endPos.frames(m_document->fps()));
                 emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
@@ -3287,7 +3349,7 @@ Transition *CustomTrackView::getTransitionItemAtStart(GenTime pos, int track)
     return clip;
 }
 
-void CustomTrackView::moveClip(const ItemInfo start, const ItemInfo end)
+void CustomTrackView::moveClip(const ItemInfo start, const ItemInfo end, bool refresh)
 {
     if (m_selectionGroup) resetSelectionGroup(false);
     ClipItem *item = getClipItemAt((int) start.startPos.frames(m_document->fps()), start.track);
@@ -3330,7 +3392,7 @@ void CustomTrackView::moveClip(const ItemInfo start, const ItemInfo end)
         // undo last move and emit error message
         emit displayMessage(i18n("Cannot move clip to position %1", m_document->timecode().getTimecodeFromFrames(end.startPos.frames(m_document->fps()))), ErrorMessage);
     }
-    m_document->renderer()->doRefresh();
+    if (refresh) m_document->renderer()->doRefresh();
     //kDebug() << " // MOVED CLIP TO: " << end.startPos.frames(25) << ", ITEM START: " << item->startPos().frames(25);
 }
 
@@ -3424,7 +3486,7 @@ void CustomTrackView::moveGroup(QList <ItemInfo> startClip, QList <ItemInfo> sta
     } else kDebug() << "///////// WARNING; NO GROUP TO MOVE";
 }
 
-void CustomTrackView::moveTransition(const ItemInfo start, const ItemInfo end)
+void CustomTrackView::moveTransition(const ItemInfo start, const ItemInfo end, bool m_refresh)
 {
     Transition *item = getTransitionItemAt(start.startPos, start.track);
     if (!item) {
@@ -3466,17 +3528,15 @@ void CustomTrackView::moveTransition(const ItemInfo start, const ItemInfo end)
         }
         emit transitionItemSelected(item, getPreviousVideoTrack(item->track()), p);
     }
-    m_document->renderer()->doRefresh();
+    if (m_refresh) m_document->renderer()->doRefresh();
 }
 
-void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end)
+void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end, bool dontWorry)
 {
-    bool resizeClipStart = true;
-    if (start.startPos == end.startPos) resizeClipStart = false;
-    /*if (resizeClipStart) offset = 1;
-    else offset = -1;*/
-    ClipItem *item = getClipItemAt((int)(start.startPos.frames(m_document->fps())), start.track);
+    bool resizeClipStart = (start.startPos != end.startPos);
+    ClipItem *item = getClipItemAtStart(start.startPos, start.track);
     if (!item) {
+        if (dontWorry) return;
         emit displayMessage(i18n("Cannot move clip at time: %1 on track %2", m_document->timecode().getTimecodeFromFrames(start.startPos.frames(m_document->fps())), start.track), ErrorMessage);
         kDebug() << "----------------  ERROR, CANNOT find clip to resize at... "; // << startPos;
         return;
@@ -3485,18 +3545,19 @@ void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end)
         // Item is part of a group, reset group
         resetSelectionGroup();
     }
+
     bool snap = KdenliveSettings::snaptopoints();
     KdenliveSettings::setSnaptopoints(false);
-    if (resizeClipStart && start.startPos != end.startPos) {
+    if (resizeClipStart) {
         ItemInfo clipinfo = item->info();
         clipinfo.track = m_document->tracksCount() - clipinfo.track;
-        bool success = m_document->renderer()->mltResizeClipStart(clipinfo, end.startPos - item->startPos());
+        bool success = m_document->renderer()->mltResizeClipStart(clipinfo, end.startPos - clipinfo.startPos);
         if (success) {
             kDebug() << "RESIZE CLP STRAT TO:" << end.startPos.frames(m_document->fps()) << ", OLD ST: " << start.startPos.frames(25);
             item->resizeStart((int) end.startPos.frames(m_document->fps()));
             updateClipFade(item);
         } else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
-    } else if (!resizeClipStart) {
+    } else {
         ItemInfo clipinfo = item->info();
         clipinfo.track = m_document->tracksCount() - clipinfo.track;
         bool success = m_document->renderer()->mltResizeClipEnd(clipinfo, end.endPos - clipinfo.startPos);
@@ -3505,7 +3566,7 @@ void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end)
             updateClipFade(item);
         } else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
     }
-    if (end.cropStart != start.cropStart) {
+    if (!resizeClipStart && end.cropStart != start.cropStart) {
         kDebug() << "// RESIZE CROP, DIFF: " << (end.cropStart - start.cropStart).frames(25);
         ItemInfo clipinfo = end;
         clipinfo.track = m_document->tracksCount() - end.track;
@@ -4267,7 +4328,7 @@ void CustomTrackView::setInPoint()
     }
     if (clip->type() == TRANSITIONWIDGET) {
         m_commandStack->push(new MoveTransitionCommand(this, startInfo, endInfo, true));
-    } else m_commandStack->push(new ResizeClipCommand(this, startInfo, endInfo, true));
+    } else m_commandStack->push(new ResizeClipCommand(this, startInfo, endInfo, true, false));
 }
 
 void CustomTrackView::setOutPoint()
@@ -4299,7 +4360,7 @@ void CustomTrackView::setOutPoint()
 
     if (clip->type() == TRANSITIONWIDGET) {
         m_commandStack->push(new MoveTransitionCommand(this, startInfo, endInfo, true));
-    } else m_commandStack->push(new ResizeClipCommand(this, startInfo, endInfo, true));
+    } else m_commandStack->push(new ResizeClipCommand(this, startInfo, endInfo, true, false));
 }
 
 void CustomTrackView::slotUpdateAllThumbs()
index dece5d42ba7095194da7cbec4143e726a1d54741..6119efa170b7f5a861b0694769cac34e2b1e200d 100644 (file)
@@ -54,11 +54,11 @@ public:
     void changeTrack(int ix, TrackInfo type);
     int cursorPos();
     void checkAutoScroll();
-    void moveClip(const ItemInfo start, const ItemInfo end);
+    void moveClip(const ItemInfo start, const ItemInfo end, bool refresh);
     void moveGroup(QList <ItemInfo> startClip, QList <ItemInfo> startTransition, const GenTime offset, const int trackOffset, bool reverseMove = false);
     /** move transition, startPos = (old start, old end), endPos = (new start, new end) */
-    void moveTransition(const ItemInfo start, const ItemInfo end);
-    void resizeClip(const ItemInfo start, const ItemInfo end);
+    void moveTransition(const ItemInfo start, const ItemInfo end, bool m_refresh);
+    void resizeClip(const ItemInfo start, const ItemInfo end, bool dontWorry = false);
     void addClip(QDomElement xml, const QString &clipId, ItemInfo info, EffectsList list = EffectsList(), bool refresh = true);
     void deleteClip(ItemInfo info, bool refresh = true);
     void slotDeleteClipMarker(const QString &comment, const QString &id, const GenTime &position);
@@ -70,7 +70,7 @@ public:
     void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group);
     void addEffect(int track, GenTime pos, QDomElement effect);
     void deleteEffect(int track, GenTime pos, QDomElement effect);
-    void updateEffect(int track, GenTime pos, QDomElement effect, int ix, bool triggeredByUser = true);
+    void updateEffect(int track, GenTime pos, QDomElement insertedEffect, int ix, bool triggeredByUser = true);
     void moveEffect(int track, GenTime pos, int oldPos, int newPos);
     void addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh);
     void deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh);
index a6e76c14dcbdd1d6b81d508bcd1ac014e40a8d39..9bbebc748651bf0efb4652c8098db84ab33a8861 100644 (file)
@@ -23,8 +23,8 @@
 
 #include <KLocale>
 
-EditEffectCommand::EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, int stackPos, bool doIt) :
-        QUndoCommand(),
+EditEffectCommand::EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, int stackPos, bool doIt, QUndoCommand *parent) :
+        QUndoCommand(parent),
         m_view(view),
         m_track(track),
         m_oldeffect(oldeffect),
@@ -59,13 +59,11 @@ bool EditEffectCommand::mergeWith(const QUndoCommand * other)
 // virtual
 void EditEffectCommand::undo()
 {
-    //kDebug() << "----  undoing action";
     m_view->updateEffect(m_track, m_pos, m_oldeffect, m_stackPos, false);
 }
 // virtual
 void EditEffectCommand::redo()
 {
-    //kDebug() << "----  redoing action";
     m_view->updateEffect(m_track, m_pos, m_effect, m_stackPos, m_doIt);
     m_doIt = false;
 }
index 1b01ede7e674a8bc261f3edde902a67ef88a7a20..c793fd4f842ac3962644dd5d8ec9b3fb7381b7f1 100644 (file)
@@ -31,7 +31,7 @@ class CustomTrackView;
 class EditEffectCommand : public QUndoCommand
 {
 public:
-    EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, int stackPos, bool doIt);
+    EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, int stackPos, bool doIt, QUndoCommand *parent = 0);
 
     virtual int id() const;
     virtual bool mergeWith(const QUndoCommand * command);
index d946cc459772b2dab03cfdf39dc62abf4dd86ffd..29c341ca24e47991373dbe0f55cd9c5ef2dd760a 100644 (file)
@@ -44,6 +44,7 @@ EditKeyFrameCommand::EditKeyFrameCommand(CustomTrackView *view, const int track,
 void EditKeyFrameCommand::undo()
 {
     m_view->editKeyFrame(m_pos, m_track, m_index, m_oldkfr);
+    m_doIt = true;
 }
 // virtual
 void EditKeyFrameCommand::redo()
index c3f1e0c28a82332e3b4bdea17c5f3ac3bb34bee7..6d29b40332bdcf31181d1f8dd2785433f1395658 100644 (file)
@@ -221,7 +221,14 @@ QDomElement EffectsList::item(int ix)
 void EffectsList::insert(int ix, QDomElement effect)
 {
     QDomNodeList effects = m_baseElement.childNodes();
-    if (ix >= effects.count()) m_baseElement.appendChild(effect);
-    else m_baseElement.insertBefore(effect, effects.at(ix));
+    if (ix >= effects.count()) m_baseElement.appendChild(importNode(effect, true));
+    else m_baseElement.insertBefore(importNode(effect, true), effects.at(ix));
 }
 
+void EffectsList::replace(int ix, QDomElement effect)
+{
+    QDomNodeList effects = m_baseElement.childNodes();
+    if (ix < effects.count()) m_baseElement.removeChild(effects.at(ix));
+    if (ix == effects.count()) m_baseElement.appendChild(importNode(effect, true));
+    else m_baseElement.insertBefore(importNode(effect, true), effects.at(ix));
+}
index 2877738a3019976cee2e7285651aef4089dba426..d019159a1b0c4b643f302892e41dbbef155234f7 100644 (file)
@@ -49,6 +49,7 @@ public:
     void removeAt(int ix);
     QDomElement item(int ix);
     void insert(int ix, QDomElement effect);
+    void replace(int ix, QDomElement effect);
     static bool hasKeyFrames(QDomElement effect);
     static void setParameter(QDomElement effect, const QString &name, const QString &value);
     static QString parameter(QDomElement effect, const QString &name);
index 8e2ab3f20c6945207f2381c8af0f85a2bfc8db8a..b10ed93e54be2829ad9943ddd8efa0ed2ca2f4f0 100644 (file)
@@ -65,26 +65,19 @@ class Wipeval: public QWidget, public Ui::Wipeval_UI
 QMap<QString, QImage> EffectStackEdit::iconCache;
 
 EffectStackEdit::EffectStackEdit(QWidget *parent) :
-        QObject(parent),
+        QScrollArea(parent),
         m_in(0),
         m_out(0),
         m_frameSize(QPoint())
 {
-    QVBoxLayout *vbox1 = new QVBoxLayout(parent);
-    vbox1->setContentsMargins(0, 0, 0, 0);
-    vbox1->setSpacing(0);
-
-    QScrollArea *area = new QScrollArea;
-    m_baseWidget = new QWidget(parent);
-    area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
-    area->setFrameStyle(QFrame::NoFrame);
-    parent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
-    area->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
-
-    vbox1->addWidget(area);
-    area->setWidget(m_baseWidget);
-    area->setWidgetResizable(true);
+    m_baseWidget = new QWidget(this);
+    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+    setFrameStyle(QFrame::NoFrame);
+    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
+
+    setWidget(m_baseWidget);
+    setWidgetResizable(true);
     m_vbox = new QVBoxLayout(m_baseWidget);
     m_vbox->setContentsMargins(0, 0, 0, 0);
     m_vbox->setSpacing(0);
@@ -241,7 +234,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int in, int out)
         } else if (type == "keyframe") {
             // keyframe editor widget
             kDebug() << "min: " << m_in << ", MAX: " << m_out;
-            KeyframeEdit *geo = new KeyframeEdit(pa, m_out - m_in, pa.attribute("min").toInt(), pa.attribute("max").toInt(), m_timecode);
+            KeyframeEdit *geo = new KeyframeEdit(pa, m_out - m_in - 1, pa.attribute("min").toInt(), pa.attribute("max").toInt(), m_timecode);
             //geo->setupParam(100, pa.attribute("min").toInt(), pa.attribute("max").toInt(), pa.attribute("keyframes"));
             //connect(geo, SIGNAL(seekToPos(int)), this, SLOT(slotSeekToPos(int)));
             //geo->setupParam(pa, minFrame, maxFrame);
@@ -538,8 +531,9 @@ void EffectStackEdit::clearAllItems()
     //qDeleteAll(m_uiItems);
     QLayoutItem *child;
     while ((child = m_vbox->takeAt(0)) != 0) {
-        if (child->widget()) delete child->widget();
+        QWidget *wid = child->widget();
         delete child;
+        if (wid) delete wid;
     }
     blockSignals(false);
 }
index f16ea1ae49b46688b847b948a277c7e2275710b6..5045bc3df490075aa4bc42949daed7251f195ac5 100644 (file)
@@ -27,6 +27,7 @@
 #include <QVBoxLayout>
 #include <QList>
 #include <QMap>
+#include <QScrollArea>
 
 enum WIPE_DIRECTON { UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, CENTER = 4 };
 
@@ -39,7 +40,7 @@ struct wipeInfo {
 
 class QFrame;
 
-class EffectStackEdit : public QObject
+class EffectStackEdit : public QScrollArea
 {
     Q_OBJECT
 public:
index da0c685558bf3a3e8916838654747ffdff25d02b..7f852e760241c00c95d7f39da51ee4f0ca2a74a5 100644 (file)
@@ -38,7 +38,12 @@ EffectStackView::EffectStackView(QWidget *parent) :
         QWidget(parent)
 {
     m_ui.setupUi(this);
+    QVBoxLayout *vbox1 = new QVBoxLayout(m_ui.frame);
     m_effectedit = new EffectStackEdit(m_ui.frame);
+    vbox1->setContentsMargins(0, 0, 0, 0);
+    vbox1->setSpacing(0);
+    vbox1->addWidget(m_effectedit);
+    m_ui.frame->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
     //m_ui.effectlist->horizontalHeader()->setVisible(false);
     //m_ui.effectlist->verticalHeader()->setVisible(false);
     m_clipref = NULL;
@@ -145,6 +150,7 @@ void EffectStackView::slotClipItemSelected(ClipItem* c, int ix)
             double factor = c->baseClip()->getProperty("aspect_ratio").toDouble();
             QPoint p((int)(size.section('x', 0, 0).toInt() * factor + 0.5), size.section('x', 1, 1).toInt());
             m_effectedit->setFrameSize(p);
+            m_effectedit->setFrameSize(p);
         } else ix = 0;
     }
     if (m_clipref == NULL) {
index 9931381c8cfa8af293d05acacf81984818c6ab34..847caaab32f7578f227604d9fc3c2da9c4dbf511 100644 (file)
@@ -33,62 +33,70 @@ KeyframeEdit::KeyframeEdit(QDomElement e, int maxFrame, int minVal, int maxVal,
         m_timecode(tc),
         m_previousPos(0)
 {
-    m_ui.setupUi(this);
-    m_ui.keyframe_list->setFont(KGlobalSettings::generalFont());
-    m_ui.keyframe_list->setHeaderLabels(QStringList() << i18n("Position") << i18n("Value"));
+    setupUi(this);
+    keyframe_list->setFont(KGlobalSettings::generalFont());
+    keyframe_list->setHeaderLabels(QStringList() << i18n("Position") << i18n("Value"));
     //setResizeMode(1, QHeaderView::Interactive);
-    m_ui.button_add->setIcon(KIcon("document-new"));
-    m_ui.button_delete->setIcon(KIcon("edit-delete"));
-    connect(m_ui.keyframe_list, SIGNAL(itemSelectionChanged()/*itemClicked(QTreeWidgetItem *, int)*/), this, SLOT(slotAdjustKeyframeInfo()));
+    button_add->setIcon(KIcon("document-new"));
+    button_delete->setIcon(KIcon("edit-delete"));
+    connect(keyframe_list, SIGNAL(itemSelectionChanged()/*itemClicked(QTreeWidgetItem *, int)*/), this, SLOT(slotAdjustKeyframeInfo()));
     setupParam();
-    m_ui.keyframe_list->header()->resizeSections(QHeaderView::ResizeToContents);
-    connect(m_ui.button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteKeyframe()));
-    connect(m_ui.button_add, SIGNAL(clicked()), this, SLOT(slotAddKeyframe()));
-    connect(m_ui.keyframe_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotGenerateParams(QTreeWidgetItem *, int)));
-    connect(m_ui.keyframe_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotSaveCurrentParam(QTreeWidgetItem *, int)));
-    connect(m_ui.keyframe_pos, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
-    m_ui.keyframe_pos->setPageStep(1);
-    m_ui.keyframe_list->setItemDelegate(new KeyItemDelegate(minVal, maxVal));
+    keyframe_list->header()->resizeSections(QHeaderView::ResizeToContents);
+    connect(button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteKeyframe()));
+    connect(button_add, SIGNAL(clicked()), this, SLOT(slotAddKeyframe()));
+    connect(keyframe_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotGenerateParams(QTreeWidgetItem *, int)));
+    connect(keyframe_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotSaveCurrentParam(QTreeWidgetItem *, int)));
+    connect(keyframe_pos, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
+    keyframe_pos->setPageStep(1);
+    m_delegate = new KeyItemDelegate(minVal, maxVal);
+    keyframe_list->setItemDelegate(m_delegate);
+}
+
+KeyframeEdit::~KeyframeEdit()
+{
+    keyframe_list->blockSignals(true);
+    keyframe_list->clear();
+    delete m_delegate;
 }
 
 void KeyframeEdit::setupParam(QDomElement e)
 {
     if (!e.isNull()) m_param = e;
-    m_ui.keyframe_list->clear();
+    keyframe_list->clear();
     QStringList frames = m_param.attribute("keyframes").split(";", QString::SkipEmptyParts);
     for (int i = 0; i < frames.count(); i++) {
         QString framePos = m_timecode.getTimecodeFromFrames(frames.at(i).section(':', 0, 0).toInt());
         QTreeWidgetItem *item = new QTreeWidgetItem(QStringList() << framePos << frames.at(i).section(':', 1, 1));
         item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
-        m_ui.keyframe_list->addTopLevelItem(item);
+        keyframe_list->addTopLevelItem(item);
     }
-    QTreeWidgetItem *first = m_ui.keyframe_list->topLevelItem(0);
-    if (first) m_ui.keyframe_list->setCurrentItem(first);
+    QTreeWidgetItem *first = keyframe_list->topLevelItem(0);
+    if (first) keyframe_list->setCurrentItem(first);
     slotAdjustKeyframeInfo();
-    m_ui.button_delete->setEnabled(m_ui.keyframe_list->topLevelItemCount() > 2);
+    button_delete->setEnabled(keyframe_list->topLevelItemCount() > 2);
 }
 
 void KeyframeEdit::slotDeleteKeyframe()
 {
-    if (m_ui.keyframe_list->topLevelItemCount() < 3) return;
-    QTreeWidgetItem *item = m_ui.keyframe_list->currentItem();
+    if (keyframe_list->topLevelItemCount() < 3) return;
+    QTreeWidgetItem *item = keyframe_list->currentItem();
     if (item) {
         delete item;
         slotGenerateParams();
     }
-    m_ui.button_delete->setEnabled(m_ui.keyframe_list->topLevelItemCount() > 2);
+    button_delete->setEnabled(keyframe_list->topLevelItemCount() > 2);
 }
 
 void KeyframeEdit::slotAddKeyframe()
 {
-    m_ui.keyframe_list->blockSignals(true);
+    keyframe_list->blockSignals(true);
     int pos2;
-    QTreeWidgetItem *item = m_ui.keyframe_list->currentItem();
+    QTreeWidgetItem *item = keyframe_list->currentItem();
     if (item == NULL) return;
-    int ix = m_ui.keyframe_list->indexOfTopLevelItem(item);
+    int ix = keyframe_list->indexOfTopLevelItem(item);
     int pos1 = m_timecode.getFrameCount(item->text(0));
-    QTreeWidgetItem *below = m_ui.keyframe_list->topLevelItem(ix + 1);
-    if (below == NULL) below = m_ui.keyframe_list->topLevelItem(ix - 1);
+    QTreeWidgetItem *below = keyframe_list->topLevelItem(ix + 1);
+    if (below == NULL) below = keyframe_list->topLevelItem(ix - 1);
     if (below == NULL) {
         if (pos1 == 0) pos2 = m_max;
         else pos2 = 0;
@@ -100,11 +108,11 @@ void KeyframeEdit::slotAddKeyframe()
     if (result > pos1) ix++;
     QTreeWidgetItem *newItem = new QTreeWidgetItem(QStringList() << m_timecode.getTimecodeFromFrames(result) << item->text(1));
     newItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
-    m_ui.keyframe_list->insertTopLevelItem(ix, newItem);
-    m_ui.keyframe_list->setCurrentItem(newItem);
+    keyframe_list->insertTopLevelItem(ix, newItem);
+    keyframe_list->setCurrentItem(newItem);
     slotAdjustKeyframeInfo();
-    m_ui.keyframe_list->blockSignals(false);
-    m_ui.button_delete->setEnabled(m_ui.keyframe_list->topLevelItemCount() > 2);
+    keyframe_list->blockSignals(false);
+    button_delete->setEnabled(keyframe_list->topLevelItemCount() > 2);
     slotGenerateParams();
 }
 
@@ -122,7 +130,7 @@ void KeyframeEdit::slotGenerateParams(QTreeWidgetItem *item, int column)
                 pos = m_max;
                 val = m_timecode.getTimecodeFromFrames(pos);
             }
-            QList<QTreeWidgetItem *> duplicates = m_ui.keyframe_list->findItems(val, Qt::MatchExactly, 0);
+            QList<QTreeWidgetItem *> duplicates = keyframe_list->findItems(val, Qt::MatchExactly, 0);
             duplicates.removeAll(item);
             if (!duplicates.isEmpty()) {
                 // Trying to insert a keyframe at existing value, revert it
@@ -136,8 +144,8 @@ void KeyframeEdit::slotGenerateParams(QTreeWidgetItem *item, int column)
         }
     }
     QString keyframes;
-    for (int i = 0; i < m_ui.keyframe_list->topLevelItemCount(); i++) {
-        QTreeWidgetItem *item = m_ui.keyframe_list->topLevelItem(i);
+    for (int i = 0; i < keyframe_list->topLevelItemCount(); i++) {
+        QTreeWidgetItem *item = keyframe_list->topLevelItem(i);
         keyframes.append(QString::number(m_timecode.getFrameCount(item->text(0))) + ':' + item->text(1) + ';');
     }
     m_param.setAttribute("keyframes", keyframes);
@@ -146,23 +154,23 @@ void KeyframeEdit::slotGenerateParams(QTreeWidgetItem *item, int column)
 
 void KeyframeEdit::slotAdjustKeyframeInfo()
 {
-    QTreeWidgetItem *item = m_ui.keyframe_list->currentItem();
+    QTreeWidgetItem *item = keyframe_list->currentItem();
     if (!item) return;
     int min = 0;
     int max = m_max;
-    QTreeWidgetItem *above = m_ui.keyframe_list->itemAbove(item);
-    QTreeWidgetItem *below = m_ui.keyframe_list->itemBelow(item);
+    QTreeWidgetItem *above = keyframe_list->itemAbove(item);
+    QTreeWidgetItem *below = keyframe_list->itemBelow(item);
     if (above) min = m_timecode.getFrameCount(above->text(0)) + 1;
     if (below) max = m_timecode.getFrameCount(below->text(0)) - 1;
-    m_ui.keyframe_pos->blockSignals(true);
-    m_ui.keyframe_pos->setRange(min, max);
-    m_ui.keyframe_pos->setValue(m_timecode.getFrameCount(item->text(0)));
-    m_ui.keyframe_pos->blockSignals(false);
+    keyframe_pos->blockSignals(true);
+    keyframe_pos->setRange(min, max);
+    keyframe_pos->setValue(m_timecode.getFrameCount(item->text(0)));
+    keyframe_pos->blockSignals(false);
 }
 
 void KeyframeEdit::slotAdjustKeyframeValue(int value)
 {
-    QTreeWidgetItem *item = m_ui.keyframe_list->currentItem();
+    QTreeWidgetItem *item = keyframe_list->currentItem();
     item->setText(0, m_timecode.getTimecodeFromFrames(value));
 }
 
index 82621c80048c962dd962267007464949ca8587fc..8de47f02f2666a9253f0383a5e459cd7fb56ca0d 100644 (file)
@@ -71,21 +71,22 @@ private:
     int m_max;
 };
 
-class KeyframeEdit : public QWidget
+class KeyframeEdit : public QWidget, public Ui::KeyframeEditor_UI
 {
     Q_OBJECT
 public:
     explicit KeyframeEdit(QDomElement e, int maxFrame, int minVal, int maxVal, Timecode tc, QWidget* parent = 0);
+    virtual ~KeyframeEdit();
     void setupParam(QDomElement e = QDomElement());
 
 private:
-    Ui::KeyframeEditor_UI m_ui;
     QDomElement m_param;
     int m_max;
     int m_minVal;
     int m_maxVal;
     Timecode m_timecode;
     int m_previousPos;
+    KeyItemDelegate *m_delegate;
 
 public slots:
 
index 74d159d80f6c978b45ac3781b0b3964bfe88ed44..659c09faad669e31687fc9f1ad0a0f6dbeb88828 100644 (file)
@@ -31,6 +31,10 @@ MoveClipCommand::MoveClipCommand(CustomTrackView *view, const ItemInfo start, co
         m_doIt(doIt)
 {
     setText(i18n("Move clip"));
+    if (parent) {
+        // command has a parent, so there are several operations ongoing, do not refresh monitor
+        m_refresh = false;
+    } else m_refresh = true;
 }
 
 
@@ -39,14 +43,14 @@ void MoveClipCommand::undo()
 {
 // kDebug()<<"----  undoing action";
     m_doIt = true;
-    m_view->moveClip(m_endPos, m_startPos);
+    m_view->moveClip(m_endPos, m_startPos, m_refresh);
 }
 // virtual
 void MoveClipCommand::redo()
 {
     //kDebug() << "----  redoing action";
     if (m_doIt)
-        m_view->moveClip(m_startPos, m_endPos);
+        m_view->moveClip(m_startPos, m_endPos, m_refresh);
     m_doIt = true;
 }
 
index 41ab4a8c08f544a33f164bc2973ea4cd45781b75..5b7d99ffecac95d1495be7a3dba530be8fd19886 100644 (file)
@@ -39,6 +39,7 @@ private:
     const ItemInfo m_startPos;
     const ItemInfo m_endPos;
     bool m_doIt;
+    bool m_refresh;
 };
 
 #endif
index 71c29444aff0dbbc81da4e57d494c7bc6242fde9..f825ed77c8b7cd987a52483b42402943baf2090a 100644 (file)
@@ -28,6 +28,10 @@ MoveTransitionCommand::MoveTransitionCommand(CustomTrackView *view, const ItemIn
         m_doIt(doIt)
 {
     setText(i18n("Move transition"));
+    if (parent) {
+        // command has a parent, so there are several operations ongoing, do not refresh monitor
+        m_refresh = false;
+    } else m_refresh = true;
 }
 
 
@@ -36,13 +40,13 @@ void MoveTransitionCommand::undo()
 {
 // kDebug()<<"----  undoing action";
     m_doIt = true;
-    m_view->moveTransition(m_endPos, m_startPos);
+    m_view->moveTransition(m_endPos, m_startPos, m_refresh);
 }
 // virtual
 void MoveTransitionCommand::redo()
 {
     //kDebug() << "----  redoing action";
-    if (m_doIt) m_view->moveTransition(m_startPos, m_endPos);
+    if (m_doIt) m_view->moveTransition(m_startPos, m_endPos, m_refresh);
     m_doIt = true;
 }
 
index aecd47a88a45cb1bdba4e1b509f53d6376b8cb18..6c9dd00c1097ad864b7624d09936b1aa7939c1cb 100644 (file)
@@ -36,6 +36,7 @@ private:
     ItemInfo m_startPos;
     ItemInfo m_endPos;
     bool m_doIt;
+    bool m_refresh;
 };
 
 #endif
index 574fc94d2744ae04194ad065608b1882a3282d03..50f2ad794daec19fadeea33e5898d603605309bb 100644 (file)
@@ -103,8 +103,8 @@ ProjectList::ProjectList(QWidget *parent) :
     connect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
     connect(m_listView, SIGNAL(showProperties(DocClipBase *)), this, SIGNAL(showClipProperties(DocClipBase *)));
 
-    ItemDelegate *listViewDelegate = new ItemDelegate(m_listView);
-    m_listView->setItemDelegate(listViewDelegate);
+    m_listViewDelegate = new ItemDelegate(m_listView);
+    m_listView->setItemDelegate(m_listViewDelegate);
 
     if (KdenliveSettings::activate_nepomuk()) {
         Nepomuk::ResourceManager::instance()->init();
@@ -119,6 +119,9 @@ ProjectList::~ProjectList()
 {
     delete m_menu;
     delete m_toolbar;
+    m_listView->blockSignals(true);
+    m_listView->clear();
+    delete m_listViewDelegate;
 }
 
 void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction)
index ebaeb00acd7b8bf6c1f9905fb013e1fbc8727f31..9618d352be77abb2e26dd1c7ba618cdb3a294f06 100644 (file)
@@ -172,6 +172,7 @@ private:
     QMenu *m_transcodeAction;
     KdenliveDoc *m_doc;
     ProjectItem *m_selectedItem;
+    ItemDelegate *m_listViewDelegate;
     bool m_refreshed;
     QToolButton *m_addButton;
     QMap <QString, QDomElement> m_infoQueue;
index e352450c0985217c7f8baf851c0b99102fb1b4e5..dc3db831a4ff68efe13c5c923d03bcd7caf82562 100644 (file)
@@ -156,7 +156,8 @@ RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) :
     m_view.out_file->setMode(KFile::File);
 
     m_view.running_jobs->setHeaderLabels(QStringList() << QString() << i18n("File") << i18n("Progress"));
-    m_view.running_jobs->setItemDelegate(new RenderViewDelegate(this));
+    m_jobsDelegate = new RenderViewDelegate(this);
+    m_view.running_jobs->setItemDelegate(m_jobsDelegate);
 
     QHeaderView *header = m_view.running_jobs->header();
     QFontMetrics fm = fontMetrics();
@@ -170,7 +171,8 @@ RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) :
 
 
     m_view.scripts_list->setHeaderLabels(QStringList() << QString() << i18n("Script Files"));
-    m_view.scripts_list->setItemDelegate(new RenderViewDelegate(this));
+    m_scriptsDelegate = new RenderViewDelegate(this);
+    m_view.scripts_list->setItemDelegate(m_scriptsDelegate);
     header = m_view.scripts_list->header();
     header->setResizeMode(0, QHeaderView::Fixed);
     header->resizeSection(0, 30);
@@ -186,6 +188,16 @@ RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) :
     focusFirstVisibleItem();
 }
 
+RenderWidget::~RenderWidget()
+{
+    m_view.running_jobs->blockSignals(true);
+    m_view.scripts_list->blockSignals(true);
+    m_view.running_jobs->clear();
+    m_view.scripts_list->clear();
+    delete m_jobsDelegate;
+    delete m_scriptsDelegate;
+}
+
 void RenderWidget::slotEditItem(QListWidgetItem *item)
 {
     QString edit = item->data(EditableRole).toString();
index c2d9ef58acf71e76066189f7d5ff350adb629e28..90064792c0a8557e1ff6be3a26a11b2807a2699a 100644 (file)
@@ -100,6 +100,7 @@ class RenderWidget : public QDialog
 
 public:
     explicit RenderWidget(const QString &projectfolder, QWidget * parent = 0);
+    virtual ~RenderWidget();
     void setGuides(QDomElement guidesxml, double duration);
     void focusFirstVisibleItem();
     void setProfile(MltVideoProfile profile);
@@ -144,6 +145,8 @@ private:
     Ui::RenderWidget_UI m_view;
     MltVideoProfile m_profile;
     QString m_projectFolder;
+    RenderViewDelegate *m_scriptsDelegate;
+    RenderViewDelegate *m_jobsDelegate;
     bool m_blockProcessing;
     QString m_renderer;
     void parseProfiles(QString meta = QString(), QString group = QString(), QString profile = QString());
index 9ad85065b0900f2a8e5bb39f0609886b6546d83c..4d8cfdf1156485addf2d68a004e9c3996e4e35a5 100644 (file)
 
 #include <KLocale>
 
-ResizeClipCommand::ResizeClipCommand(CustomTrackView *view, const ItemInfo start, const ItemInfo end, bool doIt, QUndoCommand * parent) :
+ResizeClipCommand::ResizeClipCommand(CustomTrackView *view, const ItemInfo start, const ItemInfo end, bool doIt, bool dontWorry, QUndoCommand * parent) :
         QUndoCommand(parent),
         m_view(view),
         m_startPos(start),
         m_endPos(end),
-        m_doIt(doIt)
+        m_doIt(doIt),
+        m_dontWorry(dontWorry)
 {
     setText(i18n("Resize clip"));
 }
@@ -38,13 +39,13 @@ void ResizeClipCommand::undo()
 {
 // kDebug()<<"----  undoing action";
     m_doIt = true;
-    if (m_doIt) m_view->resizeClip(m_endPos, m_startPos);
+    if (m_doIt) m_view->resizeClip(m_endPos, m_startPos, m_dontWorry);
 }
 // virtual
 void ResizeClipCommand::redo()
 {
     kDebug() << "----  redoing action";
-    if (m_doIt) m_view->resizeClip(m_startPos, m_endPos);
+    if (m_doIt) m_view->resizeClip(m_startPos, m_endPos, m_dontWorry);
     m_doIt = true;
 }
 
index 8493c95d3b954a20c7dce3f7765aa2556e68bd81..9b5a4ae6bbc164ae54a1eb59c5242419e1d5db23 100644 (file)
@@ -34,7 +34,7 @@ class CustomTrackView;
 class ResizeClipCommand : public QUndoCommand
 {
 public:
-    ResizeClipCommand(CustomTrackView *view, const ItemInfo start, const ItemInfo end, bool doIt, QUndoCommand * parent = 0);
+    ResizeClipCommand(CustomTrackView *view, const ItemInfo start, const ItemInfo end, bool doIt, bool dontWorry, QUndoCommand * parent = 0);
     virtual void undo();
     virtual void redo();
 
@@ -43,6 +43,7 @@ private:
     ItemInfo m_startPos;
     ItemInfo m_endPos;
     bool m_doIt;
+    bool m_dontWorry;
 };
 
 #endif
index 47cdf7376f1cf8fbea33f4fa635a80ff3b30ba6b..0568c50cc9748bf36e5f0c8d12da5fd07931b5c6 100644 (file)
@@ -147,7 +147,6 @@ void Transition::paint(QPainter *painter,
                        const QStyleOptionGraphicsItem *option,
                        QWidget */*widget*/)
 {
-    const double scale = option->matrix.m11();
     const QRectF exposed = option->exposedRect;
     painter->setClipRect(exposed);
     const QRectF br = rect();
index 2b2aecf31ffc6fc5db2b6582f392bc8bef972505..cdab1d25fb2c69b25d57030a38c6875440ba4df8 100644 (file)
@@ -33,7 +33,12 @@ TransitionSettings::TransitionSettings(QWidget* parent) :
         m_autoTrackTransition(0)
 {
     m_ui.setupUi(this);
+    QVBoxLayout *vbox1 = new QVBoxLayout(m_ui.frame);
     m_effectEdit = new EffectStackEdit(m_ui.frame);
+    vbox1->setContentsMargins(0, 0, 0, 0);
+    vbox1->setSpacing(0);
+    vbox1->addWidget(m_effectEdit);
+    m_ui.frame->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
     connect(m_effectEdit, SIGNAL(seekTimeline(int)), this, SIGNAL(seekTimeline(int)));
     setEnabled(false);