Warning, file /multimedia/amarok/src/playlist/UndoCommands.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Ian Monroe <ian@monroe.nu> * 0003 * Copyright (c) 2008 Nikolaj Hald Nielsen <nhn@kde.org> * 0004 * Copyright (c) 2008 Soren Harward <stharward@gmail.com> * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify it under * 0007 * the terms of the GNU General Public License as published by the Free Software * 0008 * Foundation; either version 2 of the License, or (at your option) version 3 or * 0009 * any later version accepted by the membership of KDE e.V. (or its successor approved * 0010 * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of * 0011 * version 3 of the license. * 0012 * * 0013 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0014 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0015 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0016 * * 0017 * You should have received a copy of the GNU General Public License along with * 0018 * this program. If not, see <http://www.gnu.org/licenses/>. * 0019 ****************************************************************************************/ 0020 0021 #include "UndoCommands.h" 0022 0023 #include "core/meta/Meta.h" 0024 #include "core/support/Debug.h" 0025 #include "playlist/PlaylistModelStack.h" 0026 0027 /************************ 0028 * Insert 0029 ************************/ 0030 Playlist::InsertTracksCmd::InsertTracksCmd( QUndoCommand* parent, const InsertCmdList& cmds ) 0031 : QUndoCommand( i18n( "Tracks Added" ), parent ) 0032 , m_cmdlist( cmds ) 0033 { 0034 } 0035 0036 void 0037 Playlist::InsertTracksCmd::redo() 0038 { 0039 DEBUG_BLOCK 0040 Playlist::ModelStack::instance()->bottom()->insertTracksCommand( m_cmdlist ); 0041 } 0042 0043 void 0044 Playlist::InsertTracksCmd::undo() 0045 { 0046 DEBUG_BLOCK 0047 Playlist::ModelStack::instance()->bottom()->removeTracksCommand( m_cmdlist ); 0048 } 0049 0050 /************************ 0051 * Remove 0052 ************************/ 0053 Playlist::RemoveTracksCmd::RemoveTracksCmd( QUndoCommand* parent, const RemoveCmdList& cmds ) 0054 : QUndoCommand( i18n( "Tracks Removed" ), parent ) 0055 , m_cmdlist( cmds ) 0056 { } 0057 0058 void 0059 Playlist::RemoveTracksCmd::redo() 0060 { 0061 DEBUG_BLOCK 0062 Playlist::ModelStack::instance()->bottom()->removeTracksCommand( m_cmdlist ); 0063 } 0064 0065 void 0066 Playlist::RemoveTracksCmd::undo() 0067 { 0068 DEBUG_BLOCK 0069 Playlist::ModelStack::instance()->bottom()->insertTracksCommand( m_cmdlist ); 0070 } 0071 0072 /************************ 0073 * Move 0074 ************************/ 0075 Playlist::MoveTracksCmd::MoveTracksCmd( QUndoCommand* parent, const MoveCmdList& cmds ) 0076 : QUndoCommand( i18n( "Tracks moved" ), parent ) 0077 , m_cmdlist( cmds ) 0078 { } 0079 0080 void 0081 Playlist::MoveTracksCmd::redo() 0082 { 0083 DEBUG_BLOCK 0084 Playlist::ModelStack::instance()->bottom()->moveTracksCommand( m_cmdlist, false ); 0085 } 0086 0087 void 0088 Playlist::MoveTracksCmd::undo() 0089 { 0090 DEBUG_BLOCK 0091 Playlist::ModelStack::instance()->bottom()->moveTracksCommand( m_cmdlist, true ); 0092 }