diff options
-rw-r--r-- | src/game.cpp | 5 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 16 | ||||
-rw-r--r-- | src/gui/chatwindow.h | 5 | ||||
-rw-r--r-- | src/keyboardconfig.cpp | 3 | ||||
-rw-r--r-- | src/keyboardconfig.h | 1 |
5 files changed, 30 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp index 259317545..623d2a069 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -716,6 +716,11 @@ void Game::handleInput() socialWindow->nextTab(); return; } + else if (keyboard.isKeyActive(keyboard.KEY_CLOSE_CHAT_TAB)) + { + chatWindow->closeTab(); + return; + } } const int tKey = keyboard.getKeyIndex(event.key.keysym.sym); diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 29ce3bace..c266374ef 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -396,6 +396,22 @@ void ChatWindow::nextTab() mChatTabs->setSelectedTab(tab); } +void ChatWindow::closeTab() +{ + if (!mChatTabs) + return; + + int idx = mChatTabs->getSelectedTabIndex(); + Tab *tab = mChatTabs->getTabByIndex(idx); + if (!tab) + return; + WhisperTab *whisper = dynamic_cast<WhisperTab*>(tab); + if (!whisper) + return; + + whisper->handleCommand("close", ""); +} + void ChatWindow::defaultTab() { if (mChatTabs) diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 05e039c60..b6a37ef79 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -130,6 +130,11 @@ class ChatWindow : public Window, void nextTab(); /** + * Close current chat tab + */ + void closeTab(); + + /** * Switch to the default tab */ void defaultTab(); diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index ff504ca2d..8ad38ab76 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -274,6 +274,9 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI}, {"keyChatNextTab", SDLK_KP9, N_("Next Chat Tab"), KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI}, + {"keyChatCloseTab", KeyboardConfig::KEY_NO_VALUE, + N_("Close current Chat Tab"), KeyboardConfig::GRP_DEFAULT + | KeyboardConfig::GRP_GUI}, {"keyChatPrevHistory", SDLK_KP7, N_("Previous chat line"), KeyboardConfig::GRP_CHAT}, {"keyChatNextHistory", SDLK_KP9, N_("Next chat line"), diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index 1d264b039..43bb1c17f 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -276,6 +276,7 @@ class KeyboardConfig KEY_SCROLL_CHAT_DOWN, KEY_PREV_CHAT_TAB, KEY_NEXT_CHAT_TAB, + KEY_CLOSE_CHAT_TAB, KEY_CHAT_PREV_HISTORY, KEY_CHAT_NEXT_HISTORY, KEY_AUTOCOMPLETE_CHAT, |