diff options
author | Reid <reidyaro@gmail.com> | 2012-03-01 22:03:01 +0100 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2012-03-01 22:03:01 +0100 |
commit | 490862919d79369112c75955a9c36ff8a081efd3 (patch) | |
tree | 6fe89466b9c53ba811f298174e6d787bbae71e09 /src/gui/setup_joystick.cpp | |
parent | dff814619d63496acd3c4e8730b828b5d4d931fb (diff) | |
parent | d873da3e8e57480016596f714845c1bc7e712e68 (diff) | |
download | plus-490862919d79369112c75955a9c36ff8a081efd3.tar.gz plus-490862919d79369112c75955a9c36ff8a081efd3.tar.bz2 plus-490862919d79369112c75955a9c36ff8a081efd3.tar.xz plus-490862919d79369112c75955a9c36ff8a081efd3.zip |
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/gui/setup_joystick.cpp')
-rw-r--r-- | src/gui/setup_joystick.cpp | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index 290607be4..cb3ff9341 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -31,6 +31,7 @@ #include "gui/widgets/dropdown.h" #include "gui/widgets/label.h" #include "gui/widgets/layouthelper.h" +#include "gui/widgets/namesmodel.h" #include "utils/gettext.h" @@ -40,32 +41,6 @@ extern Joystick *joystick; -class NamesModel : public gcn::ListModel -{ - public: - NamesModel() - { } - - virtual ~NamesModel() - { } - - virtual int getNumberOfElements() - { - return static_cast<int>(mNames.size()); - } - - virtual std::string getElementAt(int i) - { - if (i >= getNumberOfElements() || i < 0) - return _("???"); - - return mNames[i]; - } - - std::vector<std::string> mNames; -}; - - Setup_Joystick::Setup_Joystick(): mCalibrateLabel(new Label(_("Press the button to start calibration"))), mCalibrateButton(new Button(_("Calibrate"), "calibrate", this)), @@ -77,7 +52,7 @@ Setup_Joystick::Setup_Joystick(): { setName(_("Joystick")); - Joystick::getNames(mNamesModel->mNames); + Joystick::getNames(mNamesModel->getNames()); mOriginalJoystickEnabled = config.getBoolValue("joystickEnabled"); mJoystickEnabled->setSelected(mOriginalJoystickEnabled); @@ -95,7 +70,7 @@ Setup_Joystick::Setup_Joystick(): else { unsigned sel = config.getIntValue("selectedJoystick"); - if (sel >= mNamesModel->mNames.size()) + if (sel >= mNamesModel->size()) sel = 0; mNamesDropDown->setSelected(sel); } @@ -146,7 +121,7 @@ void Setup_Joystick::action(const gcn::ActionEvent &event) { mCalibrateButton->setCaption(_("Stop")); mCalibrateLabel->setCaption( - _("Rotate the stick and dont press buttons")); + _("Rotate the stick and don't press buttons")); joystick->startCalibration(); } } |