]> git.sesse.net Git - kdenlive/blobdiff - src/editkeyframecommand.cpp
Fix crash on clip deletion, fix issues with placeholder clips
[kdenlive] / src / editkeyframecommand.cpp
index edc89816e0016a261a9ea2d087e4b315e65f5f8d..29c341ca24e47991373dbe0f55cd9c5ef2dd760a 100644 (file)
  *   (at your option) any later version.                                   *
  *                                                                         *
  ***************************************************************************/
-#include <KLocale>
+
 
 #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 <KLocale>
+
+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_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr);
     }
     m_doIt = true;
 }
 
-#include "editkeyframecommand.moc"