You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.2 KiB

// (c) 2004 Mark Kretschmann <>
// (c) 2004 Stefan Bogner <>
// See COPYING file for licensing information.
#include <tqlabel.h> //baseclass
#include <tqimage.h> //stack allocated
#include <tqobject.h> //baseclass
#include <tqstringlist.h> //stack allocated
#include <tqdom.h> //stack allocated
namespace Amarok {
void coverContextMenu( TQWidget *parent, TQPoint point, const TQString &artist, const TQString &album, bool showCoverManager = true );
class CoverLabel : public TQLabel {
CoverLabel ( TQWidget * parent, const char * name = 0, WFlags f = 0 );
void setInformation( const TQString artist, const TQString album ) {
m_artist = artist;
m_album = album;
virtual void mouseReleaseEvent(TQMouseEvent *pEvent);
TQString m_artist;
TQString m_album;
namespace KIO { class Job; }
class CoverFetcher : public TQObject
friend class EditSearchDialog;
static const uint MAX_COVERS_CHOICE = 10;
CoverFetcher( TQWidget *parent, const TQString &artist, TQString album );
/// allow the user to edit the query?
void setUserCanEditQuery( bool b ) { m_userCanEditQuery = b; }
/// starts the fetch
void startFetch();
TQString artist() const { return m_artist; }
TQString album() const { return m_album; }
TQString amazonURL() const { return m_amazonURL; }
TQString asin() const { return m_asin; }
TQImage image() const { return m_image; }
bool wasError() const { return !m_success; }
TQStringList errors() const { return m_errors; }
enum Locale { International=0, France, Germany, Japan, UK, Canada };
static TQString localeIDToString( int id );
static int localeStringToID( const TQString &locale );
/// The CollectionDB can get the cover information using the pointer
void result( CoverFetcher* );
private slots:
void finishedXmlFetch( KIO::Job* job );
void finishedImageFetch( KIO::Job* job );
void changeLocale( int id );
const TQString m_artist;
const TQString m_album;
bool m_userCanEditQuery;
TQString m_userQuery; /// the query from the query edit dialog
TQString m_xml;
TQImage m_image;
TQString m_amazonURL;
TQString m_asin;
int m_size;
TQStringList m_queries;
TQStringList m_coverAsins;
TQStringList m_coverAmazonUrls;
TQStringList m_coverUrls;
TQStringList m_coverNames;
TQString m_currentCoverName;
TQStringList m_errors;
bool m_success;
/// The fetch was successful!
void finish();
/// Parse one <Item> TQDomNode and append results.
void parseItemNode( const TQDomNode &node );
/// The fetch failed, finish up and log an error message
void finishWithError( const TQString &message, KIO::Job *job = 0 );
/// Prompt the user for a query
void getUserQuery( TQString explanation = TQString() );
/// Will try all available queries, and then prompt the user, if allowed
void attemptAnotherFetch();
/// Show the cover that has been found
void showCover();