-
Notifications
You must be signed in to change notification settings - Fork 341
/
playlist.h
136 lines (102 loc) · 3.76 KB
/
playlist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef PLAYLIST_H_
#define PLAYLIST_H_
// qt
#include <QList>
#include <QMap>
// libmythmetadata
#include <musicmetadata.h>
// mythmusic
#include "musicplayer.h"
class PlaylistContainer;
class Playlist;
class MythSystemLegacy;
enum InsertPLOption
{
PL_REPLACE = 1,
PL_INSERTATBEGINNING,
PL_INSERTATEND,
PL_INSERTAFTERCURRENT
};
enum PlayPLOption
{
PL_FIRST = 1,
PL_FIRSTNEW,
PL_CURRENT
};
struct PlaylistOptions
{
InsertPLOption insertPLOption;
PlayPLOption playPLOption;
};
typedef QList<MusicMetadata*> SongList;
class Playlist : public QObject
{
Q_OBJECT
public:
Playlist(void);
~Playlist();
void setParent(PlaylistContainer *myparent) { m_parent = myparent; }
void loadPlaylist(QString a_name, QString a_host);
void loadPlaylistByID(int id, QString a_host);
void savePlaylist(QString a_name, QString a_host);
void shuffleTracks(MusicPlayer::ShuffleMode mode);
void describeYourself(void) const; // debugging
void fillSongsFromSonglist(QString songList);
void fillSonglistFromQuery(QString whereClause,
bool removeDuplicates = false,
InsertPLOption insertOption = PL_REPLACE,
int currentTrackID = 0);
void fillSonglistFromSmartPlaylist(QString category, QString name,
bool removeDuplicates = false,
InsertPLOption insertOption = PL_REPLACE,
int currentTrackID = 0);
void fillSonglistFromList(const QList<int> &songList,
bool removeDuplicates,
InsertPLOption insertOption,
int currentTrackID);
QString toRawSonglist(bool shuffled = false, bool tracksOnly = false);
const SongList &getSongs(void) { return m_shuffledSongs; }
MusicMetadata* getSongAt(int pos);
int getCount(void) { return m_songs.count(); }
void moveTrackUpDown(bool flag, int where_its_at);
void moveTrackUpDown(bool flag, MusicMetadata *the_track);
bool checkTrack(int a_track_id) const;
void addTrack(int trackID, bool update_display);
void addTrack(MusicMetadata *mdata, bool update_display);
void removeTrack(int the_track_id);
void removeAllTracks(void);
void removeAllCDTracks(void);
void copyTracks(Playlist *to_ptr, bool update_display);
bool hasChanged(void) { return m_changed; }
void changed(void);
/// whether any changes should be saved to the DB
void disableSaves(void) { m_doSave = false; }
void enableSaves(void) { m_doSave = true; }
bool doSaves(void) { return m_doSave; }
QString getName(void) { return m_name; }
void setName(QString a_name) { m_name = a_name; }
int getID(void) { return m_playlistid; }
void setID(int x) { m_playlistid = x; }
void getStats(uint *trackCount, uint *totalLength, uint currentTrack = 0, uint *playedLength = NULL) const;
void computeSize(double &size_in_MB, double &size_in_sec);
int CreateCDMP3(void);
int CreateCDAudio(void);
private slots:
void mkisofsData(int fd);
void cdrecordData(int fd);
void processExit(uint retval = 0);
private:
QString removeDuplicateTracks(const QString &orig_songlist, const QString &new_songlist);
int m_playlistid;
QString m_name;
SongList m_songs;
SongList m_shuffledSongs;
QMap<int, MusicMetadata*> m_songMap;
PlaylistContainer *m_parent;
bool m_changed;
bool m_doSave;
MythProgressDialog *m_progress;
MythSystemLegacy *m_proc;
uint m_procExitVal;
};
#endif