new function: stop playing after current song
This commit is contained in:
@@ -201,6 +201,7 @@ void Help::GetKeybindings()
|
||||
*w << DisplayKeys(Key.SavePlaylist) << "Save playlist\n";
|
||||
*w << DisplayKeys(Key.SortPlaylist) << "Sort playlist\n";
|
||||
*w << DisplayKeys(Key.GoToNowPlaying) << "Go to currently playing position\n";
|
||||
*w << DisplayKeys(Key.StartSearching) << "Toggle \"stop playing after current song\" option\n";
|
||||
*w << DisplayKeys(Key.ToggleAutoCenter) << "Toggle auto center mode\n\n\n";
|
||||
|
||||
*w << " " << fmtBold << "Keys - Browse screen\n -----------------------------------------\n" << fmtBoldEnd;
|
||||
|
||||
@@ -1201,7 +1201,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (Keypressed(input, Key.StartSearching))
|
||||
{
|
||||
if (myScreen == mySearcher)
|
||||
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()->Highlight(SearchEngine::SearchButton);
|
||||
mySearcher->Main()->Highlighting(0);
|
||||
|
||||
@@ -266,6 +266,7 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
||||
conf.display_screens_numbers_on_start = true;
|
||||
conf.clock_display_seconds = false;
|
||||
conf.ignore_leading_the = false;
|
||||
conf.stop_after_current_song = false;
|
||||
conf.set_window_title = true;
|
||||
conf.mpd_port = 6600;
|
||||
conf.mpd_connection_timeout = 15;
|
||||
|
||||
@@ -158,6 +158,7 @@ struct ncmpcpp_config
|
||||
bool display_screens_numbers_on_start;
|
||||
bool clock_display_seconds;
|
||||
bool ignore_leading_the;
|
||||
bool stop_after_current_song;
|
||||
|
||||
int mpd_port;
|
||||
int mpd_connection_timeout;
|
||||
|
||||
@@ -309,6 +309,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
||||
catch (std::out_of_range) { }
|
||||
Playlist::ReloadRemaining = 1;
|
||||
myPlaylist->NowPlaying = -1;
|
||||
Config.stop_after_current_song = 0;
|
||||
player_state.clear();
|
||||
break;
|
||||
}
|
||||
@@ -351,6 +352,12 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
||||
|
||||
playing_song_scroll_begin = 0;
|
||||
|
||||
if (Config.stop_after_current_song)
|
||||
{
|
||||
Mpd->Stop();
|
||||
Config.stop_after_current_song = 0;
|
||||
}
|
||||
|
||||
if (Mpd->GetState() == psPlay)
|
||||
{
|
||||
changed.ElapsedTime = 1;
|
||||
|
||||
Reference in New Issue
Block a user