key_select_album also works in search results now
This commit is contained in:
committed by
Andrzej Rybczak
parent
7600429383
commit
13dbf65350
@@ -1703,6 +1703,8 @@ int main(int argc, char *argv[])
|
|||||||
songs = myPlaylist->Items;
|
songs = myPlaylist->Items;
|
||||||
else if (myScreen->ActiveWindow() == myPlaylistEditor->Content)
|
else if (myScreen->ActiveWindow() == myPlaylistEditor->Content)
|
||||||
songs = myPlaylistEditor->Content;
|
songs = myPlaylistEditor->Content;
|
||||||
|
else if (myScreen == mySearcher)
|
||||||
|
mySearcher->SelectAlbum();
|
||||||
|
|
||||||
if (songs && !songs->Empty())
|
if (songs && !songs->Empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -337,6 +337,36 @@ void SearchEngine::Scroll(int input)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchEngine::SelectAlbum()
|
||||||
|
{
|
||||||
|
size_t pos = w->Choice();
|
||||||
|
if (pos < StaticOptions)
|
||||||
|
return; // not on a song
|
||||||
|
|
||||||
|
std::string album = w->at(pos).second->GetAlbum();
|
||||||
|
|
||||||
|
// select song under cursor
|
||||||
|
w->Select(pos, 1);
|
||||||
|
|
||||||
|
// go up
|
||||||
|
while (pos > StaticOptions)
|
||||||
|
{
|
||||||
|
if (w->at(--pos).second->GetAlbum() != album)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
w->Select(pos, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// go down
|
||||||
|
while (pos < w->Size() - 1)
|
||||||
|
{
|
||||||
|
if (w->at(++pos).second->GetAlbum() != album)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
w->Select(pos, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SearchEngine::Prepare()
|
void SearchEngine::Prepare()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < w->Size(); ++i)
|
for (size_t i = 0; i < w->Size(); ++i)
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class SearchEngine : public Screen< Menu< std::pair<Buffer *, MPD::Song *> > >
|
|||||||
|
|
||||||
void UpdateFoundList();
|
void UpdateFoundList();
|
||||||
void Scroll(int);
|
void Scroll(int);
|
||||||
|
void SelectAlbum();
|
||||||
|
|
||||||
static size_t StaticOptions;
|
static size_t StaticOptions;
|
||||||
static size_t SearchButton;
|
static size_t SearchButton;
|
||||||
|
|||||||
Reference in New Issue
Block a user