Only create audio thumbs when they are enabled, clear cache when disabled

svn path=/branches/KDE4/; revision=1996
parent 3451ee36
......@@ -26,11 +26,21 @@
ClipManager::ClipManager(KdenliveDoc *doc): m_doc(doc) {
m_clipIdCounter = 1;
m_audioThumbsEnabled = KdenliveSettings::audiothumbnails();
}
ClipManager::~ClipManager() {
}
void ClipManager::checkAudioThumbs() {
if (m_audioThumbsEnabled == KdenliveSettings::audiothumbnails()) return;
m_audioThumbsEnabled = KdenliveSettings::audiothumbnails();
for (int i = 0; i < m_clipList.count(); i++) {
if (m_audioThumbsEnabled) m_clipList.at(i)->slotRequestAudioThumbs();
else m_clipList.at(i)->slotClearAudioCache();
}
}
void ClipManager::setThumbsProgress(KUrl url, int progress) {
m_doc->setThumbsProgress(url, progress);
}
......
......@@ -53,6 +53,7 @@ Q_OBJECT public:
DocClipBase *getClipById(int clipId);
void slotDeleteClip(uint clipId);
void setThumbsProgress(KUrl url, int progress);
void checkAudioThumbs();
private: // Private attributes
/** the list of clips in the document */
......@@ -60,6 +61,7 @@ private: // Private attributes
/** the document undo stack*/
KdenliveDoc *m_doc;
int m_clipIdCounter;
bool m_audioThumbsEnabled;
};
......
......@@ -74,6 +74,11 @@ void DocClipBase::slotRequestAudioThumbs() {
emit getAudioThumbs();
}
void DocClipBase::slotClearAudioCache() {
audioFrameChache.clear();
m_audioThumbCreated = false;
}
KThumb *DocClipBase::thumbProducer() {
return m_thumbProd;
}
......
......@@ -200,6 +200,8 @@ Q_OBJECT public:
/** Clip is ready to get thumbs */
void slotRequestAudioThumbs();
/** Free cache data */
void slotClearAudioCache();
private: // Private attributes
......
......@@ -493,10 +493,12 @@ void MainWindow::slotPreferences() {
}
void MainWindow::updateConfiguration() {
//TODO: we should apply settings to all projects, not only the current one
TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
if (currentTab) {
currentTab->refresh();
currentTab->projectView()->checkAutoScroll();
if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
}
}
......
......@@ -30,7 +30,7 @@
#include "projectitem.h"
#include "timecode.h"
#include "kdenlivesettings.h"
const int NameRole = Qt::UserRole;
const int DurationRole = NameRole + 1;
......@@ -222,7 +222,7 @@ void ProjectItem::setProperties(const QMap < QString, QString > &attributes, con
m_element.setAttribute("resource", attributes["filename"]);
m_element.setAttribute("type", (int) m_clipType);
m_clip->slotRequestAudioThumbs();
if (KdenliveSettings::audiothumbnails()) m_clip->slotRequestAudioThumbs();
/*
if (attributes.contains("height")) {
m_height = attributes["height"].toInt();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment