From 0b7e752bd177c90a05ca752fa31810f9e34c432c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 19 Apr 2012 23:48:29 +0300 Subject: Dehardcode keys in gui widgets. Add new tab with keys settings in input settings tab. --- src/gui/serverdialog.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/gui/serverdialog.cpp') diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index bae1154e3..cde56875f 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -25,6 +25,8 @@ #include "chatlogger.h" #include "client.h" #include "configuration.h" +#include "keydata.h" +#include "keyevent.h" #include "logger.h" #include "main.h" @@ -396,12 +398,17 @@ void ServerDialog::action(const gcn::ActionEvent &event) void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) { - gcn::Key key = keyEvent.getKey(); + int actionId = static_cast(&keyEvent)->getActionId(); - if (key.getValue() == Key::ESCAPE) + if (actionId == Input::KEY_GUI_CANCEL) + { Client::setState(STATE_EXIT); - else if (key.getValue() == Key::ENTER) + } + else if (actionId == Input::KEY_GUI_SELECT + || actionId == Input::KEY_GUI_SELECT2) + { action(gcn::ActionEvent(nullptr, mConnectButton->getActionEventId())); + } } void ServerDialog::valueChanged(const gcn::SelectionEvent &) -- cgit v1.2.3-70-g09d2