Dragging an effect from a track to another should properly activate icon and create an undo entry.

Fixes #909
parent c25fa35a
......@@ -409,7 +409,7 @@ bool EffectStackModel::fromXml(const QDomElement &effectsXml, Fun &undo, Fun &re
return effectAdded;
}
bool EffectStackModel::copyEffect(const std::shared_ptr<AbstractEffectItem> &sourceItem, PlaylistState::ClipState state)
bool EffectStackModel::copyEffect(const std::shared_ptr<AbstractEffectItem> &sourceItem, PlaylistState::ClipState state, bool logUndo)
{
QWriteLocker locker(&m_lock);
if (sourceItem->childCount() > 0) {
......@@ -467,6 +467,12 @@ bool EffectStackModel::copyEffect(const std::shared_ptr<AbstractEffectItem> &sou
emit dataChanged(QModelIndex(), QModelIndex(), roles);
return true;
};
update();
if (logUndo) {
PUSH_LAMBDA(update, local_redo);
PUSH_LAMBDA(update, local_undo);
pCore->pushUndo(local_undo, local_redo, i18n("Paste effect"));
}
}
return res;
}
......@@ -938,7 +944,7 @@ bool EffectStackModel::importEffects(const std::shared_ptr<EffectStackModel> &so
for (int i = 0; i < sourceStack->rowCount(); i++) {
auto item = sourceStack->getEffectStackRow(i);
// NO undo. this should only be used on project opening
if (copyEffect(item, state)) {
if (copyEffect(item, state, false)) {
found = true;
if (item->isEnabled()) {
effectEnabled = true;
......
......@@ -62,7 +62,7 @@ public:
bool appendEffect(const QString &effectId, bool makeCurrent = false);
/* @brief Copy an existing effect and append it at the bottom of the stack
*/
bool copyEffect(const std::shared_ptr<AbstractEffectItem> &sourceItem, PlaylistState::ClipState state);
bool copyEffect(const std::shared_ptr<AbstractEffectItem> &sourceItem, PlaylistState::ClipState state, bool logUndo = true);
bool copyXmlEffect(QDomElement effect);
/* @brief Import all effects from the given effect stack
*/
......
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