handle single command and remove hacks used as substitute for it

mpd-git has single command, which provides functionality
of both "repeat one" and "stop after current track" modes.

repeat one = single && repeat
stop after current track = single && !repeat
This commit is contained in:
Andrzej Rybczak
2009-03-27 16:40:55 +01:00
parent 88c37b581d
commit 5f41640cd9
12 changed files with 67 additions and 69 deletions

View File

@@ -1080,11 +1080,6 @@ int main(int argc, char *argv[])
Mpd->SetRepeat(!Mpd->GetRepeat());
Mpd->UpdateStatus();
}
else if (Keypressed(input, Key.ToggleRepeatOne))
{
Config.repeat_one_mode = !Config.repeat_one_mode;
ShowMessage("'Repeat one' mode: %s", Config.repeat_one_mode ? "On" : "Off");
}
else if (Keypressed(input, Key.Shuffle))
{
Mpd->Shuffle();
@@ -1095,6 +1090,22 @@ int main(int argc, char *argv[])
Mpd->SetRandom(!Mpd->GetRandom());
Mpd->UpdateStatus();
}
else if (Keypressed(input, Key.ToggleSingle))
{
if (myScreen == mySearcher && !mySearcher->Main()->isStatic(0))
{
mySearcher->Main()->Highlight(SearchEngine::SearchButton);
mySearcher->Main()->Highlighting(0);
mySearcher->Main()->Refresh();
mySearcher->Main()->Highlighting(1);
mySearcher->EnterPressed();
}
else
{
Mpd->SetSingle(!Mpd->GetSingle());
Mpd->UpdateStatus();
}
}
else if (Keypressed(input, Key.ToggleCrossfade))
{
Mpd->SetCrossfade(Mpd->GetCrossfade() ? 0 : Config.crossfade_time);
@@ -1276,22 +1287,6 @@ int main(int argc, char *argv[])
if (s)
myBrowser->LocateSong(*s);
}
else if (Keypressed(input, Key.StartSearching))
{
if (myScreen == myPlaylist && myPlaylist->isPlaying())
{
Config.stop_after_current_song = !Config.stop_after_current_song;
ShowMessage("Stop playing after current song: %s", Config.stop_after_current_song ? "on" : "off");
}
else if (myScreen == mySearcher && !mySearcher->Main()->isStatic(0))
{
mySearcher->Main()->Highlight(SearchEngine::SearchButton);
mySearcher->Main()->Highlighting(0);
mySearcher->Main()->Refresh();
mySearcher->Main()->Highlighting(1);
mySearcher->EnterPressed();
}
}
else if (Keypressed(input, Key.GoToPosition))
{
const Song *s = myPlaylist->NowPlayingSong();