From 81a7b06f2ff1fad4b012068b15975bdb5e86a0e4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 23 Aug 2014 22:13:50 +0300 Subject: Move chat command /clear into actions. --- src/actions/chat.cpp | 10 ++++++++++ src/actions/chat.h | 1 + src/commands.cpp | 10 ---------- src/commands.h | 3 --- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 11 ++++++++++- src/input/pages/chat.cpp | 6 ++++++ 7 files changed, 28 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp index 858b5acbb..74f3fc691 100644 --- a/src/actions/chat.cpp +++ b/src/actions/chat.cpp @@ -232,4 +232,14 @@ impHandler(query) return true; } +impHandler0(clearChatTab) +{ + if (chatWindow) + { + chatWindow->clearTab(); + return true; + } + return false; +} + } // namespace Actions diff --git a/src/actions/chat.h b/src/actions/chat.h index fe35021be..8a5e3a3c8 100644 --- a/src/actions/chat.h +++ b/src/actions/chat.h @@ -37,6 +37,7 @@ namespace Actions decHandler(scrollChatDown); decHandler(msg); decHandler(query); + decHandler(clearChatTab); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index 8e90532c8..7491c678e 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -251,16 +251,6 @@ static void outStringNormal(ChatTab *const tab, } } -impHandler0(clear) -{ - if (chatWindow) - { - chatWindow->clearTab(); - return true; - } - return false; -} - impHandler0(cleanGraphics) { ResourceManager::getInstance()->clearCache(); diff --git a/src/commands.h b/src/commands.h index 9c18eb1df..1dbd3a27d 100644 --- a/src/commands.h +++ b/src/commands.h @@ -51,7 +51,6 @@ struct CommandInfo final namespace Commands { - decHandler(clear); decHandler(cleanGraphics); decHandler(cleanFonts); decHandler(createParty); @@ -144,7 +143,6 @@ enum COMMAND_BLACKLIST, COMMAND_ENEMY, COMMAND_ERASE, - COMMAND_CLEAR, COMMAND_CLEANGRAPHICS, COMMAND_CLEANFONTS, COMMAND_CREATEPARTY, @@ -229,7 +227,6 @@ static const CommandInfo commands[] = {"blacklist", &Commands::blackList, -1, true}, {"enemy", &Commands::enemy, -1, true}, {"erase", &Commands::erase, -1, true}, - {"clear", &Commands::clear, -1, true}, {"cleangraphics", &Commands::cleanGraphics, -1, false}, {"cleanfonts", &Commands::cleanFonts, -1, false}, {"createparty", &Commands::createParty, -1, true}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 15af94ec7..36adc4759 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -349,6 +349,7 @@ namespace InputAction WHO, WHISPER, QUERY, + CLEAR_CHAT_TAB, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index fc2b601b6..b5498427d 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -2910,7 +2910,16 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "q|query", - true} + true}, + {"keyClearChatTab", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::clearChatTab, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "clear", + false} }; #endif // INPUT_INPUTACTIONMAP_H diff --git a/src/input/pages/chat.cpp b/src/input/pages/chat.cpp index d61f7855a..234892c77 100644 --- a/src/input/pages/chat.cpp +++ b/src/input/pages/chat.cpp @@ -60,6 +60,12 @@ SetupActionData setupActionDataChat[] = InputAction::NEXT_CHAT_TAB, "", }, + { + // TRANSLATORS: input action name + N_("Clear current chat tab"), + InputAction::CLEAR_CHAT_TAB, + "", + }, { // TRANSLATORS: input action name N_("Close current Chat Tab"), -- cgit v1.2.3-60-g2f50