Commit 06e9e3ee authored by George Vogiatzis's avatar George Vogiatzis Committed by Nate Graham

[Applet]Correct raise max volume functions for mic

Summary:
Correct osd source devices display when `Raise maximum volume` is enabled.
Lower to normal volume when disabling `Raise maximum volume` if the
source device volume was set higher than 100%.

Test Plan:
Use shortcut keys for microphone (Volume Up/Down/Mute), with and
without the "Raise maximum volume". Correct info must be shown.

Set source device(mic) volume higher than 100% and disable "Raise
maximum volume". Volume should be lowered to 100%.

Reviewers: #plasma, drosca, ngraham

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27282
parent 830bded4
......@@ -140,7 +140,7 @@ Item {
return;
}
var volume = boundVolume(paSourceModel.defaultSource.volume + volumeStep);
var percent = volumePercent(volume);
var percent = volumePercent(volume, currentMaxVolumeValue);
paSourceModel.defaultSource.muted = percent == 0;
paSourceModel.defaultSource.volume = volume;
osd.showMicrophone(percent);
......@@ -151,7 +151,7 @@ Item {
return;
}
var volume = boundVolume(paSourceModel.defaultSource.volume - volumeStep);
var percent = volumePercent(volume);
var percent = volumePercent(volume, currentMaxVolumeValue);
paSourceModel.defaultSource.muted = percent == 0;
paSourceModel.defaultSource.volume = volume;
osd.showMicrophone(percent);
......@@ -163,7 +163,7 @@ Item {
}
var toMute = !paSourceModel.defaultSource.muted;
paSourceModel.defaultSource.muted = toMute;
osd.showMicrophone(toMute? 0 : volumePercent(paSourceModel.defaultSource.volume));
osd.showMicrophone(toMute? 0 : volumePercent(paSourceModel.defaultSource.volume, currentMaxVolumeValue));
}
function playFeedback(sinkIndex) {
......@@ -607,6 +607,11 @@ Item {
paSinkModel.setData(paSinkModel.index(i, 0), PulseAudio.NormalVolume, paSinkModel.role("Volume"));
}
}
for (var i = 0; i < paSourceModel.rowCount(); i++) {
if (paSourceModel.data(paSourceModel.index(i, 0), paSourceModel.role("Volume")) > PulseAudio.NormalVolume) {
paSourceModel.setData(paSourceModel.index(i, 0), PulseAudio.NormalVolume, paSourceModel.role("Volume"));
}
}
}
}
text: i18n("Raise maximum volume")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment