From 88ecea1761c8b3ffe9cc0529cb3fd96c25b0e453 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sun, 30 Jun 2024 14:46:22 +0200 Subject: [PATCH] Design changes --- .../src/components/playerView.vue | 29 +++++++++++++++- .../src/components/playlistView.vue | 21 ++++++++++-- MusicPlayerV2-GUI/src/views/RemoteView.vue | 33 +++++++++++-------- MusicPlayerV2-GUI/src/views/ShowcaseView.vue | 19 ++++++++--- 4 files changed, 80 insertions(+), 22 deletions(-) diff --git a/MusicPlayerV2-GUI/src/components/playerView.vue b/MusicPlayerV2-GUI/src/components/playerView.vue index 66e7d02..44ff8a4 100644 --- a/MusicPlayerV2-GUI/src/components/playerView.vue +++ b/MusicPlayerV2-GUI/src/components/playerView.vue @@ -62,7 +62,9 @@ @control="( action ) => { control( action ) }" @play-song="( song ) => { playSong( song ) }" @add-new-songs="( songs ) => addNewSongs( songs )" @playlist-reorder="( move ) => moveSong( move )" :is-logged-into-apple-music="player.isLoggedIn" - @add-new-songs-apple-music="( song ) => addNewSongFromObject( song )"> + @add-new-songs-apple-music="( song ) => addNewSongFromObject( song )" + @delete-song="song => removeSongFromPlaylist( song )" + @clear-playlist="() => clearPlaylist()"> @@ -489,6 +491,31 @@ notificationHandler.emit( 'playlist-update', playlist.value ); } + const removeSongFromPlaylist = ( song: number ) => { + playlist.value = player.getQueue(); + playlist.value.splice( song, 1 ); + player.setPlaylist( playlist.value ); + if ( !isPlaying.value ) { + player.prepare( 0 ); + isPlaying.value = true; + startProgressTracker(); + } + notificationHandler.emit( 'playlist-update', playlist.value ); + } + + const clearPlaylist = () => { + playlist.value = []; + player.control( 'pause' ); + stopProgressTracker(); + isPlaying.value = false; + player.setPlaylist( [] ); + currentlyPlayingSongArtist.value = ''; + currentlyPlayingSongName.value = 'Not playing'; + coverArt.value = ''; + pos.value = 0; + notificationHandler.emit( 'playlist-update', playlist.value ); + } + emits( 'playerStateChange', isShowingFullScreenPlayer.value ? 'show' : 'hide' ); const userStore = useUserStore(); diff --git a/MusicPlayerV2-GUI/src/components/playlistView.vue b/MusicPlayerV2-GUI/src/components/playlistView.vue index 89922d4..1f6a85a 100644 --- a/MusicPlayerV2-GUI/src/components/playlistView.vue +++ b/MusicPlayerV2-GUI/src/components/playlistView.vue @@ -1,13 +1,14 @@ +