]> git.sesse.net Git - kdenlive/commitdiff
Fixed: Crash when selecting a keyframeable effect
authorSimon A. Eugster <simon.eu@gmail.com>
Fri, 4 Feb 2011 19:20:28 +0000 (19:20 +0000)
committerSimon A. Eugster <simon.eu@gmail.com>
Fri, 4 Feb 2011 19:20:28 +0000 (19:20 +0000)
http://www.kdenlive.org/mantis/view.php?id=1981
If one of the keyframeable parameters was set to 1, this lead to a misinterpretation of the parameter as «not keyframeable» and caused a crash.

svn path=/trunk/kdenlive/; revision=5380

src/audioscopes/audiospectrum.cpp
src/effectstackedit.cpp
src/trackview.cpp

index e5778c3d361ae33c992c28306335b2bad29a3ffe..50b4aea50b5e744e4ec12d8ecf5afc10c00dd267 100644 (file)
@@ -167,7 +167,6 @@ QImage AudioSpectrum::renderAudioScope(uint, const QVector<int16_t> audioFrame,
 
 
 #ifdef DETECT_OVERMODULATION
-        // TODO Color: 1 if currently overmodulated, max 0.8 else
         bool overmodulated = false;
         int overmodulateCount = 0;
 
index d156ff709710f45b6882691cd06e66ea06d48ef2..7acae5dd662dc3e9f020a6b35b34b199c4dd4727 100644 (file)
@@ -49,6 +49,9 @@
 #include <QCheckBox>
 #include <QScrollArea>
 
+// For QDomNode debugging (output into files); leaving here as sample code.
+//#define DEBUG_ESE
+
 
 class Boolval: public QWidget, public Ui::Boolval_UI
 {
@@ -192,6 +195,19 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
     }
 
     QDomNodeList namenode = m_params.elementsByTagName("parameter");
+#ifdef DEBUG_ESE
+    QFile debugFile("/tmp/namenodes.txt");
+    if (debugFile.open(QFile::WriteOnly | QFile::Truncate)) {
+        QTextStream out(&debugFile);
+        QTextStream out2(stdout);
+        for (int i = 0; i < namenode.size(); i++) {
+            out << i << ": \n";
+            namenode.at(i).save(out, 2);
+            out2 << i << ": \n";
+            namenode.at(i).save(out2, 2);
+        }
+    }
+#endif
     QDomElement e = m_params.toElement();
     const int minFrame = e.attribute("start").toInt();
     const int maxFrame = e.attribute("end").toInt();
index cdfd02fd6ad09b39111bd644ed80e49261640113..2b06a311d60a89db02453dcc923a74c1688508b1 100644 (file)
@@ -718,8 +718,12 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo
         //kDebug() << "+ + CLIP EFF FND: " << effecttag << ", " << effectid << ", " << effectindex;
         // get effect standard tags
         QDomElement clipeffect = MainWindow::customEffects.getEffectByTag(QString(), effectid);
-        if (clipeffect.isNull()) clipeffect = MainWindow::videoEffects.getEffectByTag(effecttag, effectid);
-        if (clipeffect.isNull()) clipeffect = MainWindow::audioEffects.getEffectByTag(effecttag, effectid);
+        if (clipeffect.isNull()) {
+            clipeffect = MainWindow::videoEffects.getEffectByTag(effecttag, effectid);
+        }
+        if (clipeffect.isNull()) {
+            clipeffect = MainWindow::audioEffects.getEffectByTag(effecttag, effectid);
+        }
         if (clipeffect.isNull()) {
             kDebug() << "///  WARNING, EFFECT: " << effecttag << ": " << effectid << " not found, removing it from project";
             m_documentErrors.append(i18n("Effect %1:%2 not found in MLT, it was removed from this project\n", effecttag, effectid));
@@ -828,22 +832,24 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo
                 for (int k = 0; k < clipeffectparams.count(); k++) {
                     e = clipeffectparams.item(k).toElement();
                     if (!e.isNull() && e.tagName() == "parameter" && e.attribute("name") == paramname) {
-                        if (e.attribute("factor", "1") != "1") {
-                            QString factor = e.attribute("factor", "1");
-                            double fact;
-                            if (factor.startsWith('%')) {
-                                fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
-                            } else fact = factor.toDouble();
-                            if (e.attribute("type") == "simplekeyframe") {
-                                QStringList kfrs = paramvalue.split(";");
-                                for (int l = 0; l < kfrs.count(); l++) {
-                                    QString fr = kfrs.at(l).section('=', 0, 0);
-                                    double val = kfrs.at(l).section('=', 1, 1).toDouble();
-                                    kfrs[l] = fr + ":" + QString::number((int)(val * fact));
-                                }
-                                e.setAttribute("keyframes", kfrs.join(";"));
-                            } else e.setAttribute("value", paramvalue.toDouble() * fact);
-                        } else e.setAttribute("value", paramvalue);
+                        QString factor = e.attribute("factor", "1");
+                        double fact;
+                        if (factor.startsWith('%')) {
+                            fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
+                        } else {
+                            fact = factor.toDouble();
+                        }
+                        if (e.attribute("type") == "simplekeyframe") {
+                            QStringList kfrs = paramvalue.split(";");
+                            for (int l = 0; l < kfrs.count(); l++) {
+                                QString fr = kfrs.at(l).section('=', 0, 0);
+                                double val = kfrs.at(l).section('=', 1, 1).toDouble();
+                                kfrs[l] = fr + ":" + QString::number((int)(val * fact));
+                            }
+                            e.setAttribute("keyframes", kfrs.join(";"));
+                        } else {
+                            e.setAttribute("value", paramvalue.toDouble() * fact);
+                        }
                         break;
                     }
                 }