File indexing completed on 2024-06-16 04:38:14
0001 /* 0002 SPDX-FileCopyrightText: 2018-2022 Mladen Milinkovic <max@smoothware.net> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef UNDOACTION_H 0008 #define UNDOACTION_H 0009 0010 #include <QExplicitlySharedDataPointer> 0011 #include <QUndoCommand> 0012 0013 #include "core/undo/undostack.h" 0014 0015 namespace SubtitleComposer { 0016 0017 class Subtitle; 0018 0019 class UndoAction : public QUndoCommand 0020 { 0021 friend class UndoStack; 0022 0023 public: 0024 enum { 0025 // subtitle actions 0026 SetFramesPerSecond = 1, 0027 InsertLines, 0028 RemoveLines, 0029 MoveLine, 0030 SwapLinesTexts, 0031 ChangeStylesheet, 0032 0033 // subtitle line actions 0034 SetLinePrimaryText, 0035 SetLineSecondaryText, 0036 SetLineTexts, 0037 SetLineShowTime, 0038 SetLineHideTime, 0039 SetLineTimes, 0040 SetLineErrors, 0041 } ActionID; 0042 0043 0044 UndoAction(UndoStack::DirtyMode dirtyMode, Subtitle *subtitle=nullptr, const QString &desc=QString()); 0045 virtual ~UndoAction(); 0046 0047 void redo() override = 0; 0048 void undo() override; 0049 0050 protected: 0051 const UndoStack::DirtyMode m_dirtyMode; 0052 QExplicitlySharedDataPointer<Subtitle> m_subtitle; 0053 }; 0054 0055 } 0056 0057 #endif /*UNDOACTION_H*/