diff --git a/qml/items/RadioMprisPlayer.qml b/qml/items/RadioMprisPlayer.qml index 6861ee0..24f894b 100644 --- a/qml/items/RadioMprisPlayer.qml +++ b/qml/items/RadioMprisPlayer.qml @@ -15,8 +15,8 @@ MprisPlayer { canControl: true - canGoNext: false //appstate.playlistIndex < appstate.playlist.count - canGoPrevious: false // appstate.playlistIndex > 0 + canGoNext: radioPlayer.playlistIndex < radioPlayer.playlist.count //true //appstate.playlistIndex < appstate.playlist.count + canGoPrevious: radioPlayer.playlistIndex > 0 // appstate.playlistIndex > 0 canPause: radioPlayer.isPlaying ? true : false canPlay: radioPlayer.isPaused ? true : false @@ -32,23 +32,18 @@ MprisPlayer { if (radioPlayer.isPlaying) Mpris.Playing; else if (radioPlayer.isPaused) Mpris.Paused; else Mpris.Stopped; - /* switch (radioPlayer.playbackState) { - case Audio.PlayingState: - return Mpris.Playing - case Audio.PausedState: - return Mpris.Paused - default: - return Mpris.Stopped - }*/ } - metaData { url: radioPlayer.source - contributingArtist: radioPlayer.metaInfo + contributingArtist: radioPlayer.metaData.title title: radioPlayer._name } + onNextRequested: radioPlayer.playNext() + + onPreviousRequested: radioPlayer.playPrev() + onPauseRequested:{ radioPlayer.pauseStream(); } @@ -57,7 +52,7 @@ MprisPlayer { radioPlayer.resumeStream(); } onPlayPauseRequested: { - radioPlayer.pauseStream(); + radioPlayer.isPaused ? radioPlayer.playStream() : radioPlayer.pauseStream(); } onStopRequested: { radioPlayer.pauseStream(); diff --git a/qml/items/RadioPlayer.qml b/qml/items/RadioPlayer.qml index 54d3cbc..0dc0e2f 100644 --- a/qml/items/RadioPlayer.qml +++ b/qml/items/RadioPlayer.qml @@ -144,6 +144,17 @@ MediaPlayer { } + function playNext() { + playlistIndex < playlistCount && playlistIndex > -1 ? playlistIndex = playlistIndex + 1 : playlistIndex = 0 + loadPlaylistSelected() + } + + function playPrev() { + playlistIndex < playlistCount && playlistIndex > 0 ? playlistIndex = playlistIndex - 1 : playlistIndex = 0 + loadPlaylistSelected() + } + + function videoPause() { source = "" stop() diff --git a/qml/pages/RadioPlayerPage.qml b/qml/pages/RadioPlayerPage.qml index 9ec2297..4e743c4 100644 --- a/qml/pages/RadioPlayerPage.qml +++ b/qml/pages/RadioPlayerPage.qml @@ -200,6 +200,22 @@ Page { id: row anchors.centerIn: parent spacing: Theme.paddingMedium + Image { + id: playprev + enabled: radioPlayer.playlistIndex > 0 + opacity: enabled ? 1.0 : 0.4 + source: "image://theme/icon-m-previous" + height: play.height + width: height + fillMode: Image.PreserveAspectFit + anchors.verticalCenter: play.verticalCenter + MouseArea { + anchors.fill: parent + onClicked: { + radioPlayer.playPrev() + } + } + } Image { id: play source: radioPlayer.isPlaying ? "image://theme/icon-l-pause" : "image://theme/icon-l-play" @@ -211,25 +227,23 @@ Page { } } Image { - id: playDLNA + enabled: radioPlayer.playlistIndex < radioPlayer.playlist.count + opacity: enabled ? 1.0 : 0.4 source: "image://theme/icon-m-next" height: play.height width: height fillMode: Image.PreserveAspectFit anchors.verticalCenter: play.verticalCenter - MouseArea { anchors.fill: parent onClicked: { - console.log(radioPlayer.playlistIndex + " | "+radioPlayer.playlistCount) - radioPlayer.playlistIndex < radioPlayer.playlistCount && radioPlayer.playlistIndex > -1 ? radioPlayer.playlistIndex = radioPlayer.playlistIndex + 1 : radioPlayer.playlistIndex = 0 - radioPlayer.loadPlaylistSelected() - + radioPlayer.playNext() } } } Image { + id: sleeptimer source: "image://theme/icon-s-timer" height: play.height width: height @@ -239,22 +253,15 @@ Page { anchors.fill: parent onClicked: { pageStack.push("SleepTimerPage.qml") - /* console.log(radioPlayer.playlistIndex + " | "+radioPlayer.playlistCount) - - if (radioPlayer.playlistIndex > -1) { - radioPlayer.playlistIndex > 0 ? radioPlayer.playlistIndex = radioPlayer.playlistIndex - 1 : radioPlayer.playlistIndex = 16 - } else radioPlayer.playlistIndex = 0 - radioPlayer.loadPlaylistSelected() */ } } } - } } Rectangle { visible: orientation === Orientation.Portrait - width: upvote.width + url.width + favorite.width + (Theme.paddingMedium * 4) + width: upvote.width + favorite.width + (Theme.paddingMedium * 4) height: upvote.height + (Theme.paddingMedium * 2) radius: 90 color: Theme.rgba(Theme.overlayBackgroundColor,0.5) @@ -290,19 +297,6 @@ Page { onClicked: {radioBrowser.upVote(radioPlayer._stationuuid,upvote.returnValue)} } } - Image { - id: url - source: "image://theme/icon-m-website" - height: favorite.height - width: height - fillMode: Image.PreserveAspectFit - MouseArea { - anchors.fill: parent - onClicked: { - statusInfo.visible = true;remorse.execute(statusInfo,qsTr("

Open radio station webpage

"), function() {Qt.openUrlExternally(radioPlayer._homepage)}, 5000) - } - } - } } } } diff --git a/translations/harbour-allradio-de.ts b/translations/harbour-allradio-de.ts index 1f5102e..556a0c7 100644 --- a/translations/harbour-allradio-de.ts +++ b/translations/harbour-allradio-de.ts @@ -1069,13 +1069,6 @@ - - RadioPlayerPage - - <h2>Open radio station webpage</h2> - - - SecondPage diff --git a/translations/harbour-allradio.ts b/translations/harbour-allradio.ts index 503ccfc..e1a3c23 100644 --- a/translations/harbour-allradio.ts +++ b/translations/harbour-allradio.ts @@ -1069,13 +1069,6 @@ - - RadioPlayerPage - - <h2>Open radio station webpage</h2> - - - SecondPage