Warn when trying to add incompatible effect to bin clip

parent c71249c8
......@@ -2164,12 +2164,16 @@ void Bin::slotEffectDropped(const QStringList &effectData, const QModelIndex &pa
QItemSelectionModel::Select);
}
setCurrent(parentItem);
bool res = false;
if (effectData.count() == 4) {
// Paste effect from another stack
std::shared_ptr<EffectStackModel> sourceStack = pCore->getItemEffectStack(effectData.at(1).toInt(), effectData.at(2).toInt());
std::static_pointer_cast<ProjectClip>(parentItem)->copyEffect(sourceStack, effectData.at(3).toInt());
res = std::static_pointer_cast<ProjectClip>(parentItem)->copyEffect(sourceStack, effectData.at(3).toInt());
} else {
std::static_pointer_cast<ProjectClip>(parentItem)->addEffect(effectData.constFirst());
res = std::static_pointer_cast<ProjectClip>(parentItem)->addEffect(effectData.constFirst());
}
if (!res) {
pCore->displayMessage(i18n("Cannot add effect to clip"), InformationMessage);
}
}
}
......
......@@ -864,9 +864,10 @@ std::shared_ptr<EffectStackModel> ClipController::getEffectStack() const
{
return m_effectStack;
}
void ClipController::addEffect(const QString &effectId)
bool ClipController::addEffect(const QString &effectId)
{
m_effectStack->appendEffect(effectId, true);
return m_effectStack->appendEffect(effectId, true);
}
bool ClipController::copyEffect(const std::shared_ptr<EffectStackModel> &stackModel, int rowId)
......
......@@ -199,7 +199,7 @@ public:
std::shared_ptr<EffectStackModel> getEffectStack() const;
/** @brief Append an effect to this producer's effect list */
void addEffect(const QString &effectId);
bool addEffect(const QString &effectId);
protected:
virtual void emitProducerChanged(const QString & /*unused*/, const std::shared_ptr<Mlt::Producer> & /*unused*/){};
......
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