From: Jean-Baptiste Mardelle Date: Mon, 26 Mar 2012 12:46:39 +0000 (+0200) Subject: Fix enabling / disabling all effects in a clip & effect info text X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=a6fe2eb80506644cb2c44529a780e3cfc9880972;p=kdenlive Fix enabling / disabling all effects in a clip & effect info text --- diff --git a/src/effectstack/collapsibleeffect.cpp b/src/effectstack/collapsibleeffect.cpp index 4d49f10d..19c86f3e 100644 --- a/src/effectstack/collapsibleeffect.cpp +++ b/src/effectstack/collapsibleeffect.cpp @@ -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; diff --git a/src/effectstack/collapsibleeffect.h b/src/effectstack/collapsibleeffect.h index d58cd555..87fbc2ec 100644 --- a/src/effectstack/collapsibleeffect.h +++ b/src/effectstack/collapsibleeffect.h @@ -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); diff --git a/src/effectstack/effectstackview2.cpp b/src/effectstack/effectstackview2.cpp index c65e1565..974e7960 100644 --- a/src/effectstack/effectstackview2.cpp +++ b/src/effectstack/effectstackview2.cpp @@ -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; diff --git a/src/effectstack/effectstackview2.h b/src/effectstack/effectstackview2.h index ae966bb7..a3ab02f0 100644 --- a/src/effectstack/effectstackview2.h +++ b/src/effectstack/effectstackview2.h @@ -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); diff --git a/src/widgets/effectstack2_ui.ui b/src/widgets/effectstack2_ui.ui index ff0e2e4f..8d811b81 100644 --- a/src/widgets/effectstack2_ui.ui +++ b/src/widgets/effectstack2_ui.ui @@ -6,8 +6,8 @@ 0 0 - 86 - 102 + 113 + 121 @@ -62,6 +62,16 @@ + + + + + + + true + + + @@ -87,10 +97,11 @@ 0 0 - 86 + 113 72 + labelComment