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/quitdialog.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/gui/quitdialog.cpp') diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index a0f734adf..51458cb08 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -23,6 +23,8 @@ #include "gui/quitdialog.h" #include "client.h" +#include "keydata.h" +#include "keyevent.h" #include "gui/chatwindow.h" #include "gui/npcdialog.h" @@ -157,22 +159,23 @@ void QuitDialog::action(const gcn::ActionEvent &event) void QuitDialog::keyPressed(gcn::KeyEvent &keyEvent) { - const gcn::Key &key = keyEvent.getKey(); + int actionId = static_cast(&keyEvent)->getActionId(); int dir = 0; - switch (key.getValue()) + switch (actionId) { - case Key::ENTER: + case Input::KEY_GUI_SELECT: + case Input::KEY_GUI_SELECT2: action(gcn::ActionEvent(nullptr, mOkButton->getActionEventId())); break; - case Key::ESCAPE: + case Input::KEY_GUI_CANCEL: action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId())); break; - case Key::UP: + case Input::KEY_GUI_UP: dir = -1; break; - case Key::DOWN: + case Input::KEY_GUI_DOWN: dir = 1; break; default: -- cgit v1.2.3-70-g09d2