]> git.sesse.net Git - kdenlive/blobdiff - src/effectstackedit.cpp
Cleanup last commit and some real mess in profile switching
[kdenlive] / src / effectstackedit.cpp
index b5e5e214eee0050b0c7d33229ee8ed10baca2999..9beab1c13bc982662d9bef3c7b4d26a843e82798 100644 (file)
@@ -81,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();
@@ -190,7 +190,14 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d, int in, int out) {
         } else if (type == "position") {
             Ui::Positionval_UI *pval = new Ui::Positionval_UI;
             pval->setupUi(toFillin);
-            pval->krestrictedline->setText(m_timecode.getTimecodeFromFrames(value.toInt()));
+            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;
@@ -366,8 +373,21 @@ void EffectStackEdit::collectAllParameters() {
             namenode.item(i) = geom->getParamDesc();
         } else if (type == "position") {
             KRestrictedLine *line = ((Ui::Positionval_UI*)valueItems[paramName+"position"])->krestrictedline;
-            setValue = QString::number(m_timecode.getFrameCount(line->text(), KdenliveSettings::project_fps()));
-            kDebug() << "// NEW POSITION: " << setValue << "(" << line->text() << " PARAM: " << paramName + "position";
+            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;