]> git.sesse.net Git - kdenlive/blobdiff - src/effectstackedit.cpp
* Cleanup folder creation
[kdenlive] / src / effectstackedit.cpp
index d48687a757af4a1ffb882b34b13f1c91a741b8f0..9beab1c13bc982662d9bef3c7b4d26a843e82798 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 "complexparameter.h"
 #include "effectstackedit.h"
 #include "geometryval.h"
 
+#include "kdenlivesettings.h"
+
 QMap<QString, QImage> EffectStackEdit::iconCache;
 
 EffectStackEdit::EffectStackEdit(QWidget *parent): QWidget(parent), m_in(0), m_out(0) {
@@ -63,8 +66,9 @@ EffectStackEdit::~EffectStackEdit() {
     iconCache.clear();
 }
 
-void EffectStackEdit::updateProjectFormat(MltVideoProfile profile) {
+void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t) {
     m_profile = profile;
+    m_timecode = t;
 }
 
 void EffectStackEdit::transferParamDesc(const QDomElement& d, int in, int out) {
@@ -77,7 +81,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d, int in, int out) {
 
     QDomDocument doc;
     doc.appendChild(doc.importNode(params, true));
-    kDebug() << "IMPORTED TRANS: " << doc.toString();
+    //kDebug() << "IMPORTED TRANS: " << doc.toString();
     QDomNodeList namenode = params.elementsByTagName("parameter");
     QDomElement e = params.toElement();
     const int minFrame = e.attribute("start").toInt();
@@ -183,6 +187,21 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d, int in, int out) {
             cval->label->setText(paramName);
             valueItems[paramName] = cval;
             uiItems.append(cval);
+        } else if (type == "position") {
+            Ui::Positionval_UI *pval = new Ui::Positionval_UI;
+            pval->setupUi(toFillin);
+            int pos = value.toInt();
+            if (d.attribute("id") == "fadein") {
+                pos = pos - m_in;
+            } else if (d.attribute("id") == "fadeout") {
+                // fadeout position starts from clip end
+                pos = m_out - (pos - m_in);
+            }
+            pval->krestrictedline->setText(m_timecode.getTimecodeFromFrames(pos));
+            connect(pval->krestrictedline, SIGNAL(editingFinished()), this, SLOT(collectAllParameters()));
+            pval->label->setText(paramName);
+            valueItems[paramName + "position"] = pval;
+            uiItems.append(pval);
         } else if (type == "wipe") {
             Ui::Wipeval_UI *wpval = new Ui::Wipeval_UI;
             wpval->setupUi(toFillin);
@@ -344,13 +363,31 @@ void EffectStackEdit::collectAllParameters() {
             setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
         } else if (type == "color") {
             KColorButton *color = ((Ui::Colorval_UI*)valueItems[paramName])->kcolorbutton;
-            setValue.sprintf("0x%08x", color->color().rgba());
+            setValue = color->color().name();
+            setValue.replace('#', "0x");
         } else if (type == "complex") {
             ComplexParameter *complex = ((ComplexParameter*)valueItems[paramName+"complex"]);
             namenode.item(i) = complex->getParamDesc();
         } else if (type == "geometry") {
             Geometryval *geom = ((Geometryval*)valueItems[paramName+"geometry"]);
             namenode.item(i) = geom->getParamDesc();
+        } else if (type == "position") {
+            KRestrictedLine *line = ((Ui::Positionval_UI*)valueItems[paramName+"position"])->krestrictedline;
+            int pos = m_timecode.getFrameCount(line->text(), KdenliveSettings::project_fps());
+            if (params.attribute("id") == "fadein") {
+                pos += m_in;
+                if (pos > m_out) {
+                    pos = m_out;
+                    line->setText(m_timecode.getTimecodeFromFrames(pos));
+                }
+            } else if (params.attribute("id") == "fadeout") {
+                pos = m_out - (pos - m_in);
+                if (pos > m_out - m_in) {
+                    pos = m_out - m_in;
+                    line->setText(m_timecode.getTimecodeFromFrames(pos));
+                }
+            }
+            setValue = QString::number(pos);
         } else if (type == "wipe") {
             Ui::Wipeval_UI *wp = (Ui::Wipeval_UI*)valueItems[paramName];
             wipeInfo info;