feat: make volume bar non interacteable
This commit is contained in:
parent
a44637492d
commit
93f038aefb
1 changed files with 24 additions and 9 deletions
|
@ -23,22 +23,21 @@ Rectangle {
|
||||||
|
|
||||||
property PwNode sink: Pipewire.defaultAudioSink
|
property PwNode sink: Pipewire.defaultAudioSink
|
||||||
|
|
||||||
|
PwObjectTracker {
|
||||||
|
objects: [sink]
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: audio_area
|
id: audio_area
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
onClicked: {}
|
onClicked: {}
|
||||||
|
onWheel: wheel => {
|
||||||
onWheel: {
|
|
||||||
const newVal = sink.audio.volume + (wheel.angleDelta.y / 12000);
|
const newVal = sink.audio.volume + (wheel.angleDelta.y / 12000);
|
||||||
sink.audio.volume = newVal < 1.0 ? (newVal > 0 ? newVal : 0.0) : 1.0;
|
sink.audio.volume = newVal < 1.0 ? (newVal > 0 ? newVal : 0.0) : 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PwObjectTracker {
|
|
||||||
objects: [sink]
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
color: "#00000000"
|
color: "#00000000"
|
||||||
|
@ -59,12 +58,28 @@ Rectangle {
|
||||||
id: slider
|
id: slider
|
||||||
anchors.top: icon.bottom
|
anchors.top: icon.bottom
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
height: background.height
|
||||||
width: parent.width - 5
|
width: parent.width * 0.75
|
||||||
|
enabled: false
|
||||||
value: sink.audio.volume
|
value: sink.audio.volume
|
||||||
stepSize: 0.01
|
stepSize: 0.01
|
||||||
wheelEnabled: true
|
wheelEnabled: true
|
||||||
|
|
||||||
|
contentItem: Rectangle {
|
||||||
|
color: "#3191CD" // Change color based on value
|
||||||
|
radius: 5
|
||||||
|
width: slider.width * (slider.value / slider.to)
|
||||||
|
height: parent.height
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
color: "#C4C4C4"
|
||||||
|
radius: 5
|
||||||
|
height: 4
|
||||||
|
anchors.bottomMargin: 5
|
||||||
|
anchors.topMargin: 5
|
||||||
|
}
|
||||||
|
|
||||||
handle: Rectangle {}
|
handle: Rectangle {}
|
||||||
onMoved: sink.audio.volume = value
|
onMoved: sink.audio.volume = value
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue