]> git.sesse.net Git - kdenlive/commitdiff
Implement deletion of an effect group
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 1 Apr 2012 18:17:11 +0000 (20:17 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 1 Apr 2012 18:17:11 +0000 (20:17 +0200)
src/effectstack/collapsiblegroup.cpp
src/effectstack/collapsiblegroup.h
src/effectstack/effectstackview2.cpp
src/effectstack/effectstackview2.h
src/widgets/collapsiblegroup_ui.ui

index 941251ac7d303c65c2afad0229e5cfdbb1336020..3c43a678f9578abc17ba9fedde739625bda1f09b 100644 (file)
@@ -90,7 +90,7 @@ CollapsibleGroup::CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, QStr
     connect(enabledBox, SIGNAL(toggled(bool)), this, SLOT(slotEnable(bool)));
     connect(buttonUp, SIGNAL(clicked()), this, SLOT(slotEffectUp()));
     connect(buttonDown, SIGNAL(clicked()), this, SLOT(slotEffectDown()));
-    connect(buttonDel, SIGNAL(clicked()), this, SLOT(slotDeleteEffect()));
+    connect(buttonDel, SIGNAL(clicked()), this, SLOT(slotDeleteGroup()));
 
 }
 
@@ -136,9 +136,14 @@ void CollapsibleGroup::slotEnable(bool enable)
     }
 }
 
-void CollapsibleGroup::slotDeleteEffect()
+void CollapsibleGroup::slotDeleteGroup()
 {
-    emit deleteGroup(groupIndex());
+    QDomDocument doc;
+    // delete effects from the last one to the first, otherwise each deletion would trigger an update
+    // in other effects's kdenlive_ix index.
+    for (int i = m_subWidgets.count() - 1; i >= 0; i--)
+        doc.appendChild(doc.importNode(m_subWidgets.at(i)->effect(), true));
+    emit deleteGroup(m_index, doc);
 }
 
 void CollapsibleGroup::slotEffectUp()
index c85a145b1ed24023d8dc59bc848ec4d3677130c7..5f5e21682e448f804ae90275111df51a3bcdf2fc 100644 (file)
@@ -82,7 +82,7 @@ public slots:
 private slots:
     void slotSwitch();
     void slotShow(bool show);
-    void slotDeleteEffect();
+    void slotDeleteGroup();
     void slotEffectUp();
     void slotEffectDown();
     void slotSaveGroup();
@@ -107,7 +107,7 @@ protected:
 signals:
     void syncEffectsPos(int);
     void effectStateChanged(bool, int ix = -1);
-    void deleteGroup(int);
+    void deleteGroup(int, QDomDocument);
     void changeGroupPosition(int, bool);
     void activateEffect(int);
     void moveEffect(int current_pos, int new_pos, int groupIndex, QString groupName);
index 2c379dd15798525d75794efa47ff154ecb5aca18..933630b27d5aeaeb1a3e4e26c78ae99562407a8b 100644 (file)
@@ -187,6 +187,7 @@ void EffectStackView2::setupListView(int ix)
                connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*)));
                connect(group, SIGNAL(groupRenamed(CollapsibleGroup *)), this, SLOT(slotRenameGroup(CollapsibleGroup*)));
                 connect(group, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
+               connect(group, SIGNAL(deleteGroup(int, QDomDocument)), this , SLOT(slotDeleteGroup(int,QDomDocument)));
                vbox1->addWidget(group);
                group->installEventFilter( this );
            }
@@ -512,6 +513,23 @@ void EffectStackView2::slotSetCurrentEffect(int ix)
     }
 }
 
+void EffectStackView2::slotDeleteGroup(int groupIndex, QDomDocument doc)
+{
+    QDomNodeList effects = doc.elementsByTagName("effect");
+    ClipItem * clip = NULL;
+    int ix;
+    if (m_effectMetaInfo.trackMode) {
+       ix = m_trackindex;
+    }
+    else {
+       clip = m_clipref;
+       ix = -1;
+    }
+    
+    for (int i = 0; i < effects.count(); i++)
+       emit removeEffect(clip, ix, effects.at(i).toElement());
+}
+
 void EffectStackView2::slotDeleteEffect(const QDomElement effect)
 {
     if (m_effectMetaInfo.trackMode)
@@ -635,6 +653,7 @@ void EffectStackView2::slotCreateGroup(int ix)
     connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*)));
     connect(group, SIGNAL(groupRenamed(CollapsibleGroup *)), this , SLOT(slotRenameGroup(CollapsibleGroup*)));
     connect(group, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
+    connect(group, SIGNAL(deleteGroup(int, QDomDocument)), this , SLOT(slotDeleteGroup(int,QDomDocument)));
     l->insertWidget(groupPos, group);
     group->installEventFilter( this );
     group->addGroupEffect(effectToMove);
index cf7df7b85823ff107c5a951d8c713626d8101aef..2a1cd38e9764fe435c0d64f81e5a9cbc8d04a370 100644 (file)
@@ -138,6 +138,9 @@ private slots:
 
     /** @brief Delete an effect in the stack. */
     void slotDeleteEffect(const QDomElement effect);
+    
+    /** @brief Delete all effect in a group. */
+    void slotDeleteGroup(int groupIndex, QDomDocument doc);
 
     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
     void slotRenderPos(int pos);
index 6258dfe10db27ee399dca25330c8eaef98ce45a1..16519b5533c66bc7e42db7071de3cd01b977c234 100644 (file)
@@ -90,9 +90,6 @@
            <property name="text">
             <string/>
            </property>
-           <property name="shortcut">
-            <string>Return</string>
-           </property>
           </widget>
          </item>
          <item>