1
0
Fork 0

Make PlayPauseButton use less code.

This commit is contained in:
namedkitten 2020-05-02 12:42:10 +01:00
parent 2dab4f4422
commit 106852545f

View file

@ -2,18 +2,15 @@ import QtQuick 2.0
import player 1.0 import player 1.0
SmoothButton { SmoothButton {
iconSource: "icons/" + appearance.themeName + "/pause.svg" property var playing: Enums.PlayStatus.Playing
iconSource: "icons/" + appearance.themeName + (playing == Enums.PlayStatus.Playing ? "/pause.svg" : "/play.svg")
onClicked: { onClicked: {
player.playerCommand(Enums.Commands.TogglePlayPause) player.playerCommand(Enums.Commands.TogglePlayPause)
} }
Connections { Connections {
target: player target: player
onPlayStatusChanged: function (status) { onPlayStatusChanged: function (status) {
if (status == Enums.PlayStatus.Playing) { playing = status
iconSource = "qrc:/icons/" + appearance.themeName + "/pause.svg"
} else if (status == Enums.PlayStatus.Paused) {
iconSource = "qrc:/icons/" + appearance.themeName + "/play.svg"
}
} }
} }
} }