]> git.sesse.net Git - kdenlive/commitdiff
Fix deletion of project clips
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 23 Mar 2009 22:42:26 +0000 (22:42 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 23 Mar 2009 22:42:26 +0000 (22:42 +0000)
svn path=/trunk/kdenlive/; revision=3176

src/customtrackview.cpp

index bdf1cb225064de9a39937c93a86a932aacb09fb3..96f3d9d82314e815ed8343a4135f8acce362d870 100644 (file)
@@ -1973,6 +1973,7 @@ void CustomTrackView::insertSpace(QList<ItemInfo> clipsToMove, QList<ItemInfo> t
 }
 
 void CustomTrackView::deleteClip(const QString &clipId) {
+    resetSelectionGroup();
     QList<QGraphicsItem *> itemList = items();
     QUndoCommand *deleteCommand = new QUndoCommand();
     deleteCommand->setText(i18n("Delete timeline clips"));
@@ -1982,12 +1983,16 @@ void CustomTrackView::deleteClip(const QString &clipId) {
             ClipItem *item = (ClipItem *)itemList.at(i);
             if (item->clipProducer() == clipId) {
                 count++;
+                if (item->parentItem()) {
+                    // Clip is in a group, destroy the group
+                    new GroupClipsCommand(this, QList<ItemInfo>() << item->info(), QList<ItemInfo>(), false, true, deleteCommand);
+                }
                 new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), item->info(), item->effectList(), true, true, deleteCommand);
-                //delete item;
             }
         }
     }
-
+    if (count == 0) delete deleteCommand;
+    else m_commandStack->push(deleteCommand);
 }
 
 void CustomTrackView::setCursorPos(int pos, bool seek) {