X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fprojectlist.cpp;h=7226b22e7083d1d4335a9c5c07cc439d7bfe6441;hb=848304cd283eb5a6c13cecc57b696e91bb92f729;hp=76730ffcafcc388a5a840695f57719827dfa2386;hpb=d6a6bab50aa14e5049174a8febb0fcfd539139b8;p=kdenlive diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 76730ffc..7226b22e 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -19,7 +19,7 @@ #include "projectlist.h" #include "projectitem.h" -#include "addfoldercommand.h" +#include "commands/addfoldercommand.h" #include "kdenlivesettings.h" #include "slideshowclip.h" #include "ui_colorclip_ui.h" @@ -33,10 +33,10 @@ #include "projectlistview.h" #include "timecodedisplay.h" #include "profilesdialog.h" -#include "editclipcommand.h" -#include "editclipcutcommand.h" -#include "editfoldercommand.h" -#include "addclipcutcommand.h" +#include "commands/editclipcommand.h" +#include "commands/editclipcutcommand.h" +#include "commands/editfoldercommand.h" +#include "commands/addclipcutcommand.h" #include "ui_templateclip_ui.h" @@ -1227,7 +1227,7 @@ void ProjectList::getCachedThumbnail(SubProjectItem *item) else requestClipThumbnail(parentItem->clipId() + '#' + QString::number(pos)); } -void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged) +void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged, QStringList brokenClips) { if (!m_allClipsProcessed) m_listView->setEnabled(false); m_listView->setSortingEnabled(false); @@ -1270,6 +1270,13 @@ void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged) item = static_cast (*it); clip = item->referencedClip(); if (item->referencedClip()->getProducer() == NULL) { + bool replace = false; + if (brokenClips.contains(item->clipId())) { + // if this is a proxy clip, disable proxy + item->setProxyStatus(NOPROXY); + clip->setProperty("proxy", "-"); + replace = true; + } if (clip->isPlaceHolder() == false && !item->isProxyRunning()) { QDomElement xml = clip->toXML(); if (fpsChanged) { @@ -1277,7 +1284,7 @@ void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged) xml.removeAttribute("file_hash"); xml.removeAttribute("proxy_out"); } - bool replace = xml.attribute("replace") == "1"; + if (!replace) replace = xml.attribute("replace") == "1"; if (replace) resetThumbsProducer(clip); m_render->getFileProperties(xml, clip->getId(), m_listView->iconSize().height(), replace); } @@ -1469,6 +1476,7 @@ void ProjectList::slotRemoveInvalidProxy(const QString &id, bool durationError) { ProjectItem *item = getItemById(id); if (item) { + kDebug()<<"// Proxy for clip "<setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled); if (durationError) { kDebug() << "Proxy duration is wrong, try changing transcoding parameters."; @@ -1482,6 +1490,14 @@ void ProjectList::slotRemoveInvalidProxy(const QString &id, bool durationError) if (proxyFolder.isParentOf(KUrl(path))) { QFile::remove(path); } + if (item->referencedClip()->getProducer() == NULL) { + // Clip has no valid producer, request it + slotProxyCurrentItem(false, item); + } + else { + // refresh thumbs producer + item->referencedClip()->reloadThumbProducer(); + } } m_processingClips.removeAll(id); m_thumbnailQueue.removeAll(id); @@ -1633,7 +1649,7 @@ void ProjectList::setDocument(KdenliveDoc *doc) connect(m_doc->clipManager(), SIGNAL(modifiedClip(const QString &)), this, SLOT(slotModifiedClip(const QString &))); connect(m_doc->clipManager(), SIGNAL(missingClip(const QString &)), this, SLOT(slotMissingClip(const QString &))); connect(m_doc->clipManager(), SIGNAL(availableClip(const QString &)), this, SLOT(slotAvailableClip(const QString &))); - connect(m_doc->clipManager(), SIGNAL(checkAllClips(bool, bool)), this, SLOT(updateAllClips(bool, bool))); + connect(m_doc->clipManager(), SIGNAL(checkAllClips(bool, bool, QStringList)), this, SLOT(updateAllClips(bool, bool, QStringList))); } QList ProjectList::documentClipList() const @@ -2618,9 +2634,11 @@ void ProjectList::updateProxyConfig() else delete command; } -void ProjectList::slotProxyCurrentItem(bool doProxy) +void ProjectList::slotProxyCurrentItem(bool doProxy, ProjectItem *itemToProxy) { - QList list = m_listView->selectedItems(); + QList list; + if (itemToProxy == NULL) list = m_listView->selectedItems(); + else list << itemToProxy; QTreeWidgetItem *listItem; QUndoCommand *command = new QUndoCommand(); if (doProxy) command->setText(i18np("Add proxy clip", "Add proxy clips", list.count())); @@ -2649,7 +2667,7 @@ void ProjectList::slotProxyCurrentItem(bool doProxy) ProjectItem *item = static_cast (listItem); CLIPTYPE t = item->clipType(); if ((t == VIDEO || t == AV || t == UNKNOWN || t == IMAGE || t == PLAYLIST) && item->referencedClip()) { - if ((doProxy && item->hasProxy()) || (!doProxy && !item->hasProxy())) continue; + if ((doProxy && item->hasProxy()) || (!doProxy && !item->hasProxy() && item->referencedClip()->getProducer() != NULL)) continue; DocClipBase *clip = item->referencedClip(); if (!clip || !clip->isClean() || m_render->isProcessing(item->clipId())) { kDebug()<<"//// TRYING TO PROXY: "<clipId()<<", but it is busy"; @@ -2667,6 +2685,10 @@ void ProjectList::slotProxyCurrentItem(bool doProxy) // We need to insert empty proxy so that undo will work oldProps.insert("proxy", QString()); } + else if (item->referencedClip()->getProducer() == NULL) { + // Force clip reload + newProps.insert("resource", item->referencedClip()->getProperty("resource")); + } new EditClipCommand(this, item->clipId(), oldProps, newProps, true, command); } }