Mpris and prev/next playlist functions
This commit is contained in:
parent
3e431edef9
commit
f3c06d738f
qml
translations
@ -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();
|
||||
|
@ -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()
|
||||
|
@ -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("<h2>Open radio station webpage</h2>"), function() {Qt.openUrlExternally(radioPlayer._homepage)}, 5000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1069,13 +1069,6 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RadioPlayerPage</name>
|
||||
<message>
|
||||
<source><h2>Open radio station webpage</h2></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SecondPage</name>
|
||||
<message>
|
||||
|
@ -1069,13 +1069,6 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RadioPlayerPage</name>
|
||||
<message>
|
||||
<source><h2>Open radio station webpage</h2></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SecondPage</name>
|
||||
<message>
|
||||
|
Loading…
x
Reference in New Issue
Block a user