X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Feditkeyframecommand.cpp;h=29c341ca24e47991373dbe0f55cd9c5ef2dd760a;hb=7db53cd2efc5998a9c2357b6f79164995e338597;hp=f9dde76cadeb1f357b57d9dfca8fde9b18b35696;hpb=5c822c42a9a536c8d25d1e42e439efaca13dbba3;p=kdenlive diff --git a/src/editkeyframecommand.cpp b/src/editkeyframecommand.cpp index f9dde76c..29c341ca 100644 --- a/src/editkeyframecommand.cpp +++ b/src/editkeyframecommand.cpp @@ -14,14 +14,25 @@ * (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) { - int prev = m_oldkfr.split(";", QString::SkipEmptyParts).count(); - int next = m_newkfr.split(";", QString::SkipEmptyParts).count(); +#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")); else if (prev > next) setText(i18n("Delete keyframe")); else setText(i18n("Add keyframe")); @@ -30,15 +41,17 @@ 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); } m_doIt = true; } -#include "editkeyframecommand.moc"