From: Till Theato Date: Tue, 28 Dec 2010 23:17:52 +0000 (+0000) Subject: Add a "full description" to effects. Will be shown when the parameter comments are... X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4832646a7da7bd33e3edff6ef0c2d3f585a85378;p=kdenlive Add a "full description" to effects. Will be shown when the parameter comments are shown: http://kdenlive.org/mantis/view.php?id=1948 svn path=/trunk/kdenlive/; revision=5217 --- diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 3bcfa52d..f3184f29 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -206,13 +206,13 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in for (int i = 0; i < namenode.count() ; i++) { QDomElement pa = namenode.item(i).toElement(); - QDomNode na = pa.firstChildElement("name"); - QDomNode commentNode = pa.firstChildElement("comment"); + QDomElement na = pa.firstChildElement("name"); + QDomElement commentElem = pa.firstChildElement("comment"); QString type = pa.attribute("type"); - QString paramName = i18n(na.toElement().text().toUtf8().data()); + QString paramName = i18n(na.text().toUtf8().data()); QString comment; - if (!commentNode.isNull()) - comment = i18n(commentNode.toElement().text().toUtf8().data()); + if (!commentElem.isNull()) + comment = i18n(commentElem.text().toUtf8().data()); QWidget * toFillin = new QWidget(m_baseWidget); QString value = pa.attribute("value").isNull() ? pa.attribute("default") : pa.attribute("value"); diff --git a/src/effectstackview.cpp b/src/effectstackview.cpp index 50c1a4d9..cd9a6b4d 100644 --- a/src/effectstackview.cpp +++ b/src/effectstackview.cpp @@ -74,6 +74,8 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) : m_ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop); //use internal if drop is recognised right + m_ui.labelComment->setHidden(true); + //connect(m_ui.region_url, SIGNAL(urlSelected(const KUrl &)), this , SLOT(slotRegionChanged())); //connect(m_ui.region_url, SIGNAL(returnPressed()), this , SLOT(slotRegionChanged())); connect(m_ui.effectlist, SIGNAL(itemSelectionChanged()), this , SLOT(slotItemSelectionChanged())); @@ -84,7 +86,7 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) : 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_ui.buttonShowComments, SIGNAL(clicked()), this, SIGNAL(showComments())); + connect(m_ui.buttonShowComments, SIGNAL(clicked()), this, SLOT(slotShowComments())); 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))); connect(m_effectedit, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int))); @@ -187,8 +189,9 @@ void EffectStackView::slotClipItemSelected(ClipItem* c, int ix) double factor = c->baseClip()->getProperty("aspect_ratio").toDouble(); QPoint p((int)(size.section('x', 0, 0).toInt() * factor + 0.5), size.section('x', 1, 1).toInt()); m_effectedit->setFrameSize(p); - m_effectedit->setFrameSize(p); - } else ix = 0; + } else { + ix = 0; + } } if (m_clipref == NULL) { m_ui.effectlist->blockSignals(true); @@ -198,6 +201,7 @@ void EffectStackView::slotClipItemSelected(ClipItem* c, int ix) m_ui.effectlist->blockSignals(false); m_ui.checkAll->setToolTip(QString()); m_ui.checkAll->setText(QString()); + m_ui.labelComment->setText(QString()); setEnabled(false); return; } @@ -287,6 +291,8 @@ void EffectStackView::setupListView(int ix) m_ui.buttonUp->setEnabled(false); m_ui.buttonDown->setEnabled(false); m_ui.checkAll->setEnabled(false); + m_ui.buttonShowComments->setEnabled(false); + m_ui.labelComment->setHidden(true); } else { qMin(ix, 0); qMax(ix, m_ui.effectlist->count() - 1); @@ -317,6 +323,7 @@ void EffectStackView::slotItemSelectionChanged(bool update) m_clipref->cropStart().frames(KdenliveSettings::project_fps()), (m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps()) - 1); //minx max frame //m_ui.region_url->setUrl(KUrl(eff.attribute("region"))); + m_ui.labelComment->setText(i18n(eff.firstChildElement("description").firstChildElement("full").text().toUtf8().data())); } if (!m_trackMode && m_clipref && update) m_clipref->setSelectedEffect(activeRow); m_ui.buttonDel->setEnabled(hasItem); @@ -325,9 +332,11 @@ void EffectStackView::slotItemSelectionChanged(bool update) m_ui.buttonUp->setEnabled(activeRow > 0); m_ui.buttonDown->setEnabled((activeRow < m_ui.effectlist->count() - 1) && hasItem); m_ui.frame->setEnabled(isChecked); + m_ui.buttonShowComments->setEnabled(hasItem); if (m_ui.buttonShowComments->isChecked()) emit showComments(); + m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count() || !hasItem); } void EffectStackView::slotItemUp() @@ -389,6 +398,7 @@ void EffectStackView::slotResetEffect() if (m_ui.buttonShowComments->isChecked()) emit showComments(); + m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count()); } @@ -410,6 +420,8 @@ void EffectStackView::clear() m_ui.checkAll->setEnabled(false); m_effectedit->transferParamDesc(QDomElement(), 0, 0, 0); //m_ui.region_url->clear(); + m_ui.buttonShowComments->setEnabled(false); + m_ui.labelComment->setText(QString()); m_ui.effectlist->blockSignals(false); } @@ -498,4 +510,10 @@ int EffectStackView::isTrackMode(bool *ok) const return m_trackindex; } +void EffectStackView::slotShowComments() +{ + m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count()); + emit showComments(); +} + #include "effectstackview.moc" diff --git a/src/effectstackview.h b/src/effectstackview.h index 1336cbfd..29ba056f 100644 --- a/src/effectstackview.h +++ b/src/effectstackview.h @@ -139,6 +139,9 @@ private slots: /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */ void slotRenderPos(int pos); + /** @brief Shows/Hides the comment box and emits showComments to notify the parameter widgets to do the same. */ + void slotShowComments(); + signals: void removeEffect(ClipItem*, int, QDomElement); /** Parameters for an effect changed, update the filter in playlist */ diff --git a/src/keyframeedit.cpp b/src/keyframeedit.cpp index a93bbfc7..6dde054d 100644 --- a/src/keyframeedit.cpp +++ b/src/keyframeedit.cpp @@ -101,12 +101,12 @@ void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe) keyframe_list->blockSignals(true); m_params.append(e.cloneNode().toElement()); - QDomNode na = e.firstChildElement("name"); - QString paramName = i18n(na.toElement().text().toUtf8().data()); - QDomNode commentNode = e.firstChildElement("comment"); + QDomElement na = e.firstChildElement("name"); + QString paramName = i18n(na.text().toUtf8().data()); + QDomElement commentElem = e.firstChildElement("comment"); QString comment; - if (!commentNode.isNull()) - comment = i18n(commentNode.toElement().text().toUtf8().data()); + if (!commentElem.isNull()) + comment = i18n(commentElem.text().toUtf8().data()); int columnId = keyframe_list->columnCount(); keyframe_list->insertColumn(columnId); diff --git a/src/widgets/effectstack_ui.ui b/src/widgets/effectstack_ui.ui index 4f0ba621..d38805d3 100644 --- a/src/widgets/effectstack_ui.ui +++ b/src/widgets/effectstack_ui.ui @@ -163,12 +163,24 @@ - + 0 0 - toolButton + + + + + + + + + true + + + true + @@ -184,15 +196,30 @@ - - + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + - - true + + Qt::RichText - + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + true