]> git.sesse.net Git - kdenlive/blobdiff - src/trackview.cpp
Refactor representation of 2pass in profiles.
[kdenlive] / src / trackview.cpp
index 3b29f7352fa35ba573a806d0ac4441d8e5e4e9b8..b5b2b9efd173d318e5b0a7bb4b14cbc7941663ec 100644 (file)
@@ -413,7 +413,7 @@ void TrackView::parseDocument(QDomDocument doc)
                 kDebug() << "///// REMOVED INVALID TRANSITION: " << e.attribute("id");
                 tractor.removeChild(transitions.item(i));
                 i--;
-            } else {
+            } else if (m_trackview->canBePastedTo(transitionInfo, TRANSITIONWIDGET)) {
                 Transition *tr = new Transition(transitionInfo, a_track, m_doc->fps(), base, isAutomatic);
                 if (forceTrack) tr->setForcedTrack(true, a_track);
                 m_scene->addItem(tr);
@@ -421,6 +421,11 @@ void TrackView::parseDocument(QDomDocument doc)
                     tr->setItemLocked(true);
                 }
             }
+            else {
+                m_documentErrors.append(i18n("Removed overlapping transition: (%1, %2, %3)", e.attribute("id"), mlt_service, transitionId) + '\n');
+                tractor.removeChild(transitions.item(i));
+                i--;
+            }
         }
     }
 
@@ -447,7 +452,7 @@ void TrackView::parseDocument(QDomDocument doc)
 
     slotRebuildTrackHeaders();
     if (!m_documentErrors.isNull()) KMessageBox::sorry(this, m_documentErrors);
-    if (infoXml.hasAttribute("upgraded")) {
+    if (infoXml.hasAttribute("upgraded") || infoXml.hasAttribute("modified")) {
         // Our document was upgraded, create a backup copy just in case
         QString baseFile = m_doc->url().path().section(".kdenlive", 0, 0);
         int ct = 0;
@@ -456,8 +461,13 @@ void TrackView::parseDocument(QDomDocument doc)
             ct++;
             backupFile = baseFile + "_backup" + QString::number(ct) + ".kdenlive";
         }
+        QString message;
+        if (infoXml.hasAttribute("upgraded"))
+            message = i18n("Your project file was upgraded to the latest Kdenlive document version.\nTo make sure you don't lose data, a backup copy called %1 was created.", backupFile);
+        else
+            message = i18n("Your project file was modified by Kdenlive.\nTo make sure you don't lose data, a backup copy called %1 was created.", backupFile);
         if (KIO::NetAccess::file_copy(m_doc->url(), KUrl(backupFile), this))
-            KMessageBox::information(this, i18n("Your project file was upgraded to the latest Kdenlive document version.\nTo make sure you don't lose data, a backup copy called %1 was created.", backupFile));
+            KMessageBox::information(this, message);
         else
             KMessageBox::information(this, i18n("Your project file was upgraded to the latest Kdenlive document version, but it was not possible to create a backup copy.", backupFile));
     }
@@ -610,7 +620,8 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked)
                 speed = idString.section(':', 2, 2).toDouble();
                 strobe = idString.section(':', 3, 3).toInt();
                 if (strobe == 0) strobe = 1;
-            } else id = id.section('_', 0, 0);
+            }
+            id = id.section('_', 0, 0);
             DocClipBase *clip = m_doc->clipManager()->getClipById(id);
             if (clip == NULL) {
                 // The clip in playlist was not listed in the kdenlive producers,
@@ -632,6 +643,7 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked)
                     producerXml.setAttribute("id", id);
                     clip = new DocClipBase(m_doc->clipManager(), doc.documentElement(), id);
                     xml.insertBefore(producerXml, QDomNode());
+                    nodeindex++;
                     m_doc->clipManager()->addClip(clip);
 
                     m_documentErrors.append(i18n("Broken clip producer %1", id) + '\n');
@@ -857,7 +869,8 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo
                     }
                 }
             }
-            if (effecttag == "ladspa") {
+            // Old LADSPA filter, deprecated
+            /*if (effecttag == "ladspa") {
                 //QString ladspaEffectFile = EffectsList::parameter(effect, "src", "property");
 
                 if (!QFile::exists(ladspaEffectFile)) {
@@ -865,7 +878,8 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo
                     initEffects::ladspaEffectFile(ladspaEffectFile, currenteffect.attribute("ladspaid").toInt(), m_trackview->getLadspaParams(currenteffect));
                 }
                 currenteffect.setAttribute("src", ladspaEffectFile);
-            }
+            }*/
+            
             if (disableeffect) currenteffect.setAttribute("disable", "1");
             if (clip)
                 clip->addEffect(currenteffect, false);
@@ -884,9 +898,15 @@ DocClipBase *TrackView::getMissingProducer(const QString id) const
     if (!docRoot.endsWith('/')) docRoot.append('/');
     QDomNodeList prods = doc.elementsByTagName("producer");
     int maxprod = prods.count();
+    bool slowmotionClip = false;
     for (int i = 0; i < maxprod; i++) {
         QDomNode m = prods.at(i);
         QString prodId = m.toElement().attribute("id");
+        if (prodId.startsWith("slowmotion")) {
+            slowmotionClip = true;
+            prodId = prodId.section(':', 1, 1);
+        }
+        prodId = prodId.section('_', 0, 0);
         if (prodId == id) {
             missingXml =  m.toElement();
             break;
@@ -903,6 +923,7 @@ DocClipBase *TrackView::getMissingProducer(const QString id) const
             break;
         }
     }
+    if (slowmotionClip) resource = resource.section('?', 0, 0);
     // prepend MLT XML document root if no path in clip resource and not a color clip
     if (!resource.startsWith('/') && !resource.startsWith("0x")) resource.prepend(docRoot);
     DocClipBase *missingClip = NULL;
@@ -1010,4 +1031,19 @@ void TrackView::slotUpdateTrackEffectState(int ix)
     widgets.at(m_doc->tracksCount() - ix - 1)->updateEffectLabel(m_doc->trackInfoAt(ix).effectsList.effectNames());
 }
 
+void TrackView::slotSaveTimelinePreview(const QString path)
+{
+    QImage img(width(), height(), QImage::Format_ARGB32_Premultiplied);
+    img.fill(palette().base().color().rgb());
+    QPainter painter(&img);
+    render(&painter);
+    painter.end();
+    img = img.scaledToWidth(600, Qt::SmoothTransformation);
+    img.save(path);
+}
+
+
 #include "trackview.moc"
+
+
+