Qt Components Hildon  0.20
QML components for Maemo5 with Hildon styling.
 All Classes Functions Properties Groups Pages
Public Slots | Signals | Public Member Functions | Properties | List of all members
NowPlayingModel Class Reference

Provides a 'Now playing' playlist. More...

Public Slots

void clearItems ()
 Clears all items from the playlist.
void loadItems ()
 Loads items from the MAFW playlist into the model.
void next ()
 Moves to the next item in the playlist.
void previous ()
 Moves to the previous item in the playlist.

Signals

void ready ()
 This signal is emitted when MAFW playlist has been loaded and is ready to be accessed.

Public Member Functions

void appendItem (string id)
 Adds the source with the specifed id to the playlist.
void appendSource (string uri)
 Adds the source with the specifed uri to the playlist.
void insertItem (int row, string id)
 Inserts the with the specified id before index.
void insertSource (int row, string uri)
 Inserts the with the specified uri before index.
void moveItem (int from, int to)
 Moves the item at from to to.
variant property (int row, string name)
 Returns the value of the property with name name of the item at row.
void removeItem (int row)
 Removes the item at row from the playlist.

Properties

int count
 The number of items in the playlist.
MediaType::Type mediaType
 The type of media used for the playlist.
int position
 The current position in the playlist.
bool repeat
 Whether the playlist will be repeated.
bool shuffle
 Whether the playlist will be shuffled.

Detailed Description

Provides a 'Now playing' playlist.

The NowPlayingModel component can be used with the Audio component to provide a 'Now playing' playlist. Items added to the playlist are used for playback by the MAFW multimedia backend.

Example:

import QtQuick 1.0
import org.hildon.components 1.0
import org.hildon.multimedia 1.0
Window {
id: window
title: "Now playing"
visible: true
id: player
}
id: view
anchors.fill: parent
model: NowPlayingModel {
id: playlist
mediaType: MediaType.Audio
onReady: {
appendSource("/home/user/MyDocs/music_file_1.mp3");
appendSource("/home/user/MyDocs/music_file_2.mp3");
appendSource("/home/user/MyDocs/music_file_3.mp3");
}
}
delegate: ListItem {
anchors {
fill: parent
margins: platformplatformStyle.paddingMedium
}
verticalAlignment: Text.AlignVCenter
text: title
}
onClicked: playlist.position = index
}
}
}
See Also
Audio

Member Function Documentation

void NowPlayingModel::appendItem ( string  id)

Adds the source with the specifed id to the playlist.

If id represents a local file, the metadata for the source will be loaded.

See Also
appendSource()
void NowPlayingModel::appendSource ( string  uri)

Adds the source with the specifed uri to the playlist.

If uri represents a local file, the metadata for the source will be loaded.

See Also
appendItem()
void NowPlayingModel::insertItem ( int  row,
string  id 
)

Inserts the with the specified id before index.

If id represents a local file, the metadata for the source will be loaded.

See Also
insertSource()
void NowPlayingModel::insertSource ( int  row,
string  uri 
)

Inserts the with the specified uri before index.

If uri represents a local file, the metadata for the source will be loaded.

See Also
insertItem()
void NowPlayingModel::next ( )
slot

Moves to the next item in the playlist.

See Also
position
void NowPlayingModel::previous ( )
slot

Moves to the previous item in the playlist.

See Also
position
variant NowPlayingModel::property ( int  row,
string  name 
)

Returns the value of the property with name name of the item at row.

Valid property names are:

Name
albumArtist
albumTitle
artist
audioBitRate
audioCodec
comment
composer
copyright
coverArtUrl
date
description
duration
genre
id
keywords
lastPlayed
lastThumbnailUrl
lyrics
mimeType
playCount
resolution
resumePosition
size
thumbnailUrl
title
trackNumber
url
videoBitRate
videoCodec
videoFrameRate
year

Property Documentation

MediaType::Type NowPlayingModel::mediaType
readwrite

The type of media used for the playlist.

Possible values are:

Value Description
MediaType.Audio Audio files (default).
MediaType.Radio Internet radio streams.
MediaType.Video Video files.

Changing this property will clear the data in the model, but not the MAFW playlist. Call clearItems() to clear the MAFW playlist.

int NowPlayingModel::position
readwrite

The current position in the playlist.

See Also
next(), previous()
bool NowPlayingModel::repeat
readwrite

Whether the playlist will be repeated.

The default value is false.

bool NowPlayingModel::shuffle
readwrite

Whether the playlist will be shuffled.

The default value is false.