]> git.sesse.net Git - kdenlive/blob - src/addtransitioncommand.cpp
[PATCH by Ray Lehtiniemi] Fix up &&/& confusion
[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) : QUndoCommand(parent), m_view(view), m_info(info), m_track(transitiontrack), m_params(params), m_remove(remove), m_doIt(doIt) {
25     if (m_remove) setText(i18n("Delete transition from clip"));
26     else setText(i18n("Add transition to clip"));
27 }
28
29
30 // virtual
31 void AddTransitionCommand::undo() {
32     if (m_remove) m_view->addTransition(m_info, m_track, m_params);
33     else m_view->deleteTransition(m_info, m_track, m_params);
34 }
35 // virtual
36 void AddTransitionCommand::redo() {
37     if (m_doIt) {
38         if (m_remove) m_view->deleteTransition(m_info, m_track, m_params);
39         else m_view->addTransition(m_info, m_track, m_params);
40     }
41     m_doIt = true;
42 }
43
44