implement ProxySongList for handling general operations on lists

This commit is contained in:
Andrzej Rybczak
2012-09-02 20:51:20 +02:00
parent 0cfe5d8f01
commit 5e8d1673e0
22 changed files with 297 additions and 220 deletions

View File

@@ -486,35 +486,21 @@ void PlaylistEditor::prevFound(bool wrap)
/***********************************************************************/
MPD::Song *PlaylistEditor::getSong(size_t pos)
std::shared_ptr<ProxySongList> PlaylistEditor::getProxySongList()
{
MPD::Song *ptr = 0;
auto ptr = nullProxySongList();
if (w == Content)
ptr = &(*Content)[pos].value();
ptr = mkProxySongList(*Content, [](NC::Menu<MPD::Song>::Item &item) {
return &item.value();
});
return ptr;
}
MPD::Song *PlaylistEditor::currentSong()
{
if (w == Content && !Content->Empty())
return getSong(Content->Choice());
else
return 0;
}
bool PlaylistEditor::allowsSelection()
{
return true;
}
void PlaylistEditor::removeSelection()
{
if (w == Playlists)
removeSelectionHelper(Playlists->Begin(), Playlists->End());
else if (w == Content)
removeSelectionHelper(Content->Begin(), Content->End());
}
void PlaylistEditor::reverseSelection()
{
if (w == Playlists)