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

@@ -314,21 +314,14 @@ void SearchEngine::prevFound(bool wrap)
/***********************************************************************/
MPD::Song *SearchEngine::getSong(size_t pos)
std::shared_ptr< ProxySongList > SearchEngine::getProxySongList()
{
MPD::Song *ptr = 0;
auto &item = (*w)[pos];
if (!item.isSeparator() && item.value().isSong())
ptr = &item.value().song();
return ptr;
}
MPD::Song *SearchEngine::currentSong()
{
if (w->Empty())
return 0;
else
return getSong(w->Choice());
return mkProxySongList(*w, [](NC::Menu<SEItem>::Item &item) {
MPD::Song *ptr = 0;
if (!item.isSeparator() && item.value().isSong())
ptr = &item.value().song();
return ptr;
});
}
bool SearchEngine::allowsSelection()
@@ -336,11 +329,6 @@ bool SearchEngine::allowsSelection()
return w->Current().value().isSong();
}
void SearchEngine::removeSelection()
{
removeSelectionHelper(w->Begin(), w->End());
}
void SearchEngine::reverseSelection()
{
reverseSelectionHelper(w->Begin()+std::min(StaticOptions, w->Size()), w->End());