File indexing completed on 2025-01-19 04:24:36
0001 /**************************************************************************************** 0002 * Copyright (c) 2010 Bart Cerneels <bart.cerneels@kde.org> * 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 UMSPODCASTPROVIDER_H 0018 #define UMSPODCASTPROVIDER_H 0019 0020 #include "core/podcasts/PodcastProvider.h" 0021 #include "UmsPodcastMeta.h" 0022 0023 class KJob; 0024 0025 namespace Podcasts { 0026 0027 class UmsPodcastProvider : public PodcastProvider 0028 { 0029 Q_OBJECT 0030 public: 0031 explicit UmsPodcastProvider( const QUrl &scanDirectory ); 0032 ~UmsPodcastProvider() override; 0033 0034 UmsPodcastEpisodePtr addFile( MetaFile::TrackPtr metafileTrack ); 0035 int addPath( const QString &path ); 0036 0037 bool possiblyContainsTrack( const QUrl &url ) const override; 0038 Meta::TrackPtr trackForUrl( const QUrl &url ) override; 0039 0040 Podcasts::PodcastEpisodePtr episodeForGuid( const QString &guid ) override; 0041 0042 void addPodcast( const QUrl &url ) override; 0043 0044 Podcasts::PodcastChannelPtr addChannel( const Podcasts::PodcastChannelPtr &channel ) override; 0045 Podcasts::PodcastEpisodePtr addEpisode( Podcasts::PodcastEpisodePtr episode ) override; 0046 0047 Podcasts::PodcastChannelList channels() override; 0048 0049 virtual void removeSubscription( const Podcasts::PodcastChannelPtr &channel ); 0050 0051 virtual void configureProvider(); 0052 virtual void configureChannel( const Podcasts::PodcastChannelPtr &channel ); 0053 0054 // PlaylistProvider methods 0055 QString prettyName() const override; 0056 QIcon icon() const override; 0057 0058 Playlists::PlaylistList playlists() override; 0059 0060 QActionList playlistActions( const Playlists::PlaylistList &playlists ) override; 0061 QActionList trackActions( const QMultiHash<Playlists::PlaylistPtr, int> &playlistTracks ) override; 0062 0063 void completePodcastDownloads() override; 0064 0065 public Q_SLOTS: 0066 void updateAll() override; 0067 virtual void update( const Podcasts::PodcastChannelPtr &channel ); 0068 virtual void downloadEpisode( const Podcasts::PodcastEpisodePtr &episode ); 0069 virtual void deleteDownloadedEpisode( const Podcasts::PodcastEpisodePtr &episode ); 0070 virtual void slotUpdated(); 0071 virtual void scan(); 0072 0073 Q_SIGNALS: 0074 void updated(); 0075 0076 private Q_SLOTS: 0077 void slotDeleteEpisodes(); 0078 void slotDeleteChannels(); 0079 void deleteJobComplete( KJob *job ); 0080 void slotCopyComplete( KJob *job ); 0081 0082 private: 0083 QList<QAction *> episodeActions( const Podcasts::PodcastEpisodeList &); 0084 QList<QAction *> channelActions( const Podcasts::PodcastChannelList &); 0085 void deleteEpisodes( UmsPodcastEpisodeList umsEpisodes ); 0086 0087 QUrl m_scanDirectory; 0088 QStringList m_dirList; 0089 0090 UmsPodcastChannelList m_umsChannels; 0091 0092 QAction *m_deleteEpisodeAction; //delete a downloaded Episode 0093 QAction *m_deleteChannelAction; //delete a everything from one channel 0094 QList<QAction *> m_providerActions; 0095 0096 QMap<KJob *,UmsPodcastEpisodeList> m_deleteJobMap; 0097 }; 0098 0099 } //namespace Podcasts 0100 0101 #endif // UMSPODCASTPROVIDER_H