summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabs/setup_joystick.cpp
diff options
context:
space:
mode:
authorewewukek <ewewukek@gmail.com>2024-01-10 23:26:42 +0300
committerFedja Beader <fedja@protonmail.ch>2024-05-14 01:14:04 +0000
commit84a11a02aad86d9388175c7fd0971accdb586473 (patch)
tree2074498193d24700a002319a0c4b412752809f43 /src/gui/widgets/tabs/setup_joystick.cpp
parente0f535979ad9315efbe4a16ab1ad345d9e9a4347 (diff)
downloadmanaverse-84a11a02aad86d9388175c7fd0971accdb586473.tar.gz
manaverse-84a11a02aad86d9388175c7fd0971accdb586473.tar.bz2
manaverse-84a11a02aad86d9388175c7fd0971accdb586473.tar.xz
manaverse-84a11a02aad86d9388175c7fd0971accdb586473.zip
Switch joystick axis tolerance type to float
Diffstat (limited to 'src/gui/widgets/tabs/setup_joystick.cpp')
-rw-r--r--src/gui/widgets/tabs/setup_joystick.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp
index 3542f39a5..c7ece8c7a 100644
--- a/src/gui/widgets/tabs/setup_joystick.cpp
+++ b/src/gui/widgets/tabs/setup_joystick.cpp
@@ -54,7 +54,7 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
mNamesDropDown(new DropDown(this, mNamesModel,
false, Modal_false, nullptr, std::string())),
mToleranceLabel(new Label(this)),
- mToleranceSlider(new Slider(this, 1000, 32767, 1000)),
+ mToleranceSlider(new Slider(this, 0.01, 1, 0.01)),
mUseInactiveCheckBox(new CheckBox(this,
// TRANSLATORS: joystick settings tab checkbox
_("Use joystick if client window inactive"),
@@ -71,10 +71,11 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
mJoystickEnabled->setActionEventId("joystick");
mJoystickEnabled->addActionListener(this);
- int tolerance = config.getIntValue("joystickTolerance");
+ float tolerance = config.getFloatValue("joystickTolerance");
mToleranceSlider->setValue(tolerance);
// TRANSLATORS: joystick settings tab label
- mToleranceLabel->setCaption(_("Axis tolerance: ") + strprintf("%d", tolerance));
+ mToleranceLabel->setCaption(_("Axis tolerance: ")
+ + strprintf("%.2f", tolerance));
mToleranceLabel->setWidth(150);
mToleranceLabel->setHeight(20);
@@ -130,9 +131,10 @@ void Setup_Joystick::action(const ActionEvent &event)
}
else if (source == mToleranceSlider)
{
- int tolerance = mToleranceSlider->getValue();
+ float tolerance = mToleranceSlider->getValue();
// TRANSLATORS: joystick settings tab label
- mToleranceLabel->setCaption(_("Axis tolerance: ") + strprintf("%d", tolerance));
+ mToleranceLabel->setCaption(_("Axis tolerance: ")
+ + strprintf("%.2f", tolerance));
}
else if (source == mDetectButton)
{
@@ -177,7 +179,7 @@ void Setup_Joystick::apply()
config.setValue("useInactiveJoystick", mUseInactiveCheckBox->isSelected());
joystick->setUseInactive(mUseInactiveCheckBox->isSelected());
- int tolerance = mToleranceSlider->getValue();
+ float tolerance = mToleranceSlider->getValue();
config.setValue("joystickTolerance", tolerance);
joystick->setTolerance(tolerance);
}