]> git.sesse.net Git - kdenlive/commitdiff
Fix resizing of grouped items through the set in/out point action:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 9 Sep 2012 17:34:02 +0000 (19:34 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 9 Sep 2012 17:34:02 +0000 (19:34 +0200)
http://kdenlive.org/mantis/view.php?id=2726

src/customtrackview.cpp

index 3678d454b630b14e7a21747a59c4cc5440b82a48..ee8a31c75f0c03b215614619738bd04e35eb6115 100644 (file)
@@ -5863,7 +5863,28 @@ void CustomTrackView::setInPoint()
             return;
         }
     }
-    prepareResizeClipStart(clip, clip->info(), m_cursorPos, true);
+
+    AbstractGroupItem *parent = static_cast <AbstractGroupItem *>(clip->parentItem());
+    if (parent) {
+       // Resizing a group
+       QUndoCommand *resizeCommand = new QUndoCommand();
+        resizeCommand->setText(i18n("Resize group"));
+        QList <QGraphicsItem *> items = parent->childItems();
+        int itemcount = 0;
+        for (int i = 0; i < items.count(); ++i) {
+           AbstractClipItem *item = static_cast<AbstractClipItem *>(items.at(i));
+            if (item && item->type() == AVWIDGET) {
+                prepareResizeClipStart(item, item->info(), m_cursorPos, true, resizeCommand);
+                ++itemcount;
+            }
+        }
+        if (resizeCommand->childCount() > 0) m_commandStack->push(resizeCommand);
+       else {
+           //TODO warn user of failed resize
+           delete resizeCommand;
+       }
+    }
+    else prepareResizeClipStart(clip, clip->info(), m_cursorPos, true);
 }
 
 void CustomTrackView::setOutPoint()
@@ -5877,7 +5898,27 @@ void CustomTrackView::setOutPoint()
             return;
         }
     }
-    prepareResizeClipEnd(clip, clip->info(), m_cursorPos, true);
+    AbstractGroupItem *parent = static_cast <AbstractGroupItem *>(clip->parentItem());
+    if (parent) {
+       // Resizing a group
+       QUndoCommand *resizeCommand = new QUndoCommand();
+        resizeCommand->setText(i18n("Resize group"));
+        QList <QGraphicsItem *> items = parent->childItems();
+        int itemcount = 0;
+        for (int i = 0; i < items.count(); ++i) {
+           AbstractClipItem *item = static_cast<AbstractClipItem *>(items.at(i));
+            if (item && item->type() == AVWIDGET) {
+                prepareResizeClipEnd(item, item->info(), m_cursorPos, true, resizeCommand);
+                ++itemcount;
+            }
+        }
+        if (resizeCommand->childCount() > 0) m_commandStack->push(resizeCommand);
+       else {
+           //TODO warn user of failed resize
+           delete resizeCommand;
+       }
+    }
+    else prepareResizeClipEnd(clip, clip->info(), m_cursorPos, true);
 }
 
 void CustomTrackView::slotUpdateAllThumbs()