- Moved all input/output logic out of UI into the Audio service
- Removed volume overdrive which does not work and is out of scope
- Reworked the audio input/output selector with radio buttons instead of
NComboBox
- Hacked a bit the main volume slider so it does not crash PW
This commit is contained in:
quadbyte 2025-08-13 15:58:08 -04:00
parent ddde4b30c4
commit b9eb31c6d4
6 changed files with 172 additions and 205 deletions

View file

@ -21,35 +21,7 @@ Item {
if (Audio.muted) {
return "volume_off"
}
return Audio.volume === 0 ? "volume_off" : (Audio.volume < 0.33 ? "volume_down" : "volume_up")
}
function getIconColor() {
return (getDisplayVolume() <= 1.0) ? Colors.textPrimary : getVolumeColor()
}
function getVolumeColor() {
if (getDisplayVolume() <= 1.0) {
return Colors.accentPrimary
}
// Indicate that the volume is over 100%
// Calculate interpolation factor (0 at 100%, 1.0 at 200%)
let factor = (getDisplayVolume() - 1.0)
// Blend between accent and warning colors
return Qt.rgba(Colors.accentPrimary.r + (Colors.error.r - Colors.accentPrimary.r) * factor,
Colors.accentPrimary.g + (Colors.error.g - Colors.accentPrimary.g) * factor,
Colors.accentPrimary.b + (Colors.error.b - Colors.accentPrimary.b) * factor, 1)
}
function getDisplayVolume() {
// If volumeOverdrive is false, clamp to 100%
if (!Settings.data.audio || !Settings.data.audio.volumeOverdrive) {
return Math.min(Audio.volume, 1.0)
}
// If volumeOverdrive is true, allow up to 200%
return Math.min(Audio.volume, 2.0)
return Audio.volume <= Number.EPSILON ? "volume_off" : (Audio.volume < 0.33 ? "volume_down" : "volume_up")
}
// Connection used to open the pill when volume changes
@ -69,12 +41,12 @@ Item {
NPill {
id: pill
icon: getIcon()
iconCircleColor: getVolumeColor()
collapsedIconColor: getIconColor()
iconCircleColor: Colors.accentPrimary
collapsedIconColor: Colors.textPrimary
autoHide: true
text: Math.round(getDisplayVolume() * 100) + "%"
text: Math.floor(Audio.volume * 100) + "%"
tooltipText: "Volume: " + Math.round(
getDisplayVolume() * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
Audio.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
onWheel: function (angle) {
if (angle > 0) {