PlayListModel Class Reference

The PlayListModel class provides a data model for the playlist. More...

#include <playlistmodel.h>

List of all members.

Public Types

enum  SortMode {
  TITLE, ALBUM, ARTIST, FILENAME,
  PATH_AND_FILENAME, DATE, TRACK
}

Public Slots

void add (PlayListItem *item)
void add (QList< PlayListItem * > items)
void clear ()
void clearSelection ()
void removeSelected ()
void removeUnselected ()
void removeAt (int i)
void removeItem (PlayListItem *item)
void invertSelection ()
void selectAll ()
void showDetails ()
void doCurrentVisibleRequest ()
void addFile (const QString &path)
void addFiles (const QStringList &l)
void addDirectory (const QString &dir)
bool setFileList (const QStringList &l)
void addFileList (const QStringList &l)
void randomizeList ()
void reverseList ()
void prepareForShufflePlaying (bool yes)
void prepareForRepeatablePlaying (bool)
void sortSelection (int mode)
void sort (int mode)
void addToQueue ()
void setQueued (PlayListItem *f)
void removeInvalidItems ()
void removeDuplicates ()

Signals

void listChanged ()
void currentChanged ()
void firstAdded ()
void nameChanged (const QString &name)

Public Member Functions

 PlayListModel (const QString &name, QObject *parent=0)
 ~PlayListModel ()
QString name () const
void setName (const QString &name)
int count ()
PlayListItemcurrentItem ()
PlayListItemnextItem ()
int row (PlayListItem *item) const
PlayListItemitem (int row) const
int currentRow ()
bool setCurrent (int row)
bool isSelected (int row)
void setSelected (int row, bool select)
bool next ()
bool previous ()
QList< QString > getTitles (int first, int last)
QList< QString > getTimes (int first, int last)
void moveItems (int from, int to)
bool isQueued (PlayListItem *item) const
void setCurrentToQueued ()
bool isEmptyQueue () const
int queuedIndex (PlayListItem *item) const
const SimpleSelectiongetSelection (int row)
QList< int > getSelectedRows () const
QList< PlayListItem * > getSelectedItems () const
QList< PlayListItem * > items () const
int firstSelectedUpper (int row)
int firstSelectedLower (int row)
int totalLength () const
void loadPlaylist (const QString &f_name)
void savePlaylist (const QString &f_name)
bool isRepeatableList () const
bool isShuffle () const
bool contains (const QString &url)


Detailed Description

The PlayListModel class provides a data model for the playlist.

Author:
Vladimir Kuznetsov <vovanec@gmail.com>

Ilya Kotov <forkotov02@hotmail.ru>


Member Enumeration Documentation

Enum of available sort modes

Enumerator:
TITLE  by title
ALBUM  by album
ARTIST  by artist
FILENAME  by file name
PATH_AND_FILENAME  by path and file name
DATE  by date
TRACK  by track


Constructor & Destructor Documentation

PlayListModel::PlayListModel ( const QString &  name,
QObject *  parent = 0 
)

Constructs a playlist model.

Parameters:
name Playlist name.
parent QObject parent

PlayListModel::~PlayListModel (  ) 

Object destructor.


Member Function Documentation

void PlayListModel::add ( QList< PlayListItem * >  items  )  [slot]

Adds a list of items to the playlist.

Parameters:
items List of items

void PlayListModel::add ( PlayListItem item  )  [slot]

Adds item to the playlist.

void PlayListModel::addDirectory ( const QString &  dir  )  [slot]

Adds dir to the model.

void PlayListModel::addFile ( const QString &  path  )  [slot]

Adds file path to the playlist. File should be supported.

void PlayListModel::addFileList ( const QStringList &  l  )  [slot]

Loads list of files (regular files or directories)

void PlayListModel::addFiles ( const QStringList &  l  )  [slot]

Adds the list l of files to the model.

void PlayListModel::addToQueue (  )  [slot]

Adds selected items to play queue.

void PlayListModel::clear (  )  [slot]

Removes all items.

void PlayListModel::clearSelection (  )  [slot]

Clears selection.

bool PlayListModel::contains ( const QString &  url  ) 

Returns true if the playlist contains an item with URL url; otherwise returns false.

int PlayListModel::count (  ) 

Returns number of items.

void PlayListModel::currentChanged (  )  [signal]

Emitted when current item has changed.

PlayListItem* PlayListModel::currentItem (  ) 

Returns the current item.

int PlayListModel::currentRow (  ) 

Returns current row.

void PlayListModel::doCurrentVisibleRequest (  )  [slot]

Emits update signals manually.

void PlayListModel::firstAdded (  )  [signal]

Emitted when first item has added.

int PlayListModel::firstSelectedLower ( int  row  ) 

Returns number of first item that selected lower the row item.

int PlayListModel::firstSelectedUpper ( int  row  ) 

Returns number of first item that selected upper the row item.

QList<PlayListItem*> PlayListModel::getSelectedItems (  )  const

Returns list of PlayListItem pointers that are selected.

QList<int> PlayListModel::getSelectedRows (  )  const

Returns list with selected rows indexes.

const SimpleSelection& PlayListModel::getSelection ( int  row  ) 

Returns current selection(playlist can contain a lot of selections, this method returns selection which row belongs to)

QList<QString> PlayListModel::getTimes ( int  first,
int  last 
)

Returns a list of the formated durations.

Parameters:
first First item.
last Last item.

QList<QString> PlayListModel::getTitles ( int  first,
int  last 
)

Returns a list of the formated titles.

Parameters:
first First item.
last Last item.

void PlayListModel::invertSelection (  )  [slot]

Inverts selection (selects unselected items and unselects selected items)

bool PlayListModel::isEmptyQueue (  )  const

Returns true if play queue is empty,otherwise returns - false.

bool PlayListModel::isQueued ( PlayListItem item  )  const

Returns true if f file is in play queue, else returns false

bool PlayListModel::isRepeatableList (  )  const

Returns state of "Repeat All" option.

bool PlayListModel::isSelected ( int  row  ) 

Returns true if row is selected, otherwise returns false

bool PlayListModel::isShuffle (  )  const

Returns state of "Shuffle" option.

PlayListItem* PlayListModel::item ( int  row  )  const

Returns the item of the row or 0 if item doesn't exist.

QList<PlayListItem*> PlayListModel::items (  )  const [inline]

Returns list of all PlayListItem pointers.

void PlayListModel::listChanged (  )  [signal]

Emitted when the state of PlayListModel has changed.

void PlayListModel::loadPlaylist ( const QString &  f_name  ) 

Loads playlist with f_name name.

void PlayListModel::moveItems ( int  from,
int  to 
)

Moves the item at index position from to index position to

QString PlayListModel::name (  )  const

Returns playlist name.

void PlayListModel::nameChanged ( const QString &  name  )  [signal]

Emitted when playlist name has chanded.

Parameters:
name New playlist name.

bool PlayListModel::next (  ) 

Advances to the next item. Returns false if next iten doesn't exist, otherwise returns true

PlayListItem* PlayListModel::nextItem (  ) 

Returns the next playing item or 0 if next item is unknown.

void PlayListModel::prepareForRepeatablePlaying ( bool   )  [slot]

Prepares model for shuffle playing. yes parameter is true - model iterates in repeat mode.

void PlayListModel::prepareForShufflePlaying ( bool  yes  )  [slot]

Prepares model for shuffle playing. yes parameter is true - model iterates in shuffle mode.

bool PlayListModel::previous (  ) 

Goes back to the previous item. Returns false if previous iten doesn't exist, otherwise returns true

int PlayListModel::queuedIndex ( PlayListItem item  )  const [inline]

Returns index of f file in queue.e

void PlayListModel::randomizeList (  )  [slot]

Randomly changes items order.

void PlayListModel::removeAt ( int  i  )  [slot]

Removes items with i index.

void PlayListModel::removeDuplicates (  )  [slot]

Removes duplicate items by URL.

void PlayListModel::removeInvalidItems (  )  [slot]

Removes invalid items from playlist

void PlayListModel::removeItem ( PlayListItem item  )  [slot]

Removes item item from playlist

void PlayListModel::removeSelected (  )  [slot]

Removes selected items.

void PlayListModel::removeUnselected (  )  [slot]

Removes unselected items.

void PlayListModel::reverseList (  )  [slot]

Reverces items order.

int PlayListModel::row ( PlayListItem item  )  const [inline]

Returns the row of the item

void PlayListModel::savePlaylist ( const QString &  f_name  ) 

Saves current songs to the playlist with f_name name.

void PlayListModel::selectAll (  )  [slot]

Selects all items.

bool PlayListModel::setCurrent ( int  row  ) 

Sets current row number. Returns false if item with this number doesn't exist, otherwise returns true

Parameters:
row Number of item.

void PlayListModel::setCurrentToQueued (  ) 

Sets current song to the file that is nex in queue, if queue is empty - does nothing

bool PlayListModel::setFileList ( const QStringList &  l  )  [slot]

Removes previous items and loads list of files (regular files or directories), returns true if at least one file has been successfully loaded, otherwise returns false

void PlayListModel::setName ( const QString &  name  ) 

Sets the name of the playlist to name.

void PlayListModel::setQueued ( PlayListItem f  )  [slot]

Sets f media file to queue.

void PlayListModel::setSelected ( int  row,
bool  select 
)

Sets the selected state of the item to select

Parameters:
row Number of item.
select Selection state (true - select, false - unselect)

void PlayListModel::showDetails (  )  [slot]

Shows details for the first selected item.

void PlayListModel::sort ( int  mode  )  [slot]

Sorts items in mode sort mode.

void PlayListModel::sortSelection ( int  mode  )  [slot]

Sorts selected items in mode sort mode.

int PlayListModel::totalLength (  )  const [inline]

Returns total lenght in seconds of all songs.


The documentation for this class was generated from the following file:

Generated on Sat Mar 27 19:43:01 2010 for Qmmp by  doxygen 1.5.9