1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

SoundPlayer: Sync startup loop and show playlist settings in GUI

This fix syncs up the AudioPlayer's internal state for showing
playlist information with the AudioPlayer's GUI. Before, if the
AudioPlayer was opened with a playlist file (.m3u or .m3u8) it would
automatically show the playlist information in the GUI and set the
loop mode to playlist, but the menu options would be unchecked. In
order to hide the playlist information, the menu option would then
have to be toggled twice -- once on and again off.
This commit is contained in:
Max Trussell 2021-12-19 18:59:28 -08:00 committed by Brian Gianforcaro
parent 277ac48649
commit c8eab80b3d
3 changed files with 17 additions and 5 deletions

View file

@ -48,7 +48,7 @@ void Player::play_file_path(String const& path)
return;
}
if (path.ends_with(".m3u", AK::CaseSensitivity::CaseInsensitive) || path.ends_with(".m3u8", AK::CaseSensitivity::CaseInsensitive)) {
if (is_playlist(path)) {
playlist_loaded(path, m_playlist.load(path));
return;
}
@ -69,6 +69,12 @@ void Player::play_file_path(String const& path)
play();
}
bool Player::is_playlist(String const& path)
{
return (path.ends_with(".m3u", AK::CaseSensitivity::CaseInsensitive)
|| path.ends_with(".m3u8", AK::CaseSensitivity::CaseInsensitive));
}
void Player::set_play_state(PlayState state)
{
if (m_play_state != state) {