summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-09-02 17:19:29 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-09-02 17:19:29 (GMT)
commit166a9dbdd309b93e333d1b2ae4a2908760295eda (patch)
tree076f2f117c5ba3161e88ff1b9d765553ddf255a4
parentc3f0470c4560a283d6f450f51a8cdf9bd6f91565 (diff)
Add action to remove all preview zones
-rw-r--r--src/kdenliveui.rc3
-rw-r--r--src/mainwindow.cpp10
-rw-r--r--src/mainwindow.h1
-rw-r--r--src/project/projectmanager.cpp1
-rw-r--r--src/timeline/customruler.cpp12
-rw-r--r--src/timeline/customruler.h3
-rw-r--r--src/timeline/managers/previewmanager.cpp23
-rw-r--r--src/timeline/managers/previewmanager.h2
-rw-r--r--src/timeline/timeline.cpp6
-rw-r--r--src/timeline/timeline.h2
10 files changed, 61 insertions, 2 deletions
diff --git a/src/kdenliveui.rc b/src/kdenliveui.rc
index 360803b..7543d5d 100644
--- a/src/kdenliveui.rc
+++ b/src/kdenliveui.rc
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="kdenlive" version="145" translationDomain="kdenlive">
+<kpartgui name="kdenlive" version="146" translationDomain="kdenlive">
<MenuBar>
<Menu name="file" >
<Action name="dvd_wizard" />
@@ -108,6 +108,7 @@
<Action name="stop_prerender_timeline" />
<Action name="set_render_timeline_zone" />
<Action name="unset_render_timeline_zone" />
+ <Action name="clear_render_timeline_zone"/>
</Menu>
<Action name="resize_timeline_clip_start" />
<Action name="resize_timeline_clip_end" />
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index afa6fbf..97888dc 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -567,7 +567,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
tlMenu->addAction(stopPrevRender);
tlMenu->addAction(actionCollection()->action(QStringLiteral("set_render_timeline_zone")));
tlMenu->addAction(actionCollection()->action(QStringLiteral("unset_render_timeline_zone")));
- tlMenu->addAction(actionCollection()->action(QStringLiteral("unset_render_timeline_zone")));
+ tlMenu->addAction(actionCollection()->action(QStringLiteral("clear_render_timeline_zone")));
// Automatic timeline preview action
QAction *autoRender = new QAction(KoIconUtils::themedIcon(QStringLiteral("view-refresh")), i18n("Automatic Preview"), this);
@@ -1308,6 +1308,7 @@ void MainWindow::setupActions()
addAction(QStringLiteral("remove_lift"), i18n("Lift Timeline Zone"), this, SLOT(slotLiftZone()), KoIconUtils::themedIcon(QStringLiteral("timeline-lift")), Qt::Key_Z);
addAction(QStringLiteral("set_render_timeline_zone"), i18n("Add Preview Zone"), this, SLOT(slotDefinePreviewRender()), KoIconUtils::themedIcon(QStringLiteral("preview-add-zone")));
addAction(QStringLiteral("unset_render_timeline_zone"), i18n("Unset Preview Zone"), this, SLOT(slotRemovePreviewRender()), KoIconUtils::themedIcon(QStringLiteral("preview-remove-zone")));
+ addAction(QStringLiteral("clear_render_timeline_zone"), i18n("Clear Preview Zones"), this, SLOT(slotClearPreviewRender()), KoIconUtils::themedIcon(QStringLiteral("preview-remove-zone")));
addAction(QStringLiteral("prerender_timeline_zone"), i18n("Start Preview Render"), this, SLOT(slotPreviewRender()), KoIconUtils::themedIcon(QStringLiteral("preview-render-on")), QKeySequence(Qt::SHIFT + Qt::Key_Return));
addAction(QStringLiteral("stop_prerender_timeline"), i18n("Stop Preview Render"), this, SLOT(slotStopPreviewRender()), KoIconUtils::themedIcon(QStringLiteral("preview-render-off")));
@@ -2426,6 +2427,13 @@ void MainWindow::slotRemovePreviewRender()
}
}
+void MainWindow::slotClearPreviewRender()
+{
+ if (pCore->projectManager()->current()) {
+ pCore->projectManager()->currentTimeline()->clearPreviewRange();
+ }
+}
+
void MainWindow::slotSelectTimelineClip()
{
if (pCore->projectManager()->currentTimeline())
diff --git a/src/mainwindow.h b/src/mainwindow.h
index cf06fdb..2597185 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -332,6 +332,7 @@ private slots:
void slotStopPreviewRender();
void slotDefinePreviewRender();
void slotRemovePreviewRender();
+ void slotClearPreviewRender();
void slotSelectTimelineClip();
void slotSelectTimelineTransition();
void slotDeselectTimelineClip();
diff --git a/src/project/projectmanager.cpp b/src/project/projectmanager.cpp
index a2488f0..f1b9eb1 100644
--- a/src/project/projectmanager.cpp
+++ b/src/project/projectmanager.cpp
@@ -533,6 +533,7 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
QList <QAction*> rulerActions;
rulerActions << pCore->window()->actionCollection()->action(QStringLiteral("set_render_timeline_zone"));
rulerActions << pCore->window()->actionCollection()->action(QStringLiteral("unset_render_timeline_zone"));
+ rulerActions << pCore->window()->actionCollection()->action(QStringLiteral("clear_render_timeline_zone"));
bool ok;
m_trackView = new Timeline(doc, pCore->window()->kdenliveCategoryMap.value(QStringLiteral("timeline"))->actions(), rulerActions, &ok, pCore->window());
connect(m_trackView, &Timeline::startLoadingBin, m_progressDialog, &QProgressDialog::setMaximum, Qt::DirectConnection);
diff --git a/src/timeline/customruler.cpp b/src/timeline/customruler.cpp
index 62bb71c..6c0bf5c 100644
--- a/src/timeline/customruler.cpp
+++ b/src/timeline/customruler.cpp
@@ -604,6 +604,11 @@ const QPair <QStringList, QStringList> CustomRuler::previewChunks() const
return resultChunks;
}
+const QList <int> CustomRuler::getProcessedChunks() const
+{
+ return m_renderingPreviews;
+}
+
const QList <int> CustomRuler::getDirtyChunks() const
{
return m_dirtyRenderingPreviews;
@@ -614,6 +619,13 @@ bool CustomRuler::hasPreviewRange() const
return (!m_dirtyRenderingPreviews.isEmpty() || !m_renderingPreviews.isEmpty());
}
+void CustomRuler::clearChunks()
+{
+ m_renderingPreviews.clear();
+ m_dirtyRenderingPreviews.clear();
+ update();
+}
+
QList <int> CustomRuler::addChunks(QList <int> chunks, bool add)
{
qSort(chunks);
diff --git a/src/timeline/customruler.h b/src/timeline/customruler.h
index 5c1acef..d15ffa2 100644
--- a/src/timeline/customruler.h
+++ b/src/timeline/customruler.h
@@ -54,8 +54,11 @@ public:
bool updatePreview(int frame, bool rendered = true, bool refresh = false);
/** @brief Returns a list of rendered timeline preview chunks */
const QPair <QStringList, QStringList> previewChunks() const;
+ /** @brief Returns a list of clean timeline preview chunks (that have been created) */
+ const QList <int> getProcessedChunks() const;
/** @brief Returns a list of dirty timeline preview chunks (that need to be generated) */
const QList <int> getDirtyChunks() const;
+ void clearChunks();
QList <int> addChunks(QList <int> chunks, bool add);
/** @brief Returns true if a timeline preview zone has already be defined */
bool hasPreviewRange() const;
diff --git a/src/timeline/managers/previewmanager.cpp b/src/timeline/managers/previewmanager.cpp
index f956675..6b20cb8 100644
--- a/src/timeline/managers/previewmanager.cpp
+++ b/src/timeline/managers/previewmanager.cpp
@@ -306,6 +306,29 @@ void PreviewManager::doCleanupOldPreviews()
}
}
+void PreviewManager::clearPreviewRange()
+{
+ m_previewGatherTimer.stop();
+ abortPreview();
+ QList <int> toProcess = m_ruler->getProcessedChunks();
+ m_tractor->lock();
+ bool hasPreview = m_previewTrack != NULL;
+ foreach(int ix, toProcess) {
+ m_cacheDir.remove(QString("%1.%2").arg(ix).arg(m_extension));
+ if (!hasPreview)
+ continue;
+ int trackIx = m_previewTrack->get_clip_index_at(ix);
+ if (!m_previewTrack->is_blank(trackIx)) {
+ Mlt::Producer *prod = m_previewTrack->replace_with_blank(trackIx);
+ delete prod;
+ }
+ }
+ if (hasPreview)
+ m_previewTrack->consolidate_blanks();
+ m_tractor->unlock();
+ m_ruler->clearChunks();
+}
+
void PreviewManager::addPreviewRange(bool add)
{
QPoint p = m_doc->zone();
diff --git a/src/timeline/managers/previewmanager.h b/src/timeline/managers/previewmanager.h
index ef4b0e3..c318e92 100644
--- a/src/timeline/managers/previewmanager.h
+++ b/src/timeline/managers/previewmanager.h
@@ -60,6 +60,8 @@ public:
void invalidatePreviews(QList <int> chunks);
/** @brief: user adds current timeline zone to the preview zone. */
void addPreviewRange(bool add);
+ /** @brief: Remove all existing previews. */
+ void clearPreviewRange();
/** @brief: stops current rendering process. */
void abortRendering();
/** @brief: rendering parameters have changed, reload them. */
diff --git a/src/timeline/timeline.cpp b/src/timeline/timeline.cpp
index 225c436..441470d 100644
--- a/src/timeline/timeline.cpp
+++ b/src/timeline/timeline.cpp
@@ -1974,6 +1974,12 @@ void Timeline::addPreviewRange(bool add)
m_timelinePreview->addPreviewRange(add);
}
+void Timeline::clearPreviewRange()
+{
+ if (m_timelinePreview)
+ m_timelinePreview->clearPreviewRange();
+}
+
void Timeline::storeHeaderSize(int , int )
{
KdenliveSettings::setTimelineheaderwidth(splitter->saveState().toBase64());
diff --git a/src/timeline/timeline.h b/src/timeline/timeline.h
index 641c84d..0269a23 100644
--- a/src/timeline/timeline.h
+++ b/src/timeline/timeline.h
@@ -178,6 +178,8 @@ public:
void reloadTrack(ItemInfo info, bool includeLastFrame);
/** @brief Add or remove current timeline zone to preview render zone. */
void addPreviewRange(bool add);
+ /** @brief Resets all preview render zones. */
+ void clearPreviewRange();
/** @brief Check if timeline preview profile changed and remove preview files if necessary. */
void updatePreviewSettings(const QString &profile);
/** @brief invalidate timeline preview for visible clips in a track */