diff options
author | Socapex <philippe_groarke@yahoo.ca> | 2013-01-19 21:02:01 -0500 |
---|---|---|
committer | Socapex <philippe_groarke@yahoo.ca> | 2013-01-19 21:02:01 -0500 |
commit | df606ace309acaf0c78f52e1f98eabed6c844ae2 (patch) | |
tree | d9799b0e4a507d9eacbbafc1755eecea03f0b373 /src/gui/setup_joystick.cpp | |
parent | d0169223b889a115b486e974e5b287c3ccb00d85 (diff) | |
parent | 678d4e70999ade5a36862039875aa5564291d09d (diff) | |
download | plus-df606ace309acaf0c78f52e1f98eabed6c844ae2.tar.gz plus-df606ace309acaf0c78f52e1f98eabed6c844ae2.tar.bz2 plus-df606ace309acaf0c78f52e1f98eabed6c844ae2.tar.xz plus-df606ace309acaf0c78f52e1f98eabed6c844ae2.zip |
Merge remote-tracking branch 'upstream/master' into osx
Diffstat (limited to 'src/gui/setup_joystick.cpp')
-rw-r--r-- | src/gui/setup_joystick.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index f2a0ce144..8956384c1 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2012 The ManaPlus Developers + * Copyright (C) 2011-2013 The ManaPlus Developers * * This file is part of The ManaPlus Client. * @@ -45,6 +45,7 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) : mCalibrateLabel(new Label(this, _("Press the button to start calibration"))), mCalibrateButton(new Button(this, _("Calibrate"), "calibrate", this)), + mDetectButton(new Button(this, _("Detect joysticks"), "detect", this)), mJoystickEnabled(new CheckBox(this, _("Enable joystick"))), mNamesModel(new NamesModel), mNamesDropDown(new DropDown(this, mNamesModel)), @@ -83,8 +84,9 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) : place(0, 0, mJoystickEnabled); place(0, 1, mNamesDropDown); place(0, 2, mUseInactiveCheckBox); - place(0, 3, mCalibrateLabel); - place(0, 4, mCalibrateButton); + place(0, 3, mDetectButton); + place(0, 4, mCalibrateLabel); + place(0, 5, mCalibrateButton); setDimension(gcn::Rectangle(0, 0, 365, 75)); } @@ -97,15 +99,25 @@ Setup_Joystick::~Setup_Joystick() void Setup_Joystick::action(const gcn::ActionEvent &event) { - if (event.getSource() == mJoystickEnabled) + const gcn::Widget *const source = event.getSource(); + if (source == mJoystickEnabled) { setTempEnabled(mJoystickEnabled->isSelected()); } - else if (event.getSource() == mNamesDropDown) + else if (source == mNamesDropDown) { if (joystick) joystick->setNumber(mNamesDropDown->getSelected()); } + else if (source == mDetectButton) + { + if (joystick) + { + joystick->reload(); + Joystick::getNames(mNamesModel->getNames()); + mNamesDropDown->setSelected(joystick->getNumber()); + } + } else { if (!joystick) |