summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/charcreatedialog.cpp2
-rw-r--r--src/gui/windows/charselectdialog.cpp2
-rw-r--r--src/gui/windows/chatwindow.cpp30
-rw-r--r--src/gui/windows/editserverdialog.cpp8
-rw-r--r--src/gui/windows/inventorywindow.cpp17
-rw-r--r--src/gui/windows/logindialog.cpp8
-rw-r--r--src/gui/windows/outfitwindow.cpp4
-rw-r--r--src/gui/windows/quitdialog.cpp2
-rw-r--r--src/gui/windows/registerdialog.cpp8
-rw-r--r--src/gui/windows/updaterwindow.cpp8
-rw-r--r--src/gui/windows/worldselectdialog.cpp8
11 files changed, 48 insertions, 49 deletions
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 87dc25115..436c4d841 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -685,7 +685,7 @@ void CharCreateDialog::updatePlayer()
void CharCreateDialog::keyPressed(KeyEvent &event)
{
- const int actionId = event.getActionId();
+ const InputActionT actionId = event.getActionId();
switch (actionId)
{
case InputAction::GUI_CANCEL:
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index dd82091b0..0ffba7984 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -353,7 +353,7 @@ void CharSelectDialog::use(const int selected)
void CharSelectDialog::keyPressed(KeyEvent &event)
{
- const int actionId = event.getActionId();
+ const InputActionT actionId = event.getActionId();
switch (actionId)
{
case InputAction::GUI_CANCEL:
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);
diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp
index e6fd2e16c..18319dbde 100644
--- a/src/gui/windows/editserverdialog.cpp
+++ b/src/gui/windows/editserverdialog.cpp
@@ -299,14 +299,14 @@ void EditServerDialog::keyPressed(KeyEvent &event)
if (event.isConsumed())
return;
- const int actionId = event.getActionId();
+ const InputActionT actionId = event.getActionId();
- if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
+ if (actionId == InputAction::GUI_CANCEL)
{
scheduleDelete();
}
- else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
- || actionId == static_cast<int>(InputAction::GUI_SELECT2))
+ else if (actionId == InputAction::GUI_SELECT ||
+ actionId == InputAction::GUI_SELECT2)
{
action(ActionEvent(nullptr, mOkButton->getActionEventId()));
}
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index ed3742c9b..c5934b7ba 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -491,8 +491,7 @@ void InventoryWindow::action(const ActionEvent &event)
if (PlayerInfo::isItemProtected(item->getId()))
return;
- if (inputManager.isActionActive(static_cast<int>(
- InputAction::STOP_ATTACK)))
+ if (inputManager.isActionActive(InputAction::STOP_ATTACK))
{
PlayerInfo::dropItem(item, item->getQuantity(), Sfx_true);
}
@@ -551,12 +550,12 @@ void InventoryWindow::mouseClicked(MouseEvent &event)
if (clicks == 2 && gui)
gui->resetClickCount();
- const bool mod = (isStorageActive() && inputManager.isActionActive(
- static_cast<int>(InputAction::STOP_ATTACK)));
+ const bool mod = (isStorageActive() &&
+ inputManager.isActionActive(InputAction::STOP_ATTACK));
- const bool mod2 = (tradeWindow && tradeWindow->isWindowVisible()
- && inputManager.isActionActive(static_cast<int>(
- InputAction::STOP_ATTACK)));
+ const bool mod2 = (tradeWindow &&
+ tradeWindow->isWindowVisible() &&
+ inputManager.isActionActive(InputAction::STOP_ATTACK));
if (!mod && !mod2 && event.getButton() == MouseButton::RIGHT)
{
@@ -707,13 +706,13 @@ void InventoryWindow::mouseExited(MouseEvent &event A_UNUSED)
void InventoryWindow::keyPressed(KeyEvent &event)
{
- if (event.getActionId() == static_cast<int>(InputAction::GUI_MOD))
+ if (event.getActionId() == InputAction::GUI_MOD)
mSplit = true;
}
void InventoryWindow::keyReleased(KeyEvent &event)
{
- if (event.getActionId() == static_cast<int>(InputAction::GUI_MOD))
+ if (event.getActionId() == InputAction::GUI_MOD)
mSplit = false;
}
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index f2b41c7b5..5230ef4fe 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -252,13 +252,13 @@ void LoginDialog::keyPressed(KeyEvent &event)
return;
}
- const int actionId = event.getActionId();
- if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
+ const InputActionT actionId = event.getActionId();
+ if (actionId == InputAction::GUI_CANCEL)
{
action(ActionEvent(nullptr, mServerButton->getActionEventId()));
}
- else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
- || actionId == static_cast<int>(InputAction::GUI_SELECT2))
+ else if (actionId == InputAction::GUI_SELECT ||
+ actionId == InputAction::GUI_SELECT2)
{
action(ActionEvent(nullptr, mLoginButton->getActionEventId()));
}
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index b3a17915d..c1d9b1d24 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -30,6 +30,7 @@
#include "being/playerinfo.h"
+#include "input/inputactionoperators.h"
#include "input/inputmanager.h"
#include "gui/viewport.h"
@@ -590,8 +591,7 @@ std::string OutfitWindow::keyName(const int number)
{
if (number < 0 || number >= SHORTCUT_EMOTES)
return "";
- return inputManager.getKeyStringLong(static_cast<int>(
- InputAction::EMOTE_1) + number);
+ return inputManager.getKeyStringLong(InputAction::EMOTE_1 + number);
}
void OutfitWindow::next()
diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp
index bd710670c..d16a22ff8 100644
--- a/src/gui/windows/quitdialog.cpp
+++ b/src/gui/windows/quitdialog.cpp
@@ -202,7 +202,7 @@ void QuitDialog::action(const ActionEvent &event)
void QuitDialog::keyPressed(KeyEvent &event)
{
- const int actionId = event.getActionId();
+ const InputActionT actionId = event.getActionId();
int dir = 0;
switch (actionId)
diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp
index 85ad80988..1f0dc68e2 100644
--- a/src/gui/windows/registerdialog.cpp
+++ b/src/gui/windows/registerdialog.cpp
@@ -279,13 +279,13 @@ void RegisterDialog::keyPressed(KeyEvent &event)
mRegisterButton->setEnabled(canSubmit());
return;
}
- const int actionId = event.getActionId();
- if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
+ const InputActionT actionId = event.getActionId();
+ if (actionId == InputAction::GUI_CANCEL)
{
action(ActionEvent(nullptr, mCancelButton->getActionEventId()));
}
- else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
- || actionId == static_cast<int>(InputAction::GUI_SELECT2))
+ else if (actionId == InputAction::GUI_SELECT ||
+ actionId == InputAction::GUI_SELECT2)
{
action(ActionEvent(nullptr, mRegisterButton->getActionEventId()));
}
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index ca094f1b6..1a6a75093 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -329,8 +329,8 @@ void UpdaterWindow::action(const ActionEvent &event)
void UpdaterWindow::keyPressed(KeyEvent &event)
{
- const int actionId = event.getActionId();
- if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
+ const InputActionT actionId = event.getActionId();
+ if (actionId == InputAction::GUI_CANCEL)
{
action(ActionEvent(nullptr, mCancelButton->getActionEventId()));
if (client->getState() != STATE_GAME)
@@ -338,8 +338,8 @@ void UpdaterWindow::keyPressed(KeyEvent &event)
else
deleteSelf();
}
- else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
- || actionId == static_cast<int>(InputAction::GUI_SELECT2))
+ else if (actionId == InputAction::GUI_SELECT ||
+ actionId == InputAction::GUI_SELECT2)
{
if (mDownloadStatus == UPDATE_COMPLETE ||
mDownloadStatus == UPDATE_ERROR)
diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp
index ee5af8123..a2604cf80 100644
--- a/src/gui/windows/worldselectdialog.cpp
+++ b/src/gui/windows/worldselectdialog.cpp
@@ -120,15 +120,15 @@ void WorldSelectDialog::action(const ActionEvent &event)
void WorldSelectDialog::keyPressed(KeyEvent &event)
{
- const int actionId = event.getActionId();
+ const InputActionT actionId = event.getActionId();
- if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
+ if (actionId == InputAction::GUI_CANCEL)
{
action(ActionEvent(nullptr,
mChangeLoginButton->getActionEventId()));
}
- else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
- || actionId == static_cast<int>(InputAction::GUI_SELECT2))
+ else if (actionId == InputAction::GUI_SELECT ||
+ actionId == InputAction::GUI_SELECT2)
{
action(ActionEvent(nullptr, mChooseWorld->getActionEventId()));
}