]> git.sesse.net Git - kdenlive/blobdiff - src/effectstackedit.cpp
Use more space for Bézier spline widget in effectstack
[kdenlive] / src / effectstackedit.cpp
index 3bcfa52da7b0f9d61d7c31d513223efdfbf9f18e..6e4cbc8aa7fd8a79fe50091789f70d6e5ec86cdc 100644 (file)
@@ -34,6 +34,8 @@
 #include "colortools.h"
 #include "doubleparameterwidget.h"
 #include "cornerswidget.h"
+#include "beziercurve/beziersplinewidget.h"
+#include "beziercurve/cubicbezierspline.h"
 
 #include <KDebug>
 #include <KLocale>
@@ -203,16 +205,18 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
     bool disable = d.attribute("disable") == "1" && KdenliveSettings::disable_effect_parameters();
     setEnabled(!disable);
 
+    bool stretch = true;
+
 
     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");
@@ -379,6 +383,15 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
             QString depends = pa.attribute("depends");
             if (!depends.isEmpty())
                 meetDependency(paramName, type, EffectsList::parameter(e, depends));
+        } else if (type == "bezier_spline") {
+            BezierSplineWidget *widget = new BezierSplineWidget(this);
+            CubicBezierSpline spline;
+            spline.fromString(value);
+            widget->setSpline(spline);
+            stretch = false;
+            m_vbox->addWidget(widget);
+            m_valueItems[paramName] = widget;
+            connect(widget, SIGNAL(modified()), this, SLOT(collectAllParameters()));
         } else if (type == "corners") {
             CornersWidget *corners = new CornersWidget(m_monitor, pos, isEffect, pa.attribute("factor").toInt(), this);
             connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
@@ -474,7 +487,9 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
         if (toFillin)
             m_vbox->addWidget(toFillin);
     }
-    m_vbox->addStretch();
+
+    if (stretch)
+        m_vbox->addStretch();
 
     if (m_keyframeEditor)
         m_keyframeEditor->checkVisibleParam();
@@ -658,6 +673,9 @@ void EffectStackEdit::collectAllParameters()
             QString depends = pa.attributes().namedItem("depends").nodeValue();
             if (!depends.isEmpty())
                 meetDependency(paramName, type, EffectsList::parameter(newparam, depends));
+        } else if (type == "bezier_spline") {
+            BezierSplineWidget *widget = (BezierSplineWidget*)m_valueItems.value(paramName);
+            setValue = widget->spline().toString();
         } else if (type == "corners") {
             CornersWidget *corners = ((CornersWidget*)m_valueItems.value(paramName));
             QString xName = pa.attributes().namedItem("xpoints").nodeValue();