update mpris with slider
This commit is contained in:
parent
399f69a68a
commit
e01096691f
1 changed files with 47 additions and 18 deletions
|
|
@ -1,13 +1,17 @@
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import qs.components
|
||||||
import qs.config
|
import qs.config
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.widgets
|
import qs.widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
StyledButton {
|
StyledButton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
padding: 6
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!Mpris.active.canTogglePlaying) {
|
if (!Mpris.active.canTogglePlaying) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -19,7 +23,14 @@ StyledButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content: StyledText {
|
content: ColumnLayout {
|
||||||
|
id: content
|
||||||
|
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
implicitWidth: text.width
|
||||||
|
implicitHeight: text.height
|
||||||
|
StyledText {
|
||||||
id: text
|
id: text
|
||||||
text: `${Mpris.active?.isPlaying ? "" : ""} ${Mpris.active?.trackTitle} - ${Mpris.active?.trackArtist}`
|
text: `${Mpris.active?.isPlaying ? "" : ""} ${Mpris.active?.trackTitle} - ${Mpris.active?.trackArtist}`
|
||||||
|
|
||||||
|
|
@ -30,7 +41,7 @@ StyledButton {
|
||||||
when: root.containsMouse
|
when: root.containsMouse
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
text {
|
text {
|
||||||
color: Theme.palette.base300
|
color: Theme.palette.primarycontent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -40,9 +51,27 @@ StyledButton {
|
||||||
reversible: true
|
reversible: true
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
properties: "color"
|
properties: "color"
|
||||||
duration: 200
|
duration: 100
|
||||||
easing.type: Easing.InOutCubic
|
easing.type: Easing.InOutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
StyledSlider {
|
||||||
|
from: 0
|
||||||
|
to: Mpris.active?.length ?? 0
|
||||||
|
value: Mpris.active?.position
|
||||||
|
implicitHeight: 6
|
||||||
|
Layout.fillWidth: true
|
||||||
|
onMoved: {
|
||||||
|
Mpris.active.position = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
running: Mpris.active?.isPlaying
|
||||||
|
interval: 1000
|
||||||
|
repeat: true
|
||||||
|
onTriggered: Mpris.active?.positionChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue