ITunesDBPlaylist Class Reference

#include <itunesdb.h>

Inheritance diagram for ITunesDBPlaylist:

itunesdb::Playlist itunesdb::ListItem List of all members.

Public Member Functions

virtual itunesdb::PlaylistItemcreateNewItem (Q_UINT32 itemid)
void updateSmartPlaylist (bool force=false)
void setSortOrder (Sortorder sortOrder)
itunesdb::TrackgetTrackAt (uint position)

Protected Member Functions

virtual void readNonStringMHOD (QDataStream &stream, Q_UINT32 type, Q_UINT32 blocklen)
virtual void setDirty (bool dirtyFlag=true)
virtual itunesdb::SmartPlaylistRuleSetcreateNewSplRuleSet ()

Friends

class ITunesDB

Classes

class  Entry

Detailed Description

Special playlist implementation to use with the ITunesDB class. This adds important functionalities like setting the sort order and updating the contents of smart playlists.
To create a new ITunesDBPlaylist instance use the ITunesDB::createNewPlaylist( const QString& ) factory method and use the ITunesDB::addPlaylist( ITunesDBPlaylist* ) to add it to the database.
Here is an example on how to create a "recently played" Smart Playlist:

  // create a new playlist
  ITunesDBPlaylist * recentlyPlayed = itunesdb.createNewPlaylist( "recently played" );
  recentlyPlayed->setSortOrder( Playlist::SORTORDER_TIME_PLAYED );

  // make it a smart playlist and get the ruleset
  SmartPlaylistRuleSet& ruleSet = recentlyPlayed->enableSmartPlaylist();

  // add the rule "last played in the last 2 weeks"
  ruleSet.addInTheLastRule( FIELD_LASTPLAYED, false, -2, IN_THE_LAST_WEEKS );

  // limit to the first 30 songs, sorted by last played date
  ruleSet.setLimits( LIMIT_SORT_LASTPLAYED, LIMIT_TYPE_SONGS, 30 );

  // match ANY rule (doesn't really matter since we only have one rule)
  ruleSet.setMatchAnyFlag( true );

  // enable live update (updates the playlist on the go)
  ruleSet.setLiveUpdateFlag( true );

  // finally add the playlist to the database
  itunesdb.addPlaylist( recentlyPlayed );
 


Member Function Documentation

PlaylistItem * ITunesDBPlaylist::createNewItem ( Q_UINT32  itemid  )  [virtual]

Creates a new instance of the Entry class.

Reimplemented from itunesdb::Playlist.

void ITunesDBPlaylist::updateSmartPlaylist ( bool  force = false  ) 

Updates the content of this smart playlist against the database Nothing happens if this playlist is not a smart playlist.

See also:
itunesdb::Playlist::enableSmartPlaylist()

itunesdb::Playlist::getSmartPlaylistRules()

void ITunesDBPlaylist::setSortOrder ( Sortorder  sortOrder  ) 

Sets the sort order field.

See also:
itunesdb::Playlist::ItdbPlaylistSortOrder

Track * ITunesDBPlaylist::getTrackAt ( uint  position  ) 

Returns the track the playlist entry at the given position is referring to

void ITunesDBPlaylist::readNonStringMHOD ( QDataStream &  stream,
Q_UINT32  type,
Q_UINT32  blocklen 
) [protected, virtual]

reads mhods with type above type 15 (mhods not containing strings)

Reimplemented from itunesdb::Playlist.


The documentation for this class was generated from the following files:
Generated on Tue Dec 12 16:39:27 2006 for libqtpod.kdevelop by  doxygen 1.5.1