Debian Codegraph @

src/core/podcasts/PodcastImageFetcher.h

raw
1 /****************************************************************************************
2 * Copyright (c) 2009 Bart Cerneels <[email protected]> *
3 * *
4 * This program is free software; you can redistribute it and/or modify it under *
5 * the terms of the GNU General Public License as published by the Free Software *
6 * Foundation; either version 2 of the License, or (at your option) any later *
7 * version. *
8 * *
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
11 * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
12 * *
13 * You should have received a copy of the GNU General Public License along with *
14 * this program. If not, see <http://www.gnu.org/licenses/>. *
15 ****************************************************************************************/
16
17 #ifndef PODCASTIMAGEFETCHER_H
18 #define PODCASTIMAGEFETCHER_H
19
20 #include "core/podcasts/PodcastMeta.h"
21
22 #include <KJob>
23
24 class AMAROKCORE_EXPORT PodcastImageFetcher : public QObject
25 {
26 Q_OBJECT
27 public:
28 PodcastImageFetcher();
29
30 void addChannel( Podcasts::PodcastChannelPtr channel );
31 void addEpisode( const Podcasts::PodcastEpisodePtr &episode );
32
33 void run();
34
35 static QUrl cachedImagePath(const Podcasts::PodcastChannelPtr &channel );
36 static QUrl cachedImagePath( Podcasts::PodcastChannel *channel );
37
38 Q_SIGNALS:
39 void channelImageReady( const Podcasts::PodcastChannelPtr &channel, const QImage &image );
40 void episodeImageReady( const Podcasts::PodcastEpisodePtr &episode, const QImage &image );
41 void done( PodcastImageFetcher * );
42
43 private Q_SLOTS:
44 void slotDownloadFinished( KJob *job );
45
46 private:
47 static bool hasCachedImage(const Podcasts::PodcastChannelPtr &channel );
48
49 Podcasts::PodcastChannelList m_channels;
50 Podcasts::PodcastEpisodeList m_episodes;
51 QMap<KJob *, Podcasts::PodcastChannelPtr> m_jobChannelMap;
52 QMap<KJob *, Podcasts::PodcastEpisodePtr> m_jobEpisodeMap;
53 };
54
55 #endif // PODCASTIMAGEFETCHER_H