diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2009-03-01 11:26:39 +0100 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2009-03-01 11:26:39 +0100 |
commit | b9cbacebffffa3a4f0c24187dd559f0e3402a9fd (patch) | |
tree | fe83d1327830b7f18f73381a646b1a9e2ca301ab /src | |
parent | 27535e133c6b1f6202e93c5555a5f47d6aae083b (diff) |
new function: stop playing after current song
Diffstat (limited to 'src')
-rw-r--r-- | src/help.cpp | 1 | ||||
-rw-r--r-- | src/ncmpcpp.cpp | 7 | ||||
-rw-r--r-- | src/settings.cpp | 1 | ||||
-rw-r--r-- | src/settings.h | 1 | ||||
-rw-r--r-- | src/status.cpp | 7 |
5 files changed, 16 insertions, 1 deletions
diff --git a/src/help.cpp b/src/help.cpp index b3b9f276..ccfc9d31 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -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; diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index bec3613b..a9096cf0 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -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); diff --git a/src/settings.cpp b/src/settings.cpp index 76110b70..470d58f9 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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; diff --git a/src/settings.h b/src/settings.h index 7a423213..d9235026 100644 --- a/src/settings.h +++ b/src/settings.h @@ -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; diff --git a/src/status.cpp b/src/status.cpp index bcb58bea..b37f9f7a 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -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; |