]> git.sesse.net Git - kdenlive/blob - src/addmarkercommand.cpp
* internal rework: switch clip id's from integer to string
[kdenlive] / src / addmarkercommand.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 #include <KLocale>
18
19 #include "addmarkercommand.h"
20 #include "customtrackview.h"
21
22 AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const QString &id, const GenTime &pos, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_oldcomment(oldcomment), m_comment(comment), m_id(id), m_pos(pos), m_doIt(doIt) {
23     if (m_comment.isEmpty()) setText(i18n("Delete marker"));
24     else if (m_oldcomment.isEmpty()) setText(i18n("Add marker"));
25     else setText(i18n("Edit marker"));
26 }
27
28
29 // virtual
30 void AddMarkerCommand::undo() {
31     m_view->addMarker(m_id, m_pos, m_oldcomment);
32 }
33 // virtual
34 void AddMarkerCommand::redo() {
35     if (m_doIt) {
36         m_view->addMarker(m_id, m_pos, m_comment);
37     }
38     m_doIt = true;
39 }
40