Change name of root id to root everywhere

This commit is contained in:
2025-10-13 14:35:32 -03:00
parent e4087938a5
commit 23eb623fae
13 changed files with 48 additions and 46 deletions

View File

@@ -6,7 +6,7 @@ import qs.Common.Styled
import qs.Services
BackgroundRectangle {
id: audioWidget
id: root
property string monitor: ""
property string icon: " "
@@ -20,26 +20,26 @@ BackgroundRectangle {
states: [
State {
name: "Mute"
when: audioWidget.volume == 0 || audioWidget.sink.audio.muted
when: root.volume == 0 || root.sink.audio.muted
PropertyChanges {
audioWidget.icon: " "
root.icon: " "
}
},
State {
name: "low volume"
when: audioWidget.volume <= 25
when: root.volume <= 25
PropertyChanges {
audioWidget.icon: " "
root.icon: " "
}
},
State {
name: "high volume"
when: audioWidget.volume > 25
when: root.volume > 25
PropertyChanges {
audioWidget.icon: " "
root.icon: " "
}
}
]
@@ -50,23 +50,23 @@ BackgroundRectangle {
Connections {
function onVolumeChanged() {
audioWidget.volume = Math.round(Pipewire.defaultAudioSink.audio.volume * 100);
root.volume = Math.round(Pipewire.defaultAudioSink.audio.volume * 100);
}
target: audioWidget.audioPipewireActive ? Pipewire.defaultAudioSink.audio : null
target: root.audioPipewireActive ? Pipewire.defaultAudioSink.audio : null
}
StyledText {
id: audioText
property string audioTextText: audioWidget.audioPipewireActive ? audioWidget.icon + " " + Math.round(Pipewire.defaultAudioSink.audio.volume * 100).toString() + "%" : ""
property string audioTextText: root.audioPipewireActive ? root.icon + " " + Math.round(Pipewire.defaultAudioSink.audio.volume * 100).toString() + "%" : ""
anchors.centerIn: parent
text: audioTextText
}
Process {
id: audioWidgetProcess
id: rootProcess
running: false
command: ["pavucontrol"]
@@ -77,7 +77,7 @@ BackgroundRectangle {
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
onEntered: {
PopUpHover.start(audioWidget, "audio");
PopUpHover.start(root, "audio");
}
onExited: {
// PopUpHover.exit()
@@ -87,7 +87,7 @@ BackgroundRectangle {
if (mouse.button === Qt.RightButton) {
parent.sink.audio.muted = !parent.sink.audio.muted;
} else if (mouse.button === Qt.LeftButton) {
audioWidgetProcess.startDetached();
rootProcess.startDetached();
}
}
onWheel: wheel => {
@@ -95,12 +95,12 @@ BackgroundRectangle {
if (0)
return;
Pipewire.defaultAudioSink.audio.volume = (audioWidget.volume + 5) / 100;
Pipewire.defaultAudioSink.audio.volume = (root.volume + 5) / 100;
} else if (wheel.angleDelta.y < 0) {
if (0)
return;
Pipewire.defaultAudioSink.audio.volume = (audioWidget.volume - 5) / 100;
Pipewire.defaultAudioSink.audio.volume = (root.volume - 5) / 100;
}
}
}