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