]> git.sesse.net Git - kdenlive/commitdiff
Fix enabling / disabling all effects in a clip & effect info text
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 26 Mar 2012 12:46:39 +0000 (14:46 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 26 Mar 2012 12:46:39 +0000 (14:46 +0200)
src/effectstack/collapsibleeffect.cpp
src/effectstack/collapsibleeffect.h
src/effectstack/effectstackview2.cpp
src/effectstack/effectstackview2.h
src/widgets/effectstack2_ui.ui

index 4d49f10d9e9fbbd882fc350d91a4581891e5e6fe..19c86f3e3c5c0538d7b1e46f0d1405c690594a05 100644 (file)
@@ -335,7 +335,7 @@ void CollapsibleEffect::slotEnable(bool enable)
        if (enable || KdenliveSettings::disable_effect_parameters()) {
            widgetFrame->setEnabled(enable);
        }
-       emit effectStateChanged(!enable, m_paramWidget->index());
+       emit effectStateChanged(!enable, effectIndex());
     }
 }
 
@@ -469,6 +469,11 @@ int CollapsibleEffect::groupIndex() const
     return -1;
 }
 
+bool CollapsibleEffect::isGroup() const
+{
+    return m_isGroup;
+}
+
 int CollapsibleEffect::effectIndex() const
 {
     if (m_effect.isNull()) return -1;
index d58cd5558ab5a58d543e2606e46cc4df77e49f61..87fbc2ece8bb487b59eeb2475c78291b2421168e 100644 (file)
@@ -127,6 +127,7 @@ public:
     void addGroupEffect(CollapsibleEffect *effect);
     int index() const;
     int groupIndex() const;
+    bool isGroup() const;
     int effectIndex() const;
     void setGroupIndex(int ix);
     void removeGroup(int ix, QVBoxLayout *layout);
index c65e15656dbde5f8e1025cc422b77fcacdbe7327..974e79608deb9f466bf303ed72b8effde36ce512 100644 (file)
@@ -59,7 +59,8 @@ EffectStackView2::EffectStackView2(Monitor *monitor, QWidget *parent) :
     m_ui.buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
     
     connect(m_ui.checkAll, SIGNAL(stateChanged(int)), this, SLOT(slotCheckAll(int)));
-
+    connect(m_ui.buttonShowComments, SIGNAL(clicked()), this, SLOT(slotShowComments()));
+    m_ui.labelComment->setHidden(true);
 
     setEnabled(false);
 
@@ -161,11 +162,12 @@ void EffectStackView2::setupListView(int ix)
     blockSignals(false);
     view = new QWidget(m_ui.container);
     m_ui.container->setWidget(view);
-    slotUpdateCheckAllButton();
 
     QVBoxLayout *vbox1 = new QVBoxLayout(view);
     vbox1->setContentsMargins(0, 0, 0, 0);
     vbox1->setSpacing(0);
+    
+    if (m_currentEffectList.isEmpty()) m_ui.labelComment->setHidden(true);
 
     for (int i = 0; i < m_currentEffectList.count(); i++) {
         QDomElement d = m_currentEffectList.at(i).cloneNode().toElement();
@@ -178,6 +180,7 @@ void EffectStackView2::setupListView(int ix)
        EffectInfo effectInfo;
        effectInfo.fromString(d.attribute("kdenlive_info"));
        if (effectInfo.groupIndex >= 0) {
+           // effect is in a group
            for (int i = 0; i < m_effects.count(); i++) {
                if (m_effects.at(i)->groupIndex() == effectInfo.groupIndex) {
                    group = m_effects.at(i);
@@ -238,6 +241,7 @@ void EffectStackView2::setupListView(int ix)
         //ui.title->setPixmap(icon.pixmap(QSize(12, 12)));
     }
     vbox1->addStretch(10);
+    slotUpdateCheckAllButton();
     connect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
     
     // Wait a little bit for the new layout to be ready, then check if we have a scrollbar
@@ -390,6 +394,7 @@ void EffectStackView2::clear()
     m_ui.checkAll->setToolTip(QString());
     m_ui.checkAll->setText(QString());
     m_ui.checkAll->setEnabled(false);
+    m_ui.labelComment->setText(QString());
     setEnabled(false);
 }
 
@@ -404,8 +409,8 @@ void EffectStackView2::slotCheckAll(int state)
 
     bool disabled = (state != 2);
     for (int i = 0; i < m_effects.count(); i++) {
-       if (m_effects.at(i)->groupIndex() == -1) {
-           m_effects.at(i)->slotEnable(disabled);
+       if (!m_effects.at(i)->isGroup()) {
+           m_effects.at(i)->slotEnable(!disabled);
        }
     }
 }
@@ -479,7 +484,12 @@ void EffectStackView2::slotSetCurrentEffect(int ix)
     if (m_clipref && ix != m_clipref->selectedEffectIndex())
         m_clipref->setSelectedEffect(ix);
     for (int i = 0; i < m_effects.count(); i++) {
-        m_effects.at(i)->setActive(m_effects.at(i)->effectIndex() == ix);
+       if (m_effects.at(i)->effectIndex() == ix) {
+           m_effects.at(i)->setActive(true);
+           m_ui.labelComment->setText(i18n(m_effects.at(i)->effect().firstChildElement("description").firstChildElement("full").text().toUtf8().data()));
+            m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || m_ui.labelComment->text().isEmpty());
+       }
+        else m_effects.at(i)->setActive(false);
     }
 }
 
@@ -552,16 +562,20 @@ void EffectStackView2::slotResetEffect(int ix)
         }
     }
 
-    /*emit showComments(m_ui.buttonShowComments->isChecked());
-    m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count());*/
+    emit showComments(m_ui.buttonShowComments->isChecked());
+    m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || m_ui.labelComment->text().isEmpty());
 }
 
+void EffectStackView2::slotShowComments()
+{
+    m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || m_ui.labelComment->text().isEmpty());
+    emit showComments(m_ui.buttonShowComments->isChecked());
+}
 
 void EffectStackView2::slotCreateGroup(int ix)
 {
     QDomElement oldeffect = m_currentEffectList.itemFromIndex(ix);
     QDomElement neweffect = oldeffect.cloneNode().toElement();
-    QString groupName = QString::number(m_groupIndex);
     EffectInfo effectinfo;
     effectinfo.fromString(oldeffect.attribute("kdenlive_info"));
     effectinfo.groupIndex = m_groupIndex;
index ae966bb77a2ab7698a571b1fa39b3c64667b50fd..a3ab02f02d8db433e1590c4d597f62b6cf46567b 100644 (file)
@@ -170,6 +170,9 @@ private slots:
     
     /** @brief Update check all button status */
     void slotUpdateCheckAllButton();
+    
+    /** @brief Display additionnal effect info */
+    void slotShowComments();
 
 signals:
     void removeEffect(ClipItem*, int, QDomElement);
index ff0e2e4f6f94e5b525416ce6b18e5bd601568c5d..8d811b818af2d981212eadddf28a0107646378a8 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>86</width>
-    <height>102</height>
+    <width>113</width>
+    <height>121</height>
    </rect>
   </property>
   <property name="sizePolicy">
      </item>
     </layout>
    </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="labelComment">
+     <property name="text">
+      <string/>
+     </property>
+     <property name="wordWrap">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
    <item row="1" column="0">
     <widget class="QScrollArea" name="container">
      <property name="sizePolicy">
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>86</width>
+        <width>113</width>
         <height>72</height>
        </rect>
       </property>
+      <zorder>labelComment</zorder>
      </widget>
     </widget>
    </item>