summaryrefslogtreecommitdiff
path: root/src/gui/windows/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-31 00:19:18 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-31 00:19:18 +0300
commit694e07d193e7c5758a7d672b45668651b034003d (patch)
tree20a4aec8dee2b3b5475db9f3667e797fb43c603b /src/gui/windows/chatwindow.cpp
parentc9a84749b3b71d4df6cc3b9b488d60dc4a013a20 (diff)
downloadmanaplus-694e07d193e7c5758a7d672b45668651b034003d.tar.gz
manaplus-694e07d193e7c5758a7d672b45668651b034003d.tar.bz2
manaplus-694e07d193e7c5758a7d672b45668651b034003d.tar.xz
manaplus-694e07d193e7c5758a7d672b45668651b034003d.zip
Convert InputAction enum into strong typed enum.
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r--src/gui/windows/chatwindow.cpp30
1 files changed, 15 insertions, 15 deletions
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<ChatTab*>(tab);
- if (inputManager.isActionActive(static_cast<int>(
- 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<int>(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<int>(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<int>(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<unsigned>(
mChatInput->getText().length()));
}
- else if (actionId == static_cast<int>(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<int>(InputAction::GUI_TAB) &&
+ else if (actionId == InputAction::GUI_TAB &&
!mChatInput->getText().empty())
{
autoComplete();
return;
}
- else if (actionId == static_cast<int>(InputAction::GUI_CANCEL) &&
+ else if (actionId == InputAction::GUI_CANCEL &&
mChatInput->isVisibleLocal())
{
mChatInput->processVisible(Visible_false);
}
- else if (actionId == static_cast<int>(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<int>(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<int>(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<int>(InputAction::GUI_CTRL)))
+ if (inputManager.isActionActive(InputAction::GUI_CTRL))
{
- if (actionId == static_cast<int>(InputAction::GUI_B))
+ if (actionId == InputAction::GUI_B)
{
std::string inputText = mChatInput->getTextBeforeCaret();
toLower(inputText);