From 694e07d193e7c5758a7d672b45668651b034003d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 31 May 2015 00:19:18 +0300 Subject: Convert InputAction enum into strong typed enum. --- src/gui/windows/chatwindow.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/gui/windows/chatwindow.cpp') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 747ba498e..7a62ad755 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -698,8 +698,7 @@ void ChatWindow::mousePressed(MouseEvent &event) { event.consume(); ChatTab *const cTab = dynamic_cast(tab); - if (inputManager.isActionActive(static_cast( - InputAction::CHAT_MOD))) + if (inputManager.isActionActive(InputAction::CHAT_MOD)) { inputManager.executeChatCommand( InputAction::CLOSE_CHAT_TAB, @@ -752,16 +751,16 @@ void ChatWindow::mouseDragged(MouseEvent &event) } #define ifKey(key, str) \ - else if (actionId == static_cast(key)) \ + else if (actionId == key) \ { \ temp = str; \ } void ChatWindow::keyPressed(KeyEvent &event) { - const int actionId = event.getActionId(); + const InputActionT actionId = event.getActionId(); std::string temp; - if (actionId == static_cast(InputAction::GUI_DOWN)) + if (actionId == InputAction::GUI_DOWN) { if (mCurHist != mHistory.end()) { @@ -788,8 +787,9 @@ void ChatWindow::keyPressed(KeyEvent &event) mChatInput->setText(""); } } - else if (actionId == static_cast(InputAction::GUI_UP) && - mCurHist != mHistory.begin() && !mHistory.empty()) + else if (actionId == InputAction::GUI_UP && + mCurHist != mHistory.begin() && + !mHistory.empty()) { // Move backward through the history --mCurHist; @@ -798,7 +798,7 @@ void ChatWindow::keyPressed(KeyEvent &event) mChatInput->setCaretPosition(static_cast( mChatInput->getText().length())); } - else if (actionId == static_cast(InputAction::GUI_INSERT) && + else if (actionId == InputAction::GUI_INSERT && mChatInput->getText() != "") { // Add the current message to the history and clear the text @@ -807,18 +807,18 @@ void ChatWindow::keyPressed(KeyEvent &event) mCurHist = mHistory.end(); mChatInput->setText(""); } - else if (actionId == static_cast(InputAction::GUI_TAB) && + else if (actionId == InputAction::GUI_TAB && !mChatInput->getText().empty()) { autoComplete(); return; } - else if (actionId == static_cast(InputAction::GUI_CANCEL) && + else if (actionId == InputAction::GUI_CANCEL && mChatInput->isVisibleLocal()) { mChatInput->processVisible(Visible_false); } - else if (actionId == static_cast(InputAction::CHAT_PREV_HISTORY) && + else if (actionId == InputAction::CHAT_PREV_HISTORY && mChatInput->isVisibleLocal()) { const ChatTab *const tab = getFocused(); @@ -850,7 +850,7 @@ void ChatWindow::keyPressed(KeyEvent &event) mChatInput->getText().length())); } } - else if (actionId == static_cast(InputAction::CHAT_NEXT_HISTORY) && + else if (actionId == InputAction::CHAT_NEXT_HISTORY && mChatInput->isVisibleLocal()) { const ChatTab *const tab = getFocused(); @@ -886,7 +886,7 @@ void ChatWindow::keyPressed(KeyEvent &event) mChatInput->getText().length())); } } - else if (actionId == static_cast(InputAction::GUI_F1)) + else if (actionId == InputAction::GUI_F1) { if (emoteWindow) { @@ -908,9 +908,9 @@ void ChatWindow::keyPressed(KeyEvent &event) ifKey(InputAction::GUI_F11, "\u2618") ifKey(InputAction::GUI_F12, "\u2592") - if (inputManager.isActionActive(static_cast(InputAction::GUI_CTRL))) + if (inputManager.isActionActive(InputAction::GUI_CTRL)) { - if (actionId == static_cast(InputAction::GUI_B)) + if (actionId == InputAction::GUI_B) { std::string inputText = mChatInput->getTextBeforeCaret(); toLower(inputText); -- cgit v1.2.3-70-g09d2