]> git.sesse.net Git - kdenlive/blob - src/addclipcommand.cpp
1e8b961e2436b57d98aa79c511dabcafbd2b4e53
[kdenlive] / src / addclipcommand.cpp
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20 #include <KLocale>
21
22 #include "addclipcommand.h"
23
24 AddClipCommand::AddClipCommand(ProjectList *list, const QStringList &names, const QDomElement &xml, const int id, const KUrl &url, const QString &group, bool doIt)
25          : m_list(list), m_names(names), m_xml(xml), m_id(id), m_url(url), m_group(group), m_doIt(doIt) {
26             if (doIt) setText(i18n("Add clip"));
27             else setText(i18n("Delete clip"));
28          }
29
30
31 // virtual 
32 void AddClipCommand::undo()
33 {
34   if (!m_list) kDebug()<<"----  ERROR, NO LIST FOR undoing action";
35 kDebug()<<"----  undoing action";
36   if (m_doIt) m_list->deleteClip(m_id);
37   else m_list->addClip(m_names, m_xml, m_id, m_url, m_group);
38 }
39 // virtual 
40 void AddClipCommand::redo()
41 {
42   if (!m_list) kDebug()<<"----  ERROR, NO LIST FOR redoing action";
43 kDebug()<<"----  redoing action";
44   if (m_doIt) m_list->addClip(m_names, m_xml, m_id, m_url, m_group);
45   else m_list->deleteClip(m_id);
46 }
47
48 #include "addclipcommand.moc"