summaryrefslogtreecommitdiff
path: root/src/inputmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-12 20:11:09 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-12 20:20:59 +0300
commitaeec9ca9881bbd4fdc332b342b09a795ee3961b4 (patch)
tree3e32a1dd828464a7e6e8c439f658421772a62f40 /src/inputmanager.cpp
parent36027fc87b99b8f048265f6ac470227a1c32d481 (diff)
downloadplus-aeec9ca9881bbd4fdc332b342b09a795ee3961b4.tar.gz
plus-aeec9ca9881bbd4fdc332b342b09a795ee3961b4.tar.bz2
plus-aeec9ca9881bbd4fdc332b342b09a795ee3961b4.tar.xz
plus-aeec9ca9881bbd4fdc332b342b09a795ee3961b4.zip
add ability to show assigned keys in browserbox.
Example: This is chat modifier key: ###ChatMod;. If chat mod key is left shift, it will show: "This is chat modifier key: left shift."
Diffstat (limited to 'src/inputmanager.cpp')
-rw-r--r--src/inputmanager.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp
index 4b5988a57..3b99c3498 100644
--- a/src/inputmanager.cpp
+++ b/src/inputmanager.cpp
@@ -66,7 +66,8 @@ static class KeyFunctor final
InputManager::InputManager() :
mSetupInput(nullptr),
mNewKeyIndex(Input::KEY_NO_VALUE),
- mMask(1)
+ mMask(1),
+ mNameMap()
{
}
@@ -104,6 +105,7 @@ void InputManager::retrieve()
const char *const cf = keyData[i].configField;
if (*cf)
{
+ mNameMap[cf] = i;
KeyFunction &kf = mKey[i];
const std::string keyStr = config.getValue(cf, "");
if (keyStr.empty())
@@ -392,6 +394,16 @@ std::string InputManager::getKeyValueString(const int index) const
return keyStr;
}
+std::string InputManager::getKeyValueByName(const std::string &keyName)
+{
+ const std::map<std::string, int>::const_iterator
+ it = mNameMap.find(keyName);
+
+ if (it == mNameMap.end())
+ return std::string();
+ return getKeyValueString((*it).second);
+}
+
void InputManager::addActionKey(const int action, const int type,
const int val)
{