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,16 +75,28 @@ 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
onWheel: event => {
if (event.angleDelta.y > 0)
Audio.setVolume(Audio.volume + 0.1);
else if (event.angleDelta.y < 0)
Audio.setVolume(Audio.volume - 0.1);
}
StyledSlider {
anchors.left: parent.left
anchors.right: parent.right
implicitHeight: parent.implicitHeight
value: Audio.volume value: Audio.volume
onMoved: Audio.setVolume(value) onMoved: Audio.setVolume(value)
@ -96,6 +108,7 @@ Item {
} }
} }
} }
}
StyledRect { StyledRect {
Layout.topMargin: Appearance.spacing.normal Layout.topMargin: Appearance.spacing.normal