summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-23 18:00:53 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-23 18:00:53 +0300
commit663b79fd68f9e7f578415f3d0f015a3d8ba998cb (patch)
treefc1064bf86303f12a2d8cfeb91004364a480b0de
parent16faca9102b7f6771fb0745d5b4bc694f966fca4 (diff)
downloadplus-663b79fd68f9e7f578415f3d0f015a3d8ba998cb.tar.gz
plus-663b79fd68f9e7f578415f3d0f015a3d8ba998cb.tar.bz2
plus-663b79fd68f9e7f578415f3d0f015a3d8ba998cb.tar.xz
plus-663b79fd68f9e7f578415f3d0f015a3d8ba998cb.zip
Move chat command /help into actions.
-rw-r--r--src/actions/windows.cpp15
-rw-r--r--src/commands.cpp33
-rw-r--r--src/commands.h5
-rw-r--r--src/input/inputactionmap.h2
4 files changed, 16 insertions, 39 deletions
diff --git a/src/actions/windows.cpp b/src/actions/windows.cpp
index 7e5b31858..f2fcfa85a 100644
--- a/src/actions/windows.cpp
+++ b/src/actions/windows.cpp
@@ -67,6 +67,7 @@
#include "gui/windows/updaterwindow.h"
#include "gui/widgets/tabs/chattab.h"
+#include "gui/widgets/tabs/chattabtype.h"
#include "render/graphics.h"
@@ -132,7 +133,19 @@ static bool showHelpPage(const std::string &page, const bool showHide)
impHandler0(helpWindowShow)
{
- return showHelpPage("index", true);
+ if (!chatWindow || !chatWindow->isInputFocused())
+ return showHelpPage("index", true);
+ if (!event.tab)
+ return showHelpPage("chatcommands", true);
+ switch (event.tab->getType())
+ {
+ case ChatTabType::PARTY:
+ return showHelpPage("chatparty", true);
+ case ChatTabType::GUILD:
+ return showHelpPage("chatguild", true);
+ default:
+ return showHelpPage("chatcommands", true);
+ }
}
impHandler0(aboutWindowShow)
diff --git a/src/commands.cpp b/src/commands.cpp
index abbfeb91e..f13950d59 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -258,39 +258,6 @@ impHandler(announce)
return true;
}
-impHandler(help)
-{
- if (!helpWindow)
- return false;
-
- if (!event.tab)
- {
- helpWindow->loadHelp("chatcommands");
- helpWindow->requestMoveToTop();
- return true;
- }
- switch (event.tab->getType())
- {
- case ChatTabType::PARTY:
- {
- helpWindow->loadHelp("chatparty");
- break;
- }
- case ChatTabType::GUILD:
- {
- helpWindow->loadHelp("chatguild");
- break;
- }
- default:
- {
- helpWindow->loadHelp("chatcommands");
- break;
- }
- }
- helpWindow->requestMoveToTop();
- return true;
-}
-
impHandler0(ipcToggle)
{
if (ipc)
diff --git a/src/commands.h b/src/commands.h
index e694937c6..54f97c617 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -52,7 +52,6 @@ struct CommandInfo final
namespace Commands
{
decHandler(announce);
- decHandler(help);
decHandler(ipcToggle);
decHandler(where);
decHandler(who);
@@ -142,8 +141,7 @@ namespace Commands
enum
{
- COMMAND_HELP = 0,
- COMMAND_ANNOUNCE,
+ COMMAND_ANNOUNCE = 0,
COMMAND_IPC_TOGGLE,
COMMAND_WHERE,
COMMAND_WHO,
@@ -237,7 +235,6 @@ enum
static const CommandInfo commands[] =
{
- {"help", &Commands::help, -1, false},
{"announce", &Commands::announce, -1, true},
{"ipctoggle", &Commands::ipcToggle, -1, false},
{"where", &Commands::where, -1, false},
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 19026df4d..47138a746 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -488,7 +488,7 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
&Actions::helpWindowShow,
InputAction::NO_VALUE, 50,
InputCondition::SHORTCUT0,
- "",
+ "help",
false},
{"keyWindowStatus",
InputType::KEYBOARD, SDLK_F2,