summaryrefslogtreecommitdiff
path: root/src/helpers.h
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/helpers.h
parent0cfe5d8f01cae20ea0751f28bf16c8a6ff818fc2 (diff)
implement ProxySongList for handling general operations on lists
Diffstat (limited to 'src/helpers.h')
-rw-r--r--src/helpers.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/helpers.h b/src/helpers.h
index be3be6e1..02f63309 100644
--- a/src/helpers.h
+++ b/src/helpers.h
@@ -32,10 +32,22 @@ inline HasSongs *hasSongs(BasicScreen *screen)
return dynamic_cast<HasSongs *>(screen);
}
-template <typename Iterator> void removeSelectionHelper(Iterator first, Iterator last)
+inline std::shared_ptr<ProxySongList> proxySongList(BasicScreen *screen)
{
- for (; first != last; ++first)
- first->setSelected(false);
+ auto ptr = nullProxySongList();
+ auto hs = hasSongs(screen);
+ if (hs)
+ ptr = hs->getProxySongList();
+ return ptr;
+}
+
+inline MPD::Song *currentSong(BasicScreen *screen)
+{
+ MPD::Song *ptr = 0;
+ auto pl = proxySongList(screen);
+ if (pl)
+ ptr = pl->currentSong();
+ return ptr;
}
template <typename Iterator> void reverseSelectionHelper(Iterator first, Iterator last)