CuteLogger
Fast and simple logging solution for Qt based applications
playlistcommands.h
1 /*
2  * Copyright (c) 2013-2018 Meltytech, LLC
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 3 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, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef PLAYLISTCOMMANDS_H
19 #define PLAYLISTCOMMANDS_H
20 
21 #include "models/playlistmodel.h"
22 #include <QUndoCommand>
23 #include <QString>
24 
25 namespace Playlist
26 {
27 
28 class AppendCommand : public QUndoCommand
29 {
30 public:
31  AppendCommand(PlaylistModel& model, const QString& xml, bool emitModified = true, QUndoCommand * parent = 0);
32  void redo();
33  void undo();
34 private:
35  PlaylistModel& m_model;
36  QString m_xml;
37  bool m_emitModified;
38 };
39 
40 class InsertCommand : public QUndoCommand
41 {
42 public:
43  InsertCommand(PlaylistModel& model, const QString& xml, int row, QUndoCommand * parent = 0);
44  void redo();
45  void undo();
46 private:
47  PlaylistModel& m_model;
48  QString m_xml;
49  int m_row;
50 };
51 
52 class UpdateCommand : public QUndoCommand
53 {
54 public:
55  UpdateCommand(PlaylistModel& model, const QString& xml, int row, QUndoCommand * parent = 0);
56  void redo();
57  void undo();
58 private:
59  PlaylistModel& m_model;
60  QString m_newXml;
61  QString m_oldXml;
62  int m_row;
63 };
64 
65 class RemoveCommand : public QUndoCommand
66 {
67 public:
68  RemoveCommand(PlaylistModel& model, int row, QUndoCommand * parent = 0);
69  void redo();
70  void undo();
71 private:
72  PlaylistModel& m_model;
73  QString m_xml;
74  int m_row;
75 };
76 
77 class MoveCommand : public QUndoCommand
78 {
79 public:
80  MoveCommand(PlaylistModel& model, int from, int to, QUndoCommand * parent = 0);
81  void redo();
82  void undo();
83 private:
84  PlaylistModel& m_model;
85  int m_from;
86  int m_to;
87 };
88 
89 class ClearCommand : public QUndoCommand
90 {
91 public:
92  ClearCommand(PlaylistModel& model, QUndoCommand * parent = 0);
93  void redo();
94  void undo();
95 private:
96  PlaylistModel& m_model;
97  QString m_xml;
98 };
99 
100 }
101 
102 #endif // PLAYLISTCOMMANDS_H
Definition: playlistcommands.cpp:23