]> git.sesse.net Git - kdenlive/blob - src/addtransitioncommand.cpp
Fix broken loading when document profile was different than default profile
[kdenlive] / src / addtransitioncommand.cpp
1 /***************************************************************************
2                           addtransitioncommand.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
19 #include "addtransitioncommand.h"
20 #include "customtrackview.h"
21
22 #include <KLocale>
23
24 AddTransitionCommand::AddTransitionCommand(CustomTrackView *view, ItemInfo info, int transitiontrack, QDomElement params, bool remove, bool doIt, QUndoCommand * parent) :
25         QUndoCommand(parent),
26         m_view(view),
27         m_info(info),
28         m_params(params),
29         m_track(transitiontrack),
30         m_doIt(doIt),
31         m_remove(remove)
32 {
33     if (m_remove) setText(i18n("Delete transition from clip"));
34     else setText(i18n("Add transition to clip"));
35 }
36
37
38 // virtual
39 void AddTransitionCommand::undo()
40 {
41     if (m_remove) m_view->addTransition(m_info, m_track, m_params);
42     else m_view->deleteTransition(m_info, m_track, m_params);
43 }
44 // virtual
45 void AddTransitionCommand::redo()
46 {
47     if (m_doIt) {
48         if (m_remove) m_view->deleteTransition(m_info, m_track, m_params);
49         else m_view->addTransition(m_info, m_track, m_params);
50     }
51     m_doIt = true;
52 }
53
54