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 #ifndef AMAROK_COLLECTION_MEDIADEVICEUSERPLAYLISTPROVIDER_H 0018 #define AMAROK_COLLECTION_MEDIADEVICEUSERPLAYLISTPROVIDER_H 0019 0020 #include "core-impl/playlists/providers/user/UserPlaylistProvider.h" 0021 #include "MediaDevicePlaylist.h" 0022 0023 #include <QIcon> 0024 0025 #include <KLocalizedString> 0026 0027 namespace Collections { 0028 class MediaDeviceCollection; 0029 } 0030 0031 namespace Playlists { 0032 0033 class AMAROK_EXPORT MediaDeviceUserPlaylistProvider : public Playlists::UserPlaylistProvider 0034 { 0035 Q_OBJECT 0036 public: 0037 explicit MediaDeviceUserPlaylistProvider( Collections::MediaDeviceCollection *collection ); 0038 ~MediaDeviceUserPlaylistProvider() override; 0039 0040 /* PlaylistProvider functions */ 0041 QString prettyName() const override { return i18n( "Media Device playlists" ); } 0042 QIcon icon() const override { return QIcon::fromTheme( QStringLiteral("multimedia-player") ); } 0043 0044 /* Playlists::UserPlaylistProvider functions */ 0045 Playlists::PlaylistList playlists() override; 0046 0047 virtual Playlists::PlaylistPtr save( const Meta::TrackList &tracks ); 0048 Playlists::PlaylistPtr save( const Meta::TrackList &tracks, const QString& name ) override; 0049 0050 bool isWritable() override { return true; } 0051 void renamePlaylist(Playlists::PlaylistPtr playlist, const QString &newName ) override; 0052 bool deletePlaylists( const Playlists::PlaylistList &playlistlist ) override; 0053 0054 /// MediaDevice-specific Functions 0055 0056 void addMediaDevicePlaylist( Playlists::MediaDevicePlaylistPtr &playlist ); 0057 void removePlaylist( Playlists::MediaDevicePlaylistPtr &playlist ); 0058 0059 public Q_SLOTS: 0060 void sendUpdated() { Q_EMIT updated(); } 0061 0062 Q_SIGNALS: 0063 void playlistSaved( const Playlists::MediaDevicePlaylistPtr &playlist, const QString &name ); 0064 void playlistRenamed( const Playlists::MediaDevicePlaylistPtr &playlist ); 0065 void playlistsDeleted( const Playlists::MediaDevicePlaylistList &playlistlist ); 0066 0067 private: 0068 MediaDevicePlaylistList m_playlists; 0069 0070 Collections::MediaDeviceCollection *m_collection; 0071 }; 0072 0073 } //namespace Playlists 0074 0075 #endif