X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fclipmanager.cpp;h=13f2b1bd27d44ea7ce888b94b3d185749c44bfe5;hb=593c46dd843608c9b800b0ee9f2ad0dc0c69f5a7;hp=056bfce923bedeef0eb2fa0b50fb2c7689cfd2e2;hpb=e7cc204174b626f1970483faf36ec6d9033b1a7f;p=kdenlive diff --git a/src/clipmanager.cpp b/src/clipmanager.cpp index 056bfce9..13f2b1bd 100644 --- a/src/clipmanager.cpp +++ b/src/clipmanager.cpp @@ -44,6 +44,8 @@ ClipManager::ClipManager(KdenliveDoc *doc) : m_clipIdCounter = 1; m_folderIdCounter = 1; connect(&m_fileWatcher, SIGNAL(dirty(const QString &)), this, SLOT(slotClipModified(const QString &))); + connect(&m_fileWatcher, SIGNAL(deleted(const QString &)), this, SLOT(slotClipMissing(const QString &))); + connect(&m_fileWatcher, SIGNAL(created(const QString &)), this, SLOT(slotClipAvailable(const QString &))); } ClipManager::~ClipManager() @@ -140,8 +142,9 @@ QMap ClipManager::documentFolderList() const void ClipManager::addClip(DocClipBase *clip) { m_clipList.append(clip); - if (clip->clipType() == IMAGE || clip->clipType() == AUDIO || (clip->clipType() == TEXT && !clip->fileURL().isEmpty())) { + if (clip->clipType() != COLOR && clip->clipType() != SLIDESHOW && !clip->fileURL().isEmpty()) { // listen for file change + //kDebug() << "// LISTEN FOR: " << clip->fileURL().path(); m_fileWatcher.addFile(clip->fileURL().path()); } const QString id = clip->getId(); @@ -168,7 +171,8 @@ void ClipManager::deleteClip(const QString &clipId) { for (int i = 0; i < m_clipList.count(); i++) { if (m_clipList.at(i)->getId() == clipId) { - if (m_clipList.at(i)->clipType() == IMAGE || m_clipList.at(i)->clipType() == AUDIO || (m_clipList.at(i)->clipType() == TEXT && !m_clipList.at(i)->fileURL().isEmpty())) { + if (m_clipList.at(i)->clipType() != COLOR && m_clipList.at(i)->clipType() != SLIDESHOW && !m_clipList.at(i)->fileURL().isEmpty()) { + //if (m_clipList.at(i)->clipType() == IMAGE || m_clipList.at(i)->clipType() == AUDIO || (m_clipList.at(i)->clipType() == TEXT && !m_clipList.at(i)->fileURL().isEmpty())) { // listen for file change m_fileWatcher.removeFile(m_clipList.at(i)->fileURL().path()); } @@ -518,7 +522,7 @@ QDomElement ClipManager::groupsXml() const void ClipManager::slotClipModified(const QString &path) { - //kDebug()<<"// CLIP: "< list = getClipByResource(path); for (int i = 0; i < list.count(); i++) { DocClipBase *clip = list.at(i); @@ -526,6 +530,26 @@ void ClipManager::slotClipModified(const QString &path) } } +void ClipManager::slotClipMissing(const QString &path) +{ + // kDebug() << "// CLIP: " << path << " WAS MISSING"; + const QList list = getClipByResource(path); + for (int i = 0; i < list.count(); i++) { + DocClipBase *clip = list.at(i); + if (clip != NULL) emit missingClip(clip->getId()); + } +} + +void ClipManager::slotClipAvailable(const QString &path) +{ + // kDebug() << "// CLIP: " << path << " WAS ADDED"; + const QList list = getClipByResource(path); + for (int i = 0; i < list.count(); i++) { + DocClipBase *clip = list.at(i); + if (clip != NULL) emit availableClip(clip->getId()); + } +} + int ClipManager::clipsCount() const { return m_clipList.count();