summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-18 19:47:28 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-18 19:47:28 +0300
commit7da95c7f4da447876458a0b1a17736b9a2865844 (patch)
tree4b6ac0ab5bc32a11234a5363de95d0cfec8cb7d5 /src/gui/windows
parent515ce6c1413b5e3da131f3e4997abdc39c003a2c (diff)
downloadmv-7da95c7f4da447876458a0b1a17736b9a2865844.tar.gz
mv-7da95c7f4da447876458a0b1a17736b9a2865844.tar.bz2
mv-7da95c7f4da447876458a0b1a17736b9a2865844.tar.xz
mv-7da95c7f4da447876458a0b1a17736b9a2865844.zip
Move inputaction into separate file.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/charcreatedialog.cpp3
-rw-r--r--src/gui/windows/charselectdialog.cpp15
-rw-r--r--src/gui/windows/chatwindow.cpp48
-rw-r--r--src/gui/windows/editserverdialog.cpp7
-rw-r--r--src/gui/windows/inventorywindow.cpp10
-rw-r--r--src/gui/windows/logindialog.cpp7
-rw-r--r--src/gui/windows/outfitwindow.cpp2
-rw-r--r--src/gui/windows/quitdialog.cpp11
-rw-r--r--src/gui/windows/registerdialog.cpp7
-rw-r--r--src/gui/windows/serverdialog.cpp13
-rw-r--r--src/gui/windows/updaterwindow.cpp7
-rw-r--r--src/gui/windows/worldselectdialog.cpp7
12 files changed, 73 insertions, 64 deletions
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index cc254bce0..e8f92e343 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -26,6 +26,7 @@
#include "events/keyevent.h"
+#include "input/inputaction.h"
#include "input/keydata.h"
#include "gui/windows/okdialog.h"
@@ -665,7 +666,7 @@ void CharCreateDialog::keyPressed(KeyEvent &event)
const int actionId = event.getActionId();
switch (actionId)
{
- case Input::KEY_GUI_CANCEL:
+ case InputAction::GUI_CANCEL:
event.consume();
action(ActionEvent(mCancelButton,
mCancelButton->getActionEventId()));
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 74a135bab..73ebb90b6 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -28,6 +28,7 @@
#include "events/keyevent.h"
+#include "input/inputaction.h"
#include "input/keydata.h"
#include "being/attributes.h"
@@ -297,13 +298,13 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
const int actionId = event.getActionId();
switch (actionId)
{
- case Input::KEY_GUI_CANCEL:
+ case InputAction::GUI_CANCEL:
event.consume();
action(ActionEvent(mSwitchLoginButton,
mSwitchLoginButton->getActionEventId()));
break;
- case Input::KEY_GUI_RIGHT:
+ case InputAction::GUI_RIGHT:
{
event.consume();
int idx = mCharacterView->getSelected();
@@ -318,7 +319,7 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
break;
}
- case Input::KEY_GUI_LEFT:
+ case InputAction::GUI_LEFT:
{
event.consume();
int idx = mCharacterView->getSelected();
@@ -333,7 +334,7 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
break;
}
- case Input::KEY_GUI_UP:
+ case InputAction::GUI_UP:
{
event.consume();
int idx = mCharacterView->getSelected();
@@ -348,7 +349,7 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
break;
}
- case Input::KEY_GUI_DOWN:
+ case InputAction::GUI_DOWN:
{
event.consume();
int idx = mCharacterView->getSelected();
@@ -363,7 +364,7 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
break;
}
- case Input::KEY_GUI_DELETE:
+ case InputAction::GUI_DELETE:
{
event.consume();
const int idx = mCharacterView->getSelected();
@@ -375,7 +376,7 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
break;
}
- case Input::KEY_GUI_SELECT:
+ case InputAction::GUI_SELECT:
{
event.consume();
use(mCharacterView->getSelected());
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 262700fc6..bd0f68453 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -662,7 +662,7 @@ void ChatWindow::mousePressed(MouseEvent &event)
{
event.consume();
if (inputManager.isActionActive(static_cast<int>(
- Input::KEY_CHAT_MOD)))
+ InputAction::CHAT_MOD)))
{
ChatTab *const wTab = dynamic_cast<WhisperTab*>(tab);
if (wTab)
@@ -721,7 +721,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
{
const int actionId = event.getActionId();
std::string temp;
- if (actionId == static_cast<int>(Input::KEY_GUI_DOWN))
+ if (actionId == static_cast<int>(InputAction::GUI_DOWN))
{
if (mCurHist != mHistory.end())
{
@@ -745,7 +745,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
mChatInput->setText("");
}
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_UP) &&
+ else if (actionId == static_cast<int>(InputAction::GUI_UP) &&
mCurHist != mHistory.begin() && !mHistory.empty())
{
// Move backward through the history
@@ -754,7 +754,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
mChatInput->setCaretPosition(static_cast<unsigned>(
mChatInput->getText().length()));
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_INSERT) &&
+ else if (actionId == static_cast<int>(InputAction::GUI_INSERT) &&
mChatInput->getText() != "")
{
// Add the current message to the history and clear the text
@@ -763,18 +763,18 @@ void ChatWindow::keyPressed(KeyEvent &event)
mCurHist = mHistory.end();
mChatInput->setText("");
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_TAB) &&
+ else if (actionId == static_cast<int>(InputAction::GUI_TAB) &&
!mChatInput->getText().empty())
{
autoComplete();
return;
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL) &&
+ else if (actionId == static_cast<int>(InputAction::GUI_CANCEL) &&
mChatInput->isVisibleLocal())
{
mChatInput->processVisible(false);
}
- else if (actionId == static_cast<int>(Input::KEY_CHAT_PREV_HISTORY) &&
+ else if (actionId == static_cast<int>(InputAction::CHAT_PREV_HISTORY) &&
mChatInput->isVisibleLocal())
{
const ChatTab *const tab = getFocused();
@@ -806,7 +806,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
mChatInput->getText().length()));
}
}
- else if (actionId == static_cast<int>(Input::KEY_CHAT_NEXT_HISTORY) &&
+ else if (actionId == static_cast<int>(InputAction::CHAT_NEXT_HISTORY) &&
mChatInput->isVisibleLocal())
{
const ChatTab *const tab = getFocused();
@@ -842,7 +842,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
mChatInput->getText().length()));
}
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_F1))
+ else if (actionId == static_cast<int>(InputAction::GUI_F1))
{
if (emoteWindow)
{
@@ -852,21 +852,21 @@ void ChatWindow::keyPressed(KeyEvent &event)
emoteWindow->show();
}
}
- ifKey(Input::KEY_GUI_F2, "\u2318")
- ifKey(Input::KEY_GUI_F3, "\u263A")
- ifKey(Input::KEY_GUI_F4, "\u2665")
- ifKey(Input::KEY_GUI_F5, "\u266A")
- ifKey(Input::KEY_GUI_F6, "\u266B")
- ifKey(Input::KEY_GUI_F7, "\u26A0")
- ifKey(Input::KEY_GUI_F8, "\u2622")
- ifKey(Input::KEY_GUI_F9, "\u262E")
- ifKey(Input::KEY_GUI_F10, "\u2605")
- ifKey(Input::KEY_GUI_F11, "\u2618")
- ifKey(Input::KEY_GUI_F12, "\u2592")
-
- if (inputManager.isActionActive(static_cast<int>(Input::KEY_GUI_CTRL)))
- {
- if (actionId == static_cast<int>(Input::KEY_GUI_B))
+ ifKey(InputAction::GUI_F2, "\u2318")
+ ifKey(InputAction::GUI_F3, "\u263A")
+ ifKey(InputAction::GUI_F4, "\u2665")
+ ifKey(InputAction::GUI_F5, "\u266A")
+ ifKey(InputAction::GUI_F6, "\u266B")
+ ifKey(InputAction::GUI_F7, "\u26A0")
+ ifKey(InputAction::GUI_F8, "\u2622")
+ ifKey(InputAction::GUI_F9, "\u262E")
+ ifKey(InputAction::GUI_F10, "\u2605")
+ ifKey(InputAction::GUI_F11, "\u2618")
+ ifKey(InputAction::GUI_F12, "\u2592")
+
+ if (inputManager.isActionActive(static_cast<int>(InputAction::GUI_CTRL)))
+ {
+ if (actionId == static_cast<int>(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 516efea4d..da0de7026 100644
--- a/src/gui/windows/editserverdialog.cpp
+++ b/src/gui/windows/editserverdialog.cpp
@@ -23,6 +23,7 @@
#include "events/keyevent.h"
+#include "input/inputaction.h"
#include "input/keydata.h"
#include "gui/models/typelistmodel.h"
@@ -256,12 +257,12 @@ void EditServerDialog::keyPressed(KeyEvent &event)
const int actionId = event.getActionId();
- if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
+ if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
{
scheduleDelete();
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_SELECT)
- || actionId == static_cast<int>(Input::KEY_GUI_SELECT2))
+ else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
+ || actionId == static_cast<int>(InputAction::GUI_SELECT2))
{
action(ActionEvent(nullptr, mOkButton->getActionEventId()));
}
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index ee920f8a1..2049d2a12 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -396,7 +396,7 @@ void InventoryWindow::action(const ActionEvent &event)
return;
if (inputManager.isActionActive(static_cast<int>(
- Input::KEY_STOP_ATTACK)))
+ InputAction::STOP_ATTACK)))
{
PlayerInfo::dropItem(item, item->getQuantity(), true);
}
@@ -445,11 +445,11 @@ void InventoryWindow::mouseClicked(MouseEvent &event)
gui->resetClickCount();
const bool mod = (isStorageActive() && inputManager.isActionActive(
- static_cast<int>(Input::KEY_STOP_ATTACK)));
+ static_cast<int>(InputAction::STOP_ATTACK)));
const bool mod2 = (tradeWindow && tradeWindow->isWindowVisible()
&& inputManager.isActionActive(static_cast<int>(
- Input::KEY_STOP_ATTACK)));
+ InputAction::STOP_ATTACK)));
if (!mod && !mod2 && event.getButton() == MouseButton::RIGHT)
{
@@ -584,13 +584,13 @@ void InventoryWindow::mouseExited(MouseEvent &event A_UNUSED)
void InventoryWindow::keyPressed(KeyEvent &event)
{
- if (event.getActionId() == static_cast<int>(Input::KEY_GUI_MOD))
+ if (event.getActionId() == static_cast<int>(InputAction::GUI_MOD))
mSplit = true;
}
void InventoryWindow::keyReleased(KeyEvent &event)
{
- if (event.getActionId() == static_cast<int>(Input::KEY_GUI_MOD))
+ if (event.getActionId() == static_cast<int>(InputAction::GUI_MOD))
mSplit = false;
}
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index 99354f4fb..f03507320 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -27,6 +27,7 @@
#include "events/keyevent.h"
+#include "input/inputaction.h"
#include "input/keydata.h"
#include "listeners/openurllistener.h"
@@ -245,12 +246,12 @@ void LoginDialog::keyPressed(KeyEvent &event)
}
const int actionId = event.getActionId();
- if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
+ if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
{
action(ActionEvent(nullptr, mServerButton->getActionEventId()));
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_SELECT)
- || actionId == static_cast<int>(Input::KEY_GUI_SELECT2))
+ else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
+ || actionId == static_cast<int>(InputAction::GUI_SELECT2))
{
action(ActionEvent(nullptr, mLoginButton->getActionEventId()));
}
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index fb2b4a4e7..f9ac83ada 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -529,7 +529,7 @@ std::string OutfitWindow::keyName(const int number)
if (number < 0 || number >= SHORTCUT_EMOTES)
return "";
return inputManager.getKeyStringLong(static_cast<int>(
- Input::KEY_EMOTE_1) + number);
+ InputAction::EMOTE_1) + number);
}
void OutfitWindow::next()
diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp
index e3276fae6..c34801c8e 100644
--- a/src/gui/windows/quitdialog.cpp
+++ b/src/gui/windows/quitdialog.cpp
@@ -30,6 +30,7 @@
#include "events/keyevent.h"
+#include "input/inputaction.h"
#include "input/keydata.h"
#include "gui/viewport.h"
@@ -208,17 +209,17 @@ void QuitDialog::keyPressed(KeyEvent &event)
switch (actionId)
{
- case Input::KEY_GUI_SELECT:
- case Input::KEY_GUI_SELECT2:
+ case InputAction::GUI_SELECT:
+ case InputAction::GUI_SELECT2:
action(ActionEvent(nullptr, mOkButton->getActionEventId()));
break;
- case Input::KEY_GUI_CANCEL:
+ case InputAction::GUI_CANCEL:
action(ActionEvent(nullptr, mCancelButton->getActionEventId()));
break;
- case Input::KEY_GUI_UP:
+ case InputAction::GUI_UP:
dir = -1;
break;
- case Input::KEY_GUI_DOWN:
+ case InputAction::GUI_DOWN:
dir = 1;
break;
default:
diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp
index 61b7e0dac..3a906b00e 100644
--- a/src/gui/windows/registerdialog.cpp
+++ b/src/gui/windows/registerdialog.cpp
@@ -26,6 +26,7 @@
#include "events/keyevent.h"
+#include "input/inputaction.h"
#include "input/keydata.h"
#include "listeners/wrongdatanoticelistener.h"
@@ -276,12 +277,12 @@ void RegisterDialog::keyPressed(KeyEvent &event)
return;
}
const int actionId = event.getActionId();
- if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
+ if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
{
action(ActionEvent(nullptr, mCancelButton->getActionEventId()));
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_SELECT)
- || actionId == static_cast<int>(Input::KEY_GUI_SELECT2))
+ else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
+ || actionId == static_cast<int>(InputAction::GUI_SELECT2))
{
action(ActionEvent(nullptr, mRegisterButton->getActionEventId()));
}
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 74906dc25..5a0bf0478 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -29,6 +29,7 @@
#include "events/keyevent.h"
+#include "input/inputaction.h"
#include "input/keydata.h"
#include "gui/gui.h"
@@ -300,23 +301,23 @@ void ServerDialog::keyPressed(KeyEvent &event)
{
switch (event.getActionId())
{
- case Input::KEY_GUI_CANCEL:
+ case InputAction::GUI_CANCEL:
event.consume();
client->setState(STATE_EXIT);
return;
- case Input::KEY_GUI_SELECT:
- case Input::KEY_GUI_SELECT2:
+ case InputAction::GUI_SELECT:
+ case InputAction::GUI_SELECT2:
event.consume();
action(ActionEvent(nullptr,
mConnectButton->getActionEventId()));
return;
- case Input::KEY_GUI_INSERT:
+ case InputAction::GUI_INSERT:
(new EditServerDialog(this, ServerInfo(), -1))->postInit();
return;
- case Input::KEY_GUI_DELETE:
+ case InputAction::GUI_DELETE:
{
const int index = mServersList->getSelected();
if (index >= 0)
@@ -328,7 +329,7 @@ void ServerDialog::keyPressed(KeyEvent &event)
return;
}
- case Input::KEY_GUI_BACKSPACE:
+ case InputAction::GUI_BACKSPACE:
{
const int index = mServersList->getSelected();
if (index >= 0)
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 40b8014e2..475144f61 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -27,6 +27,7 @@
#include "events/keyevent.h"
+#include "input/inputaction.h"
#include "input/keydata.h"
#include "gui/widgets/browserbox.h"
@@ -302,13 +303,13 @@ void UpdaterWindow::action(const ActionEvent &event)
void UpdaterWindow::keyPressed(KeyEvent &event)
{
const int actionId = event.getActionId();
- if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
+ if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
{
action(ActionEvent(nullptr, mCancelButton->getActionEventId()));
client->setState(STATE_LOGIN);
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_SELECT)
- || actionId == static_cast<int>(Input::KEY_GUI_SELECT2))
+ else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
+ || actionId == static_cast<int>(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 4a70e3750..f81f14399 100644
--- a/src/gui/windows/worldselectdialog.cpp
+++ b/src/gui/windows/worldselectdialog.cpp
@@ -26,6 +26,7 @@
#include "events/keyevent.h"
+#include "input/inputaction.h"
#include "input/keydata.h"
#include "gui/widgets/button.h"
@@ -123,13 +124,13 @@ void WorldSelectDialog::keyPressed(KeyEvent &event)
{
const int actionId = event.getActionId();
- if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
+ if (actionId == static_cast<int>(InputAction::GUI_CANCEL))
{
action(ActionEvent(nullptr,
mChangeLoginButton->getActionEventId()));
}
- else if (actionId == static_cast<int>(Input::KEY_GUI_SELECT)
- || actionId == static_cast<int>(Input::KEY_GUI_SELECT2))
+ else if (actionId == static_cast<int>(InputAction::GUI_SELECT)
+ || actionId == static_cast<int>(InputAction::GUI_SELECT2))
{
action(ActionEvent(nullptr, mChooseWorld->getActionEventId()));
}