]> git.sesse.net Git - kdenlive/commitdiff
Fix proxy clip having wrong duration and crash when deleting proxies from the project...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 27 Jun 2011 10:02:21 +0000 (10:02 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 27 Jun 2011 10:02:21 +0000 (10:02 +0000)
svn path=/trunk/kdenlive/; revision=5734

src/docclipbase.cpp
src/mainwindow.cpp
src/mainwindow.h
src/projectlist.cpp
src/projectsettings.cpp
src/projectsettings.h

index cc719b0fc2dd59e572a1cc9d46e7fa50ca982944..964c8186b71cf22e9670056cbb8be538e6b071d7 100644 (file)
@@ -839,11 +839,23 @@ void DocClipBase::setProperties(QMap <QString, QString> properties)
     bool refreshProducer = false;
     QStringList keys;
     keys << "luma_duration" << "luma_file" << "fade" << "ttl" << "softness" << "crop" << "animation";
+    QString oldProxy = m_properties.value("proxy");
     while (i.hasNext()) {
         i.next();
         setProperty(i.key(), i.value());
         if (m_clipType == SLIDESHOW && keys.contains(i.key())) refreshProducer = true;
     }
+    if (properties.contains("proxy")) {
+        QString value = properties.value("proxy");
+        // If value is "-", that means user manually disabled proxy on this clip
+        if (value.isEmpty() || value == "-") {
+            // reset proxy
+            emit abortProxy(m_id, oldProxy);
+        }
+        else {
+            emit createProxy(m_id);
+        }
+    }
     if (refreshProducer) slotRefreshProducer();
 }
 
@@ -951,7 +963,6 @@ void DocClipBase::refreshThumbUrl()
 
 void DocClipBase::setProperty(const QString &key, const QString &value)
 {
-    QString oldProxy = m_properties.value("proxy");
     m_properties.insert(key, value);
     if (key == "resource") {
         getFileHash(value);
@@ -1017,16 +1028,6 @@ void DocClipBase::setProperty(const QString &key, const QString &value)
             resetProducerProperty("set.force_full_luma");
         } else setProducerProperty("set.force_full_luma", value.toInt());
     }
-    else if (key == "proxy") {
-        // If value is "-", that means user manually disabled proxy on this clip
-        if (value.isEmpty() || value == "-") {
-            // reset proxy
-            emit abortProxy(m_id, oldProxy);
-        }
-        else {
-            emit createProxy(m_id);
-        }
-    }
 }
 
 QMap <QString, QString> DocClipBase::properties() const
index 2ff3cfdf79cf939ccd2b647c53556de889e0373b..9ae246b65759157181e79435e1e128ce5c760eaf 100644 (file)
@@ -2200,6 +2200,7 @@ void MainWindow::slotEditProjectSettings()
 {
     QPoint p = m_activeDocument->getTracksCount();
     ProjectSettings *w = new ProjectSettings(m_projectList, m_activeTimeline->projectView()->extractTransitionsLumas(), p.x(), p.y(), m_activeDocument->projectFolder().path(), true, !m_activeDocument->isModified(), this);
+    connect(w, SIGNAL(disableProxies()), this, SLOT(slotDisableProxies()));
 
     if (w->exec() == QDialog::Accepted) {
         QString profile = w->selectedProfile();
@@ -2248,6 +2249,13 @@ void MainWindow::slotEditProjectSettings()
     delete w;
 }
 
+void MainWindow::slotDisableProxies()
+{
+    m_activeDocument->setDocumentProperty("enableproxy", QString::number((int) false));
+    m_activeDocument->setModified();
+    slotUpdateProxySettings();
+}
+
 void MainWindow::slotUpdateProjectProfile(const QString &profile)
 {
     // Recreate the stopmotion widget if profile changes
index f948e4cc9c5f72ff2c186249a26a1bfdcc1a0f0c..a033e0e0302e185673ac221b99a6d4ff6c85a9d5 100644 (file)
@@ -545,6 +545,8 @@ private slots:
     void slotOpenBackupDialog(const KUrl url = KUrl());
     /** @brief Make sure to block clip monitor before deleting a clip's producer. */
     void slotBlockClipMonitor(const QString id);
+    /** @brief Disable proxies for this project. */
+    void slotDisableProxies();
 
 signals:
     Q_SCRIPTABLE void abortRenderJob(const QString &url);
index e723b9773c53910c672342088d19dad36885d26f..1c876f1492469ef6fedb808016df59afeb2d5fa8 100644 (file)
@@ -1093,7 +1093,8 @@ void ProjectList::slotGotProxy(ProjectItem *item)
     if (item == NULL) return;
     DocClipBase *clip = item->referencedClip();
     // Proxy clip successfully created
-    QDomElement e = clip->toXML().cloneNode().toElement();  
+    QDomElement e = clip->toXML().cloneNode().toElement();
+    kDebug()<<"// QUERYING CLIP, proxy: "<<e.attribute("proxy")<<", OUT: "<<e.attribute("proxy_out");
 
     // Make sure we get the correct producer length if it was adjusted in timeline
     CLIPTYPE t = item->clipType();
@@ -1686,9 +1687,9 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
                     proxyPath.addPath("proxy/");
                     proxyPath.addPath(clip->getClipHash() + "." + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension")));
                     QMap <QString, QString> newProps;
-                    newProps.insert("proxy", proxyPath.path());
                     // insert required duration for proxy
                     if (t != IMAGE) newProps.insert("proxy_out", clip->producerProperty("out"));
+                    newProps.insert("proxy", proxyPath.path());
                     QMap <QString, QString> oldProps = clip->properties();
                     oldProps.insert("proxy", QString());
                     EditClipCommand *command = new EditClipCommand(this, clipId, oldProps, newProps, true);
@@ -2459,9 +2460,9 @@ void ProjectList::slotProxyCurrentItem(bool doProxy)
                 if (doProxy) {
                     newProps.clear();
                     QString path = proxydir + item->referencedClip()->getClipHash() + "." + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension"));
-                    newProps.insert("proxy", path);
                     // insert required duration for proxy
                     newProps.insert("proxy_out", item->referencedClip()->producerProperty("out"));
+                    newProps.insert("proxy", path);
                     // We need to insert empty proxy so that undo will work
                     oldProps.insert("proxy", QString());
                 }
index 41deae0fc5c6976c2d68c703e42a3178a854d220..5f5e902a82fb4b223cc0d09bd54a0ca3e79b68d3 100644 (file)
@@ -187,8 +187,10 @@ void ProjectSettings::slotClearCache()
 
 void ProjectSettings::slotDeleteProxies()
 {
+    if (KMessageBox::warningContinueCancel(this, i18n("Deleting proxy clips will disable proxies for this project.")) != KMessageBox::Continue) return;
     buttonBox->setEnabled(false);
-    
+    enable_proxy->setChecked(false);
+    emit disableProxies();
     KIO::NetAccess::del(KUrl(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/"), this);
     KStandardDirs::makeDir(project_folder->url().path(KUrl::AddTrailingSlash) + "proxy/");
     buttonBox->setEnabled(true);
index 33cdfb55791d73ec13fba1fed0e2f1d13c241d97..5a0a93b16cf4516a1cbc057b81e746f0d32fbe41 100644 (file)
@@ -68,6 +68,10 @@ private:
     bool m_savedProject;
     ProjectList *m_projectList;
     QStringList m_lumas;
+
+signals:
+    /** @brief User deleted proxies, so disable them in project. */
+    void disableProxies();
 };