]> git.sesse.net Git - kdenlive/commitdiff
Add ability to enable or disable all effects in the effect stack at once:
authorTill Theato <root@ttill.de>
Fri, 11 Jun 2010 22:17:33 +0000 (22:17 +0000)
committerTill Theato <root@ttill.de>
Fri, 11 Jun 2010 22:17:33 +0000 (22:17 +0000)
http://kdenlive.org/mantis/view.php?id=1018

svn path=/trunk/kdenlive/; revision=4509

src/effectstackview.cpp
src/effectstackview.h
src/widgets/effectstack_ui.ui

index 34e410bfbf98cb3901e830368c2802481ce04ff5..116f4e4dd066411a1fe9981c697fda1879b79b04 100644 (file)
@@ -60,9 +60,10 @@ EffectStackView::EffectStackView(QWidget *parent) :
     m_ui.buttonSave->setToolTip(i18n("Save effect"));
     m_ui.buttonReset->setIcon(KIcon("view-refresh"));
     m_ui.buttonReset->setToolTip(i18n("Reset effect"));
+    m_ui.checkAll->setToolTip(i18n("Enable/Disable all effects"));
 
 
-    m_ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop);//use internal if drop is recognised right
+    m_ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop); //use internal if drop is recognised right
 
     connect(m_ui.effectlist, SIGNAL(itemSelectionChanged()), this , SLOT(slotItemSelectionChanged()));
     connect(m_ui.effectlist, SIGNAL(itemChanged(QListWidgetItem *)), this , SLOT(slotItemChanged(QListWidgetItem *)));
@@ -71,6 +72,7 @@ EffectStackView::EffectStackView(QWidget *parent) :
     connect(m_ui.buttonDel, SIGNAL(clicked()), this, SLOT(slotItemDel()));
     connect(m_ui.buttonSave, SIGNAL(clicked()), this, SLOT(slotSaveEffect()));
     connect(m_ui.buttonReset, SIGNAL(clicked()), this, SLOT(slotResetEffect()));
+    connect(m_ui.checkAll, SIGNAL(stateChanged(int)), this, SLOT(slotCheckAll(int)));
     connect(m_effectedit, SIGNAL(parameterChanged(const QDomElement, const QDomElement)), this , SLOT(slotUpdateEffectParams(const QDomElement, const QDomElement)));
     connect(m_effectedit, SIGNAL(seekTimeline(int)), this , SLOT(slotSeekTimeline(int)));
     m_effectLists["audio"] = &MainWindow::audioEffects;
@@ -128,7 +130,6 @@ void EffectStackView::slotSaveEffect()
     effectprops.setAttribute("id", name);
     effectprops.setAttribute("type", "custom");
 
-
     QFile file(path);
     if (file.open(QFile::WriteOnly | QFile::Truncate)) {
         QTextStream out(&file);
@@ -184,6 +185,7 @@ void EffectStackView::slotItemChanged(QListWidgetItem *item)
         m_effectedit->updateParameter("disable", QString::number((int) disable));
         emit changeEffectState(m_clipref, activeRow, disable);
     }
+    slotUpdateCheckAllButton();
 }
 
 
@@ -232,14 +234,17 @@ void EffectStackView::setupListView(int ix)
         m_ui.buttonReset->setEnabled(false);
         m_ui.buttonUp->setEnabled(false);
         m_ui.buttonDown->setEnabled(false);
+        m_ui.checkAll->setEnabled(false);
     } else {
         if (ix < 0) ix = 0;
         if (ix > m_ui.effectlist->count() - 1) ix = m_ui.effectlist->count() - 1;
         m_ui.effectlist->setCurrentRow(ix);
+        m_ui.checkAll->setEnabled(true);
     }
     m_ui.effectlist->blockSignals(false);
     if (m_ui.effectlist->count() == 0) m_effectedit->transferParamDesc(QDomElement(), 0, 0);
     else slotItemSelectionChanged(false);
+    slotUpdateCheckAllButton();
 }
 
 void EffectStackView::slotItemSelectionChanged(bool update)
@@ -249,7 +254,9 @@ void EffectStackView::slotItemSelectionChanged(bool update)
     bool isChecked = false;
     if (hasItem && m_ui.effectlist->currentItem()->checkState() == Qt::Checked) isChecked = true;
     if (hasItem && m_ui.effectlist->currentItem()->isSelected()) {
-        m_effectedit->transferParamDesc(m_clipref->effectAt(activeRow), m_clipref->cropStart().frames(KdenliveSettings::project_fps()), m_clipref->cropDuration().frames(KdenliveSettings::project_fps()));//minx max frame
+        m_effectedit->transferParamDesc(m_clipref->effectAt(activeRow),
+                                        m_clipref->cropStart().frames(KdenliveSettings::project_fps()),
+                                        m_clipref->cropDuration().frames(KdenliveSettings::project_fps())); //minx max frame
     }
     if (m_clipref && update) m_clipref->setSelectedEffect(activeRow);
     m_ui.buttonDel->setEnabled(hasItem);
@@ -279,6 +286,7 @@ void EffectStackView::slotItemDel()
     int activeRow = m_ui.effectlist->currentRow();
     if (activeRow >= 0) {
         emit removeEffect(m_clipref, m_clipref->effectAt(activeRow));
+        slotUpdateCheckAllButton();
     }
 }
 
@@ -320,6 +328,7 @@ void EffectStackView::clear()
     m_ui.buttonReset->setEnabled(false);
     m_ui.buttonUp->setEnabled(false);
     m_ui.buttonDown->setEnabled(false);
+    m_ui.checkAll->setEnabled(false);
     m_effectedit->transferParamDesc(QDomElement(), 0, 0);
     m_ui.effectlist->blockSignals(false);
 }
@@ -327,8 +336,42 @@ void EffectStackView::clear()
 
 void EffectStackView::slotSeekTimeline(int pos)
 {
-    if (!m_clipref) return;
-    emit seekTimeline(m_clipref->startPos().frames(KdenliveSettings::project_fps()) + pos);
+    if (m_clipref)
+        emit seekTimeline(m_clipref->startPos().frames(KdenliveSettings::project_fps()) + pos);
+}
+
+void EffectStackView::slotUpdateCheckAllButton()
+{
+    bool hasEnabled = false;
+    bool hasDisabled = false;
+    for (int i = 0; i < m_ui.effectlist->count(); ++i) {
+        if (m_ui.effectlist->item(i)->checkState() == Qt::Checked)
+            hasEnabled = true;
+        else
+            hasDisabled = true;
+    }
+
+    m_ui.checkAll->blockSignals(true);
+    if (hasEnabled && hasDisabled)
+        m_ui.checkAll->setCheckState(Qt::PartiallyChecked);
+    else if (hasEnabled)
+        m_ui.checkAll->setCheckState(Qt::Checked);
+    else
+        m_ui.checkAll->setCheckState(Qt::Unchecked);
+    m_ui.checkAll->blockSignals(false);
+}
+
+void EffectStackView::slotCheckAll(int state)
+{
+    if (state == 1) {
+        state = 2;
+        m_ui.checkAll->blockSignals(true);
+        m_ui.checkAll->setCheckState(Qt::Checked);
+        m_ui.checkAll->blockSignals(false);
+    }
+
+    for (int i = 0; i < m_ui.effectlist->count(); ++i)
+        m_ui.effectlist->item(i)->setCheckState((Qt::CheckState)state);
 }
 
 #include "effectstackview.moc"
index aa7e80c3cd481ba2e649868c8a9520c1e316b2b3..7c66ca13a9ff50b4494d4fbac85419c3c1f3b48d 100644 (file)
  ***************************************************************************/
 
 /**
-* @class EffectStackView
-* @brief View part of the EffectStack
-* @author Marco Gittler
-*/
+ * @class EffectStackView
+ * @brief View part of the EffectStack
+ * @author Marco Gittler
+ */
 
 #ifndef EFFECTSTACKVIEW_H
 #define EFFECTSTACKVIEW_H
@@ -38,10 +38,20 @@ class EffectStackView : public QWidget
 public:
     EffectStackView(QWidget *parent = 0);
     virtual ~EffectStackView();
-    void raiseWindow(QWidget*);
+
+    /** @brief Raises @param dock if a clip is loaded. */
+    void raiseWindow(QWidget* dock);
+
+    /** @brief Clears the list of effects and updates the buttons accordingly. */
     void clear();
+
+    /** @brief Sets the add effect button's menu to @param menu. */
     void setMenu(QMenu *menu);
+
+    /** @brief Passes updates on @param profile and @param t on to the effect editor. */
     void updateProjectFormat(MltVideoProfile profile, Timecode t);
+
+    /** @brief Tells the effect editor to update its timecode format. */
     void updateTimecodeFormat();
 
 private:
@@ -49,24 +59,58 @@ private:
     ClipItem* m_clipref;
     QMap<QString, EffectsList*> m_effectLists;
     EffectStackEdit* m_effectedit;
+
+    /** @brief Sets the list of effects according to the clip's effect list.
+    * @param ix Number of the effect to preselect */
     void setupListView(int ix);
-    //void updateButtonStatus();
 
 public slots:
-    void slotClipItemSelected(ClipItem*, int ix);
-    void slotUpdateEffectParams(const QDomElement, const QDomElement);
-    /** @brief Remove selected effect. */
+    /** @brief Sets the clip whose effect list should be managed.
+    * @param c Clip whose effect list should be managed
+    * @param ix Effect to preselect */
+    void slotClipItemSelected(ClipItem* c, int ix);
+    
+    /** @brief Emits updateClipEffect.
+    * @param old Old effect information
+    * @param e New effect information
+    *
+    * Connected to a parameter change in the editor */
+    void slotUpdateEffectParams(const QDomElement old, const QDomElement e);
+
+    /** @brief Removes the selected effect. */
     void slotItemDel();
 
 private slots:
+    /** @brief Updates buttons and the editor according to selected effect.
+    * @param update (optional) Set the clip's selected effect (display keyframes in timeline) */
     void slotItemSelectionChanged(bool update = true);
+
+    /** @brief Moves the selected effect upwards. */
     void slotItemUp();
+
+    /** @brief Moves the selected effect downwards. */
     void slotItemDown();
+
+    /** @brief Resets the selected effect to its default values. */
     void slotResetEffect();
+
+    /** @brief Updates effect @param item if it was enabled or disabled. */
     void slotItemChanged(QListWidgetItem *item);
+
+    /** @brief Saves the selected effect's values to a custom effect.
+    *
+    * TODO: save all effects into one custom effect */
     void slotSaveEffect();
+
+    /** @brief Emits seekTimeline with position = clipstart + @param pos. */
     void slotSeekTimeline(int pos);
 
+    /** @brief Makes the check all checkbox represent the check state of the effects. */
+    void slotUpdateCheckAllButton();
+
+    /** @brief Sets the check state of all effects according to @param state. */
+    void slotCheckAll(int state);
+
 signals:
     void removeEffect(ClipItem*, QDomElement);
     /**  Parameters for an effect changed, update the filter in playlist */
@@ -82,7 +126,6 @@ signals:
     void reloadEffects();
     /** An effect with position parameter was changed, seek */
     void seekTimeline(int);
-
 };
 
 #endif
index 8fd8b6ef5bb1af7e3997c9b11c109e3fd08991d1..610588051d96baa2906712fc7280f0b9f891077a 100644 (file)
@@ -27,7 +27,7 @@
        <property name="horizontalSpacing">
         <number>2</number>
        </property>
-       <item row="0" column="0" colspan="7">
+       <item row="1" column="0" colspan="7">
         <widget class="KListWidget" name="effectlist">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@@ -46,7 +46,7 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="0">
+       <item row="2" column="0">
         <widget class="QToolButton" name="buttonNew">
          <property name="text">
           <string>N</string>
@@ -59,7 +59,7 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
+       <item row="2" column="1">
         <widget class="QToolButton" name="buttonUp">
          <property name="enabled">
           <bool>false</bool>
@@ -72,7 +72,7 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="2">
+       <item row="2" column="2">
         <widget class="QToolButton" name="buttonDown">
          <property name="enabled">
           <bool>false</bool>
@@ -85,7 +85,7 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="3">
+       <item row="2" column="3">
         <widget class="QToolButton" name="buttonReset">
          <property name="enabled">
           <bool>false</bool>
@@ -98,7 +98,7 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="4">
+       <item row="2" column="4">
         <spacer>
          <property name="orientation">
           <enum>Qt::Horizontal</enum>
          </property>
         </spacer>
        </item>
-       <item row="1" column="5">
+       <item row="2" column="5">
         <widget class="QToolButton" name="buttonSave">
          <property name="enabled">
           <bool>false</bool>
          </property>
         </widget>
        </item>
-       <item row="1" column="6">
+       <item row="2" column="6">
         <widget class="QToolButton" name="buttonDel">
          <property name="enabled">
           <bool>false</bool>
          </property>
         </widget>
        </item>
+       <item row="0" column="0">
+        <widget class="QCheckBox" name="checkAll">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="checkable">
+          <bool>true</bool>
+         </property>
+         <property name="tristate">
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
      <widget class="QFrame" name="frame">