From 9d079960521d6ad7ec4f2eea7cc62b4dece1f947 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Thu, 23 Dec 2010 23:17:52 +0000 Subject: [PATCH] Make it possible to add a comment explaining effect parameters (for now only double params). The comment is available as a tooltip. See: http://kdenlive.org/mantis/view.php?id=1939 svn path=/trunk/kdenlive/; revision=5193 --- effects/frei0r_hqdn3d.xml | 2 ++ src/doubleparameterwidget.cpp | 4 +++- src/doubleparameterwidget.h | 3 ++- src/effectstackedit.cpp | 6 +++++- src/keyframeedit.cpp | 8 +++++++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/effects/frei0r_hqdn3d.xml b/effects/frei0r_hqdn3d.xml index 903c33fd..4e92d6fc 100644 --- a/effects/frei0r_hqdn3d.xml +++ b/effects/frei0r_hqdn3d.xml @@ -6,9 +6,11 @@ Spatial + Amount of spatial filtering Temporal + Amount of temporal filtering diff --git a/src/doubleparameterwidget.cpp b/src/doubleparameterwidget.cpp index c06e0ed4..efc28e0b 100644 --- a/src/doubleparameterwidget.cpp +++ b/src/doubleparameterwidget.cpp @@ -30,10 +30,12 @@ #include -DoubleParameterWidget::DoubleParameterWidget(const QString &name, int value, int min, int max, int defaultValue, const QString suffix, QWidget *parent) : +DoubleParameterWidget::DoubleParameterWidget(const QString &name, int value, int min, int max, int defaultValue, const QString &comment, const QString suffix, QWidget *parent) : QWidget(parent), m_default(defaultValue) { + setToolTip(comment); + QHBoxLayout *layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); diff --git a/src/doubleparameterwidget.h b/src/doubleparameterwidget.h index 87c30b66..0a914a40 100644 --- a/src/doubleparameterwidget.h +++ b/src/doubleparameterwidget.h @@ -45,9 +45,10 @@ public: * @param min Minimum value * @param max maximum value * @param defaultValue Value used when using reset functionality + * @param comment A comment explaining the parameter. Will be shown for the tooltip. * @param suffix (optional) Suffix to display in spinbox * @param parent (optional) Parent Widget */ - DoubleParameterWidget(const QString &name, int value, int min, int max, int defaultValue, const QString suffix = QString(), QWidget* parent = 0); + DoubleParameterWidget(const QString &name, int value, int min, int max, int defaultValue, const QString &comment, const QString suffix = QString(), QWidget* parent = 0); /** @brief Updates the label to display @param name. */ void setName(const QString &name); /** @brief Gets the parameter's value. */ diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index fa8c2034..3e3f2d07 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -207,8 +207,12 @@ 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"); QString type = pa.attribute("type"); QString paramName = i18n(na.toElement().text().toUtf8().data()); + QString comment; + if (!commentNode.isNull()) + comment = i18n(commentNode.toElement().text().toUtf8().data()); QWidget * toFillin = new QWidget(m_baseWidget); QString value = pa.attribute("value").isNull() ? pa.attribute("default") : pa.attribute("value"); @@ -239,7 +243,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in max = pa.attribute("max").toInt(); DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, (int)(value.toDouble() + 0.5), min, max, - pa.attribute("default").toInt(), pa.attribute("suffix"), this); + pa.attribute("default").toInt(), comment, pa.attribute("suffix"), this); m_vbox->addWidget(doubleparam); m_valueItems[paramName] = doubleparam; connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters())); diff --git a/src/keyframeedit.cpp b/src/keyframeedit.cpp index 6085a27f..39c512e0 100644 --- a/src/keyframeedit.cpp +++ b/src/keyframeedit.cpp @@ -100,15 +100,21 @@ 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"); + QString comment; + if (!commentNode.isNull()) + comment = i18n(commentNode.toElement().text().toUtf8().data()); + int columnId = keyframe_list->columnCount(); keyframe_list->insertColumn(columnId); keyframe_list->setHorizontalHeaderItem(columnId, new QTableWidgetItem(paramName)); DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, 0, m_params.at(columnId).attribute("min").toInt(), m_params.at(columnId).attribute("max").toInt(), - m_params.at(columnId).attribute("default").toInt(), m_params.at(columnId).attribute("suffix"), this); + m_params.at(columnId).attribute("default").toInt(), comment, m_params.at(columnId).attribute("suffix"), this); connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int))); m_slidersLayout->addWidget(doubleparam, columnId, 0); -- 2.39.2