MythTV  master
playlistcontainer.h
Go to the documentation of this file.
1 #ifndef _PLAYLIST_CONTAINER_H_
2 #define _PLAYLIST_CONTAINER_H_
3 
4 // qt
5 #include <QCoreApplication>
6 
7 // MythTV
8 #include "mthread.h"
9 
10 
11 #define DEFAULT_PLAYLIST_NAME "default_playlist_storage"
12 #define DEFAULT_STREAMLIST_NAME "stream_playlist"
13 
14 class PlaylistContainer;
15 class Playlist;
16 class AllMusic;
17 
19 {
20  public:
22  AllMusic *all_music_ptr)
23  : MThread("PlaylistLoading"), parent(parent_ptr),
24  all_music(all_music_ptr) {}
25 
26  void run() override; // MThread
27 
28  private:
30  AllMusic *all_music {nullptr};
31 };
32 
34 {
36 
37  public:
38  explicit PlaylistContainer(AllMusic *all_music);
40 
41  void load();
42  void resync(void);
43  void describeYourself(void) const; // debugging
44 
45  Playlist* getActive(void) { return m_activePlaylist; }
46  Playlist* getPlaylist(int id);
47  Playlist* getPlaylist(const QString &name);
49 
50  void save();
51 
52  void createNewPlaylist(QString name);
53  void copyNewPlaylist(QString name);
54  void copyToActive(int index);
55 
56  QString getPlaylistName(int index, bool &reference);
57 
58  void deletePlaylist(int kill_me);
59  void renamePlaylist(int index, QString new_name);
60 
61  bool nameIsUnique(const QString& a_name, int which_id);
62 
63  void clearActive();
64 
65  bool doneLoading(){return m_doneLoading;}
66 
67  bool cleanOutThreads();
68 
69  void FillIntelliWeights(int &rating, int &playcount,
70  int &lastplay, int &random);
71  QList<Playlist*> *getPlaylists(void) { return m_allPlaylists; }
72  QStringList getPlaylistNames(void);
73 
74  private:
77  QList<Playlist*> *m_allPlaylists {nullptr};
78 
80  bool m_doneLoading {false};
81  QString m_myHost;
82 
83  int m_ratingWeight {2};
86  int m_randomWeight {2};
87 };
88 
89 #endif // _PLAYLIST_CONTAINER_H_
QString getPlaylistName(int index, bool &reference)
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
PlaylistContainer(AllMusic *all_music)
void describeYourself(void) const
void deletePlaylist(int kill_me)
QStringList getPlaylistNames(void)
Playlist * getActive(void)
PlaylistLoadingThread(PlaylistContainer *parent_ptr, AllMusic *all_music_ptr)
Playlist * getPlaylist(int id)
void copyNewPlaylist(QString name)
def rating(profile, smoonURL, gate)
Definition: scan.py:25
PlaylistLoadingThread * m_playlistsLoader
void createNewPlaylist(QString name)
bool nameIsUnique(const QString &a_name, int which_id)
Playlist * m_streamPlaylist
const char * name
Definition: ParseText.cpp:328
void run() override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Playlist * getStreamPlaylist(void)
Q_DECLARE_TR_FUNCTIONS(PlaylistContainer)
Playlist * m_activePlaylist
QList< Playlist * > * getPlaylists(void)
void copyToActive(int index)
QList< Playlist * > * m_allPlaylists
void FillIntelliWeights(int &rating, int &playcount, int &lastplay, int &random)
static long int random(void)
Definition: compat.h:149
void renamePlaylist(int index, QString new_name)
PlaylistContainer * parent