Commit e5780eee authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

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