Skip to content

Commit

Permalink
Play not worked after pause #30
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmitar committed Nov 12, 2017
1 parent 6d13c49 commit aa051f6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
9 changes: 7 additions & 2 deletions plasmoid/contents/ui/Mpris2.qml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ PlasmaCore.DataSource {

readonly property bool canControl: sourceActive ? data[currentSource].CanControl || false : false

readonly property bool canPlayPause: canControl ? data[currentSource].CanPlay || data[currentSource].CanPause || false : false
readonly property bool canPlay: canControl ? data[currentSource].CanPlay || false : false

readonly property bool canPause: canControl ? data[currentSource].CanPause || false : false

readonly property bool canPlayPause: canPlay || canPause

readonly property bool canGoNext: canControl ? data[currentSource].CanGoNext || false : false

Expand Down Expand Up @@ -210,9 +214,10 @@ PlasmaCore.DataSource {
debug('next source:', _source)

} else if (connectedSources.length > 0) {
disconnectSource(_currentSource)
disconnectSource('@multiplex')
playbarEngine.setSource('')
debug('next source:', 'Nothing')
debug('next source: Nothing')

}
}
Expand Down
24 changes: 17 additions & 7 deletions plasmoid/contents/ui/PlaybackItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,24 @@ Item {
signal stop

onPlayPause: {
if (mpris2.source === 'spotify') {
mpris2.startOperation('PlayPause')
return
// if (mpris2.source === 'spotify') {
// mpris2.startOperation('PlayPause')
// return
// }


if (playing) {
if (mpris2.canPause)
mpris2.startOperation('Pause')
else
mpris2.startOperation('PlayPause')

} else {
if (mpris2.canPlay)
mpris2.startOperation('Play')
else
mpris2.startOperation('PlayPause')
}
if (!playing)
mpris2.startOperation('Play')
else
mpris2.startOperation('PlayPause')
}

onPrevious: {
Expand Down
18 changes: 11 additions & 7 deletions plasmoid/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,18 @@ Item {
mpris2.startOperation('Raise')
}
function action_playPause() {
if (mpris2.source === 'spotify') {
mpris2.startOperation('PlayPause')
return
if (playing) {
if (mpris2.canPause)
mpris2.startOperation('Pause')
else
mpris2.startOperation('PlayPause')

} else {
if (mpris2.canPlay)
mpris2.startOperation('Play')
else
mpris2.startOperation('PlayPause')
}
if (mpris2.playbackStatus !== 'Playing')
mpris2.startOperation('Play')
else
mpris2.startOperation('PlayPause')
}
function action_previous() {
mpris2.startOperation('Previous')
Expand Down

0 comments on commit aa051f6

Please sign in to comment.