summaryrefslogtreecommitdiff
path: root/src/playlist.cpp
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2015-05-10 12:14:56 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2015-05-11 22:35:06 +0200
commita8e2ec5ed0814ed601f36cf00014c12076647ff5 (patch)
tree4f243c03e1a2185e09ed58fa2b66ef547da7969c /src/playlist.cpp
parenta7dab01eff8f389052eb7e71a4871954bccd7d49 (diff)
replace ProxySongList with NC::List and SongList
Diffstat (limited to 'src/playlist.cpp')
-rw-r--r--src/playlist.cpp36
1 files changed, 5 insertions, 31 deletions
diff --git a/src/playlist.cpp b/src/playlist.cpp
index 44841f27..d85e6a20 100644
--- a/src/playlist.cpp
+++ b/src/playlist.cpp
@@ -31,7 +31,9 @@
#include "song.h"
#include "status.h"
#include "statusbar.h"
+#include "helpers/song_iterator_maker.h"
#include "utility/comparators.h"
+#include "utility/functional.h"
#include "title.h"
using Global::MainHeight;
@@ -63,12 +65,12 @@ Playlist::Playlist()
{
case DisplayMode::Classic:
w.setItemDisplayer(std::bind(
- Display::Songs, ph::_1, proxySongList(), std::cref(Config.song_list_format)
+ Display::Songs, ph::_1, std::cref(w), std::cref(Config.song_list_format)
));
break;
case DisplayMode::Columns:
w.setItemDisplayer(std::bind(
- Display::SongsInColumns, ph::_1, proxySongList()
+ Display::SongsInColumns, ph::_1, std::cref(w)
));
break;
}
@@ -176,37 +178,9 @@ bool Playlist::find(SearchDirection direction, bool wrap, bool skip_current)
/***********************************************************************/
-ProxySongList Playlist::proxySongList()
-{
- return ProxySongList(w, [](NC::Menu<MPD::Song>::Item &item) {
- return &item.value();
- });
-}
-
-bool Playlist::allowsSelection()
-{
- return !w.empty();
-}
-
-void Playlist::selectCurrent()
-{
- w.current()->setSelected(!w.current()->isSelected());
-}
-
-void Playlist::reverseSelection()
-{
- reverseSelectionHelper(w.begin(), w.end());
-}
-
std::vector<MPD::Song> Playlist::getSelectedSongs()
{
- std::vector<MPD::Song> result;
- for (auto it = w.begin(); it != w.end(); ++it)
- if (it->isSelected())
- result.push_back(it->value());
- if (result.empty() && !w.empty())
- result.push_back(w.current()->value());
- return result;
+ return w.getSelectedSongs();
}
/***********************************************************************/