From: Jean-Baptiste M. <jb...@kd...> - 2011-12-02 13:59:31
|
Git commit 155005a3d487d127a5ee9985f43fba634feac1b4 by Jean-Baptiste Mardelle. Committed on 02/12/2011 at 14:57. Pushed by mardelle into branch 'v0.8.2'. Fix small bug in audio thumbs creation M +5 -3 src/clipmanager.cpp M +7 -1 src/docclipbase.cpp M +1 -0 src/docclipbase.h M +0 -1 src/projectlist.cpp http://commits.kde.org/kdenlive/155005a3d487d127a5ee9985f43fba634feac1b4 diff --git a/src/clipmanager.cpp b/src/clipmanager.cpp index e63a0de..9fd9aef 100644 --- a/src/clipmanager.cpp +++ b/src/clipmanager.cpp @@ -181,17 +181,19 @@ void ClipManager::checkAudioThumbs() m_thumbsMutex.lock(); for (int i = 0; i < m_clipList.count(); i++) { DocClipBase *clip = m_clipList.at(i); - if (clip->clipType() & (AUDIO | AV | PLAYLIST) && !clip->audioThumbCreated()) + if (clip->hasAudioThumb() && !clip->audioThumbCreated()) m_audioThumbsQueue.append(m_clipList.at(i)->getId()); } m_thumbsMutex.unlock(); - if (!m_audioThumbsThread.isRunning()) m_audioThumbsThread = QtConcurrent::run(this, &ClipManager::slotGetAudioThumbs); + if (!m_audioThumbsThread.isRunning() && !m_audioThumbsQueue.isEmpty()) { + m_audioThumbsThread = QtConcurrent::run(this, &ClipManager::slotGetAudioThumbs); + } } void ClipManager::askForAudioThumb(const QString &id) { DocClipBase *clip = getClipById(id); - if (clip && KdenliveSettings::audiothumbnails() && (clip->clipType() & (AUDIO | AV | PLAYLIST))) { + if (clip && KdenliveSettings::audiothumbnails() && (clip->hasAudioThumb())) { m_thumbsMutex.lock(); if (!m_audioThumbsQueue.contains(id)) m_audioThumbsQueue.append(id); m_thumbsMutex.unlock(); diff --git a/src/docclipbase.cpp b/src/docclipbase.cpp index 5d43417..2876109 100644 --- a/src/docclipbase.cpp +++ b/src/docclipbase.cpp @@ -87,7 +87,6 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin if (!m_properties.contains("name")) m_properties.insert("name", url.fileName()); m_thumbProd = new KThumb(clipManager, url, m_id, m_properties.value("file_hash")); - if (m_clipType & (AV | AUDIO | PLAYLIST)) getAudioThumbs(); } DocClipBase::~DocClipBase() @@ -116,6 +115,12 @@ QPoint DocClipBase::zone() const } +bool DocClipBase::hasAudioThumb() const +{ + if (m_clipType == AUDIO || m_clipType == AV || m_clipType == PLAYLIST) return true; + return false; +} + void DocClipBase::slotClearAudioCache() { m_audioFrameCache.clear(); @@ -465,6 +470,7 @@ void DocClipBase::setProducer(Mlt::Producer *producer, bool reset, bool readProp m_thumbProd->setProducer(producer); } else m_thumbProd->setProducer(producer); + getAudioThumbs(); } bool updated = false; if (id.contains('_')) { diff --git a/src/docclipbase.h b/src/docclipbase.h index 64b78c1..c2a8bd4 100644 --- a/src/docclipbase.h +++ b/src/docclipbase.h @@ -83,6 +83,7 @@ Q_OBJECT public: /** Returns the internal unique id of the clip. */ const QString &getId() const; + bool hasAudioThumb() const; //KThumb *thumbCreator; bool audioThumbCreated() const; /*void getClipMainThumb();*/ diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 3a77ad8..e701e03 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -1806,7 +1806,6 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce } item->setProperties(properties, metadata); clip->setProducer(producer, replace); - clip->getAudioThumbs(); // Proxy stuff QString size = properties.value("frame_size"); |