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
|
||||
|
||||
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: {
|
||||
player.playerCommand(Enums.Commands.TogglePlayPause)
|
||||
}
|
||||
Connections {
|
||||
target: player
|
||||
onPlayStatusChanged: function (status) {
|
||||
if (status == Enums.PlayStatus.Playing) {
|
||||
iconSource = "qrc:/icons/" + appearance.themeName + "/pause.svg"
|
||||
} else if (status == Enums.PlayStatus.Paused) {
|
||||
iconSource = "qrc:/icons/" + appearance.themeName + "/play.svg"
|
||||
}
|
||||
playing = status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue