Commit 58fcf54f authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '2004'

parents 0fabb824 f9638000
Pipeline #19790 passed with stage
in 9 minutes and 26 seconds
......@@ -148,7 +148,7 @@ public:
enum CLIPSTATUS { StatusReady = 0, StatusMissing, StatusWaiting, StatusDeleting };
void setClipStatus(AbstractProjectItem::CLIPSTATUS status);
virtual void setClipStatus(AbstractProjectItem::CLIPSTATUS status);
AbstractProjectItem::CLIPSTATUS clipStatus() const;
bool statusReady() const;
......
......@@ -214,6 +214,7 @@ public:
painter->setFont(font);
if (type == AbstractProjectItem::ClipItem || type == AbstractProjectItem::SubClipItem) {
int decoWidth = 0;
AbstractProjectItem::CLIPSTATUS clipStatus = (AbstractProjectItem::CLIPSTATUS)index.data(AbstractProjectItem::ClipStatus).toInt();
if (opt.decorationSize.height() > 0) {
r.setWidth(r.height() * pCore->getCurrentDar());
QPixmap pix = opt.icon.pixmap(opt.icon.actualSize(r.size()));
......@@ -225,6 +226,12 @@ public:
}
m_thumbRect = r;
}
if (clipStatus == AbstractProjectItem::StatusMissing) {
painter->save();
painter->setPen(QPen(Qt::red, 3));
painter->drawRect(m_thumbRect);
painter->restore();
}
int mid = (int)((r1.height() / 2));
r1.adjust(decoWidth, 0, 0, -mid);
QRect r2 = option.rect;
......@@ -286,7 +293,6 @@ public:
r.setWidth(bounding.height());
reload.paint(painter, r);
}
int jobProgress = index.data(AbstractProjectItem::JobProgress).toInt();
auto status = index.data(AbstractProjectItem::JobStatus).value<JobManagerStatus>();
if (status == JobManagerStatus::Pending || status == JobManagerStatus::Running) {
......@@ -1394,6 +1400,11 @@ void Bin::slotReloadClip()
}
if (currentItem) {
emit openClip(std::shared_ptr<ProjectClip>());
if (currentItem->clipStatus() == AbstractProjectItem::StatusMissing) {
// Don't attempt to reload missing clip
emit displayBinMessage(i18n("Missing source clip"), KMessageWidget::Warning);
return;
}
if (currentItem->clipType() == ClipType::Playlist) {
// Check if a clip inside playlist is missing
QString path = currentItem->url();
......
......@@ -1223,10 +1223,16 @@ bool ProjectClip::rename(const QString &name, int column)
QVariant ProjectClip::getData(DataType type) const
{
switch (type) {
case AbstractProjectItem::IconOverlay:
return m_effectStack && m_effectStack->rowCount() > 0 ? QVariant("kdenlive-track_has_effect") : QVariant();
default:
return AbstractProjectItem::getData(type);
case AbstractProjectItem::IconOverlay:
if (m_clipStatus == AbstractProjectItem::StatusMissing) {
return QVariant("window-close");
}
if (m_clipStatus == AbstractProjectItem::StatusWaiting) {
return QVariant("view-refresh");
}
return m_effectStack && m_effectStack->rowCount() > 0 ? QVariant("kdenlive-track_has_effect") : QVariant();
default:
return AbstractProjectItem::getData(type);
}
}
......@@ -1545,3 +1551,12 @@ QVector <uint8_t> ProjectClip::audioFrameCache(int stream)
}
return audioLevels;
}
void ProjectClip::setClipStatus(AbstractProjectItem::CLIPSTATUS status)
{
AbstractProjectItem::setClipStatus(status);
if (auto ptr = m_model.lock()) {
std::static_pointer_cast<ProjectItemModel>(ptr)->onItemUpdated(std::static_pointer_cast<ProjectClip>(shared_from_this()),
AbstractProjectItem::IconOverlay);
}
}
......@@ -229,6 +229,7 @@ public:
/** @brief Return FFmpeg's audio stream index for an MLT audio stream index
*/
int getAudioStreamFfmpegIndex(int mltStream);
void setClipStatus(AbstractProjectItem::CLIPSTATUS status) override;
protected:
friend class ClipModel;
......
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