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()
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();
{
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());
}
void ClipManager::slotClipModified(const QString &path)
{
- //kDebug()<<"// CLIP: "<<path<<" WAS MODIFIED";
+ // kDebug() << "// CLIP: " << path << " WAS MODIFIED";
const QList <DocClipBase *> list = getClipByResource(path);
for (int i = 0; i < list.count(); i++) {
DocClipBase *clip = list.at(i);
}
}
+void ClipManager::slotClipMissing(const QString &path)
+{
+ // kDebug() << "// CLIP: " << path << " WAS MISSING";
+ const QList <DocClipBase *> 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 <DocClipBase *> 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();