]> git.sesse.net Git - kdenlive/commitdiff
Fix broken loading of documents with several clips that are not in timeline
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 9 Aug 2009 18:36:11 +0000 (18:36 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 9 Aug 2009 18:36:11 +0000 (18:36 +0000)
svn path=/trunk/kdenlive/; revision=3809

src/mainwindow.cpp
src/projectlist.cpp
src/projectlist.h
src/renderer.cpp
src/renderer.h

index 24d444c350e0a7a491d2407f0a70be4b61884548..aefdfac7018a1df9a6546e7b297d41881cf95c21 100644 (file)
@@ -624,7 +624,7 @@ void MainWindow::slotConnectMonitors()
     m_projectList->setRenderer(m_projectMonitor->render);
     connect(m_projectList, SIGNAL(receivedClipDuration(const QString &)), this, SLOT(slotUpdateClip(const QString &)));
     connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
-    connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, const QString &, bool)), m_projectMonitor->render, SLOT(getFileProperties(const QDomElement &, const QString &, bool)));
+    connect(m_projectList, SIGNAL(getFileProperties(const QDomElement, const QString &, bool)), m_projectMonitor->render, SLOT(getFileProperties(const QDomElement, const QString &, bool)));
     connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QPixmap &)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QPixmap &)));
     connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool)));
 
@@ -1744,7 +1744,6 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
             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()));
             disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
             disconnect(m_activeDocument, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
@@ -1803,6 +1802,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     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 &)));
@@ -1851,7 +1851,6 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     //doc->setRenderer(m_projectMonitor->render);
     m_commandStack->setActiveStack(doc->commandStack());
     KdenliveSettings::setProject_display_ratio(doc->dar());
-    m_projectList->updateAllClips();
     //doc->clipManager()->checkAudioThumbs();
 
     //m_overView->setScene(trackView->projectScene());
@@ -1862,6 +1861,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     m_saveAction->setEnabled(doc->isModified());
     m_activeDocument = doc;
     m_activeTimeline->updateProjectFps();
+    m_projectList->updateAllClips();
     if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings();
 
     // set tool to select tool
index fef580f46c145b76f9b29e72f50a08ec829bcc5d..84c7a78f7e63e6bfcf739faf386267ea9bfbbc2c 100644 (file)
@@ -457,7 +457,6 @@ void ProjectList::slotAddFolder(const QString foldername, const QString &clipId,
     } else {
         if (edit) {
             ProjectItem *item = getFolderItemById(clipId);
-            QTreeWidgetItemIterator it(m_listView);
             if (item) {
                 m_listView->blockSignals(true);
                 item->setGroupName(foldername);
@@ -497,8 +496,10 @@ void ProjectList::deleteProjectFolder(QMap <QString, QString> map)
 
 void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
 {
-    if (getProperties) m_listView->setEnabled(false);
-    m_listView->blockSignals(true);
+    if (getProperties) {
+       m_listView->setEnabled(false);
+       m_listView->blockSignals(true);
+    }
     const QString parent = clip->getProperty("groupid");
     kDebug() << "Adding clip with groupid: " << parent;
     ProjectItem *item = NULL;
@@ -533,7 +534,7 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
         if (!annotation.isEmpty()) item->setText(2, annotation);
         item->setText(3, QString::number(f.rating()));
     }
-    m_listView->blockSignals(false);
+    if (getProperties) m_listView->blockSignals(false);
 }
 
 void ProjectList::slotResetProjectList()
@@ -580,11 +581,16 @@ void ProjectList::slotUpdateClip(const QString &id)
 
 void ProjectList::updateAllClips()
 {
+    m_listView->setSortingEnabled(false);
+    
     QTreeWidgetItemIterator it(m_listView);
+    DocClipBase *clip;
+    ProjectItem *item;
+    m_listView->blockSignals(true);
     while (*it) {
-        ProjectItem *item = static_cast <ProjectItem *>(*it);
+        item = static_cast <ProjectItem *>(*it);
         if (!item->isGroup()) {
-            DocClipBase *clip = item->referencedClip();
+            clip = item->referencedClip();
             /*if (clip->clipType() == TEXT && !QFile::exists(clip->fileURL().path())) {
                 // regenerate text clip image if required
                 TitleWidget *dia_ui = new TitleWidget(KUrl(), QString(), m_render, this);
@@ -595,27 +601,27 @@ void ProjectList::updateAllClips()
                 pix.save(clip->fileURL().path());
                 delete dia_ui;
             }*/
-
             if (item->referencedClip()->producer() == NULL) {
-                if (clip->isPlaceHolder() == false) requestClipInfo(clip->toXML(), clip->getId());
+                if (clip->isPlaceHolder() == false) {
+                   requestClipInfo(clip->toXML(), clip->getId());
+               }
                 else item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
             } else {
                 if (item->icon(0).isNull()) {
                     requestClipThumbnail(clip->getId());
                 }
                 if (item->data(1, DurationRole).toString().isEmpty()) {
-                    m_listView->blockSignals(true);
                     item->changeDuration(item->referencedClip()->producer()->get_playtime());
-                    m_listView->blockSignals(false);
                 }
             }
-            m_listView->blockSignals(true);
-            item->setData(1, UsageRole, QString::number(item->numReferences()));
-            m_listView->blockSignals(false);
+           item->setData(1, UsageRole, QString::number(item->numReferences()));
             qApp->processEvents();
         }
         ++it;
     }
+
+    m_listView->blockSignals(false);
+    m_listView->setSortingEnabled(true);
     if (m_infoQueue.isEmpty()) slotProcessNextThumbnail();
 }
 
@@ -770,6 +776,7 @@ void ProjectList::setDocument(KdenliveDoc *doc)
 {
     m_listView->blockSignals(true);
     m_listView->clear();
+    m_listView->setSortingEnabled(false);
     emit clipSelected(NULL);
     m_thumbnailQueue.clear();
     m_infoQueue.clear();
@@ -779,9 +786,6 @@ void ProjectList::setDocument(KdenliveDoc *doc)
     m_commandStack = doc->commandStack();
     m_doc = doc;
 
-    connect(m_doc->clipManager(), SIGNAL(reloadClip(const QString &)), this, SLOT(slotReloadClip(const QString &)));
-    connect(m_doc->clipManager(), SIGNAL(checkAllClips()), this, SLOT(updateAllClips()));
-
     QMap <QString, QString> flist = doc->clipManager()->documentFolderList();
     QMapIterator<QString, QString> f(flist);
     while (f.hasNext()) {
@@ -793,9 +797,11 @@ void ProjectList::setDocument(KdenliveDoc *doc)
     for (int i = 0; i < list.count(); i++) {
         slotAddClip(list.at(i), false);
     }
-
+    
     m_listView->blockSignals(false);
     m_toolbar->setEnabled(true);
+    connect(m_doc->clipManager(), SIGNAL(reloadClip(const QString &)), this, SLOT(slotReloadClip(const QString &)));
+    connect(m_doc->clipManager(), SIGNAL(checkAllClips()), this, SLOT(updateAllClips()));
 }
 
 QDomElement ProjectList::producersList()
index 6a84ae05212e221cfb5f369d459983b6372cc8f3..ebaeb00acd7b8bf6c1f9905fb013e1fbc8727f31 100644 (file)
@@ -203,7 +203,7 @@ private slots:
 
 signals:
     void clipSelected(DocClipBase *);
-    void getFileProperties(const QDomElement&, const QString &, bool);
+    void getFileProperties(const QDomElement, const QString &, bool);
     void receivedClipDuration(const QString &);
     void showClipProperties(DocClipBase *);
     void projectModified();
index 7488beda7c1425bb65d2a472c29591529727f0e8..502b4517a290570e4e800259a4430b4880ad070c 100644 (file)
@@ -69,6 +69,7 @@ Render::Render(const QString & rendererName, int winid, int /* extid */, QWidget
         m_name(rendererName),
         m_mltConsumer(NULL),
         m_mltProducer(NULL),
+       m_mltProfile(NULL),
         m_framePosition(0),
         m_isZoneMode(false),
         m_isLoopMode(false),
@@ -132,6 +133,7 @@ void Render::buildConsumer()
     delete m_blackClip;
     m_blackClip = NULL;
 
+    if (m_mltProfile) delete m_mltProfile;
     m_mltProfile = new Mlt::Profile(tmp);
     delete[] tmp;
 
@@ -234,9 +236,6 @@ int Render::resetProfile()
     }
     m_mltProducer = NULL;
 
-    if (m_mltProfile) delete m_mltProfile;
-    m_mltProfile = NULL;
-
     buildConsumer();
 
     //kDebug() << "//RESET WITHSCENE: " << scene;
@@ -537,10 +536,11 @@ void Render::slotSplitView(bool doit)
     }
 }
 
-void Render::getFileProperties(const QDomElement &xml, const QString &clipId, bool replaceProducer)
+void Render::getFileProperties(const QDomElement xml, const QString &clipId, bool replaceProducer)
 {
     KUrl url = KUrl(xml.attribute("resource", QString()));
     Mlt::Producer *producer = NULL;
+    //kDebug() << "PROFILE WIDT: "<< xml.attribute("mlt_service") << ": "<< m_mltProfile->width() << "\n...................\n\n";
     /*if (xml.attribute("type").toInt() == TEXT && !QFile::exists(url.path())) {
         emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer);
         return;
index 87e36d77a73410f08ba46f77ab7e7a02f508686c..fe0814a24bfd96ee931c1f0377c946992edb3f12 100644 (file)
@@ -287,7 +287,7 @@ public slots:  // Public slots
     /** Wraps the VEML command of the same name. Requests the file properties
     for the specified url from the renderer. Upon return, the result will be emitted
     via replyGetFileProperties(). */
-    void getFileProperties(const QDomElement &xml, const QString &clipId, bool replaceProducer = true);
+    void getFileProperties(const QDomElement xml, const QString &clipId, bool replaceProducer = true);
 
     void exportFileToFirewire(QString srcFileName, int port, GenTime startTime, GenTime endTime);
     static char *decodedString(QString str);