]> git.sesse.net Git - kdenlive/blob - src/editkeyframecommand.cpp
Reindent the codebase using 'linux' bracket placement.
[kdenlive] / src / editkeyframecommand.cpp
1 /***************************************************************************
2                           editkeyframecommand.cpp  -  description
3                              -------------------
4     begin                : 2008
5     copyright            : (C) 2008 by Jean-Baptiste Mardelle
6     email                : jb@kdenlive.org
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18
19 #include "editkeyframecommand.h"
20 #include "customtrackview.h"
21
22 #include <KLocale>
23
24 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)
25 {
26     int prev = m_oldkfr.split(';', QString::SkipEmptyParts).count();
27     int next = m_newkfr.split(';', QString::SkipEmptyParts).count();
28     if (prev == next) setText(i18n("Edit keyframe"));
29     else if (prev > next) setText(i18n("Delete keyframe"));
30     else setText(i18n("Add keyframe"));
31     //kDebug() << "///  CREATE GUIDE COMMAND, TIMES: " << m_oldPos.frames(25) << "x" << m_pos.frames(25);
32 }
33
34
35 // virtual
36 void EditKeyFrameCommand::undo()
37 {
38     m_view->editKeyFrame(m_pos, m_track, m_index, m_oldkfr);
39 }
40 // virtual
41 void EditKeyFrameCommand::redo()
42 {
43     if (m_doIt) {
44         m_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr);
45     }
46     m_doIt = true;
47 }
48