split PressSpace action into modular pieces

This commit is contained in:
Andrzej Rybczak
2015-05-17 18:10:42 +02:00
parent c68631b2f0
commit 2caf08aaa7
36 changed files with 306 additions and 275 deletions

View File

@@ -268,15 +268,6 @@ void SearchEngine::enterPressed()
addSongToPlaylist(w.current()->value().song(), true);
}
void SearchEngine::spacePressed()
{
if (w.current()->value().isSong())
{
addSongToPlaylist(w.current()->value().song(), false);
w.scroll(NC::Scroll::Down);
}
}
void SearchEngine::mouseButtonPressed(MEVENT me)
{
if (w.empty() || !w.hasCoords(me.x, me.y) || size_t(me.y) >= w.size())
@@ -291,12 +282,7 @@ void SearchEngine::mouseButtonPressed(MEVENT me)
else if (w.choice() >= StaticOptions)
{
if (me.bstate & BUTTON1_PRESSED)
{
size_t pos = w.choice();
spacePressed();
if (pos < w.size()-1)
w.scroll(NC::Scroll::Up);
}
addItemToPlaylist();
else
enterPressed();
}
@@ -332,6 +318,14 @@ bool SearchEngine::find(SearchDirection direction, bool wrap, bool skip_current)
/***********************************************************************/
bool SearchEngine::addItemToPlaylist()
{
bool result = false;
if (!w.empty() && w.current()->value().isSong())
result = addSongToPlaylist(w.current()->value().song(), false);
return result;
}
std::vector<MPD::Song> SearchEngine::getSelectedSongs()
{
std::vector<MPD::Song> result;