provide generic interface for dealing with selected items
This commit is contained in:
@@ -146,7 +146,7 @@ void Browser::SpacePressed()
|
||||
{
|
||||
if (Config.space_selects && w->Choice() >= (itsBrowsedDir != "/" ? 1 : 0))
|
||||
{
|
||||
Select(w);
|
||||
w->SelectCurrent();
|
||||
w->Scroll(wDown);
|
||||
return;
|
||||
}
|
||||
@@ -238,6 +238,39 @@ MPD::Song *Browser::CurrentSong()
|
||||
return !w->Empty() && w->Current().type == itSong ? w->Current().song : 0;
|
||||
}
|
||||
|
||||
void Browser::ReverseSelection()
|
||||
{
|
||||
w->ReverseSelection(itsBrowsedDir == "/" ? 0 : 1);
|
||||
}
|
||||
|
||||
void Browser::GetSelectedSongs(MPD::SongList &v)
|
||||
{
|
||||
std::vector<size_t> selected;
|
||||
w->GetSelected(selected);
|
||||
for (std::vector<size_t>::const_iterator it = selected.begin(); it != selected.end(); it++)
|
||||
{
|
||||
const Item &item = w->at(*it);
|
||||
switch (item.type)
|
||||
{
|
||||
case itDirectory:
|
||||
{
|
||||
Mpd->GetDirectoryRecursive(locale_to_utf_cpy(item.name), v);
|
||||
break;
|
||||
}
|
||||
case itSong:
|
||||
{
|
||||
v.push_back(new Song(*item.song));
|
||||
break;
|
||||
}
|
||||
case itPlaylist:
|
||||
{
|
||||
Mpd->GetPlaylistContent(locale_to_utf_cpy(item.name), v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
const char *supported_extensions[] = { "wma", "asf", "rm", "mp1", "mp2", "mp3", "mp4", "m4a", "flac", "ogg", "wav", "au", "aiff", "aif", "ac3", "aac", "mpc", "it", "mod", "s3m", "xm", "wv", 0 };
|
||||
|
||||
Reference in New Issue
Block a user