Make PlayPauseButton use less code.
This commit is contained in:
parent
2dab4f4422
commit
106852545f
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue