playlists management support and playlist editor screen added

This commit is contained in:
unK
2008-09-01 09:22:57 +02:00
parent f8f414d93a
commit 3e3f16540b
17 changed files with 831 additions and 259 deletions

View File

@@ -29,10 +29,12 @@ extern Menu *mPlaylist;
extern Menu *mBrowser;
extern Menu *mTagEditor;
extern Menu *mSearcher;
extern Menu *mPlaylistEditor;
extern Window *wFooter;
extern SongList vPlaylist;
extern SongList vPlaylistContent;
extern ItemList vBrowser;
extern NcmpcppScreen current_screen;
@@ -70,6 +72,14 @@ void DeleteSong(int id)
mPlaylist->DeleteOption(id+1);
}
void PlaylistDeleteSong(const string &path, int id)
{
Mpd->QueueDeleteFromPlaylist(path, id);
delete vPlaylistContent[id];
vPlaylistContent.erase(vPlaylistContent.begin()+id);
mPlaylistEditor->DeleteOption(id+1);
}
bool MoveSongUp(int pos)
{
if (pos > 0 && !mPlaylist->Empty() && current_screen == csPlaylist)
@@ -96,6 +106,30 @@ bool MoveSongDown(int pos)
return false;
}
bool PlaylistMoveSongUp(const string &path, int pos)
{
if (pos > 0 && !mPlaylistEditor->Empty() && current_screen == csPlaylistEditor)
{
mPlaylistEditor->Swap(pos, pos-1);
Mpd->Move(path, pos, pos-1);
return true;
}
else
return false;
}
bool PlaylistMoveSongDown(const string &path, int pos)
{
if (pos+1 < mPlaylistEditor->MaxChoice() && !mPlaylistEditor->Empty() && current_screen == csPlaylistEditor)
{
mPlaylistEditor->Swap(pos+1, pos);
Mpd->Move(path, pos, pos+1);
return true;
}
else
return false;
}
string DisplayKeys(int *key, int size)
{
bool backspace = 1;