]> git.sesse.net Git - kdenlive/blobdiff - src/effectstackedit.cpp
Some ui cleanup
[kdenlive] / src / effectstackedit.cpp
index e6602e34db0e65d786323335f5c848643e8aad8c..aa9d9ffadbdd5cc266e0f320cdb1a648bd4e70f2 100644 (file)
 #include "ui_listval_ui.h"
 #include "ui_boolval_ui.h"
 #include "ui_colorval_ui.h"
-#include "ui_positionval_ui.h"
 #include "ui_wipeval_ui.h"
 #include "ui_keyframeeditor_ui.h"
 #include "complexparameter.h"
 #include "geometryval.h"
 #include "keyframeedit.h"
+#include "positionedit.h"
 #include "effectslist.h"
 #include "kdenlivesettings.h"
 #include "profilesdialog.h"
@@ -57,10 +57,6 @@ class Listval: public EffectStackEdit::UiItem, public Ui::Listval_UI
 {
 };
 
-class Positionval: public EffectStackEdit::UiItem, public Ui::Positionval_UI
-{
-};
-
 class Wipeval: public EffectStackEdit::UiItem, public Ui::Wipeval_UI
 {
 };
@@ -132,7 +128,7 @@ void EffectStackEdit::updateParameter(const QString &name, const QString &value)
     m_params.setAttribute(name, value);
 }
 
-void EffectStackEdit::transferParamDesc(const QDomElement& d, int in, int out)
+void EffectStackEdit::transferParamDesc(const QDomElement d, int in, int out)
 {
     kDebug() << "in";
     m_params = d;
@@ -247,7 +243,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d, int in, int out)
         } else if (type == "keyframe") {
             // keyframe editor widget
             kDebug() << "min: " << m_in << ", MAX: " << m_out;
-            KeyframeEdit *geo = new KeyframeEdit(pa, m_out - m_in, m_timecode);
+            KeyframeEdit *geo = new KeyframeEdit(pa, m_out - m_in, pa.attribute("min").toInt(), pa.attribute("max").toInt(), m_timecode);
             //geo->setupParam(100, pa.attribute("min").toInt(), pa.attribute("max").toInt(), pa.attribute("keyframes"));
             //connect(geo, SIGNAL(seekToPos(int)), this, SLOT(slotSeekToPos(int)));
             //geo->setupParam(pa, minFrame, maxFrame);
@@ -267,8 +263,6 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d, int in, int out)
             connect(cval->kcolorbutton, SIGNAL(clicked()) , this, SLOT(collectAllParameters()));
             m_uiItems.append(cval);
         } else if (type == "position") {
-            Positionval *pval = new Positionval;
-            pval->setupUi(toFillin);
             int pos = value.toInt();
             if (d.attribute("id") == "fadein" || d.attribute("id") == "fade_from_black") {
                 pos = pos - m_in;
@@ -276,11 +270,11 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d, int in, int out)
                 // fadeout position starts from clip end
                 pos = m_out - (pos - m_in);
             }
-            pval->krestrictedline->setText(m_timecode.getTimecodeFromFrames(pos));
-            pval->label->setText(paramName);
-            m_valueItems[paramName + "position"] = pval;
-            connect(pval->krestrictedline, SIGNAL(editingFinished()), this, SLOT(collectAllParameters()));
-            m_uiItems.append(pval);
+            PositionEdit *posedit = new PositionEdit(paramName, pos, 1, m_out, m_timecode);
+            m_vbox->addWidget(posedit);
+            m_valueItems[paramName+"position"] = posedit;
+            connect(posedit, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
+            m_items.append(posedit);
         } else if (type == "wipe") {
             Wipeval *wpval = new Wipeval;
             wpval->setupUi(toFillin);
@@ -436,9 +430,10 @@ void EffectStackEdit::collectAllParameters()
         if (type == "complex") paramName.append("complex");
         else if (type == "position") paramName.append("position");
         else if (type == "geometry") paramName.append("geometry");
+        else if (type == "keyframe") paramName.append("keyframe");
         if (!m_valueItems.contains(paramName)) {
             kDebug() << "// Param: " << paramName << " NOT FOUND";
-            return;
+            continue;
         }
 
         QString setValue;
@@ -461,24 +456,24 @@ void EffectStackEdit::collectAllParameters()
             Geometryval *geom = ((Geometryval*)m_valueItems.value(paramName));
             namenode.item(i) = geom->getParamDesc();
         } else if (type == "position") {
-            KRestrictedLine *line = ((Positionval*)m_valueItems.value(paramName))->krestrictedline;
-            int pos = m_timecode.getFrameCount(line->text(), KdenliveSettings::project_fps());
+            PositionEdit *pedit = ((PositionEdit*)m_valueItems.value(paramName));
+            int pos = pedit->getPosition();
             setValue = QString::number(pos);
             if (m_params.attribute("id") == "fadein" || m_params.attribute("id") == "fade_from_black") {
                 // Make sure duration is not longer than clip
-                if (pos > m_out) {
+                /*if (pos > m_out) {
                     pos = m_out;
-                    line->setText(m_timecode.getTimecodeFromFrames(pos));
-                }
+                    pedit->setPosition(pos);
+                }*/
                 EffectsList::setParameter(m_params, "in", QString::number(m_in));
                 EffectsList::setParameter(m_params, "out", QString::number(m_in + pos));
                 setValue.clear();
             } else if (m_params.attribute("id") == "fadeout" || m_params.attribute("id") == "fade_to_black") {
                 // Make sure duration is not longer than clip
-                if (pos > m_out) {
+                /*if (pos > m_out) {
                     pos = m_out;
-                    line->setText(m_timecode.getTimecodeFromFrames(pos));
-                }
+                    pedit->setPosition(pos);
+                }*/
                 EffectsList::setParameter(m_params, "in", QString::number(m_out + m_in - pos));
                 EffectsList::setParameter(m_params, "out", QString::number(m_out + m_in));
                 setValue.clear();