'Pluginize' Ampache
[amarok.git] / src / servicebrowser / ServiceDynamicCollection.h
blob8c517a224cbad0679b57f253455a3c22a026ae58
1 //
2 // C++ Interface: servicedynamiccollection
3 //
4 // Description:
5 //
6 //
7 // Author: <>, (C) 2007
8 //
9 // Copyright: See COPYING file that comes with this distribution
12 #ifndef SERVICEDYNAMICCOLLECTION_H
13 #define SERVICEDYNAMICCOLLECTION_H
15 #include "amarok_export.h"
16 #include <servicecollection.h>
18 typedef QMap<int, Meta::TrackPtr> TrackIdMap;
19 typedef QMap<int, Meta::ArtistPtr> ArtistIdMap;
20 typedef QMap<int, Meta::AlbumPtr> AlbumIdMap;
21 typedef QMap<int, Meta::GenrePtr> GenreIdMap;
24 /**
25 A specialised collection used for services that dynamically fetch their data from somewhere ( a web service, an external program, etc....)
27 @author
29 class AMAROK_EXPORT ServiceDynamicCollection : public ServiceCollection
31 public:
33 Q_OBJECT
34 public:
35 ServiceDynamicCollection( const QString &id, const QString &prettyName );
36 virtual ~ServiceDynamicCollection();
38 virtual void startFullScan() {} //TODO
39 virtual QueryMaker* queryMaker() = 0;
41 virtual QString collectionId() const;
42 virtual QString prettyName() const;
44 virtual QStringList query( const QString &query ) { Q_UNUSED( query ); return QStringList(); }
45 virtual int insert( const QString &statement, const QString &table ) { Q_UNUSED( statement ); Q_UNUSED( table ); return 0; }
47 virtual QString escape( QString text ) const { Q_UNUSED( text ); return QString(); }
50 Meta::TrackPtr trackById( int id );
51 Meta::AlbumPtr albumById( int id );
52 Meta::ArtistPtr artistById( int id );
53 Meta::GenrePtr genreById( int id );
56 //Override some stuff to be able to hande id mappings
59 void addTrack( QString key, Meta::TrackPtr trackPtr );
60 void addArtist( QString key, Meta::ArtistPtr artistPtr);
61 void addAlbum ( QString key, Meta::AlbumPtr albumPtr );
62 void addGenre( QString key, Meta::GenrePtr genrePtr);
64 //TODO:
65 //void setTrackMap( TrackMap map ) { m_trackMap = map; }
66 //void setArtistMap( ArtistMap map ) { m_artistMap = map; }
67 //void setAlbumMap( AlbumMap map ) { m_albumMap = map; }
68 //void setGenreMap( GenreMap map ) { m_genreMap = map; }
70 private:
71 ServiceMetaFactory * m_metaFactory;
73 QString m_collectionId;
74 QString m_prettyName;
76 TrackIdMap m_trackIdMap;
77 ArtistIdMap m_artistIdMap;
78 AlbumIdMap m_albumIdMap;
79 GenreIdMap m_genreIdMap;
83 #endif