diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-19 23:48:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-19 23:48:29 +0300 |
commit | 0b7e752bd177c90a05ca752fa31810f9e34c432c (patch) | |
tree | db1809a48faf051af11c94058e8f126c9e9ef1ab /src/gui/chatwindow.cpp | |
parent | 23f87c10db7e6b149e9e1f351e1a82516c545df7 (diff) | |
download | manaverse-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.gz manaverse-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.bz2 manaverse-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.xz manaverse-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.cpp | 18 |
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(); |