From 5e8d1673e014e5d9af4c5538ae938d7c414a2ed3 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 2 Sep 2012 20:51:20 +0200 Subject: implement ProxySongList for handling general operations on lists --- src/media_library.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'src/media_library.cpp') 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 MediaLibrary::getProxySongList() { - MPD::Song *ptr = 0; + auto ptr = nullProxySongList(); if (w == Songs) - ptr = &(*Songs)[pos].value(); + ptr = mkProxySongList(*Songs, [](NC::Menu::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) -- cgit v1.2.3