From 106852545f1a6d76627c9ae8b7af0de7247f35f0 Mon Sep 17 00:00:00 2001 From: namedkitten Date: Sat, 2 May 2020 12:42:10 +0100 Subject: [PATCH] Make PlayPauseButton use less code. --- src/qml/UIComponents/PlayPauseButton.qml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qml/UIComponents/PlayPauseButton.qml b/src/qml/UIComponents/PlayPauseButton.qml index 85063ed..31ca3e0 100644 --- a/src/qml/UIComponents/PlayPauseButton.qml +++ b/src/qml/UIComponents/PlayPauseButton.qml @@ -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 } } }