1
#ifndef NOATUNPLAYLIST_H
2
#define NOATUNPLAYLIST_H
9
* Do not, under any circumstances, call a Playlist method
10
* when you can call a Player method, unless, of course, you
15
friend class Downloader;
18
* if dl is true, then download this ASAP
19
* dl implicitly becomes false if u==0 or
22
PlaylistItem(const KURL &u=0, bool dl=true);
23
virtual ~PlaylistItem();
27
* it may just be the ID3 tag, but I can't guarantee it
29
QString title() const;
31
* set the title of the song (ID3 loaders do this)
32
* also, note that that rather then overridering
33
* this, you should prefer modified()
35
virtual void setTitle(const QString &t);
38
* return the location as local, or null if
39
* file hasn't yet started downloading
44
* is the file completely downloaded?
45
* if so, file() will return the name
47
bool isDownloaded() const;
49
* if false, don't try to play the file
50
* if true, go ahead, but it may not
53
bool playable() const;
56
virtual void setUrl(const KURL &u, bool dl=true);
60
* The format is cc:cc/ll:ll where c is current
63
QString lengthString() const;
66
* If you can identify the length of this file
67
* set it, in milliseconds. The engine will do it
70
* If unknown, the length will be -1
72
virtual void setLength(int msec);
75
* length of the song in seconds, or -1 if unknown
77
int length() const { return mLength; }
80
* retursn the mimetype for this file
83
QCString mimetype() const;
86
* returns the mimetype's associated extentions
88
QStrList extension() const;
91
* exactly the same as file()
93
operator QString() const { return file(); }
96
* return the net-location
98
operator KURL() const { return url(); }
101
* Noatun stores file properties in the form
102
* of Atoms. To get an atom, give a name for it,
103
* and it'l return the value, or @p def
106
* To implement an atom, the keys can't conflict
107
* so, here's the format:
108
* PluginName:AtomName
110
* The core doesn't need the "PluginName" part.
112
* Internally, we use the following <b>case sensitive</b> keys, so far:
114
* title, artist, album, date, comment
116
* If you, the Noatun Plugin Developer wants
117
* to add a new atom, that in some way or another
118
* should be standard (Like fps for Frames/Second). <b>Contact
121
* A Key name that ends with an underscore is not visible
122
* to the user, and the value can be generic crap encoding in
125
QString property(const QString &key, const QString &def=0) const;
128
* Set the said property for the given key
129
* Clearing it first if it already exists.
131
* Send changed can be left alone
133
void setProperty(const QString &key, const QString &property, bool sendchanged=true);
136
* Clear the property for the given key in this item
138
void clearProperty(const QString &key, bool sendchanged=false);
141
* Returns a list of all properties. the best playlist will be
142
* able to store them all between noatun sessions
144
QStringList properties() const;
147
* returns whether the given key exists as a property
149
bool isProperty(const QString &key) const;
151
protected: // methods accessed by Downloader (friend)
153
* this file is done downloading
155
virtual void doneDownloading();
158
* called every so often when the percent of download
161
virtual void downloaded(int percent);
164
* called when the title or length, or when
165
* the file is done downloading
167
virtual void modified();
170
* download timed out, by default, delete this
172
virtual void timeout();
179
QDict<QString> mProperties;
183
* The playlist, which you derive from when creating
186
* Do not, under any circumstances, call a Playlist method
187
* when you can call a Player method, unless, of course, you
190
class Playlist : public QObject
193
friend class PlaylistItem;
195
Playlist(QObject *parent, const char *name);
200
virtual void reset()=0;
205
virtual void clear()=0;
209
virtual void addFile(const KURL&, bool play=false)=0;
212
* cycle forward, return that
214
virtual PlaylistItem *next()=0;
218
virtual PlaylistItem *current()=0;
220
* cycle back, return that
222
virtual PlaylistItem *previous()=0;
227
virtual PlaylistItem *getFirst() const =0;
230
* get the item after item
232
virtual PlaylistItem *getAfter(const PlaylistItem *item) const =0;
235
* is the view visible?
237
virtual bool listVisible() const =0;
239
* do the KCmdLineArgs stuff
241
int handleArguments();
244
* Clear the properties in all the playlistitems
245
* in which the key is equal to the given
247
* This requires @ref getFirst and @ref getAfter to work :)
249
virtual void clearProperties(const QString &key, bool sendchanged=true);
255
virtual void showList()=0;
259
virtual void hideList()=0;
263
virtual void toggleList();
267
virtual void remove(PlaylistItem*)=0;
271
* when item @p item is deleted from the
272
* playlist. the item itself has no such
273
* signal since it's not a QObject
275
* This is called by the internals to signal
278
void removed(PlaylistItem *item);
280
* when you want the engine to reload current()
284
* when the list is hidden
288
* when the list is shown
292
* they just added one that will be played when
293
* the play button is pressed. emit this when no file
294
* has been replace by some file, not always.
299
* A new item has been allocated, this is
300
* called by the internals
302
void added(PlaylistItem *item);
305
void deleted(PlaylistItem *item);