]> git.sesse.net Git - kdenlive/commitdiff
Continued work on proxy editing
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 18 Jan 2011 21:47:15 +0000 (21:47 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 18 Jan 2011 21:47:15 +0000 (21:47 +0000)
svn path=/trunk/kdenlive/; revision=5333

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

index dcf15cf873773afd1ccd1c12271864d856561ee2..b6eb1efde3059ceeed96688a52225c4796604d21 100644 (file)
@@ -616,6 +616,7 @@ void KdenliveSettingsDialog::updateSettings()
     }
     
     if (m_configProject.kcfg_enableproxy->isChecked() != KdenliveSettings::enableproxy()) {
+        KdenliveSettings::setEnableproxy(m_configProject.kcfg_enableproxy->isChecked());
         emit updateProxySettings();
     }
 
index 9b2be9c8dfe9a5e8ba7a00b7753af12d34d4981c..34ecc812b61d0503cc81c3a026dd4aed4e90208a 100644 (file)
@@ -4141,7 +4141,7 @@ void MainWindow::slotUpdateProxySettings()
     if (m_renderWidget) m_renderWidget->updateProxyConfig();
     if (KdenliveSettings::enableproxy())
         KStandardDirs::makeDir(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) + "proxy/");
-    //TODO: update proxy in project tree
+    m_projectList->updateProxyConfig();
 }
 
 #include "mainwindow.moc"
index b2837a206950e25ffc1cd7b044bc69ccc319871e..bf88350129ab0454074f05af8473ecbe95b7358e 100644 (file)
@@ -1020,6 +1020,7 @@ void ProjectList::slotGotProxy(const QString id, bool success)
             item->setProxyStatus(2);
             QDomElement e = item->referencedClip()->toXML().cloneNode().toElement();  
             e.removeAttribute("file_hash");
+            e.setAttribute("replace", 1);
             m_infoQueue.insert(id, e);
             if (!m_queueTimer.isActive()) slotProcessNextClipInQueue();
         }
@@ -1054,10 +1055,16 @@ void ProjectList::slotProcessNextClipInQueue()
 
     QMap<QString, QDomElement>::const_iterator j = m_infoQueue.constBegin();
     if (j != m_infoQueue.constEnd()) {
-        const QDomElement dom = j.value();
+        QDomElement dom = j.value();
         const QString id = j.key();
         m_infoQueue.remove(j.key());
-        emit getFileProperties(dom, id, m_listView->iconSize().height(), false);
+        bool replace;
+        if (dom.hasAttribute("replace")) {
+            dom.removeAttribute("replace");
+            replace = true;
+        }
+        else replace = false;
+        emit getFileProperties(dom, id, m_listView->iconSize().height(), replace);
     }
     if (!m_infoQueue.isEmpty()) m_queueTimer.start();
 }
@@ -1515,6 +1522,7 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
             item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled);
             toReload = clipId;
         }
+        if (item->referencedClip()->getProperty("proxy").isEmpty()) item->setProxyStatus(0);
         item->referencedClip()->setProducer(producer, replace);
         item->referencedClip()->askForAudioThumbs();
         if (!replace && item->data(0, Qt::DecorationRole).isNull())
@@ -1938,7 +1946,6 @@ QMap <QString, QString> ProjectList::getProxies()
     QTreeWidgetItemIterator it(m_listView);
     while (*it) {
         if ((*it)->type() != PROJECTCLIPTYPE) {
-            // subitem
             ++it;
             continue;
         }
@@ -1952,4 +1959,36 @@ QMap <QString, QString> ProjectList::getProxies()
     return list;
 }
 
+void ProjectList::updateProxyConfig()
+{
+    ProjectItem *item;
+    QTreeWidgetItemIterator it(m_listView);
+    while (*it) {
+        if ((*it)->type() != PROJECTCLIPTYPE) {
+            ++it;
+            continue;
+        }
+        item = static_cast<ProjectItem *>(*it);
+        if (item && item->referencedClip() != NULL) {
+            if  (KdenliveSettings::enableproxy()) {
+                DocClipBase *clip = item->referencedClip();
+                connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
+                item->setProxyStatus(1);
+                clip->generateProxy(m_doc->projectFolder());
+            }
+            else if (!item->referencedClip()->getProperty("proxy").isEmpty()) {
+                // remove proxy
+                item->referencedClip()->clearProperty("proxy");
+                QDomElement e = item->toXml().cloneNode().toElement();
+                e.removeAttribute("file_hash");
+                e.setAttribute("replace", 1);
+                m_infoQueue.insert(item->clipId(), e);
+            }
+        }
+        ++it;
+    }
+    if (!m_infoQueue.isEmpty() && !m_queueTimer.isActive()) m_queueTimer.start();
+
+}
+
 #include "projectlist.moc"
index 186ce3a2c73498c1020d312c8a45e51a173dd3fa..42d56d6c8af36397fa9aa02e3013c3168a25f165 100644 (file)
@@ -189,6 +189,8 @@ public:
     static QString getExtensions();
     /** @brief Returns a list of urls containing original and proxy urls. */
     QMap <QString, QString> getProxies();
+    /** @brief Enable / disable proxies. */
+    void updateProxyConfig();
 
 public slots:
     void setDocument(KdenliveDoc *doc);
index 11d2d3e8d0c788ca8b6cd9f655344f5a379eb69b..b53e2721a7dfdbdd30601f67f9efcee86778f176 100644 (file)
@@ -373,7 +373,10 @@ public slots:
     bool isValid(KUrl url);
 
     /** @brief Requests the file properties for the specified URL.
-     *
+        @param xml The xml parameters for the clip
+        @param clipId The clip Id string
+        @param imageHeight The height (in pixels) of the returned thumbnail (height of a treewidgetitem in projectlist)
+        @param replaceProducer If true, the MLT producer will be recreated
      * Upon return, the result will be emitted via replyGetFileProperties().
      * Wraps the VEML command of the same name. */
     void getFileProperties(const QDomElement xml, const QString &clipId, int imageHeight, bool replaceProducer = true);