Commit 5c11d545 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Fix player status information

parent 7dc35275
/*
* Copyright 2013-2015 Andreas Cord-Landwehr <cordlandwehr@kde.org>
* Copyright 2013-2019 Andreas Cord-Landwehr <cordlandwehr@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -20,29 +20,44 @@
import QtQuick 2.1
import QtQuick.Controls 2.1 as QQC2
import org.kde.kirigami 2.0 as Kirigami2
import org.kde.kirigami 2.0 as Kirigami
import artikulate 1.0
Item {
id: root
width: button.width
height: button.height
width: 32
height: width
property string fileUrl
signal stopped()
Connections {
target: playerBackend
onStateChanged: {
// set next possible action icon
if (playerBackend.state === Player.PlayingState) {
statusIcon.source = "media-playback-stop";
return
}
if (playerBackend.state === Player.StoppedState) {
statusIcon.source = "media-playback-start";
return
}
}
}
Player {
id: playerBackend
soundFileUrl: root.fileUrl
}
QQC2.RoundButton {
id: button
enabled: fileUrl != ""
Kirigami2.Icon {
enabled: fileUrl !== ""
Kirigami.Icon {
id: statusIcon
source: "media-playback-start"
width: 32
width: root.width
height: width
anchors.centerIn: parent
}
......@@ -57,19 +72,5 @@ Item {
return;
}
}
Connections {
target: playerBackend
onStateChanged: {
// set next possible action icon
if (playerBackend.state === Player.PlayingState) {
button.iconName = "media-playback-stop";
return
}
if (playerBackend.state === Player.StoppedState) {
button.iconName = "media-playback-start";
return
}
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment