]> git.sesse.net Git - kdenlive/blob - src/commands/addmarkercommand.cpp
46a7d9c17364f344a7d0b793d88e66be02d742b7
[kdenlive] / src / commands / 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
18
19 #include "addmarkercommand.h"
20 #include "customtrackview.h"
21
22 #include <KLocale>
23
24 AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const CommentedTime &oldMarker, const CommentedTime &newMarker, const QString &id, QUndoCommand * parent) :
25         QUndoCommand(parent),
26         m_view(view),
27         m_oldMarker(oldMarker),
28         m_newMarker(newMarker),
29         m_id(id)
30 {
31     if (m_newMarker.markerType() < 0)
32         setText(i18n("Delete marker"));
33     else if (m_oldMarker.comment().isEmpty())
34         setText(i18n("Add marker"));
35     else
36         setText(i18n("Edit marker"));
37 }
38
39 // virtual
40 void AddMarkerCommand::undo()
41 {
42     m_view->addMarker(m_id, m_oldMarker);
43 }
44 // virtual
45 void AddMarkerCommand::redo()
46 {
47     m_view->addMarker(m_id, m_newMarker);
48 }
49