From: Jean-Baptiste Mardelle Date: Mon, 27 Jun 2011 10:02:21 +0000 (+0000) Subject: Fix proxy clip having wrong duration and crash when deleting proxies from the project... X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=059d57d43c93efb5a862ae150425922678810ad7;p=kdenlive Fix proxy clip having wrong duration and crash when deleting proxies from the project settings dialog svn path=/trunk/kdenlive/; revision=5734 --- diff --git a/src/docclipbase.cpp b/src/docclipbase.cpp index cc719b0f..964c8186 100644 --- a/src/docclipbase.cpp +++ b/src/docclipbase.cpp @@ -839,11 +839,23 @@ void DocClipBase::setProperties(QMap 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 DocClipBase::properties() const diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2ff3cfdf..9ae246b6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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 diff --git a/src/mainwindow.h b/src/mainwindow.h index f948e4cc..a033e0e0 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -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); diff --git a/src/projectlist.cpp b/src/projectlist.cpp index e723b977..1c876f14 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -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: "<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 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 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()); } diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp index 41deae0f..5f5e902a 100644 --- a/src/projectsettings.cpp +++ b/src/projectsettings.cpp @@ -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); diff --git a/src/projectsettings.h b/src/projectsettings.h index 33cdfb55..5a0a93b1 100644 --- a/src/projectsettings.h +++ b/src/projectsettings.h @@ -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(); };