00001 #ifndef _PLAYLIST_CONTAINER_H_ 00002 #define _PLAYLIST_CONTAINER_H_ 00003 00004 #include "mthread.h" 00005 00006 #include "playlist.h" 00007 00008 class PlaylistLoadingThread : public MThread 00009 { 00010 public: 00011 PlaylistLoadingThread(PlaylistContainer *parent_ptr, 00012 AllMusic *all_music_ptr); 00013 virtual void run(); 00014 00015 private: 00016 PlaylistContainer *parent; 00017 AllMusic *all_music; 00018 }; 00019 00020 class PlaylistContainer 00021 { 00022 public: 00023 PlaylistContainer(AllMusic *all_music, const QString &host_name); 00024 ~PlaylistContainer(); 00025 00026 void load(); 00027 void describeYourself(void) const; // debugging 00028 00029 Playlist* getActive(void) { return active_playlist; } 00030 Playlist* getPlaylist(int id); 00031 Playlist* getPlaylist(const QString &name); 00032 Playlist* getStreamPlaylist(void) { return stream_playlist; } 00033 00034 void clearCDList(); 00035 void addCDTrack(int x); 00036 void removeCDTrack(int x); 00037 bool checkCDTrack(int x); 00038 void save(); 00039 00040 void createNewPlaylist(QString name); 00041 void copyNewPlaylist(QString name); 00042 void copyToActive(int index); 00043 00044 QString getPlaylistName(int index, bool &reference); 00045 00046 void postLoad(); 00047 00048 void deletePlaylist(int index); 00049 void renamePlaylist(int index, QString new_name); 00050 00051 void popBackPlaylist(); 00052 bool pendingWriteback(); 00053 void setPending(int x) {pending_writeback_index = x;} 00054 int getPending() {return pending_writeback_index;} 00055 00056 bool nameIsUnique(QString a_name, int which_id); 00057 00058 void clearActive(); 00059 00060 bool doneLoading(){return done_loading;} 00061 00062 bool cleanOutThreads(); 00063 00064 void FillIntelliWeights(int &rating, int &playcount, 00065 int &lastplay, int &random); 00066 QList<Playlist*> *getPlaylists(void) { return all_other_playlists; } 00067 QStringList getPlaylistNames(void); 00068 00069 private: 00070 Playlist *active_playlist; 00071 Playlist *backup_playlist; 00072 Playlist *stream_playlist; 00073 QList<int> cd_playlist; 00074 QList<Playlist*> *all_other_playlists; 00075 AllMusic *all_available_music; 00076 00077 int pending_writeback_index; 00078 00079 PlaylistLoadingThread *playlists_loader; 00080 bool done_loading; 00081 QString my_host; 00082 00083 int RatingWeight; 00084 int PlayCountWeight; 00085 int LastPlayWeight; 00086 int RandomWeight; 00087 }; 00088 00089 #endif // _PLAYLIST_CONTAINER_H_
1.6.3