]> git.sesse.net Git - kdenlive/blob - src/edittransitioncommand.cpp
Sort initializers in declaration order
[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
18 #include "edittransitioncommand.h"
19 #include "customtrackview.h"
20
21 #include <KLocale>
22
23 EditTransitionCommand::EditTransitionCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, bool doIt) :
24         m_view(view),
25         m_track(track),
26         m_oldeffect(oldeffect),
27         m_pos(pos),
28         m_doIt(doIt)
29 {
30     m_effect = effect.cloneNode().toElement();
31     QString effectName;
32     QDomNode namenode = effect.elementsByTagName("name").item(0);
33     if (!namenode.isNull()) effectName = i18n(namenode.toElement().text().toUtf8().data());
34     else effectName = i18n("effect");
35     setText(i18n("Edit transition %1", effectName));
36 }
37
38 // virtual
39 int EditTransitionCommand::id() const
40 {
41     return 2;
42 }
43
44 // virtual
45 bool EditTransitionCommand::mergeWith(const QUndoCommand * other)
46 {
47     if (other->id() != id()) return false;
48     if (m_track != static_cast<const EditTransitionCommand*>(other)->m_track) return false;
49     if (m_pos != static_cast<const EditTransitionCommand*>(other)->m_pos) return false;
50     m_effect = static_cast<const EditTransitionCommand*>(other)->m_effect;
51     return true;
52 }
53
54 // virtual
55 void EditTransitionCommand::undo()
56 {
57     m_view->updateTransition(m_track, m_pos, m_effect, m_oldeffect, m_doIt);
58 }
59 // virtual
60 void EditTransitionCommand::redo()
61 {
62     m_view->updateTransition(m_track, m_pos, m_oldeffect, m_effect, m_doIt);
63     m_doIt = true;
64 }
65