void ProjectList::slotGotProxy(const QString &proxyPath)
{
- if (proxyPath.isEmpty() || !m_refreshed || m_abortAllProxies) return;
+ if (proxyPath.isEmpty() || m_abortAllProxies) return;
QTreeWidgetItemIterator it(m_listView);
ProjectItem *item;
- while (*it) {
+ while (*it && !m_abortAllProxies) {
if ((*it)->type() == PROJECTCLIPTYPE) {
item = static_cast <ProjectItem *>(*it);
if (item->referencedClip()->getProperty("proxy") == proxyPath)
void ProjectList::slotResetProjectList()
{
+ m_listView->blockSignals(true);
m_abortAllProxies = true;
m_proxyThreads.waitForFinished();
m_proxyThreads.clearFutures();
m_thumbnailQueue.clear();
m_listView->clear();
+ m_listView->setEnabled(true);
emit clipSelected(NULL);
m_refreshed = false;
m_allClipsProcessed = false;
m_abortAllProxies = false;
+ m_listView->blockSignals(false);
}
void ProjectList::slotUpdateClip(const QString &id)
item = static_cast <ProjectItem *>(*it);
clip = item->referencedClip();
if (item->referencedClip()->getProducer() == NULL) {
- if (clip->isPlaceHolder() == false) {
+ if (clip->isPlaceHolder() == false && !item->isProxyRunning()) {
QDomElement xml = clip->toXML();
if (fpsChanged) {
xml.removeAttribute("out");
if (replace) resetThumbsProducer(clip);
m_render->getFileProperties(xml, clip->getId(), m_listView->iconSize().height(), replace);
}
- else {
+ else if (clip->isPlaceHolder()) {
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
if (item->data(0, Qt::DecorationRole).isNull()) {
item->setData(0, Qt::DecorationRole, missingPixmap);
QDomDocument doc;
QDomElement prods = doc.createElement("producerlist");
doc.appendChild(prods);
- kDebug() << "//////////// PRO LIST BUILD PRDSLIST ";
QTreeWidgetItemIterator it(m_listView);
while (*it) {
if ((*it)->type() != PROJECTCLIPTYPE) {
{
if (m_render->processingItems() == 0 && m_thumbnailQueue.isEmpty()) {
if (!m_refreshed && m_allClipsProcessed) {
- kDebug()<<"// LOADING IS OVER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
+ m_refreshed = true;
m_listView->setEnabled(true);
slotClipSelected();
- emit loadingIsOver();
+ QTimer::singleShot(500, this, SIGNAL(loadingIsOver()));
emit displayMessage(QString(), -1);
- m_refreshed = true;
}
updateButtons();
} else if (!m_refreshed) {
if (item->parent()) {
if (item->parent()->type() == PROJECTFOLDERTYPE)
static_cast <FolderProjectItem *>(item->parent())->switchIcon();
- } else if (KdenliveSettings::checkfirstprojectclip() && m_listView->topLevelItemCount() == 1) {
+ } else if (KdenliveSettings::checkfirstprojectclip() && m_listView->topLevelItemCount() == 1 && m_refreshed && m_allClipsProcessed) {
// this is the first clip loaded in project, check if we want to adjust project settings to the clip
updatedProfile = adjustProjectProfileToItem(item);
}
}
} else {
int max = m_doc->clipManager()->clipsCount();
- emit displayMessage(i18n("Loading clips"), (int)(100 *(max - queue) / max));
+ if (max > 0) emit displayMessage(i18n("Loading clips"), (int)(100 *(max - queue) / max));
}
- if (m_allClipsProcessed) processNextThumbnail();
- }
- if (replace && item) {
- toReload = clipId;
+ if (m_allClipsProcessed) emit processNextThumbnail();
}
if (!item) {
// no item for producer, delete it
delete producer;
+ return;
}
+ if (replace) toReload = clipId;
if (!toReload.isEmpty())
emit clipNeedsReload(toReload);
}
QFile::remove(info.dest);
setProxyStatus(info.dest, CREATINGPROXY);
+
+ // Get the list of clips that will need to get progress info
+ QTreeWidgetItemIterator it(m_listView);
+ QList <ProjectItem *> processingItems;
+ while (*it && !m_abortAllProxies) {
+ if ((*it)->type() == PROJECTCLIPTYPE) {
+ ProjectItem *item = static_cast <ProjectItem *>(*it);
+ if (item->referencedClip()->getProperty("proxy") == info.dest) {
+ processingItems.append(item);
+ }
+ }
+ ++it;
+ }
// Special case: playlist clips (.mlt or .kdenlive project files)
if (info.type == PLAYLIST) {
}
else {
QString log = QString(myProcess.readAll());
- processLogInfo(info.dest, &duration, log);
+ processLogInfo(processingItems, &duration, log);
}
myProcess.waitForFinished(500);
}
// Proxy process crashed
QFile::remove(info.dest);
setProxyStatus(info.dest, PROXYCRASHED);
- }
-
+ }
+ return;
}
if (info.type == IMAGE) {
// Make sure we don't block when proxy file already exists
parameters << "-y";
parameters << info.dest;
- kDebug()<<"// STARTING PROXY GEN: "<<parameters;
QProcess myProcess;
myProcess.setProcessChannelMode(QProcess::MergedChannels);
myProcess.start("ffmpeg", parameters);
myProcess.waitForStarted();
int result = -1;
int duration = 0;
+
while (myProcess.state() != QProcess::NotRunning) {
// building proxy file
if (m_abortProxy.contains(info.dest) || m_abortAllProxies) {
m_abortProxy.removeAll(info.dest);
m_processingProxy.removeAll(info.dest);
QFile::remove(info.dest);
- setProxyStatus(info.dest, NOPROXY);
+ if (!m_abortAllProxies) setProxyStatus(info.dest, NOPROXY);
result = -2;
}
else {
QString log = QString(myProcess.readAll());
- processLogInfo(info.dest, &duration, log);
+ processLogInfo(processingItems, &duration, log);
}
myProcess.waitForFinished(500);
}
myProcess.waitForFinished();
+ m_abortProxy.removeAll(info.dest);
+ m_processingProxy.removeAll(info.dest);
if (result == -1) result = myProcess.exitStatus();
if (result == 0) {
// proxy successfully created
QFile::remove(info.dest);
setProxyStatus(info.dest, PROXYCRASHED);
}
- m_abortProxy.removeAll(info.dest);
- m_processingProxy.removeAll(info.dest);
}
-void ProjectList::processLogInfo(const QString &path, int *duration, const QString &log)
+void ProjectList::processLogInfo(QList <ProjectItem *>items, int *duration, const QString &log)
{
int progress;
if (*duration == 0) {
progress = numbers.at(0).toInt() * 3600 + numbers.at(1).toInt() * 60 + numbers.at(2).toDouble();
}
else progress = (int) time.toDouble();
- setProxyStatus(path, CREATINGPROXY, (int) (100.0 * progress / (*duration)));
+ for (int i = 0; i < items.count(); i++)
+ setProxyStatus(items.at(i), CREATINGPROXY, (int) (100.0 * progress / (*duration)));
}
}
if (proxyPath.isEmpty() || m_abortAllProxies) return;
QTreeWidgetItemIterator it(m_listView);
ProjectItem *item;
- while (*it) {
+ while (*it && !m_abortAllProxies) {
if ((*it)->type() == PROJECTCLIPTYPE) {
item = static_cast <ProjectItem *>(*it);
if (item->referencedClip()->getProperty("proxy") == proxyPath) {