Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QMediaPlaylist Class Reference
[QtMediaModule]

The QMediaPlaylist class provides the basics for playlist handling of media content. More...

    #include <QMediaPlaylist>

Inherits QAbstractListModel.

Public Types

Public Functions

Signals

Static Public Members

Additional Inherited Members


Detailed Description

The QMediaPlaylist class provides the basics for playlist handling of media content.

The QMediaPlaylist class is useful for efficient handling and displaying media content. QMediaPlaylist class is implicitly shared, so can be passed around as arguments with minimal cost. Unless a QMediaPlaylist is explicitly copied via the copy() function, all modifications to a playlist object will be reflected in all other shared copies.

QMediaPlaylist is also derived from QAbstractListModel, and as such can be used by the model/view framework, or as the data source for a QMediaList object.

    mediaPlaylist = new QMediaPlayList();
    todo();

Member Type Documentation

enum QMediaPlaylist::DataRole

ConstantValueDescription
QMediaPlaylist::TitleQt::DisplayRoleTitle of media
QMediaPlaylist::UrlQt::UserRoleFilename, http address
QMediaPlaylist::Artist?Artist of media
QMediaPlaylist::Album?Album of media
QMediaPlaylist::Genre?Genre of media
QMediaPlaylist::AlbumCover?Cover image of media

enum QMediaPlaylist::Probability

ConstantValueDescription
QMediaPlaylist::Frequent0Play this track a greater frequency when compared to tracks of other ratings.
QMediaPlaylist::Infrequent1Play this track a lower frequency when compared to tracks of other ratings.
QMediaPlaylist::Never2Don't play this track again.
QMediaPlaylist::Unrated3Play this track a moderate frequency when compared to tracks of other ratings. This is the default probability rating for unrated tracks.


Member Function Documentation

QMediaPlaylist::QMediaPlaylist ()

Constructs an empty QMediaPlaylist object.

QMediaPlaylist::QMediaPlaylist ( const QString & filename )

Constructs a new QMediaPlaylist object. If filename is a url, or an unknown file format, tries to create a playlist, one entry per line from the file. If the file extension has been previously registered via registerTypeHandler(), then loading will be handed off to the registered file type loader.

See also registerTypeHandler().

QMediaPlaylist::QMediaPlaylist ( const QMediaPlaylist & playlist )

Constructs a shared copy of playlist.

QMediaPlaylist::QMediaPlaylist ( const QStringList & files )

Constructs a new QMediaPlaylist object, one entry per line from files.

QMediaPlaylist::QMediaPlaylist ( const QContentFilter & filter )

Constructs a new QMediaPlaylist object, using a QContentSet with passed filter to initialise.

QMediaPlaylist::~QMediaPlaylist ()   [virtual]

Destroys the playlist.

void QMediaPlaylist::clear ()   [virtual]

Removes all items from the playlist.

QContent QMediaPlaylist::content ( const QModelIndex & index ) const

Returns the QContent object for the media located at index.

void QMediaPlaylist::copy ( const QMediaPlaylist & other )   [virtual]

Creates a deep copy of playlist other.

void QMediaPlaylist::enqueue ( const QMediaPlaylist & playlist )   [virtual]

Appends the playlist onto the end of the current playlist. If the current playlist is empty, falls through to playNow().

QModelIndex QMediaPlaylist::firstIndex ()

Returns the index of the first media item in the playlist.

bool QMediaPlaylist::isShuffle () const   [virtual]

Returns true if shuffle has been set on this playlist.

QModelIndex QMediaPlaylist::nextIndex ()

Returns the index of the next media item in the playlist.

void QMediaPlaylist::playFirst ()   [virtual]

Sets the playing index to the first media in the playlist.

void QMediaPlaylist::playNext ()   [virtual]

Sets the playing index to the next media in the playlist.

void QMediaPlaylist::playNow ( const QMediaPlaylist & playlist )   [virtual]

Replaces the current playlist with playlist, and calls playFirst().

void QMediaPlaylist::playPrevious ()   [virtual]

Sets the playing index to the previous media in the playlist.

QModelIndex QMediaPlaylist::playing () const   [virtual]

Returns the index of the currently playing track.

See also setPlaying().

void QMediaPlaylist::playingChanged ( const QModelIndex & index )   [signal]

This signal is emitted whenever the current playing index is changed.

See also setPlaying().

QModelIndex QMediaPlaylist::previousIndex ()

Returns the index of the previous media item in the playlist.

Probability QMediaPlaylist::probability ( const QModelIndex & index ) const   [virtual]

Returns the shuffle mode probability setting of the media located at index.

See also setProbability() and setShuffle().

void QMediaPlaylist::registerTypeHandler ( const QString & extension, QPlaylistHandlerInterface * handler )   [static]

Registers a playlist load/save handler for the given file extension.

See also load() and save().

void QMediaPlaylist::remove ( const QModelIndex & index )   [virtual]

Removes the item at index.

void QMediaPlaylist::resetProbabilities ()   [virtual]

Resets the shuffle mode probabilities of all media items in the playlist to QMediaPlaylist::Unrated.

See also setProbability().

bool QMediaPlaylist::save ( const QString & filename ) const   [virtual]

Saves the playlist into filename. If a handler is registered for the file extension of the filename, then the handler will be called to save the file, otherwise it will return false and not save the file.

void QMediaPlaylist::setPlaying ( const QModelIndex & index )   [virtual]

Sets the currently playing track to index.

See also playingChanged().

void QMediaPlaylist::setProbability ( const QModelIndex & index, Probability probability )   [virtual]

Sets the shuffle probability for the media located at index.

See also probability(), setShuffle(), and setShuffleValues().

void QMediaPlaylist::setShuffle ( bool shuffle )   [virtual]

Turns on or off shuffle functionality on this playlist. Shuffle is a special weighted play queue, that dynamically resizes to keep shuffleTotalCount() items visible, with shuffleHistoryCount() number of songs visible as "history" when shuffle is set to true. Using probabilities set via setProbability(), tracks are added as needed to then end of the queue as the play location is moved, and the history is shrunk to maintain maximum of shuffleHistoryCount() number of recently played entries.

See also isShuffle(), setShuffleValues(), and setProbability().

void QMediaPlaylist::setShuffleValues ( int historyCount, int totalCount )

Sets historyCount number of recently played entries, and totalCount total number of entries in the list when shuffle mode is turned on.

See also setShuffle() and setProbability().

int QMediaPlaylist::shuffleHistoryCount ()

Returns the shuffle mode history value.

See also setShuffleValues() and setShuffle().

int QMediaPlaylist::shuffleTotalCount ()

Returns the shuffle mode history value.

See also setShuffleValues() and setShuffle().

QString QMediaPlaylist::suggestedName () const   [virtual]

Returns a suggested filename for saving the playlist to.

See also save().

void QMediaPlaylist::unregisterTypeHandler ( const QString & extension )   [static]

Unregisters a playlist load/save handler for the given file extension.

bool QMediaPlaylist::operator!= ( const QMediaPlaylist & other ) const

If other is a shared copy of this playlist, return false, otherwise, compare internal values and if they match up, return false.

QMediaPlaylist & QMediaPlaylist::operator= ( const QMediaPlaylist & other )

Sets this playlist to be a shallow copy of other. Any modifications to the other playlist object will be reflected by this object, and vice-versa.

bool QMediaPlaylist::operator== ( const QMediaPlaylist & other ) const

If other is a shared copy of this playlist, return true, otherwise, compare internal values and if they match up, return true.


Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3