diff --git a/backends/keymapper/keymap.cpp b/backends/keymapper/keymap.cpp index 4f90a699fe9..bfb6416683d 100644 --- a/backends/keymapper/keymap.cpp +++ b/backends/keymapper/keymap.cpp @@ -42,7 +42,7 @@ Keymap::Keymap(KeymapType type, const String &name) : } Keymap::~Keymap() { - for (ActionList::iterator it = _actions.begin(); it != _actions.end(); ++it) + for (ActionArray::iterator it = _actions.begin(); it != _actions.end(); ++it) delete *it; } @@ -78,7 +78,7 @@ const HardwareInput *Keymap::getActionMapping(Action *action) const { } const Action *Keymap::findAction(const char *id) const { - for (ActionList::const_iterator it = _actions.begin(); it != _actions.end(); ++it) { + for (ActionArray::const_iterator it = _actions.begin(); it != _actions.end(); ++it) { if (strcmp((*it)->id, id) == 0) return *it; } @@ -103,7 +103,7 @@ void Keymap::loadMappings(const HardwareInputSet *hwKeys) { String prefix = KEYMAP_KEY_PREFIX + _name + "_"; - for (ActionList::iterator it = _actions.begin(); it != _actions.end(); ++it) { + for (ActionArray::const_iterator it = _actions.begin(); it != _actions.end(); ++it) { Action* ua = *it; String actionId(ua->id); String confKey = prefix + actionId; @@ -132,7 +132,7 @@ void Keymap::saveMappings() { String prefix = KEYMAP_KEY_PREFIX + _name + "_"; - for (HardwareActionMap::iterator it = _hwActionMap.begin(); it != _hwActionMap.end(); it++) { + for (HardwareActionMap::const_iterator it = _hwActionMap.begin(); it != _hwActionMap.end(); it++) { const Action *action = it->_value; const HardwareInput *input = it->_key; diff --git a/backends/keymapper/keymap.h b/backends/keymapper/keymap.h index 5baadb23266..fd72c6f7732 100644 --- a/backends/keymapper/keymap.h +++ b/backends/keymapper/keymap.h @@ -47,6 +47,8 @@ public: kKeymapTypeGame }; + typedef Array ActionArray; + Keymap(KeymapType type, const String &name); ~Keymap(); @@ -80,7 +82,7 @@ public: /** * Get the list of all the Actions contained in this Keymap */ - List &getActions() { return _actions; } + const ActionArray &getActions() const { return _actions; } void setConfigDomain(ConfigManager::Domain *dom); @@ -97,7 +99,7 @@ public: */ void saveMappings(); - const String &getName() { return _name; } + const String &getName() const { return _name; } KeymapType getType() const { return _type; } /** @@ -118,7 +120,6 @@ private: const Action *findAction(const char *id) const; - typedef List ActionList; typedef HashMap HardwareActionMap; KeymapType _type; @@ -126,7 +127,7 @@ private: bool _enabled; - ActionList _actions; + ActionArray _actions; HardwareActionMap _hwActionMap; ConfigManager::Domain *_configDomain; diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp index 8d5ba3c6528..82f402c970d 100644 --- a/backends/keymapper/remap-dialog.cpp +++ b/backends/keymapper/remap-dialog.cpp @@ -216,7 +216,7 @@ void RemapDialog::loadKeymap() { assert(_kmPopUp->getSelected() != -1); Keymap *km = _keymapTable[_kmPopUp->getSelectedTag()]; - for (List::iterator it = km->getActions().begin(); it != km->getActions().end(); ++it) { + for (Keymap::ActionArray::const_iterator it = km->getActions().begin(); it != km->getActions().end(); ++it) { ActionRow row; row.action = *it;