diff options
author | Max Kellermann <max@duempel.org> | 2013-10-19 19:50:54 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-20 13:06:40 +0200 |
commit | c772bc45c60be3f559cdd42a9628f37f15da0a17 (patch) | |
tree | 2a30c33f17c6be05510af649027aafea805417ae /src/PlaylistControl.cxx | |
parent | c1e7be3b8e4ab5fb99587b8e5f262ce41805f892 (diff) | |
download | mpd-c772bc45c60be3f559cdd42a9628f37f15da0a17.tar.gz mpd-c772bc45c60be3f559cdd42a9628f37f15da0a17.tar.xz mpd-c772bc45c60be3f559cdd42a9628f37f15da0a17.zip |
PlaylistError: convert playlist_result to a strictly-typed enum
Diffstat (limited to '')
-rw-r--r-- | src/PlaylistControl.cxx | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/PlaylistControl.cxx b/src/PlaylistControl.cxx index 896dbaaa8..97db2a184 100644 --- a/src/PlaylistControl.cxx +++ b/src/PlaylistControl.cxx @@ -56,7 +56,7 @@ playlist::Stop(player_control &pc) } } -enum playlist_result +PlaylistResult playlist::PlayPosition(player_control &pc, int song) { pc.ClearError(); @@ -66,13 +66,13 @@ playlist::PlayPosition(player_control &pc, int song) /* play any song ("current" song, or the first song */ if (queue.IsEmpty()) - return PLAYLIST_RESULT_SUCCESS; + return PlaylistResult::SUCCESS; if (playing) { /* already playing: unpause playback, just in case it was paused, and return */ pc.SetPause(false); - return PLAYLIST_RESULT_SUCCESS; + return PlaylistResult::SUCCESS; } /* select a song: "current" song, or the first one */ @@ -80,7 +80,7 @@ playlist::PlayPosition(player_control &pc, int song) ? current : 0; } else if (!queue.IsValidPosition(song)) - return PLAYLIST_RESULT_BAD_RANGE; + return PlaylistResult::BAD_RANGE; if (queue.random) { if (song >= 0) @@ -103,10 +103,10 @@ playlist::PlayPosition(player_control &pc, int song) error_count = 0; PlayOrder(pc, i); - return PLAYLIST_RESULT_SUCCESS; + return PlaylistResult::SUCCESS; } -enum playlist_result +PlaylistResult playlist::PlayId(player_control &pc, int id) { if (id == -1) @@ -114,7 +114,7 @@ playlist::PlayId(player_control &pc, int id) int song = queue.IdToPosition(id); if (song < 0) - return PLAYLIST_RESULT_NO_SUCH_SONG; + return PlaylistResult::NO_SUCH_SONG; return PlayPosition(pc, song); } @@ -189,11 +189,11 @@ playlist::PlayPrevious(player_control &pc) PlayOrder(pc, order); } -enum playlist_result +PlaylistResult playlist::SeekSongPosition(player_control &pc, unsigned song, float seek_time) { if (!queue.IsValidPosition(song)) - return PLAYLIST_RESULT_BAD_RANGE; + return PlaylistResult::BAD_RANGE; const Song *queued_song = GetQueuedSong(); @@ -219,37 +219,37 @@ playlist::SeekSongPosition(player_control &pc, unsigned song, float seek_time) if (!pc.Seek(the_song, seek_time)) { UpdateQueuedSong(pc, queued_song); - return PLAYLIST_RESULT_NOT_PLAYING; + return PlaylistResult::NOT_PLAYING; } queued = -1; UpdateQueuedSong(pc, nullptr); - return PLAYLIST_RESULT_SUCCESS; + return PlaylistResult::SUCCESS; } -enum playlist_result +PlaylistResult playlist::SeekSongId(player_control &pc, unsigned id, float seek_time) { int song = queue.IdToPosition(id); if (song < 0) - return PLAYLIST_RESULT_NO_SUCH_SONG; + return PlaylistResult::NO_SUCH_SONG; return SeekSongPosition(pc, song, seek_time); } -enum playlist_result +PlaylistResult playlist::SeekCurrent(player_control &pc, float seek_time, bool relative) { if (!playing) - return PLAYLIST_RESULT_NOT_PLAYING; + return PlaylistResult::NOT_PLAYING; if (relative) { const auto status = pc.GetStatus(); if (status.state != PlayerState::PLAY && status.state != PlayerState::PAUSE) - return PLAYLIST_RESULT_NOT_PLAYING; + return PlaylistResult::NOT_PLAYING; seek_time += (int)status.elapsed_time; } |