![]() |
Sayonara Player
|
Global handler for playlists. More...
#include <PlaylistHandler.h>
Public Types | |
enum | PlaylistIndex : uint8_t { Current =0, Active } |
The PlaylistIndex enum. | |
Public Slots | |
int | loadOldPlaylists () |
load playlists of last session from database More... | |
Signals | |
void | sigPlaylistCreated (PlaylistPtr pl) |
emitted when new playlist has been created More... | |
void | sigCurrentTrackChanged (int trackIndex, int playlist_idx) |
emitted when current track index has changed More... | |
void | sigNewPlaylistAdded (PlaylistPtr pl) |
emitted when new playlist has been added More... | |
void | sigPlaylistNameChanged (int idx) |
emitted when playlist name has changed More... | |
void | sigCurrentPlaylistChanged (int idx) |
emitted when tracks were added/removed or have changed More... | |
void | sigActivePlaylistChanged (int idx) |
void | sigTrackDeletionRequested (const MetaDataList &tracks, Library::TrackDeletionMode deletion_mode) |
emitted when a track deletion was triggered over the Ui More... | |
void | sigFindTrackRequested (TrackID trackId) |
Public Member Functions | |
void | shutdown () |
Call this before the program stops. Singletons and Destructors don't work out so well. | |
void | clearPlaylist (int playlistIndex) |
clears the current visible playlist More... | |
void | playNext (const MetaDataList &tracks) |
insert tracks to active playlist after current playback position More... | |
void | playNext (const QStringList &paths) |
void | insertTracks (const MetaDataList &tracks, int idx, int playlistIndex) |
insert tracks into a playlist at a given index More... | |
void | insertTracks (const QStringList &paths, int idx, int playlistIndex) |
void | appendTracks (const MetaDataList &tracks, int playlistIndex) |
append tracks at a given playlist index More... | |
void | appendTracks (const QStringList &paths, int playlistIndex) |
void | moveRows (const IndexSet &indexes, int tgt_idx, int playlistIndex) |
move rows within playlist More... | |
void | removeRows (const IndexSet &indexes, int playlistIndex) |
remove rows from playlist More... | |
void | changeTrack (int trackIndex, int playlistIndex) |
change the track in a given playlist More... | |
int | activeIndex () const |
get active playlist index More... | |
PlaylistConstPtr | activePlaylist () const |
int | current_index () const |
void | set_current_index (int playlistIndex) |
int | count () const |
Returns number of playlists. More... | |
PlaylistConstPtr | playlist (int playlistIndex) const |
get specific playlist at given index More... | |
void | deletePlaylist (int playlistIndex) |
delete the given playlist from database More... | |
int | closePlaylist (int playlistIndex) |
close playlist More... | |
void | resetPlaylist (int playlistIndex) |
reload playlist from db More... | |
QString | requestNewPlaylistName (const QString &prefix=QString()) const |
Request a new name for the playlist (usually New %1 is returned). If the prefix differs, instead of New, the prefix is chosen. E.g. "File system 2" for tracks added by the file manager. More... | |
Util::SaveAsAnswer | savePlaylist (int playlistIndex) |
save playlist to database, overwrite old one More... | |
Util::SaveAsAnswer | savePlaylistAs (int playlistIndex, const QString &name, bool forceOverride) |
Save playlist under new name. More... | |
Util::SaveAsAnswer | renamePlaylist (int playlistIndex, const QString &name) |
rename playlist More... | |
void | savePlaylistToFile (int playlistIndex, const QString &filename, bool relative) |
save a playlist to file More... | |
int | createPlaylist (const MetaDataList &tracks, const QString &name=QString(), bool temporary=true) |
create a new playlist More... | |
int | createPlaylist (const QStringList &path_list, const QString &name=QString(), bool temporary=true) |
create a new playlist (overloaded) More... | |
int | createPlaylist (const QString &dir, const QString &name=QString(), bool temporary=true) |
create a new playlist (overloaded) More... | |
int | createPlaylist (const CustomPlaylist &pl) |
create a new playlist (overloaded) More... | |
int | createEmptyPlaylist (bool overrideCurrent=false) |
create a new empty playlist More... | |
int | createEmptyPlaylist (const QString &name) |
void | deleteTracks (int playlistIndex, const IndexSet &rows, Library::TrackDeletionMode deletion_mode) |
Global handler for playlists.
int Playlist::Handler::activeIndex | ( | ) | const |
get active playlist index
void Playlist::Handler::appendTracks | ( | const MetaDataList & | tracks, |
int | playlistIndex | ||
) |
append tracks at a given playlist index
tracks | track list |
playlistIndex | playlist index |
void Playlist::Handler::changeTrack | ( | int | trackIndex, |
int | playlistIndex | ||
) |
change the track in a given playlist
idx | track index |
playlistIndex | playlist index |
void Playlist::Handler::clearPlaylist | ( | int | playlistIndex | ) |
clears the current visible playlist
playlistIndex | playlist index |
int Playlist::Handler::closePlaylist | ( | int | playlistIndex | ) |
close playlist
playlistIndex | playlist index |
int Playlist::Handler::count | ( | ) | const |
Returns number of playlists.
int Playlist::Handler::createEmptyPlaylist | ( | bool | overrideCurrent = false | ) |
create a new empty playlist
name | new playlist name. If no name given, current playlist will be overwritten |
int Playlist::Handler::createPlaylist | ( | const CustomPlaylist & | pl | ) |
create a new playlist (overloaded)
pl | a CustomPlaylist object fetched from database |
int Playlist::Handler::createPlaylist | ( | const MetaDataList & | tracks, |
const QString & | name = QString() , |
||
bool | temporary = true |
||
) |
create a new playlist
tracks | track list |
name | new playlist name. If no name given, current playlist will be overwritten |
temporary | is the playlist temporary or persistent? |
type | deprecated |
int Playlist::Handler::createPlaylist | ( | const QString & | dir, |
const QString & | name = QString() , |
||
bool | temporary = true |
||
) |
create a new playlist (overloaded)
dir | directory path |
name | new playlist name. If no name given, current playlist will be overwritten |
temporary | is the playlist temporary or persistent? |
type | deprecated |
int Playlist::Handler::createPlaylist | ( | const QStringList & | path_list, |
const QString & | name = QString() , |
||
bool | temporary = true |
||
) |
create a new playlist (overloaded)
pathlist | paths, may contain files or directories |
name | new playlist name. If no name given, current playlist will be overwritten |
temporary | is the playlist temporary or persistent? |
type | deprecated |
void Playlist::Handler::deletePlaylist | ( | int | playlistIndex | ) |
delete the given playlist from database
playlistIndex | playlist index |
void Playlist::Handler::insertTracks | ( | const MetaDataList & | tracks, |
int | idx, | ||
int | playlistIndex | ||
) |
insert tracks into a playlist at a given index
tracks | track list |
idx | track index within playlist |
playlistIndex | playlist index |
|
slot |
load playlists of last session from database
void Playlist::Handler::moveRows | ( | const IndexSet & | indexes, |
int | tgt_idx, | ||
int | playlistIndex | ||
) |
move rows within playlist
idx_list | list of row indices to be moved |
tgt_idx | target index where rows should be moved |
playlistIndex | playlist index |
PlaylistConstPtr Playlist::Handler::playlist | ( | int | playlistIndex | ) | const |
get specific playlist at given index
playlistIndex | playlist index |
void Playlist::Handler::playNext | ( | const MetaDataList & | tracks | ) |
insert tracks to active playlist after current playback position
tracks | list of tracks |
void Playlist::Handler::removeRows | ( | const IndexSet & | indexes, |
int | playlistIndex | ||
) |
remove rows from playlist
indexes | list of row indices to be removed |
playlistIndex | playlist index |
Util::SaveAsAnswer Playlist::Handler::renamePlaylist | ( | int | playlistIndex, |
const QString & | name | ||
) |
rename playlist
playlistIndex | playlist index |
name | new playlist name |
QString Playlist::Handler::requestNewPlaylistName | ( | const QString & | prefix = QString() | ) | const |
Request a new name for the playlist (usually New %1 is returned). If the prefix differs, instead of New, the prefix is chosen. E.g. "File system 2" for tracks added by the file manager.
The | prefix is a localized "New" by default. |
void Playlist::Handler::resetPlaylist | ( | int | playlistIndex | ) |
reload playlist from db
playlistIndex | playlist index |
Util::SaveAsAnswer Playlist::Handler::savePlaylist | ( | int | playlistIndex | ) |
save playlist to database, overwrite old one
playlistIndex | playlist index |
Util::SaveAsAnswer Playlist::Handler::savePlaylistAs | ( | int | playlistIndex, |
const QString & | name, | ||
bool | forceOverride | ||
) |
Save playlist under new name.
playlistIndex | playlist index |
name | new playlist name |
force_override | override if name exists |
void Playlist::Handler::savePlaylistToFile | ( | int | playlistIndex, |
const QString & | filename, | ||
bool | relative | ||
) |
save a playlist to file
filename,if | filename does not end with m3u, extension is appended automatically |
relative | relative paths in m3u file |
|
signal |
emitted when tracks were added/removed or have changed
idx | playlist index |
|
signal |
emitted when current track index has changed
trackIndex | index in playlist |
playlist_idx | index of playlist |
|
signal |
emitted when new playlist has been added
pl | reference to new playlist |
|
signal |
emitted when new playlist has been created
pl | Playlist, usually current one |
|
signal |
emitted when playlist name has changed
idx | index of playlist |
|
signal |
emitted when a track deletion was triggered over the Ui
tracks | which tracks should be deleted |
deletion_mode |