summaryrefslogtreecommitdiff
path: root/src/media_library.cpp
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2012-09-02 20:51:20 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2012-09-02 20:51:20 +0200
commit5e8d1673e014e5d9af4c5538ae938d7c414a2ed3 (patch)
tree389d567eaa8a5e60a45b18048c6de1b5547ae914 /src/media_library.cpp
parent0cfe5d8f01cae20ea0751f28bf16c8a6ff818fc2 (diff)
implement ProxySongList for handling general operations on lists
Diffstat (limited to 'src/media_library.cpp')
-rw-r--r--src/media_library.cpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/media_library.cpp b/src/media_library.cpp
index 33c4405f..9a0800c1 100644
--- a/src/media_library.cpp
+++ b/src/media_library.cpp
@@ -531,37 +531,21 @@ void MediaLibrary::prevFound(bool wrap)
/***********************************************************************/
-MPD::Song *MediaLibrary::getSong(size_t pos)
+std::shared_ptr<ProxySongList> MediaLibrary::getProxySongList()
{
- MPD::Song *ptr = 0;
+ auto ptr = nullProxySongList();
if (w == Songs)
- ptr = &(*Songs)[pos].value();
+ ptr = mkProxySongList(*Songs, [](NC::Menu<MPD::Song>::Item &item) {
+ return &item.value();
+ });
return ptr;
}
-MPD::Song *MediaLibrary::currentSong()
-{
- if (w == Songs && !Songs->Empty())
- return getSong(Songs->Choice());
- else
- return 0;
-}
-
bool MediaLibrary::allowsSelection()
{
return true;
}
-void MediaLibrary::removeSelection()
-{
- if (w == Tags)
- removeSelectionHelper(Tags->Begin(), Tags->End());
- else if (w == Albums)
- removeSelectionHelper(Albums->Begin(), Albums->End());
- else if (w == Songs)
- removeSelectionHelper(Songs->Begin(), Songs->End());
-}
-
void MediaLibrary::reverseSelection()
{
if (w == Tags)