From dded1355609c8f23281f78ec719b09b1693ea717 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 23 Aug 2014 14:50:14 +0300 Subject: Move chat command /closeall into actions. --- src/actions/chat.cpp | 11 +++++++++++ src/actions/chat.h | 1 + src/commands.cpp | 12 ------------ src/commands.h | 5 +---- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ src/input/pages/chat.cpp | 6 ++++++ 7 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp index 5b70c2085..9895d8388 100644 --- a/src/actions/chat.cpp +++ b/src/actions/chat.cpp @@ -112,6 +112,17 @@ impHandler0(closeChatTab) return false; } +impHandler0(closeAllChatTabs) +{ + if (chatWindow) + { + chatWindow->removeAllWhispers(); + chatWindow->saveState(); + return true; + } + return false; +} + impHandler0(scrollChatUp) { if (chatWindow && chatWindow->isWindowVisible()) diff --git a/src/actions/chat.h b/src/actions/chat.h index ed7ef97ed..bdb62e209 100644 --- a/src/actions/chat.h +++ b/src/actions/chat.h @@ -31,6 +31,7 @@ namespace Actions decHandler(prevChatTab); decHandler(nextChatTab); decHandler(closeChatTab); + decHandler(closeAllChatTabs); decHandler(scrollChatUp); decHandler(scrollChatDown); } // namespace Actions diff --git a/src/commands.cpp b/src/commands.cpp index 2f68efda4..3c0734e43 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -754,18 +754,6 @@ impHandler0(attackHuman) return true; } - -impHandler0(closeAll) -{ - if (chatWindow) - { - chatWindow->removeAllWhispers(); - chatWindow->saveState(); - return true; - } - return false; -} - impHandler0(ignoreAll) { if (chatWindow) diff --git a/src/commands.h b/src/commands.h index ba3bb28df..8a03a5f40 100644 --- a/src/commands.h +++ b/src/commands.h @@ -80,7 +80,6 @@ namespace Commands decHandler(move); decHandler(target); decHandler(attackHuman); - decHandler(closeAll); decHandler(ignoreAll); decHandler(outfit); decHandler(emote); @@ -144,8 +143,7 @@ namespace Commands enum { - COMMAND_CLOSEALL = 0, - COMMAND_IGNOREALL, + COMMAND_IGNOREALL = 0, COMMAND_HELP, COMMAND_ANNOUNCE, COMMAND_IPC_TOGGLE, @@ -241,7 +239,6 @@ enum static const CommandInfo commands[] = { - {"closeall", &Commands::closeAll, -1, false}, {"ignoreall", &Commands::ignoreAll, -1, false}, {"help", &Commands::help, -1, false}, {"announce", &Commands::announce, -1, true}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 2231a89dd..5cea51f31 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -341,6 +341,7 @@ namespace InputAction WINDOW_ABOUT, WINDOW_UPDATER, TARGET_CLOSEST_MONSTER, + CLOSE_ALL_CHAT_TABS, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 65c145dbd..35fd37d57 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -2837,6 +2837,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::GAME | InputCondition::NOTARGET | InputCondition::VALIDSPEED, "", + false}, + {"keyChatCloseAllTabs", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT | Input::GRP_GUI, + &Actions::closeAllChatTabs, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "closeall", false} }; diff --git a/src/input/pages/chat.cpp b/src/input/pages/chat.cpp index 71922103a..113efa3a5 100644 --- a/src/input/pages/chat.cpp +++ b/src/input/pages/chat.cpp @@ -66,6 +66,12 @@ SetupActionData setupActionDataChat[] = InputAction::CLOSE_CHAT_TAB, "", }, + { + // TRANSLATORS: input action name + N_("Close all chat tabs"), + InputAction::CLOSE_ALL_CHAT_TABS, + "", + }, { // TRANSLATORS: input action name N_("Previous chat line"), -- cgit v1.2.3-60-g2f50