Start reimplementing clip missing in project

parent c5ebe183
......@@ -81,12 +81,10 @@ void FileWatcher::slotUrlModified(const QString &path)
void FileWatcher::slotUrlMissing(const QString &path)
{
Q_UNUSED(path)
// TODO handle missing clips by replacing producer with an invalid producer
// const QStringList ids = m_occurences.value(path);
/*for (const QString &id : ids) {
emit missingClip(id);
}*/
for (const QString &id : m_occurences[path]) {
emit binClipMissing(id);
}
}
void FileWatcher::slotProcessModifiedUrls()
......
......@@ -52,6 +52,7 @@ signals:
void binClipModified(const QString &binId);
/** @brief Same signal than binClipModified, but triggers immediately. Can be useful to refresh UI without actually reloading the file (yet)*/
void binClipWaiting(const QString &binId);
void binClipMissing(const QString &binId);
private slots:
void slotUrlModified(const QString &path);
......
......@@ -61,6 +61,7 @@ ProjectItemModel::ProjectItemModel(QObject *parent)
m_blankThumb.addPixmap(pix);
connect(m_fileWatcher.get(), &FileWatcher::binClipModified, this, &ProjectItemModel::reloadClip);
connect(m_fileWatcher.get(), &FileWatcher::binClipWaiting, this, &ProjectItemModel::setClipWaiting);
connect(m_fileWatcher.get(), &FileWatcher::binClipMissing, this, &ProjectItemModel::setClipInvalid);
}
std::shared_ptr<ProjectItemModel> ProjectItemModel::construct(QObject *parent)
......@@ -486,7 +487,7 @@ void ProjectItemModel::deregisterItem(int id, TreeItem *item)
AbstractTreeModel::deregisterItem(id, item);
if (clip->itemType() == AbstractProjectItem::ClipItem) {
auto clipItem = static_cast<ProjectClip *>(clip);
m_fileWatcher->addFile(clipItem->clipId(), clipItem->clipUrl());
m_fileWatcher->removeFile(clipItem->clipId());
}
}
......@@ -908,6 +909,15 @@ void ProjectItemModel::setClipWaiting(const QString &binId)
}
}
void ProjectItemModel::setClipInvalid(const QString &binId)
{
std::shared_ptr<ProjectClip> clip = getClipByBinID(binId);
if (clip) {
clip->setClipStatus(AbstractProjectItem::StatusMissing);
//TODO: set producer as blank invalid
}
}
void ProjectItemModel::updateWatcher(std::shared_ptr<ProjectClip> clipItem)
{
if (clipItem->clipType() == ClipType::AV || clipItem->clipType() == ClipType::Audio || clipItem->clipType() == ClipType::Image ||
......
......@@ -196,6 +196,7 @@ public:
/** @brief Set the status of the clip to "waiting". This happens when the corresponding file has changed*/
void setClipWaiting(const QString &binId);
void setClipInvalid(const QString &binId);
/** @brief Number of clips in the bin playlist */
int clipsCount() const;
......
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