summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-27 22:44:30 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-27 22:53:48 +0300
commit5023a1d0b96071a35547dcc309ce45ba6a17eec1 (patch)
tree8dbd39ef0b498979a6922634926183bd871cc999
parent481bbd254103fc9d6dc98b19a5226f8868c8c5d9 (diff)
downloadplus-5023a1d0b96071a35547dcc309ce45ba6a17eec1.tar.gz
plus-5023a1d0b96071a35547dcc309ce45ba6a17eec1.tar.bz2
plus-5023a1d0b96071a35547dcc309ce45ba6a17eec1.tar.xz
plus-5023a1d0b96071a35547dcc309ce45ba6a17eec1.zip
Fix compilation.
-rw-r--r--src/gui/setup_joystick.cpp31
-rw-r--r--src/gui/widgets/namesmodel.h6
2 files changed, 9 insertions, 28 deletions
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index a3240282a..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);
}
diff --git a/src/gui/widgets/namesmodel.h b/src/gui/widgets/namesmodel.h
index 3f9f10b52..dc694fc46 100644
--- a/src/gui/widgets/namesmodel.h
+++ b/src/gui/widgets/namesmodel.h
@@ -38,6 +38,12 @@ class NamesModel : public gcn::ListModel
virtual std::string getElementAt(int i);
+ std::vector<std::string> &getNames()
+ { return mNames; }
+
+ size_t size()
+ { return mNames.size(); }
+
protected:
std::vector<std::string> mNames;
};