]> git.sesse.net Git - kdenlive/commitdiff
Fix several title clips problems, including:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 5 Apr 2009 23:04:31 +0000 (23:04 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 5 Apr 2009 23:04:31 +0000 (23:04 +0000)
http://www.kdenlive.org/mantis/view.php?id=597

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

src/clipmanager.cpp
src/kdenlivedoc.cpp
src/kdenlivedoc.h
src/mainwindow.cpp
src/renderer.cpp
src/renderer.h
src/trackview.cpp

index 5616f48db1b20671f5637a532f60f570c7c1a3b8..c43b583d25660d12d6251d4068c5c81139ab50f1 100644 (file)
@@ -336,7 +336,7 @@ void ClipManager::slotAddTextClipFile(const QString titleName, const QString ima
     QDomElement prod = doc.createElement("producer");
     doc.appendChild(prod);
     prod.setAttribute("resource", imagePath);
-    prod.setAttribute("titlename", titleName);
+    prod.setAttribute("name", titleName);
     prod.setAttribute("xmldata", xml);
     uint id = m_clipIdCounter++;
     prod.setAttribute("id", QString::number(id));
index 4476473daf7771676c8ae062397d08dff56c21d7..d81e705d801d960d6063a5fe0f866591691b29b1 100644 (file)
@@ -249,7 +249,7 @@ KdenliveDoc::~KdenliveDoc()
 void KdenliveDoc::setSceneList()
 {
     m_render->setSceneList(m_document.toString(), m_startPos);
-    checkProjectClips();
+    //checkProjectClips();
 }
 
 QDomDocument KdenliveDoc::createEmptyDocument(const int videotracks, const int audiotracks)
@@ -1195,6 +1195,10 @@ void KdenliveDoc::setRenderer(Render *render) {
 void KdenliveDoc::checkProjectClips()
 {
     if (m_render == NULL) return;
+    m_clipManager->resetProducersList(m_render->producersList());
+    return;
+
+    // Useless now...
     QList <Mlt::Producer *> prods = m_render->producersList();
     QString id ;
     QString prodId ;
@@ -1207,20 +1211,20 @@ void KdenliveDoc::checkProjectClips()
         if (clip) clip->setProducer(prods.at(i));
         if (clip && clip->clipType() == TEXT && !QFile::exists(clip->fileURL().path())) {
             // regenerate text clip image if required
-            kDebug() << "// TITLE: " << clip->getProperty("titlename") << " Preview file: " << clip->getProperty("resource") << " DOES NOT EXIST";
-            QString titlename = clip->getProperty("titlename");
+            //kDebug() << "// TITLE: " << clip->getProperty("titlename") << " Preview file: " << clip->getProperty("resource") << " DOES NOT EXIST";
+            QString titlename = clip->getProperty("name");
             QString titleresource;
             if (titlename.isEmpty()) {
                 QStringList titleInfo = TitleWidget::getFreeTitleInfo(projectFolder());
                 titlename = titleInfo.at(0);
                 titleresource = titleInfo.at(1);
-                clip->setProperty("titlename", titlename);
+                clip->setProperty("name", titlename);
                 kDebug() << "// New title set to: " << titlename;
             } else {
-                titleresource = TitleWidget::getTitleResourceFromName(projectFolder(), titlename);
+                titleresource = TitleWidget::getFreeTitleInfo(projectFolder()).at(1);
+                //titleresource = TitleWidget::getTitleResourceFromName(projectFolder(), titlename);
             }
-            QString titlepath = projectFolder().path() + "/titles/";
-            TitleWidget *dia_ui = new TitleWidget(KUrl(), titlepath, m_render, kapp->activeWindow());
+            TitleWidget *dia_ui = new TitleWidget(KUrl(), KUrl(titleresource).directory(), m_render, kapp->activeWindow());
             QDomDocument doc;
             doc.setContent(clip->getProperty("xmldata"));
             dia_ui->setXml(doc);
@@ -1383,26 +1387,27 @@ void KdenliveDoc::addClip(QDomElement elem, QString clipId, bool createClipItem)
             extension = KUrl(path).fileName();
             path = KUrl(path).directory();
         } else if (elem.attribute("type").toInt() == TEXT && QFile::exists(path) == false) {
-            kDebug() << "// TITLE: " << elem.attribute("titlename") << " Preview file: " << elem.attribute("resource") << " DOES NOT EXIST";
-            QString titlename = elem.attribute("titlename");
+            kDebug() << "// TITLE: " << elem.attribute("name") << " Preview file: " << elem.attribute("resource") << " DOES NOT EXIST";
+            QString titlename = elem.attribute("name");
             QString titleresource;
             if (titlename.isEmpty()) {
                 QStringList titleInfo = TitleWidget::getFreeTitleInfo(projectFolder());
                 titlename = titleInfo.at(0);
                 titleresource = titleInfo.at(1);
-                elem.setAttribute("titlename", titlename);
+                elem.setAttribute("name", titlename);
                 kDebug() << "// New title set to: " << titlename;
             } else {
-                titleresource = TitleWidget::getTitleResourceFromName(projectFolder(), titlename);
+                titleresource = TitleWidget::getFreeTitleInfo(projectFolder()).at(1);
+                //titleresource = TitleWidget::getTitleResourceFromName(projectFolder(), titlename);
             }
-            QString titlepath = projectFolder().path() + "/titles/";
-            TitleWidget *dia_ui = new TitleWidget(KUrl(), titlepath, m_render, kapp->activeWindow());
+            TitleWidget *dia_ui = new TitleWidget(KUrl(), KUrl(titleresource).directory(), m_render, kapp->activeWindow());
             QDomDocument doc;
             doc.setContent(elem.attribute("xmldata"));
             dia_ui->setXml(doc);
             QImage pix = dia_ui->renderedPixmap();
             pix.save(titleresource);
             elem.setAttribute("resource", titleresource);
+            setNewClipResource(clipId, titleresource);
             delete dia_ui;
         }
         if (path.isEmpty() == false && QFile::exists(path) == false && elem.attribute("type").toInt() != TEXT) {
index a2fdc171223f304fa0214e18376a4d09f14fa8ac..0bf427f4f80402c04ea6051261a30da62162fe07 100644 (file)
@@ -148,7 +148,7 @@ private:
     bool convertDocument(double version);
     QDomDocument createEmptyDocument(const int videotracks, const int audiotracks);
     QString colorToString(const QColor& c);
-    void checkProjectClips();
+
     void setNewClipResource(const QString &id, const QString &path);
     QString searchFileRecursively(const QDir &dir, const QString &matchSize, const QString &matchHash) const;
     void moveProjectData(KUrl url);
@@ -157,6 +157,7 @@ public slots:
     void slotCreateTextClip(QString group, const QString &groupId);
     /** Set to true if document needs saving, false otherwise */
     void setModified(bool mod = true);
+    void checkProjectClips();
 
 private slots:
     void slotAutoSave();
index d956bb40f703be2d417553a8c718b1537e275f3e..8f5fc1b9245cd1356ed10c91699d5c0cbb753250 100644 (file)
@@ -1071,8 +1071,10 @@ void MainWindow::setupActions()
 
     KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, collection);
 
+    /*
+    //TODO: Add status tooltip to actions ?
     connect(collection, SIGNAL(actionHovered(QAction*)),
-            this, SLOT(slotDisplayActionMessage(QAction*)));
+            this, SLOT(slotDisplayActionMessage(QAction*)));*/
 
 
     QAction *addClip = new KAction(KIcon("kdenlive-add-clip"), i18n("Add Clip"), this);
@@ -1709,6 +1711,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
             disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), m_activeTimeline, SLOT(slotSetZone(QPoint)));
             disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
             disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
+            disconnect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), m_activeDocument, SLOT(checkProjectClips()));
 
 
             disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
@@ -1766,6 +1769,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
     connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
     connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
+    connect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers()), doc, SLOT(checkProjectClips()));
     connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
     connect(doc, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
     connect(doc, SIGNAL(signalDeleteProjectClip(const QString &)), m_projectList, SLOT(slotDeleteClip(const QString &)));
index c88fc355e96d34d2baf214f6ba4777491c6387a8..01ba6e42cb2ee7a0ad32ef3e56ecf4cc6e131f76 100644 (file)
@@ -868,6 +868,7 @@ void Render::setSceneList(QString playlist, int position)
     }
     m_isBlocked = false;
     blockSignals(false);
+    emit refreshDocumentProducers();
     //kDebug()<<"// SETSCN LST, POS: "<<position;
     //if (position != 0) emit rendererPosition(position);
 }
index d7f1306170ab32c598daa4e49b633b99f66c9b3b..affb77d440f82277878b197f6143a31eb5ed3d66 100644 (file)
@@ -262,6 +262,7 @@ signals:   // Signals
     void rendererPosition(int);
     void rendererStopped(int);
     void removeInvalidClip(const QString &);
+    void refreshDocumentProducers();
 
 public slots:  // Public slots
     /** Start Consumer */
index 9c860270dc52e9010a074b6ff71316e74a47652f..9d8f42b39389776d1692bb2ee3392ebd0b673464 100644 (file)
@@ -134,7 +134,8 @@ void TrackView::parseDocument(QDomDocument doc)
 {
     //int cursorPos = 0;
     m_documentErrors.clear();
-    // kDebug() << "//// DOCUMENT: " << doc.toString();
+
+    //kDebug() << "//// DOCUMENT: " << doc.toString();
     /*QDomNode props = doc.elementsByTagName("properties").item(0);
     if (!props.isNull()) {
         cursorPos = props.toElement().attribute("timeline_position").toInt();
@@ -154,9 +155,25 @@ void TrackView::parseDocument(QDomDocument doc)
     m_invalidProducers.clear();
     QDomNodeList producers = doc.elementsByTagName("producer");
     for (int i = 0; i < producers.count(); i++) {
-        // CHeck for invalid producers
+        // Check for invalid producers
         QDomNode n = producers.item(i);
         e = n.toElement();
+
+        /*
+        // Check for invalid markup
+        QDomNodeList params = e.elementsByTagName("property");
+        for (int j = 0; j < params.count(); j++) {
+            QDomElement p = params.item(j).toElement();
+            if (p.attribute("name") == "markup") {
+         QString val = p.text().toUtf8().data();
+         kDebug()<<"//FOUND MARKUP, VAL: "<<val;
+         //e.setAttribute("value", value);
+         n.removeChild(params.item(j));
+         break;
+            }
+        }
+        */
+
         if (e.hasAttribute("in") == false && e.hasAttribute("out") == false) continue;
         int in = e.attribute("in").toInt();
         int out = e.attribute("out").toInt();