new feature: reverse playlist
This commit is contained in:
@@ -200,7 +200,7 @@ void Help::GetKeybindings()
|
|||||||
*w << DisplayKeys(Key.MoveTo) << "Move selected item(s) to cursor position\n";
|
*w << DisplayKeys(Key.MoveTo) << "Move selected item(s) to cursor position\n";
|
||||||
*w << DisplayKeys(Key.Add) << "Add url/file/directory to playlist\n";
|
*w << DisplayKeys(Key.Add) << "Add url/file/directory to playlist\n";
|
||||||
*w << DisplayKeys(Key.SavePlaylist) << "Save playlist\n";
|
*w << DisplayKeys(Key.SavePlaylist) << "Save playlist\n";
|
||||||
*w << DisplayKeys(Key.SortPlaylist) << "Sort playlist\n";
|
*w << DisplayKeys(Key.SortPlaylist) << "Sort/reverse playlist\n";
|
||||||
*w << DisplayKeys(Key.GoToNowPlaying) << "Go to currently playing position\n";
|
*w << DisplayKeys(Key.GoToNowPlaying) << "Go to currently playing position\n";
|
||||||
*w << DisplayKeys(Key.StartSearching) << "Toggle \"stop playing after current song\" option\n";
|
*w << DisplayKeys(Key.StartSearching) << "Toggle \"stop playing after current song\" option\n";
|
||||||
*w << DisplayKeys(Key.ToggleAutoCenter) << "Toggle auto center mode\n\n\n";
|
*w << DisplayKeys(Key.ToggleAutoCenter) << "Toggle auto center mode\n\n\n";
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Menu< std::pair<std::string, MPD::Song::GetFunction> > *Playlist::SortDialog;
|
|||||||
const size_t Playlist::SortOptions = 10;
|
const size_t Playlist::SortOptions = 10;
|
||||||
|
|
||||||
const size_t Playlist::SortDialogWidth = 30;
|
const size_t Playlist::SortDialogWidth = 30;
|
||||||
const size_t Playlist::SortDialogHeight = 17;
|
const size_t Playlist::SortDialogHeight = 18;
|
||||||
|
|
||||||
void Playlist::Init()
|
void Playlist::Init()
|
||||||
{
|
{
|
||||||
@@ -75,6 +75,7 @@ void Playlist::Init()
|
|||||||
SortDialog->AddOption(std::make_pair("Filename", &MPD::Song::GetFile));
|
SortDialog->AddOption(std::make_pair("Filename", &MPD::Song::GetFile));
|
||||||
SortDialog->AddSeparator();
|
SortDialog->AddSeparator();
|
||||||
SortDialog->AddOption(std::make_pair("Sort", (MPD::Song::GetFunction)0));
|
SortDialog->AddOption(std::make_pair("Sort", (MPD::Song::GetFunction)0));
|
||||||
|
SortDialog->AddOption(std::make_pair("Reverse", (MPD::Song::GetFunction)0));
|
||||||
SortDialog->AddOption(std::make_pair("Cancel", (MPD::Song::GetFunction)0));
|
SortDialog->AddOption(std::make_pair("Cancel", (MPD::Song::GetFunction)0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +214,21 @@ void Playlist::Sort()
|
|||||||
BlockRefreshing = 0;
|
BlockRefreshing = 0;
|
||||||
if (pos == SortOptions+1) // sort
|
if (pos == SortOptions+1) // sort
|
||||||
break;
|
break;
|
||||||
else if (pos == SortOptions+2) // cancel
|
else if (pos == SortOptions+2) // reverse
|
||||||
|
{
|
||||||
|
BlockUpdate = 1;
|
||||||
|
ShowMessage("Reversing playlist order...");
|
||||||
|
Mpd->StartCommandsList();
|
||||||
|
for (size_t i = 0, j = w->Size()-1; i < w->Size()/2; i++, j--)
|
||||||
|
{
|
||||||
|
Mpd->Swap(i, j);
|
||||||
|
w->Swap(i, j);
|
||||||
|
}
|
||||||
|
Mpd->CommitCommandsList();
|
||||||
|
ShowMessage("Playlist reversed!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (pos == SortOptions+3) // cancel
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user