File indexing completed on 2025-01-19 04:24:30

0001 /****************************************************************************************
0002  * Copyright (c) 2009 Alejandro Wainzinger <aikawarazuni@gmail.com>                     *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #include "MediaDevicePlaylist.h"
0018 
0019 #include "core-impl/collections/support/CollectionManager.h"
0020 #include "core/support/Debug.h"
0021 //#include "core/meta/stream/Stream.h"
0022 //#include "MediaDeviceStorage.h"
0023 #include "playlistmanager/PlaylistManager.h"
0024 #include "MediaDeviceUserPlaylistProvider.h"
0025 
0026 #include <typeinfo>
0027 
0028 Playlists::MediaDevicePlaylist::MediaDevicePlaylist( const QString & name, const Meta::TrackList
0029         &tracks )
0030     : m_tracks( tracks )
0031 {
0032     m_name = name;
0033     // Tell the handler to save it
0034 }
0035 
0036 Playlists::MediaDevicePlaylist::~MediaDevicePlaylist()
0037 {
0038 }
0039 
0040 int
0041 Playlists::MediaDevicePlaylist::trackCount() const
0042 {
0043     return m_tracks.count();
0044 }
0045 
0046 Meta::TrackList
0047 Playlists::MediaDevicePlaylist::tracks()
0048 {
0049     return m_tracks;
0050 }
0051 
0052 void
0053 Playlists::MediaDevicePlaylist::addTrack(const Meta::TrackPtr &track, int position )
0054 {
0055     DEBUG_BLOCK
0056     int insertAt = (position == -1) ? m_tracks.count() : position;
0057     m_tracks.insert( insertAt, track );
0058 }
0059 
0060 void
0061 Playlists::MediaDevicePlaylist::removeTrack( int position )
0062 {
0063     DEBUG_BLOCK
0064     m_tracks.removeAt( position );
0065 }
0066 
0067 void
0068 Playlists::MediaDevicePlaylist::setName( const QString & name )
0069 {
0070     m_name = name;
0071 }
0072