CuteLogger
Fast and simple logging solution for Qt based applications
playlistcommands.h
1 /*
2  * Copyright (c) 2013-2015 Meltytech, LLC
3  * Author: Dan Dennedy <dan@dennedy.org>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef PLAYLISTCOMMANDS_H
20 #define PLAYLISTCOMMANDS_H
21 
22 #include "models/playlistmodel.h"
23 #include <QUndoCommand>
24 #include <QString>
25 
26 namespace Playlist
27 {
28 
29 class AppendCommand : public QUndoCommand
30 {
31 public:
32  AppendCommand(PlaylistModel& model, const QString& xml, QUndoCommand * parent = 0);
33  void redo();
34  void undo();
35 private:
36  PlaylistModel& m_model;
37  QString m_xml;
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:24