File indexing completed on 2024-05-05 04:48:45

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Ian Monroe <ian@monroe.nu>                                        *
0003  * Copyright (c) 2008 Soren Harward <stharward@gmail.com>                               *
0004  *                                                                                      *
0005  * This program is free software; you can redistribute it and/or modify it under        *
0006  * the terms of the GNU General Public License as published by the Free Software        *
0007  * Foundation; either version 2 of the License, or (at your option) version 3 or        *
0008  * any later version accepted by the membership of KDE e.V. (or its successor approved  *
0009  * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of  *
0010  * version 3 of the license.                                                            *
0011  *                                                                                      *
0012  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0013  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0014  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0015  *                                                                                      *
0016  * You should have received a copy of the GNU General Public License along with         *
0017  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0018  ****************************************************************************************/
0019 
0020 #ifndef AMAROK_UNDOCOMMANDS_H
0021 #define AMAROK_UNDOCOMMANDS_H
0022 
0023 #include "core/meta/forward_declarations.h"
0024 
0025 #include <QList>
0026 #include <QPair>
0027 #include <QUndoCommand>
0028 
0029 namespace Playlist
0030 {
0031 typedef QPair<Meta::TrackPtr, int> InsertCmd;
0032 typedef QList<InsertCmd> InsertCmdList;
0033 class InsertTracksCmd : public QUndoCommand
0034 {
0035 public:
0036     InsertTracksCmd( QUndoCommand* parent, const InsertCmdList& );
0037     void undo() override;
0038     void redo() override;
0039 private:
0040     const InsertCmdList m_cmdlist;
0041 };
0042 
0043 typedef QPair<Meta::TrackPtr, int> RemoveCmd;
0044 typedef QList<RemoveCmd> RemoveCmdList;
0045 class RemoveTracksCmd: public QUndoCommand
0046 {
0047 public:
0048     RemoveTracksCmd( QUndoCommand* parent, const RemoveCmdList& );
0049     void undo() override;
0050     void redo() override;
0051 private:
0052     const RemoveCmdList m_cmdlist;
0053 };
0054 
0055 typedef QPair<int, int> MoveCmd;
0056 typedef QList<MoveCmd> MoveCmdList;
0057 class MoveTracksCmd: public QUndoCommand
0058 {
0059 public:
0060     MoveTracksCmd( QUndoCommand* parent, const MoveCmdList& );
0061     void undo() override;
0062     void redo() override;
0063 private:
0064     const MoveCmdList m_cmdlist;
0065 };
0066 }
0067 
0068 #endif