Add audoOverdrive to Volume Symbol in bar
This commit is contained in:
parent
3389cb9a5d
commit
e2a0e491a0
1 changed files with 14 additions and 5 deletions
|
|
@ -28,17 +28,17 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIconColor() {
|
function getIconColor() {
|
||||||
return (Audio.volume <= 1.0) ? Colors.textPrimary : getVolumeColor()
|
return (getDisplayVolume() <= 1.0) ? Colors.textPrimary : getVolumeColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVolumeColor() {
|
function getVolumeColor() {
|
||||||
if (Audio.volume <= 1.0) {
|
if (getDisplayVolume() <= 1.0) {
|
||||||
return Colors.accentPrimary
|
return Colors.accentPrimary
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indicate that the volume is over 100%
|
// Indicate that the volume is over 100%
|
||||||
// Calculate interpolation factor (0 at 100%, 1.0 at 200%)
|
// Calculate interpolation factor (0 at 100%, 1.0 at 200%)
|
||||||
let factor = (Audio.volume - 1.0)
|
let factor = (getDisplayVolume() - 1.0)
|
||||||
|
|
||||||
// Blend between accent and warning colors
|
// Blend between accent and warning colors
|
||||||
return Qt.rgba(Colors.accentPrimary.r + (Colors.error.r - Colors.accentPrimary.r) * factor,
|
return Qt.rgba(Colors.accentPrimary.r + (Colors.error.r - Colors.accentPrimary.r) * factor,
|
||||||
|
|
@ -46,6 +46,15 @@ Item {
|
||||||
Colors.accentPrimary.b + (Colors.error.b - Colors.accentPrimary.b) * factor, 1)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
// Connection used to open the pill when volume changes
|
// Connection used to open the pill when volume changes
|
||||||
Connections {
|
Connections {
|
||||||
target: Audio.sink?.audio ? Audio.sink?.audio : null
|
target: Audio.sink?.audio ? Audio.sink?.audio : null
|
||||||
|
|
@ -66,9 +75,9 @@ Item {
|
||||||
iconCircleColor: getVolumeColor()
|
iconCircleColor: getVolumeColor()
|
||||||
collapsedIconColor: getIconColor()
|
collapsedIconColor: getIconColor()
|
||||||
autoHide: true
|
autoHide: true
|
||||||
text: Math.round(Audio.volume * 100) + "%"
|
text: Math.round(getDisplayVolume() * 100) + "%"
|
||||||
tooltipText: "Volume: " + Math.round(
|
tooltipText: "Volume: " + Math.round(
|
||||||
Audio.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
|
getDisplayVolume() * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
|
||||||
|
|
||||||
onWheel: function (angle) {
|
onWheel: function (angle) {
|
||||||
if (angle > 0) {
|
if (angle > 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue