Changeset View
Changeset View
Standalone View
Standalone View
src/covermanager/CoverFetcher.h
Show All 25 Lines | |||||
26 | 26 | | |||
27 | #include <QHash> | 27 | #include <QHash> | ||
28 | #include <QObject> //baseclass | 28 | #include <QObject> //baseclass | ||
29 | #include <QPointer> | 29 | #include <QPointer> | ||
30 | #include <QStringList> //stack allocated | 30 | #include <QStringList> //stack allocated | ||
31 | 31 | | |||
32 | class CoverFetchQueue; | 32 | class CoverFetchQueue; | ||
33 | class CoverFoundDialog; | 33 | class CoverFoundDialog; | ||
34 | class QThread; | ||||
34 | 35 | | |||
35 | namespace KIO { class Job; } | 36 | namespace KIO { class Job; } | ||
36 | 37 | | |||
37 | class CoverFetcher : public QObject | 38 | class CoverFetcher : public QObject | ||
38 | { | 39 | { | ||
39 | Q_OBJECT | 40 | Q_OBJECT | ||
40 | 41 | | |||
41 | public: | 42 | public: | ||
Show All 15 Lines | 57 | Q_SIGNALS: | |||
57 | void finishedSingle( int state ); | 58 | void finishedSingle( int state ); | ||
58 | 59 | | |||
59 | private Q_SLOTS: | 60 | private Q_SLOTS: | ||
60 | 61 | | |||
61 | /// Fetch a cover | 62 | /// Fetch a cover | ||
62 | void slotFetch( CoverFetchUnit::Ptr unit ); | 63 | void slotFetch( CoverFetchUnit::Ptr unit ); | ||
63 | 64 | | |||
64 | /// Handle result of a fetch job | 65 | /// Handle result of a fetch job | ||
65 | void slotResult( const QUrl &url, QByteArray data, NetworkAccessManagerProxy::Error e ); | 66 | void slotResult( const QUrl &url, const QByteArray &data, NetworkAccessManagerProxy::Error e ); | ||
66 | 67 | | |||
67 | /// Cover found dialog is closed by the user | 68 | /// Cover found dialog is closed by the user | ||
68 | void slotDialogFinished(); | 69 | void slotDialogFinished(); | ||
69 | 70 | | |||
70 | /// The fetch request was redirected. | 71 | /// The fetch request was redirected. | ||
71 | void fetchRequestRedirected( QNetworkReply *oldReply, QNetworkReply *newReply ); | 72 | void fetchRequestRedirected( QNetworkReply *oldReply, QNetworkReply *newReply ); | ||
72 | 73 | | |||
73 | private: | 74 | private: | ||
74 | static CoverFetcher* s_instance; | 75 | static CoverFetcher* s_instance; | ||
75 | CoverFetcher(); | 76 | CoverFetcher(); | ||
76 | ~CoverFetcher(); | 77 | ~CoverFetcher(); | ||
77 | 78 | | |||
78 | /// Remove a fetch unit from the queue, and clean up any running jobs | 79 | /// Remove a fetch unit from the queue, and clean up any running jobs | ||
79 | void abortFetch( CoverFetchUnit::Ptr unit ); | 80 | void abortFetch( CoverFetchUnit::Ptr unit ); | ||
80 | 81 | | |||
81 | void queueQueryForAlbum( Meta::AlbumPtr album ); | 82 | void queueQueryForAlbum( Meta::AlbumPtr album ); | ||
82 | 83 | | |||
83 | const int m_limit; //!< maximum number of concurrent fetches | | |||
84 | CoverFetchQueue *m_queue; //!< current fetch queue | 84 | CoverFetchQueue *m_queue; //!< current fetch queue | ||
85 | Meta::AlbumList m_queueLater; //!< put here if m_queue exceeds m_limit | 85 | QThread *m_queueThread; | ||
86 | 86 | | |||
87 | QHash< QUrl, CoverFetchUnit::Ptr > m_urls; | 87 | QHash< QUrl, CoverFetchUnit::Ptr > m_urls; | ||
88 | QHash< const CoverFetchUnit::Ptr, QImage > m_selectedImages; | 88 | QHash< const CoverFetchUnit::Ptr, QImage > m_selectedImages; | ||
89 | 89 | | |||
90 | QStringList m_errors; | 90 | QStringList m_errors; | ||
91 | 91 | | |||
92 | QPointer<CoverFoundDialog> m_dialog; | 92 | QPointer<CoverFoundDialog> m_dialog; | ||
93 | 93 | | |||
Show All 23 Lines |