popouts/audio: scroll volume slider

Also more spacing
This commit is contained in:
2 * r + 2 * t 2025-08-05 16:10:27 +10:00
parent 9ada66a78e
commit 7eea88774b

View file

@ -55,7 +55,7 @@ Item {
} }
StyledText { StyledText {
Layout.topMargin: Appearance.spacing.small Layout.topMargin: Appearance.spacing.normal
Layout.bottomMargin: Appearance.spacing.small / 2 Layout.bottomMargin: Appearance.spacing.small / 2
text: qsTr("Input") text: qsTr("Input")
font.weight: 500 font.weight: 500
@ -75,24 +75,37 @@ Item {
} }
StyledText { StyledText {
Layout.topMargin: Appearance.spacing.small Layout.topMargin: Appearance.spacing.normal
Layout.bottomMargin: Appearance.spacing.small / 2 Layout.bottomMargin: Appearance.spacing.small / 2
text: qsTr("Volume") text: qsTr("Volume (%1)").arg(Audio.muted ? qsTr("Muted") : `${Math.round(Audio.volume * 100)}%`)
font.weight: 500 font.weight: 500
} }
StyledSlider { CustomMouseArea {
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: Appearance.padding.normal * 3 implicitHeight: Appearance.padding.normal * 3
value: Audio.volume onWheel: event => {
onMoved: Audio.setVolume(value) if (event.angleDelta.y > 0)
Audio.setVolume(Audio.volume + 0.1);
else if (event.angleDelta.y < 0)
Audio.setVolume(Audio.volume - 0.1);
}
Behavior on value { StyledSlider {
NumberAnimation { anchors.left: parent.left
duration: Appearance.anim.durations.normal anchors.right: parent.right
easing.type: Easing.BezierSpline implicitHeight: parent.implicitHeight
easing.bezierCurve: Appearance.anim.curves.standard
value: Audio.volume
onMoved: Audio.setVolume(value)
Behavior on value {
NumberAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
} }
} }
} }