#include <playlist.h>
Inheritance diagram for itunesdb::Playlist:
Public Types | |
enum | Sortorder { SORTORDER_MANUAL = 1, SORTORDER_TITLE = 3, SORTORDER_ALBUM = 4, SORTORDER_ARTIST = 5, SORTORDER_BITRATE = 6, SORTORDER_GENRE = 7, SORTORDER_FILETYPE = 8, SORTORDER_TIME_MODIFIED = 9, SORTORDER_TRACK_NR = 10, SORTORDER_SIZE = 11, SORTORDER_TIME = 12, SORTORDER_YEAR = 13, SORTORDER_SAMPLERATE = 14, SORTORDER_COMMENT = 15, SORTORDER_TIME_ADDED = 16, SORTORDER_EQUALIZER = 17, SORTORDER_COMPOSER = 18, SORTORDER_PLAYCOUNT = 20, SORTORDER_TIME_PLAYED = 21, SORTORDER_CD_NR = 22, SORTORDER_RATING = 23, SORTORDER_RELEASE_DATE = 24, SORTORDER_BPM = 25, SORTORDER_GROUPING = 26, SORTORDER_CATEGORY = 27, SORTORDER_DESCRIPTION = 28 } |
Public Member Functions | |
const QString & | getTitle () const |
void | setTitle (const QString &newtitle) |
Sortorder | getSortOrder () const |
bool | contains (Q_UINT32 trackID) const |
int | addPlaylistItem (Q_UINT32 trackid, int position=-1) |
Q_UINT32 | removeTrackAt (Iterator &pos) |
Q_UINT32 | removeTrackAt (uint pos) |
bool | removeAll (Q_UINT32 trackid) |
virtual Q_UINT32 | getTrackIDAt (uint pos) |
virtual Iterator | getTrackIDs () |
virtual ConstIterator | getTrackIDs () const |
virtual uint | getNumTracks () const |
Q_UINT64 | getID () const |
void | setID (Q_UINT64 id) |
void | sort () |
void | clear () |
virtual bool | isHidden () const |
SmartPlaylistRuleSet & | enableSmartPlaylist () |
bool | isSmartPlaylist () const |
void | discardSmartPlaylistData () |
SmartPlaylistRuleSet * | getSmartPlaylistRules () const |
bool | isPodcastList () const |
template<class JavaLikeTrackIterator> | |
void | addAll (JavaLikeTrackIterator trackIter) |
template<class CPPStyleTrackIterator> | |
void | addAll (CPPStyleTrackIterator trackIter, CPPStyleTrackIterator end) |
Public Attributes | |
enum itunesdb::Playlist::Sortorder | ItdbPlaylistSortOrder |
Protected Member Functions | |
Playlist (const Playlist &) | |
virtual PlaylistItem * | createNewItem (Q_UINT32 trackid) |
virtual QDataStream & | readFromStream (QDataStream &instream, bool *ok=NULL) |
virtual QDataStream & | writeToStream (QDataStream &outstream, bool isMainlist) |
virtual void | doneAddingData () |
virtual int | addPlaylistItem (PlaylistItem *item) |
virtual SmartPlaylistRuleSet * | createNewSplRuleSet () |
void | fillSplHeaderBuffer (QByteArray &buffer) const |
void | fillSplRulesBuffer (QByteArray &buffer) const |
virtual void | readNonStringMHOD (QDataStream &stream, Q_UINT32 type, Q_UINT32 blocklen) |
virtual uint | writeNonStringMHODs (QDataStream &outstream) const |
void | writeData (QByteArray &data, bool isMainlist) const |
void | writeTitle (QDataStream &stream) const |
void | writeLongPlaylist (QDataStream &stream) const |
void | writeTracks (QDataStream &stream) const |
Protected Attributes | |
TrackList_T | m_tracklist |
Q_UINT32 | hidden |
Q_UINT32 | timeStamp |
Q_UINT64 | m_id |
Q_UINT32 | unk3 |
Q_UINT16 | mIsPodcast |
Sortorder | m_order |
SmartPlaylistRuleSet * | mSplRuleSet |
Friends | |
class | ItunesDBParser |
class | ItunesDBWriter |
Classes | |
class | ConstIterator |
class | Iterator |
class | TrackList_T |
ITunesDB
related implementation ITunesDBPlaylist
addPlaylistItem( Q_UINT32, int )
method can be used to add tracks to the playlist, removeAll( Q_UINT32 )
and removeTrackAt( uint )
will remove them. For editing the rules of smart playlists use the getSmartPlaylistRules()
method to retrieve the SmartPlaylistRuleSet
and use its methods for manipulating the rules. To create a new smart playlist create a new playlist and use enableSmartPlaylist()
method to enable smart playlist behaviour. This method also returns the still empty SmartPlaylistRuleSet
ready for adding new rules.
const QString & itunesdb::Playlist::getTitle | ( | ) | const |
Returns the title of the playlist
void itunesdb::Playlist::setTitle | ( | const QString & | newtitle | ) |
Sets the title of the playlist
newtitle | the new title |
Playlist::Sortorder itunesdb::Playlist::getSortOrder | ( | ) | const |
Returns the sort order field of the playlist
bool itunesdb::Playlist::contains | ( | Q_UINT32 | trackID | ) | const |
Returns true if the playlist contains the specified trackid.
int itunesdb::Playlist::addPlaylistItem | ( | Q_UINT32 | trackid, | |
int | position = -1 | |||
) |
Adds a new PlaylistItem at the specified position to the list and sets the dirty flag to true. The position field only works if the playlists sort order is set to "manual" which is the only sort order implemented by this class, but may be ignored if you use the ITunesDBPlaylist
implementation and set the sort order to something other than manual.
trackid | the id of the track to add. Doesn't check if the track actually exists | |
position | the position field as found in the itunesdb mhip playlist item, or -1 if the item should just be appended to the list |
ITunesDBPlaylist
for a full implementation of itunesDBs playlists Q_UINT32 itunesdb::Playlist::removeTrackAt | ( | Iterator & | pos | ) |
Removes the track at the position the given Iterator points to and returns the former trackid at that position. If the Iterator doesn't point to an element in this list PLAYLISTITEM_INVALID (as defined in playlistitem.h) is returned. After the operation the given Iterator will point to the next element.
Q_UINT32 itunesdb::Playlist::removeTrackAt | ( | uint | pos | ) |
Removes the track at the given position and returns the former trackid at that position. If the given position is out of range PLAYLISTITEM_INVALID (as defined in playlistitem.h) is returned.
bool itunesdb::Playlist::removeAll | ( | Q_UINT32 | trackid | ) |
Removes all occurences of the track with the given ID. Returns true if an element with the given trackid existed and was removed, false otherwise.
Q_UINT32 itunesdb::Playlist::getTrackIDAt | ( | uint | pos | ) | [virtual] |
Returns the trackID at the given position or PLAYLISTITEM_INVALID (as defined in playlistitem.h) if the given position is either negative or above the last element in the list.
Playlist::Iterator itunesdb::Playlist::getTrackIDs | ( | ) | [virtual] |
Returns an iterator over all tracks in this playlist. The iterator works like a java iterator - you can check if there are any elements left with the Iterator::hasNext()
method and get the next element with the Iterator::next()
method.
Playlist::ConstIterator itunesdb::Playlist::getTrackIDs | ( | ) | const [virtual] |
The const version of the above method. Returns an iterator over all tracks in this playlist.
uint itunesdb::Playlist::getNumTracks | ( | ) | const [virtual] |
Returns the number of tracks in this playlist
Q_UINT64 itunesdb::Playlist::getID | ( | ) | const [inline] |
Returns the unique DB id for this playlist
void itunesdb::Playlist::setID | ( | Q_UINT64 | id | ) |
Sets the unique DB id for this playlist
id | the unique DB id for this playlist |
void itunesdb::Playlist::sort | ( | ) |
Sorts the playlistItems by position.
void itunesdb::Playlist::clear | ( | ) |
Empties the playlist. After a call to this method the getNumTracks()
method returns 0.
virtual bool itunesdb::Playlist::isHidden | ( | ) | const [inline, virtual] |
Returns true if this playlist is hidden.
SmartPlaylistRuleSet & itunesdb::Playlist::enableSmartPlaylist | ( | ) |
Enables Smart Playlist Behaviour by creating a SmartPlaylistRuleSet.
bool itunesdb::Playlist::isSmartPlaylist | ( | ) | const |
Returns true if this playlist is a smart playlist.
void itunesdb::Playlist::discardSmartPlaylistData | ( | ) |
Discards smart playlist data thus making it a normal playlist. The items in this playlist will be kept.
SmartPlaylistRuleSet * itunesdb::Playlist::getSmartPlaylistRules | ( | ) | const |
Returns the SmartPlaylistRuleSet making up this smart playlist, or NULL IF this playlist isn't a SmartPlaylist. All smart playlist behaviour can be / is controlled by the returned object.
bool itunesdb::Playlist::isPodcastList | ( | ) | const [inline] |
Returns true if this playlist is a podcast list
void itunesdb::Playlist::addAll | ( | JavaLikeTrackIterator | trackIter | ) | [inline] |
Adds all tracks delivered by the given Iterator.
void itunesdb::Playlist::addAll | ( | CPPStyleTrackIterator | trackIter, | |
CPPStyleTrackIterator | end | |||
) | [inline] |
Adds all tracks delivered by the given Iterator.
PlaylistItem * itunesdb::Playlist::createNewItem | ( | Q_UINT32 | trackid | ) | [protected, virtual] |
Creates a new PlaylistItem. Override this method if you need your own PlaylistItem implementation.
Reimplemented in ITunesDBPlaylist.
void itunesdb::Playlist::doneAddingData | ( | ) | [protected, virtual] |
override from ListItem::doneAddingData()
Reimplemented from itunesdb::ListItem.
int itunesdb::Playlist::addPlaylistItem | ( | PlaylistItem * | item | ) | [protected, virtual] |
Adds a new playlist item to the internal list.
void itunesdb::Playlist::writeLongPlaylist | ( | QDataStream & | stream | ) | const [protected] |
writes the stuff uiTunes would write as the second mhod for playlists. We don't use it - it's just here for completeness
void itunesdb::Playlist::writeTracks | ( | QDataStream & | stream | ) | const [protected] |
Writes the track list