From: Jean-Baptiste Mardelle Date: Tue, 8 Nov 2011 11:04:17 +0000 (+0100) Subject: * Make sure project tree is enabled when creating new project X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=68f7b8f12675a71d12d63a3807ea6503332c0335;p=kdenlive * Make sure project tree is enabled when creating new project * Don't parse project tree like hell when creating proxy clips --- diff --git a/src/projectlist.cpp b/src/projectlist.cpp index ce63215e..6923f389 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -1172,6 +1172,7 @@ void ProjectList::slotResetProjectList() m_proxyThreads.clearFutures(); m_thumbnailQueue.clear(); m_listView->clear(); + m_listView->setEnabled(true); emit clipSelected(NULL); m_refreshed = false; m_allClipsProcessed = false; @@ -1665,11 +1666,11 @@ void ProjectList::slotCheckForEmptyQueue() { if (m_render->processingItems() == 0 && m_thumbnailQueue.isEmpty()) { if (!m_refreshed && m_allClipsProcessed) { + m_refreshed = true; m_listView->setEnabled(true); slotClipSelected(); QTimer::singleShot(500, this, SIGNAL(loadingIsOver())); emit displayMessage(QString(), -1); - m_refreshed = true; } updateButtons(); } else if (!m_refreshed) { @@ -1837,17 +1838,16 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce } } 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) emit processNextThumbnail(); } - if (replace && item) { - toReload = clipId; - } if (!item) { // no item for producer, delete it delete producer; + return; } + if (replace) toReload = clipId; if (!toReload.isEmpty()) emit clipNeedsReload(toReload); } @@ -2338,6 +2338,19 @@ void ProjectList::slotGenerateProxy() 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 processingItems; + while (*it && !m_abortAllProxies) { + if ((*it)->type() == PROJECTCLIPTYPE) { + ProjectItem *item = static_cast (*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) { @@ -2382,7 +2395,7 @@ void ProjectList::slotGenerateProxy() } else { QString log = QString(myProcess.readAll()); - processLogInfo(info.dest, &duration, log); + processLogInfo(processingItems, &duration, log); } myProcess.waitForFinished(500); } @@ -2465,13 +2478,13 @@ void ProjectList::slotGenerateProxy() // Make sure we don't block when proxy file already exists parameters << "-y"; parameters << info.dest; - kDebug()<<"// STARTING PROXY GEN: "<items, int *duration, const QString &log) { int progress; if (*duration == 0) { @@ -2524,7 +2537,8 @@ void ProjectList::processLogInfo(const QString &path, int *duration, const QStri 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))); } } diff --git a/src/projectlist.h b/src/projectlist.h index 2bc2f950..6f1815e4 100644 --- a/src/projectlist.h +++ b/src/projectlist.h @@ -338,7 +338,7 @@ private: void setProxyStatus(const QString proxyPath, PROXYSTATUS status, int progress = 0); void setProxyStatus(ProjectItem *item, PROXYSTATUS status, int progress = 0); /** @brief Process ffmpeg output to find out process progress. */ - void processLogInfo(const QString &path, int *duration, const QString &log); + void processLogInfo(QList items, int *duration, const QString &log); void monitorItemEditing(bool enable); /** @brief Set thumbnail for a project's clip. */ void setThumbnail(const QString &clipId, const QPixmap &pix);