]> git.sesse.net Git - kdenlive/commitdiff
Make it possible to add a comment explaining effect parameters (for now only double...
authorTill Theato <root@ttill.de>
Thu, 23 Dec 2010 23:17:52 +0000 (23:17 +0000)
committerTill Theato <root@ttill.de>
Thu, 23 Dec 2010 23:17:52 +0000 (23:17 +0000)
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
src/doubleparameterwidget.cpp
src/doubleparameterwidget.h
src/effectstackedit.cpp
src/keyframeedit.cpp

index 903c33fd3fc19e44ead016be943308fae4f1ec30..4e92d6fc08851fe6b00d5151c9b18acdb37e5f44 100644 (file)
@@ -6,9 +6,11 @@
         
         <parameter type="simplekeyframe" name="Spatial" default="40" min="0" max="1000" factor="1000">
             <name>Spatial</name>
+            <comment>Amount of spatial filtering</comment>
         </parameter>
         
         <parameter type="simplekeyframe" name="Temporal" default="60" min="0" max="1000" factor="1000">
             <name>Temporal</name>
+            <comment>Amount of temporal filtering</comment>
         </parameter>
 </effect>
index c06e0ed4fd964a90d4fd2c747db30e47c478e5ba..efc28e0bd0254de4cd97268aed08a701c54c8dba 100644 (file)
 #include <KLocalizedString>
 
 
-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);
 
index 87c30b668857f40149c3859a54c26d7ab02590dc..0a914a40b9a395e5159f7881563b63bf471cae8d 100644 (file)
@@ -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. */
index fa8c20345ea8314e6d1e95891498a33a2852de8c..3e3f2d070e4c17c18c6d7076409b594b2f06c2f8 100644 (file)
@@ -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()));
index 6085a27f554bae1da7c11b6e343b88fedf055a76..39c512e0ea8186dc693851ecc9b31543cb21c793 100644 (file)
@@ -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);