Applet: Automatically raise maximum volume when over defined maximum volume
ClosedPublic

Authored by drosca on May 3 2017, 1:07 PM.

Details

Summary

When volume is above the maximum volume set in applet, moving the volume
slider will only lower it to the maximum applet volume.
This change automatically raises maximum volume when over defined
maximum volume (eg. when the volume is set by other volume control app
or when set by the applications itself like VLC), so it is possible to
control volume over the defined maximum value without first raising maximum volume.

Test Plan

Raised volume over 100% in VLC, applet automatically raised max volume for the stream.
Lowered the volume to 100%, stream in applet went back to global maximum volume.

Diff Detail

Repository
R115 Plasma Audio Volume Applet
Branch
auto-raise-volume (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
drosca created this revision.May 3 2017, 1:07 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 3 2017, 1:07 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
Zren added a subscriber: Zren.May 3 2017, 1:31 PM

Hmmm, this seems better than my solution since mine stays in the boosted state (slide.maxValue=150%) after the volume when back below 100%.

I'm guessing the side effect of this method is that if you uncheck "force boost" when the volume is 150%, it will stay at 150% volume until you manually slide it down to below 100%? If it does, wouldn't it then set the slider.maxValue to 100%, causing the volume to jump from 100% down to 66% (since you'd be 1/3 of the way down the slider when the max jumps from 150% to 100%).

If that does happen, we probably need a if (!forced && volume > 100%) volume = 100% when you uncheck it.

drosca added a comment.May 3 2017, 2:03 PM
In D5695#106714, @Zren wrote:

I'm guessing the side effect of this method is that if you uncheck "force boost" when the volume is 150%, it will stay at 150% volume until you manually slide it down to below 100%? If it does, wouldn't it then set the slider.maxValue to 100%, causing the volume to jump from 100% down to 66% (since you'd be 1/3 of the way down the slider when the max jumps from 150% to 100%).

If that does happen, we probably need a if (!forced && volume > 100%) volume = 100% when you uncheck it.

Good catch, thanks.

drosca updated this revision to Diff 14109.May 3 2017, 2:07 PM

Fix issue pointed by Zren

sebas accepted this revision.May 5 2017, 8:16 AM
sebas added a subscriber: sebas.

Cosmetical comment aside, looks good.

This revision is now accepted and ready to land.May 5 2017, 8:16 AM
drosca added a comment.May 6 2017, 1:22 PM
In D5695#106996, @sebas wrote:

Cosmetical comment aside, looks good.

What's that cosmetical comment? Did you forget to send it?

sebas added a comment.May 6 2017, 1:23 PM

You're right, forgot to submit the cosmetical comment.

applet/contents/ui/ListItemBase.qml
282

Should be "volume", since that's the property. Or perhaps we don't need "volume" or "Volume".

drosca added inline comments.May 6 2017, 1:27 PM
applet/contents/ui/ListItemBase.qml
282

"Volume" is a role from the model, so assigning to the "volume" property instead only makes it go through one indirection level. The "volume" property should be made readonly as it is there only for property changes.

This revision was automatically updated to reflect the committed changes.