summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Theato <root@ttill.de>2014-05-06 20:02:45 (GMT)
committerTill Theato <root@ttill.de>2014-05-06 20:02:45 (GMT)
commit1af0d1d55af0e3eccb8619f4c83a78996e0bd3aa (patch)
tree0084ffcfca51b8203a97224e39ec6a52be006918
parent505017d82b98054a728f9a8725c6d51329ee8a0d (diff)
Remove old keyframe code.
-rw-r--r--src/commands/CMakeLists.txt1
-rw-r--r--src/commands/editkeyframecommand.cpp60
-rw-r--r--src/commands/editkeyframecommand.h46
-rw-r--r--src/customtrackview.cpp76
-rw-r--r--src/customtrackview.h1
5 files changed, 19 insertions, 165 deletions
diff --git a/src/commands/CMakeLists.txt b/src/commands/CMakeLists.txt
index f65f096..641bc9b 100644
--- a/src/commands/CMakeLists.txt
+++ b/src/commands/CMakeLists.txt
@@ -18,7 +18,6 @@ set(kdenlive_SRCS
commands/editeffectcommand.cpp
commands/editfoldercommand.cpp
commands/editguidecommand.cpp
- commands/editkeyframecommand.cpp
commands/edittransitioncommand.cpp
commands/groupclipscommand.cpp
commands/insertspacecommand.cpp
diff --git a/src/commands/editkeyframecommand.cpp b/src/commands/editkeyframecommand.cpp
deleted file mode 100644
index 87676bb..0000000
--- a/src/commands/editkeyframecommand.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************
- editkeyframecommand.cpp - description
- -------------------
- begin : 2008
- copyright : (C) 2008 by Jean-Baptiste Mardelle
- email : jb@kdenlive.org
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-
-#include "editkeyframecommand.h"
-#include "customtrackview.h"
-
-#include <KLocalizedString>
-
-EditKeyFrameCommand::EditKeyFrameCommand(CustomTrackView *view, const int track, const 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(QLatin1Char(';'), QString::SkipEmptyParts).count();
- int next = m_newkfr.split(QLatin1Char(';'), QString::SkipEmptyParts).count();
- if (prev == next)
- setText(i18n("Edit keyframe"));
- else if (prev > next)
- setText(i18n("Delete keyframe"));
- else
- setText(i18n("Add keyframe"));
- //kDebug() << "/// CREATE GUIDE COMMAND, TIMES: " << m_oldPos.frames(25) << "x" << m_pos.frames(25);
-}
-
-
-// virtual
-void EditKeyFrameCommand::undo()
-{
- m_view->editKeyFrame(m_pos, m_track, m_index, m_oldkfr);
- m_doIt = true;
-}
-// virtual
-void EditKeyFrameCommand::redo()
-{
- if (m_doIt) {
- m_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr);
- }
- m_doIt = true;
-}
-
diff --git a/src/commands/editkeyframecommand.h b/src/commands/editkeyframecommand.h
deleted file mode 100644
index 81ece60..0000000
--- a/src/commands/editkeyframecommand.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/***************************************************************************
- editkeyframecommand.h - description
- -------------------
- begin : 2008
- copyright : (C) 2008 by Jean-Baptiste Mardelle
- email : jb@kdenlive.org
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef KEYFRAMECOMMAND_H
-#define KEYFRAMECOMMAND_H
-
-#include <QUndoCommand>
-
-#include "gentime.h"
-#include "definitions.h"
-class CustomTrackView;
-
-
-class EditKeyFrameCommand : public QUndoCommand
-{
-public:
- EditKeyFrameCommand(CustomTrackView *view, const int track, const GenTime &pos, const int effectIndex, const QString& oldkeyframes, const QString& newkeyframes, bool doIt);
- void undo();
- void redo();
-
-private:
- CustomTrackView *m_view;
- const QString m_oldkfr;
- const QString m_newkfr;
- const int m_track;
- const int m_index;
- const GenTime m_pos;
- bool m_doIt;
-};
-
-#endif
-
diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp
index 5db4109..dc489bb 100644
--- a/src/customtrackview.cpp
+++ b/src/customtrackview.cpp
@@ -34,7 +34,6 @@
#include "commands/moveeffectcommand.h"
#include "commands/addtransitioncommand.h"
#include "commands/edittransitioncommand.h"
-#include "commands/editkeyframecommand.h"
#include "commands/changespeedcommand.h"
#include "commands/addmarkercommand.h"
#include "commands/razorclipcommand.h"
@@ -1409,49 +1408,24 @@ void CustomTrackView::groupSelectedItems(QList <QGraphicsItem *> selection, bool
void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
{
if (m_dragItem && m_dragItem->hasKeyFrames()) {
- /*if (m_moveOpMode == KEYFRAME) {
- // user double clicked on a keyframe, open edit dialog
- //TODO: update for effects with several values per keyframe
- QDialog d(parentWidget());
- Ui::KeyFrameDialog_UI view;
- view.setupUi(&d);
- view.kfr_position->setText(m_document->timecode().getTimecode(GenTime(m_dragItem->selectedKeyFramePos(), m_document->fps()) - m_dragItem->cropStart()));
- view.kfr_value->setValue(m_dragItem->selectedKeyFrameValue());
- view.kfr_value->setFocus();
- if (d.exec() == QDialog::Accepted) {
- int pos = m_document->timecode().getFrameCount(view.kfr_position->text());
- m_dragItem->updateKeyFramePos(GenTime(pos, m_document->fps()) + m_dragItem->cropStart(), (double) view.kfr_value->value() * m_dragItem->keyFrameFactor());
- ClipItem *item = static_cast <ClipItem *>(m_dragItem);
- QString previous = item->keyframes(item->selectedEffectIndex());
- item->updateKeyframeEffect();
- QString next = item->keyframes(item->selectedEffectIndex());
- EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
- m_commandStack->push(command);
- updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect(), item->selectedEffectIndex());
- emit clipItemSelected(item, item->selectedEffectIndex());
- }
-
- } else*/ {
- // add keyframe
- GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x()), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
- int single = m_dragItem->checkForSingleKeyframe();
- int val = m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
- ClipItem * item = static_cast <ClipItem *>(m_dragItem);
- QDomElement oldEffect = item->selectedEffect().cloneNode().toElement();
- if (single > -1) {
- item->insertKeyframe(item->getEffectAtIndex(item->selectedEffectIndex()), (item->cropStart() + item->cropDuration()).frames(m_document->fps()) - 1, single);
- }
- //QString previous = item->keyframes(item->selectedEffectIndex());
- item->insertKeyframe(item->getEffectAtIndex(item->selectedEffectIndex()), keyFramePos.frames(m_document->fps()), val);
- //item->updateKeyframeEffect();
- //QString next = item->keyframes(item->selectedEffectIndex());
- QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
- EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false, false);
- //EditKeyFrameCommand *command = new EditKeyFrameCommand(this, m_dragItem->track(), m_dragItem->startPos(), item->selectedEffectIndex(), previous, next, false);
- m_commandStack->push(command);
- updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect());
- emit clipItemSelected(item, item->selectedEffectIndex());
+ // add keyframe
+ GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x()), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
+ int single = m_dragItem->checkForSingleKeyframe();
+ int val = m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
+ ClipItem * item = static_cast <ClipItem *>(m_dragItem);
+ QDomElement oldEffect = item->selectedEffect().cloneNode().toElement();
+ if (single > -1) {
+ item->insertKeyframe(item->getEffectAtIndex(item->selectedEffectIndex()), (item->cropStart() + item->cropDuration()).frames(m_document->fps()) - 1, single);
}
+ //QString previous = item->keyframes(item->selectedEffectIndex());
+ item->insertKeyframe(item->getEffectAtIndex(item->selectedEffectIndex()), keyFramePos.frames(m_document->fps()), val);
+ //item->updateKeyframeEffect();
+ //QString next = item->keyframes(item->selectedEffectIndex());
+ QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false, false);
+ m_commandStack->push(command);
+ updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect());
+ emit clipItemSelected(item, item->selectedEffectIndex());
} else if (m_dragItem && !m_dragItem->isItemLocked()) {
editItemDuration();
} else {
@@ -1555,16 +1529,6 @@ void CustomTrackView::editItemDuration()
}
}
-void CustomTrackView::editKeyFrame(const GenTime & /*pos*/, const int /*track*/, const int /*index*/, const QString & /*keyframes*/)
-{
- /*ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), track);
- if (clip) {
- clip->setKeyframes(index, keyframes);
- updateEffect(m_document->tracksCount() - clip->track(), clip->startPos(), clip->effectAt(index), index, false);
- } else emit displayMessage(i18n("Cannot find clip with keyframe"), ErrorMessage);*/
-}
-
-
void CustomTrackView::displayContextMenu(QPoint pos, AbstractClipItem *clip, AbstractGroupItem *group)
{
m_deleteGuide->setEnabled(m_dragGuide != NULL);
@@ -4220,12 +4184,10 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
}
QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
- //item->updateKeyframeEffect();
- //QString next = item->keyframes(item->selectedEffectIndex());
- //EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
- EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false, false);
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false, false);
m_commandStack->push(command);
+
updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect());
emit clipItemSelected(item);
}
diff --git a/src/customtrackview.h b/src/customtrackview.h
index 1de1d17..d06a589 100644
--- a/src/customtrackview.h
+++ b/src/customtrackview.h
@@ -108,7 +108,6 @@ public:
void slotSeekToPreviousSnap();
void slotSeekToNextSnap();
double getSnapPointForPos(double pos);
- void editKeyFrame(const GenTime &pos, const int track, const int index, const QString &keyframes);
bool findString(const QString &text);
void selectFound(QString track, QString pos);
bool findNextString(const QString &text);