diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-26 17:46:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-26 17:46:50 +0300 |
commit | a1cd5307497bfc754f157a3e22bfa98fc126137a (patch) | |
tree | 2516d80f0a08fe0004dcdd49efec8d31b0d76214 /src/keyboardconfig.cpp | |
parent | 4208c8cd889112aa1adffaa2b6492f61734d1105 (diff) | |
download | manaverse-a1cd5307497bfc754f157a3e22bfa98fc126137a.tar.gz manaverse-a1cd5307497bfc754f157a3e22bfa98fc126137a.tar.bz2 manaverse-a1cd5307497bfc754f157a3e22bfa98fc126137a.tar.xz manaverse-a1cd5307497bfc754f157a3e22bfa98fc126137a.zip |
Split keyboard keys to groups.
Diffstat (limited to 'src/keyboardconfig.cpp')
-rw-r--r-- | src/keyboardconfig.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index ea9f9b90b..f9831c18f 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -40,6 +40,7 @@ struct KeyData // keyData must be in same order as enum keyAction. static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { + {"", 0, N_("Basic Keys"), 0}, {"keyMoveUp", SDLK_UP, N_("Move Up"), KeyboardConfig::GRP_DEFAULT}, {"keyMoveDown", SDLK_DOWN, N_("Move Down"), KeyboardConfig::GRP_DEFAULT}, {"keyMoveLeft", SDLK_LEFT, N_("Move Left"), KeyboardConfig::GRP_DEFAULT}, @@ -58,7 +59,6 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { KeyboardConfig::GRP_DEFAULT}, {"keyMoveToPoint", SDLK_RSHIFT, N_("Move to navigation point"), KeyboardConfig::GRP_DEFAULT}, - {"keySmilie", SDLK_LALT, N_("Smilie"), KeyboardConfig::GRP_DEFAULT}, {"keyTalk", SDLK_t, N_("Talk"), KeyboardConfig::GRP_DEFAULT}, {"keyTarget", SDLK_LSHIFT, N_("Stop Attack"), KeyboardConfig::GRP_DEFAULT}, {"keyTargetClosest", SDLK_a, N_("Target Closest"), @@ -77,6 +77,10 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { KeyboardConfig::GRP_DEFAULT}, {"keyPathfind", SDLK_f, N_("Change Map View Mode"), KeyboardConfig::GRP_DEFAULT}, + {"keyOK", SDLK_SPACE, N_("Select OK"), + KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI}, + {"keyQuit", SDLK_ESCAPE, N_("Quit"), KeyboardConfig::GRP_DEFAULT}, + {"", 0, N_("Shortcuts Keys"), 0}, {"keyShortcutsKey", SDLK_MENU, N_("Item Shortcuts Key"), KeyboardConfig::GRP_DEFAULT}, {"keyShortcut1", SDLK_1, strprintf(N_("Item Shortcut %d"), 1), @@ -119,6 +123,7 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { strprintf(N_("Item Shortcut %d"), 19), KeyboardConfig::GRP_DEFAULT}, {"keyShortcut20", KeyboardConfig::KEY_NO_VALUE, strprintf(N_("Item Shortcut %d"), 20), KeyboardConfig::GRP_DEFAULT}, + {"", 0, N_("Windows Keys"), 0}, {"keyWindowHelp", SDLK_F1, N_("Help Window"), KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI}, {"keyWindowStatus", SDLK_F2, N_("Status Window"), @@ -165,6 +170,8 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { | KeyboardConfig::GRP_GUI}, {"keySocialNextTab", KeyboardConfig::KEY_NO_VALUE, N_("Next Social Tab"), KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI}, + {"", 0, N_("Emotes Keys"), 0}, + {"keySmilie", SDLK_LALT, N_("Smilie"), KeyboardConfig::GRP_DEFAULT}, {"keyEmoteShortcut1", SDLK_1, strprintf(N_("Emote Shortcut %d"), 1), KeyboardConfig::GRP_EMOTION}, {"keyEmoteShortcut2", SDLK_2, strprintf(N_("Emote Shortcut %d"), 2), @@ -258,12 +265,14 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { KeyboardConfig::GRP_EMOTION}, {"keyEmoteShortcut44", SDLK_b, strprintf(N_("Emote Shortcut %d"), 44), KeyboardConfig::GRP_EMOTION}, + {"", 0, N_("Outfits Keys"), 0}, {"keyWearOutfit", SDLK_RCTRL, N_("Wear Outfit"), KeyboardConfig::GRP_DEFAULT}, {"keyCopyOutfit", SDLK_RALT, N_("Copy Outfit"), KeyboardConfig::GRP_DEFAULT}, {"keyCopyEquipedOutfit", SDLK_RIGHTBRACKET, N_("Copy equipped to Outfit"), KeyboardConfig::GRP_DEFAULT}, + {"", 0, N_("Chat Keys"), 0}, {"keyChat", SDLK_RETURN, N_("Toggle Chat"), KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_CHAT}, {"keyChatScrollUp", SDLK_PAGEUP, N_("Scroll Chat Up"), @@ -285,9 +294,7 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { KeyboardConfig::GRP_CHAT}, {"keyDeActivateChat", SDLK_ESCAPE, N_("Deactivate Chat Input"), KeyboardConfig::GRP_CHAT}, - {"keyOK", SDLK_SPACE, N_("Select OK"), - KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI}, - {"keyQuit", SDLK_ESCAPE, N_("Quit"), KeyboardConfig::GRP_DEFAULT}, + {"", 0, N_("Other Keys"), 0}, {"keyIgnoreInput1", SDLK_LSUPER, N_("Ignore input 1"), KeyboardConfig::GRP_DEFAULT}, {"keyIgnoreInput2", SDLK_RSUPER, N_("Ignore input 2"), @@ -370,15 +377,21 @@ void KeyboardConfig::retrieve() { for (int i = 0; i < KEY_TOTAL; i++) { - mKey[i].value = static_cast<int>(config.getValue( - mKey[i].configField, mKey[i].defaultValue)); + if (*mKey[i].configField) + { + mKey[i].value = static_cast<int>(config.getValue( + mKey[i].configField, mKey[i].defaultValue)); + } } } void KeyboardConfig::store() { for (int i = 0; i < KEY_TOTAL; i++) - config.setValue(mKey[i].configField, mKey[i].value); + { + if (*mKey[i].configField) + config.setValue(mKey[i].configField, mKey[i].value); + } } void KeyboardConfig::makeDefault() @@ -396,7 +409,7 @@ bool KeyboardConfig::hasConflicts() */ for (i = 0; i < KEY_TOTAL; i++) { - if (mKey[i].value == KEY_NO_VALUE) + if (mKey[i].value == KEY_NO_VALUE || !*mKey[i].configField) continue; for (j = i, j++; j < KEY_TOTAL; j++) @@ -405,7 +418,8 @@ bool KeyboardConfig::hasConflicts() // as well as emote and ignore keys, but no other keys if (mKey[j].value != KEY_NO_VALUE && mKey[i].value == mKey[j].value && - ((mKey[i].grp & mKey[j].grp) != 0) + ((mKey[i].grp & mKey[j].grp) != 0 && + *mKey[i].configField) ) { mBindError = strprintf(_("Conflict \"%s\" and \"%s\" keys. " |