1 // (c) 2004 Mark Kretschmann <markey@web.de>
2 // (c) 2004 Stefan Bogner <bochi@online.ms>
3 // See COPYING file for licensing information.
5 #ifndef AMAROK_COVERFETCHER_H
6 #define AMAROK_COVERFETCHER_H
8 #include <QImage> //stack allocated
9 #include <QLabel> //baseclass
10 #include <QObject> //baseclass
11 #include <QStringList> //stack allocated
15 void coverContextMenu( QWidget
*parent
, QPoint point
, const QString
&artist
, const QString
&album
, bool showCoverManager
= true );
20 class CoverLabel
: public QLabel
{
22 explicit CoverLabel ( QWidget
* parent
, Qt::WindowFlags f
= 0 );
24 void setInformation( const QString artist
, const QString album
) {
30 virtual void mouseReleaseEvent(QMouseEvent
*pEvent
);
39 namespace KIO
{ class Job
; }
41 class CoverFetcher
: public QObject
43 friend class EditSearchDialog
;
46 static const uint MAX_COVERS_CHOICE
= 10;
49 CoverFetcher( QWidget
*parent
, const QString
&artist
, QString album
);
52 /// allow the user to edit the query?
53 void setUserCanEditQuery( bool b
) { m_userCanEditQuery
= b
; }
58 QString
artist() const { return m_artist
; }
59 QString
album() const { return m_album
; }
60 QString
amazonURL() const { return m_amazonURL
; }
61 QString
asin() const { return m_asin
; }
62 QImage
image() const { return m_image
; }
64 bool wasError() const { return !m_success
; }
65 QStringList
errors() const { return m_errors
; }
67 enum Locale
{ International
=0, France
, Germany
, Japan
, UK
, Canada
};
68 static QString
localeIDToString( int id
);
69 static int localeStringToID( const QString
&locale
);
72 /// The CollectionDB can get the cover information using the pointer
73 void result( CoverFetcher
* );
76 void finishedXmlFetch( KJob
* job
);
77 void finishedImageFetch( KJob
* job
);
78 void changeLocale( int id
);
81 const QString m_artist
;
82 const QString m_album
;
84 bool m_userCanEditQuery
;
85 QString m_userQuery
; /// the query from the query edit dialog
92 QStringList m_queries
;
93 QStringList m_coverAsins
;
94 QStringList m_coverAmazonUrls
;
95 QStringList m_coverUrls
;
96 QStringList m_coverNames
;
97 QString m_currentCoverName
;
103 /// The fetch was successful!
106 /// The fetch failed, finish up and log an error message
107 void finishWithError( const QString
&message
, KJob
*job
= 0 );
109 /// Prompt the user for a query
110 void getUserQuery( QString explanation
= QString() );
112 /// Will try all available queries, and then prompt the user, if allowed
113 void attemptAnotherFetch();
115 /// Show the cover that has been found
119 #endif /* AMAROK_COVERFETCHER_H */