X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Feditkeyframecommand.cpp;h=29c341ca24e47991373dbe0f55cd9c5ef2dd760a;hb=459decee5e330552ef73b7cb363dbbe38fdc7e87;hp=8e4d397eb5309082b79ac4788ce0dc4e1d3e8d59;hpb=f9dbfa756b78f336576b42f041de325c98aa48e8;p=kdenlive diff --git a/src/editkeyframecommand.cpp b/src/editkeyframecommand.cpp index 8e4d397e..29c341ca 100644 --- a/src/editkeyframecommand.cpp +++ b/src/editkeyframecommand.cpp @@ -14,12 +14,23 @@ * (at your option) any later version. * * * ***************************************************************************/ -#include + #include "editkeyframecommand.h" #include "customtrackview.h" -EditKeyFrameCommand::EditKeyFrameCommand(CustomTrackView *view, const int track, GenTime pos, const int effectIndex, const QString& oldkeyframes, const QString& newkeyframes, bool doIt) : m_view(view), m_track(track), m_pos(pos), m_index(effectIndex), m_oldkfr(oldkeyframes), m_newkfr(newkeyframes), m_doIt(doIt) { +#include + +EditKeyFrameCommand::EditKeyFrameCommand(CustomTrackView *view, const int track, GenTime pos, const int effectIndex, const QString& oldkeyframes, const QString& newkeyframes, bool doIt) : + QUndoCommand(), + m_view(view), + m_oldkfr(oldkeyframes), + m_newkfr(newkeyframes), + m_track(track), + m_index(effectIndex), + m_pos(pos), + m_doIt(doIt) +{ int prev = m_oldkfr.split(';', QString::SkipEmptyParts).count(); int next = m_newkfr.split(';', QString::SkipEmptyParts).count(); if (prev == next) setText(i18n("Edit keyframe")); @@ -30,11 +41,14 @@ EditKeyFrameCommand::EditKeyFrameCommand(CustomTrackView *view, const int track, // virtual -void EditKeyFrameCommand::undo() { +void EditKeyFrameCommand::undo() +{ m_view->editKeyFrame(m_pos, m_track, m_index, m_oldkfr); + m_doIt = true; } // virtual -void EditKeyFrameCommand::redo() { +void EditKeyFrameCommand::redo() +{ if (m_doIt) { m_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr); }