From a149a49aa167cb7122afc6b12bdb4af9fa90394c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 8 Mar 2014 22:08:22 +0300 Subject: Add about button. --- src/actionmanager.cpp | 14 ++++++++++++-- src/actionmanager.h | 1 + src/client.cpp | 11 +++++++++++ src/client.h | 1 + src/gui/setupactiondata.h | 6 ++++++ src/input/keyboarddata.h | 7 +++++++ src/input/keydata.h | 1 + 7 files changed, 39 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index b8ea34286..1eb1da4e3 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -703,7 +703,7 @@ impHandler0(hideWindows) return true; } -impHandler0(helpWindowShow) +static bool showHelpPage(const std::string &page) { if (helpWindow) { @@ -713,7 +713,7 @@ impHandler0(helpWindowShow) } else { - helpWindow->loadHelp("index"); + helpWindow->loadHelp(page); helpWindow->requestMoveToTop(); } return true; @@ -721,6 +721,16 @@ impHandler0(helpWindowShow) return false; } +impHandler0(helpWindowShow) +{ + showHelpPage("index"); +} + +impHandler0(aboutWindowShow) +{ + showHelpPage("about"); +} + static void showHideWindow(Window *const window) { if (window) diff --git a/src/actionmanager.h b/src/actionmanager.h index ca8c3e2b9..7a0ad6e17 100644 --- a/src/actionmanager.h +++ b/src/actionmanager.h @@ -102,6 +102,7 @@ namespace ActionManager decHandler(hideWindows); decHandler(helpWindowShow); + decHandler(aboutWindowShow); decHandler(setupWindowShow); decHandler(statusWindowShow); decHandler(inventoryWindowShow); diff --git a/src/client.cpp b/src/client.cpp index a462f8603..2f2341ea7 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -234,6 +234,7 @@ Client::Client(const Options &options) : mSetupButton(nullptr), mVideoButton(nullptr), mHelpButton(nullptr), + mAboutButton(nullptr), mThemesButton(nullptr), mPerfomanceButton(nullptr), #ifdef ANDROID @@ -1146,6 +1147,9 @@ int Client::gameExec() ADDBUTTON(mThemesButton, new Button(mDesktop, // TRANSLATORS: theme tab quick button _("Theme"), "Themes", this)) + ADDBUTTON(mAboutButton, new Button(mDesktop, + // TRANSLATORS: theme tab quick button + _("About"), "about", this)) ADDBUTTON(mHelpButton, new Button(mDesktop, // TRANSLATORS: theme tab quick button _("Help"), "help", this)) @@ -1579,6 +1583,8 @@ int Client::gameExec() mVideoButton = nullptr; delete mThemesButton; mThemesButton = nullptr; + delete mAboutButton; + mAboutButton = nullptr; delete mHelpButton; mHelpButton = nullptr; delete mPerfomanceButton; @@ -1869,6 +1875,11 @@ void Client::action(const ActionEvent &event) inputManager.executeAction(Input::KEY_WINDOW_HELP); return; } + else if (eventId == "about") + { + inputManager.executeAction(Input::KEY_WINDOW_ABOUT); + return; + } else if (eventId == "Video") { tab = "Video"; diff --git a/src/client.h b/src/client.h index fe48418e7..fd1942684 100644 --- a/src/client.h +++ b/src/client.h @@ -425,6 +425,7 @@ private: Button *mSetupButton; Button *mVideoButton; Button *mHelpButton; + Button *mAboutButton; Button *mThemesButton; Button *mPerfomanceButton; #ifdef ANDROID diff --git a/src/gui/setupactiondata.h b/src/gui/setupactiondata.h index aa07e24c4..d146a334f 100644 --- a/src/gui/setupactiondata.h +++ b/src/gui/setupactiondata.h @@ -364,6 +364,12 @@ static SetupActionData setupActionData2[] = Input::KEY_HIDE_WINDOWS, "", }, + { + // TRANSLATORS: input action name + N_("About Window"), + Input::KEY_WINDOW_ABOUT, + "", + }, { // TRANSLATORS: input action name N_("Help Window"), diff --git a/src/input/keyboarddata.h b/src/input/keyboarddata.h index a3fbbeab5..2b49a9186 100644 --- a/src/input/keyboarddata.h +++ b/src/input/keyboarddata.h @@ -2172,6 +2172,13 @@ static const KeyData keyData[Input::KEY_TOTAL] = { nullptr, Input::KEY_NO_VALUE, 50, COND_DEFAULT}, + {"keyWindowAbout", + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_DEFAULT | Input::GRP_GUI, + &ActionManager::aboutWindowShow, + Input::KEY_NO_VALUE, 50, + COND_SHORTCUT0}, }; #endif // INPUT_KEYBOARDDATA_H diff --git a/src/input/keydata.h b/src/input/keydata.h index e8b44bd64..41a0e85a5 100644 --- a/src/input/keydata.h +++ b/src/input/keydata.h @@ -370,6 +370,7 @@ namespace Input KEY_GUI_F10, KEY_GUI_F11, KEY_GUI_F12, + KEY_WINDOW_ABOUT, KEY_TOTAL }; } // namespace Input -- cgit v1.2.3-70-g09d2