]> git.sesse.net Git - kdenlive/blob - src/edittransitioncommand.cpp
* internal rework: switch clip id's from integer to string
[kdenlive] / src / edittransitioncommand.cpp
1 /***************************************************************************
2                           edittransitioncommand.cpp  -  description
3                              -------------------
4     begin                : 2008
5     copyright            : (C) 2008 by Marco Gittler
6     email                : g.marco@freenet.de
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 #include <KLocale>
18
19 #include "edittransitioncommand.h"
20 #include "customtrackview.h"
21
22 EditTransitionCommand::EditTransitionCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, bool doIt)
23         : m_view(view), m_track(track), m_pos(pos), m_oldeffect(oldeffect), m_doIt(doIt) {
24     m_effect = effect.cloneNode().toElement();
25     QString effectName;
26     QDomNode namenode = effect.elementsByTagName("name").item(0);
27     if (!namenode.isNull()) effectName = i18n(namenode.toElement().text().toUtf8().data());
28     else effectName = i18n("effect");
29     setText(i18n("Edit transition %1", effectName));
30 }
31
32 // virtual
33 int EditTransitionCommand::id() const {
34     return 1;
35 }
36
37 // virtual
38 bool EditTransitionCommand::mergeWith(const QUndoCommand * other) {
39     if (other->id() != id()) return false;
40     if (m_track != static_cast<const EditTransitionCommand*>(other)->m_track) return false;
41     if (m_pos != static_cast<const EditTransitionCommand*>(other)->m_pos) return false;
42     m_effect = static_cast<const EditTransitionCommand*>(other)->m_effect;
43     return true;
44 }
45
46 // virtual
47 void EditTransitionCommand::undo() {
48     m_view->updateTransition(m_track, m_pos, m_effect, m_oldeffect);
49 }
50 // virtual
51 void EditTransitionCommand::redo() {
52     m_view->updateTransition(m_track, m_pos, m_oldeffect, m_effect);
53 }
54