Prev and next only when playing favorites

This commit is contained in:
nesnomis 2025-06-04 18:47:17 +02:00
parent 1cf3224545
commit ce873bde7b
3 changed files with 11 additions and 7 deletions

View File

@ -27,8 +27,9 @@ MprisPlayer {
*/
canGoNext: radioPlayer.playlistIndex < radioPlayer.playlist.count -1 //true //appstate.playlistIndex < appstate.playlist.count
canGoPrevious: radioPlayer.playlistIndex > 0 // appstate.playlistIndex > 0
canGoNext: radioPlayer.playlistIndex < radioPlayer.playlist.count -1 && radioPlayer._favorite
//true //appstate.playlistIndex < appstate.playlist.count
canGoPrevious: radioPlayer.playlistIndex > 0 && radioPlayer._favorite// appstate.playlistIndex > 0
canPause: radioPlayer.isPlaying ? true : false
canPlay: radioPlayer.isPaused ? true : false

View File

@ -45,7 +45,8 @@ MediaPlayer {
property int stationOk: 3
property int maxTagClicks: 0
property int playlistCount: playlist.count - 1
property int playlistIndex: Favorites.getSetting("playlistIndex",-1)
//property int playlistIndex: Favorites.getSetting("playlistIndex",-1)
property int playlistIndex: -1
property QDtimer timer: QDtimer {
id: qdTimer
interval: 200; running: false; repeat: false
@ -63,7 +64,7 @@ MediaPlayer {
autoPlay: false
autoLoad: true
onPlaylistIndexChanged: console.log("INDEX: "+playlistIndex)
//onPlaylistIndexChanged: console.log("INDEX: "+playlistIndex)
//on_FavoriteChanged: {setStationFavorite(_stationuuid,_name,_countrycode,_homepage,_url_resolved,_favicon,_tags,_codec,_bitrate,_hls,_favorite);Favorites.getMostPlayedFavorites(mostPlayedFavorites,15)}
onPlaying: if (!playerPageOpen) pageStack.push("../pages/RadioPlayerPage.qml")
@ -195,7 +196,7 @@ MediaPlayer {
isPlaying = true
isPaused = false
qdTimer.start()
Favorites.setSetting("playlistIndex",playlistIndex)
//Favorites.setSetting("playlistIndex",playlistIndex)
}
onError: {

View File

@ -202,7 +202,8 @@ Page {
spacing: Theme.paddingMedium
Image {
id: playprev
enabled: radioPlayer.playlistIndex > 0
enabled: radioPlayer.playlistIndex > 0 && radioPlayer._favorite
visible: radioPlayer._favorite
opacity: enabled ? 1.0 : 0.4
source: "image://theme/icon-m-previous"
height: play.height
@ -228,7 +229,8 @@ Page {
}
Image {
id: playDLNA
enabled: radioPlayer.playlistIndex < radioPlayer.playlist.count -1
enabled: radioPlayer.playlistIndex < radioPlayer.playlist.count -1 && radioPlayer._favorite
visible: radioPlayer._favorite
opacity: enabled ? 1.0 : 0.4
source: "image://theme/icon-m-next"
height: play.height