summaryrefslogtreecommitdiff
path: root/src/gui/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-19 23:48:29 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-19 23:48:29 +0300
commit0b7e752bd177c90a05ca752fa31810f9e34c432c (patch)
treedb1809a48faf051af11c94058e8f126c9e9ef1ab /src/gui/chatwindow.cpp
parent23f87c10db7e6b149e9e1f351e1a82516c545df7 (diff)
downloadmv-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.gz
mv-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.bz2
mv-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.xz
mv-0b7e752bd177c90a05ca752fa31810f9e34c432c.zip
Dehardcode keys in gui widgets.
Add new tab with keys settings in input settings tab.
Diffstat (limited to 'src/gui/chatwindow.cpp')
-rw-r--r--src/gui/chatwindow.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 3832e5850..a91a8fc82 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -28,7 +28,8 @@
#include "configuration.h"
#include "guild.h"
#include "inputmanager.h"
-#include "keyboardconfig.h"
+#include "keydata.h"
+#include "keyevent.h"
#include "localplayer.h"
#include "party.h"
#include "playerinfo.h"
@@ -742,7 +743,8 @@ void ChatWindow::mouseReleased(gcn::MouseEvent &event A_UNUSED)
void ChatWindow::keyPressed(gcn::KeyEvent &event)
{
const int key = event.getKey().getValue();
- if (key == Key::DOWN)
+ int actionId = static_cast<KeyEvent*>(&event)->getActionId();
+ if (actionId == Input::KEY_GUI_DOWN)
{
if (mCurHist != mHistory.end())
{
@@ -766,7 +768,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
mChatInput->setText("");
}
}
- else if (key == Key::UP &&
+ else if (actionId == Input::KEY_GUI_UP &&
mCurHist != mHistory.begin() && !mHistory.empty())
{
// Move backward through the history
@@ -775,7 +777,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
mChatInput->setCaretPosition(static_cast<unsigned>(
mChatInput->getText().length()));
}
- else if (key == Key::INSERT &&
+ else if (actionId == Input::KEY_GUI_INSERT &&
mChatInput->getText() != "")
{
// Add the current message to the history and clear the text
@@ -784,18 +786,18 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
mCurHist = mHistory.end();
mChatInput->setText("");
}
- else if (inputManager.isActionActive(Input::KEY_AUTOCOMPLETE_CHAT) &&
+ else if (actionId == Input::KEY_GUI_TAB &&
mChatInput->getText() != "")
{
autoComplete();
return;
}
- else if (inputManager.isActionActive(Input::KEY_DEACTIVATE_CHAT) &&
+ else if (actionId == Input::KEY_GUI_CANCEL &&
mChatInput->isVisible())
{
mChatInput->processVisible(false);
}
- else if (inputManager.isActionActive(Input::KEY_CHAT_PREV_HISTORY) &&
+ else if (actionId == Input::KEY_CHAT_PREV_HISTORY &&
mChatInput->isVisible())
{
ChatTab *tab = getFocused();
@@ -827,7 +829,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
mChatInput->getText().length()));
}
}
- else if (inputManager.isActionActive(Input::KEY_CHAT_NEXT_HISTORY) &&
+ else if (actionId == Input::KEY_CHAT_NEXT_HISTORY &&
mChatInput->isVisible())
{
ChatTab *tab = getFocused();