From 7f510bc175ad1d71686865e6690da90ead71ee86 Mon Sep 17 00:00:00 2001 From: Hartmnt Date: Tue, 10 Oct 2023 22:03:31 +0000 Subject: [PATCH] FIX(client,positional-audio): Fix positional minimum and maximum distance constraints 8d7e1b52c29 added constraints to the positional distance sliders and spinner boxes. It was decided that the maximum distance must always be at least 1m larger than the minimum and vice versa. However, the methods which update the slider value were - incorrectly - using +1 and -1, which only equates to 0.1m in slide space. The subsequent update happening in the methods, which update the spinner boxes, were now using the incorrect 0.1m change in the checks and in turn adding or subtracting 1 in spinner box space (which correctly equates to 1m in spinner box space). Because of the order of loading operations, only the minimum slider is affected by the problem: It would reduce by 0.9m everytime the options dialog was loaded (and saved). This commit fixes the problem by adding and subtracting 10 in two of the methods which is 1m in slider space. It also slightly changes the wording of the comments --- src/mumble/AudioConfigDialog.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mumble/AudioConfigDialog.cpp b/src/mumble/AudioConfigDialog.cpp index 0ef432dc978..07871cfceab 100644 --- a/src/mumble/AudioConfigDialog.cpp +++ b/src/mumble/AudioConfigDialog.cpp @@ -866,22 +866,22 @@ void AudioOutputDialog::on_qsbMinimumDistance_valueChanged(double value) { qsMinDistance->setValue(value * 10); // Ensure that max distance is always a least 1m larger than min distance - qsMaxDistance->setValue(std::max(qsMaxDistance->value(), static_cast< int >(value * 10) + 1)); + qsMaxDistance->setValue(std::max(qsMaxDistance->value(), static_cast< int >(value * 10) + 10)); } void AudioOutputDialog::on_qsMaxDistance_valueChanged(int value) { QSignalBlocker blocker(qsbMaximumDistance); qsbMaximumDistance->setValue(value / 10.0f); - // Ensure that max distance is always a least 1m larger than min distance + // Ensure that min distance is always a least 1m less than max distance qsbMinimumDistance->setValue(std::min(qsbMinimumDistance->value(), (value / 10.0) - 1)); } void AudioOutputDialog::on_qsbMaximumDistance_valueChanged(double value) { QSignalBlocker blocker(qsMaxDistance); qsMaxDistance->setValue(value * 10); - // Ensure that max distance is always a least 1m larger than min distance - qsMinDistance->setValue(std::min(qsMinDistance->value(), static_cast< int >(value * 10) - 1)); + // Ensure that min distance is always a least 1m less than max distance + qsMinDistance->setValue(std::min(qsMinDistance->value(), static_cast< int >(value * 10) - 10)); } void AudioOutputDialog::on_qsMinimumVolume_valueChanged(int value) {