Qmmp
Public Types | Public Slots | Signals | Public Member Functions
PlayListModel Class Reference

#include <playlistmodel.h>

List of all members.

Public Types

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

Public Slots

void add (PlayListItem *item)
void add (QList< PlayListItem * > items)
void add (const QString &path)
void add (const QStringList &paths)
void clear ()
void clearSelection ()
void removeSelected ()
void removeUnselected ()
void removeAt (int i)
void removeItem (PlayListItem *item)
void invertSelection ()
void selectAll ()
void showDetails (QWidget *parent=0)
void doCurrentVisibleRequest ()
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 ()
void clearQueue ()
void stopAfterSelected ()

Signals

void listChanged ()
void currentChanged ()
void itemAdded (PlayListItem *item)
void nameChanged (const QString &name)
void loaderFinished ()

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 setCurrent (PlayListItem *item)
bool isSelected (int row)
void setSelected (int row, bool selected=true)
bool next ()
bool previous ()
QStringList getTitles (int first, int last)
QStringList 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
int queueSize () const
bool isStopAfter (PlayListItem *item) const
const SimpleSelectiongetSelection (int row)
QList< int > selectedRows () const
QList< PlayListItem * > selectedItems () 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 isLoaderRunning () 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 SortMode

Enum of available sort modes

Enumerator:
TITLE 

by title

ALBUM 

by album

DISCNUMBER 

by discnumber

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 ( const QString &  name,
QObject *  parent = 0 
)

Constructs a playlist model.

Parameters:
namePlaylist name.
parentQObject parent

Object destructor.


Member Function Documentation

void add ( PlayListItem item) [slot]

Adds item to the playlist.

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

Adds a list of items to the playlist.

Parameters:
itemsList of items.
void add ( const QString &  path) [slot]

Adds a list of files and directories to the playlist

Parameters:
pathFull path of file or directory.
void add ( const QStringList &  paths) [slot]

Adds a list of files and directories to the playlist

Parameters:
pathsFull paths of files and directories.
void addToQueue ( ) [slot]

Adds/removes selected items to/from playback queue.

void clear ( ) [slot]

Removes all items.

void clearQueue ( ) [slot]

Removes all items from queue.

void clearSelection ( ) [slot]

Clears selection.

bool contains ( const QString &  url)

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

int count ( )

Returns number of items.

void currentChanged ( ) [signal]

Emitted when current item has changed.

Returns the current item.

int currentRow ( )

Returns current row.

void doCurrentVisibleRequest ( ) [slot]

Emits update signals manually.

int firstSelectedLower ( int  row)

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

int firstSelectedUpper ( int  row)

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

const SimpleSelection& getSelection ( int  row)

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

QStringList getTimes ( int  first,
int  last 
)

Returns a list of the formatted durations.

Parameters:
firstFirst item.
lastLast item.
QStringList getTitles ( int  first,
int  last 
)

Returns a list of the formated titles.

Parameters:
firstFirst item.
lastLast item.
void invertSelection ( ) [slot]

Inverts selection (selects unselected items and unselects selected items)

bool isEmptyQueue ( ) const

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

bool isLoaderRunning ( ) const

Returns true if the file loader thread is active; otherwise returns false.

bool isQueued ( PlayListItem item) const

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

bool isRepeatableList ( ) const

Returns state of "Repeat All" option.

bool isSelected ( int  row)

Returns true if row is selected, otherwise returns false

bool isShuffle ( ) const

Returns state of "Shuffle" option.

bool isStopAfter ( PlayListItem item) const

Returns true if playback stops after item, otherwise returns false.

PlayListItem* item ( int  row) const

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

void itemAdded ( PlayListItem item) [signal]

Emitted when new item has added.

Parameters:
itemNew playlist item pointer.
QList<PlayListItem*> items ( ) const [inline]

Returns list of all PlayListItem pointers.

void listChanged ( ) [signal]

Emitted when the state of PlayListModel has changed.

void loaderFinished ( ) [signal]

Emitted when playlist loader thread has finished.

void loadPlaylist ( const QString &  f_name)

Loads playlist with f_name name.

void moveItems ( int  from,
int  to 
)

Moves the item at index position from to index position to.

QString name ( ) const

Returns playlist name.

void nameChanged ( const QString &  name) [signal]

Emitted when playlist name has chanded.

Parameters:
nameNew playlist name.
bool next ( )

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

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

void prepareForRepeatablePlaying ( bool  ) [slot]

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

void prepareForShufflePlaying ( bool  yes) [slot]

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

bool previous ( )

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

int queuedIndex ( PlayListItem item) const

Returns index of f file in queue.e

int queueSize ( ) const

Returns the number of items in the queue

void randomizeList ( ) [slot]

Randomly changes items order.

void removeAt ( int  i) [slot]

Removes items with i index.

void removeDuplicates ( ) [slot]

Removes duplicate items by URL.

void removeInvalidItems ( ) [slot]

Removes invalid items from playlist

void removeItem ( PlayListItem item) [slot]

Removes item item from playlist

void removeSelected ( ) [slot]

Removes selected items.

void removeUnselected ( ) [slot]

Removes unselected items.

void reverseList ( ) [slot]

Reverces items order.

int row ( PlayListItem item) const [inline]

Returns the row of the item

void savePlaylist ( const QString &  f_name)

Saves current songs to the playlist with f_name name.

void selectAll ( ) [slot]

Selects all items.

QList<PlayListItem*> selectedItems ( ) const

Returns list of PlayListItem pointers that are selected.

QList<int> selectedRows ( ) const

Returns list with selected rows indexes.

bool setCurrent ( int  row)

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

Parameters:
rowNumber of item.
bool setCurrent ( PlayListItem item)

Sets current item to item. Returns true if success, otherwise returns false

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

void setName ( const QString &  name)

Sets the name of the playlist to name.

void setQueued ( PlayListItem f) [slot]

Adds/removes media file f to/from playback queue.

void setSelected ( int  row,
bool  selected = true 
)

Sets the selected state of the item to select

Parameters:
rowNumber of item.
selectedSelection state (true - select, false - unselect)
void showDetails ( QWidget *  parent = 0) [slot]

Shows details for the first selected item.

Parameters:
parentparent Widget.
void sort ( int  mode) [slot]

Sorts items in mode sort mode.

void sortSelection ( int  mode) [slot]

Sorts selected items in mode sort mode.

void stopAfterSelected ( ) [slot]

Toggles 'stop after selected' feature.

int totalLength ( ) const [inline]

Returns total lenght in seconds of all songs.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator