summaryrefslogtreecommitdiff
path: root/src/gui/widgets/setuptouchitem.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-31 19:26:21 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-31 19:26:21 +0300
commitf355fe070293a3f80b33ee0bc0154b2fe767fc4d (patch)
tree2a7a3015791dabcae946f2b12259233b4e38876c /src/gui/widgets/setuptouchitem.h
parent6fbb71142de5b2b12c2153b41a21b6dc34284343 (diff)
downloadmanaverse-f355fe070293a3f80b33ee0bc0154b2fe767fc4d.tar.gz
manaverse-f355fe070293a3f80b33ee0bc0154b2fe767fc4d.tar.bz2
manaverse-f355fe070293a3f80b33ee0bc0154b2fe767fc4d.tar.xz
manaverse-f355fe070293a3f80b33ee0bc0154b2fe767fc4d.zip
Sort onscreen keyboard actions list.
Diffstat (limited to 'src/gui/widgets/setuptouchitem.h')
-rw-r--r--src/gui/widgets/setuptouchitem.h41
1 files changed, 8 insertions, 33 deletions
diff --git a/src/gui/widgets/setuptouchitem.h b/src/gui/widgets/setuptouchitem.h
index 2f5cf7805..77eff2ae6 100644
--- a/src/gui/widgets/setuptouchitem.h
+++ b/src/gui/widgets/setuptouchitem.h
@@ -26,46 +26,21 @@
#include "gui/widgets/namesmodel.h"
#include "gui/widgets/setupitem.h"
+#include <algorithm>
+
class TouchActionsModel final : public NamesModel
{
public:
- TouchActionsModel() :
- NamesModel()
- {
- int cnt = 0;
- for (int f = 0, sz = touchActionDataSize; f < sz; f ++)
- {
- int k = 0;
- while (!touchActionData[f][k].name.empty())
- {
- const SetupActionData &data = touchActionData[f][k];
- mNames.push_back(data.name);
- mActionId.push_back(data.actionId);
- mActionToSelection[data.actionId] = cnt;
- k ++;
- cnt ++;
- }
- }
- }
+ TouchActionsModel();
+
+ A_DELETE_COPY(TouchActionsModel)
virtual ~TouchActionsModel()
{ }
- int getActionFromSelection(int sel)
- {
- if (sel < 0 || sel > mActionId.size())
- return -1;
- return mActionId[sel];
- }
-
- int getSelectionFromAction(int action)
- {
- std::map<int, int>::const_iterator it
- = mActionToSelection.find(action);
- if (it == mActionToSelection.end())
- return 0;
- return (*it).second;
- }
+ int getActionFromSelection(int sel);
+
+ int getSelectionFromAction(int action);
private:
std::vector<int> mActionId;