Fix a signature difference
[amarok.git] / src / servicebrowser / ServiceAlbumCoverDownloader.h
blobc130a0dede84653bbe5d5c95da6124308feff2be
1 /***************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef SERVICEALBUMCOVERDOWNLOADER_H
21 #define SERVICEALBUMCOVERDOWNLOADER_H
24 #include "servicemetabase.h"
26 #include "amarok_export.h"
27 #include <kio/jobclasses.h>
28 #include <kio/job.h>
29 #include <KTempDir>
32 #include <QObject>
34 namespace Meta
37 //forward declaration
38 class ServiceAlbumCoverDownloader;
40 class AMAROK_EXPORT ServiceAlbumWithCover : public ServiceAlbum
42 private:
44 mutable QImage m_cover;
45 mutable bool m_hasFetchedCover;
46 mutable bool m_isFetchingCover;
47 QString m_coverDownloadPath;
48 mutable ServiceAlbumCoverDownloader * m_coverDownloader;
50 public:
52 ServiceAlbumWithCover( QString name );
53 ServiceAlbumWithCover( QStringList resultRow );
55 virtual ~ServiceAlbumWithCover();
57 virtual QString downloadPrefix() const = 0;
59 virtual void setCoverUrl( const QString &coverUrl ) = 0;
60 virtual QString coverUrl() const = 0;
62 void setImage( const QImage & image );
63 void imageDownloadCanceled() const;
65 virtual QPixmap image( int size = 1, bool withShadow = false); //overridden from Meta::Album
69 /**
70 A helper class for fetching covers from online services
72 @author
74 class ServiceAlbumCoverDownloader : public QObject
76 Q_OBJECT
78 public:
80 ServiceAlbumCoverDownloader();
81 ~ServiceAlbumCoverDownloader();
83 void downloadCover( const Meta::ServiceAlbumWithCover * album );
85 private slots:
87 void coverDownloadComplete( KJob * downloadJob );
88 void coverDownloadCanceled( KJob * downloadJob );
89 private:
90 const ServiceAlbumWithCover * m_album;
91 QString m_coverDownloadPath;
92 KIO::FileCopyJob * m_albumDownloadJob;
93 KTempDir * m_tempDir;
98 #endif