summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-23 19:54:53 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-23 19:54:53 +0300
commit0bda5a9018bb8a8b0511e86d6b0790a5b5127e42 (patch)
tree7b79a624486e94e862546e994d4f65720720aa14 /src
parentd6f58bee33ca548ea6fc125553aa8d4d2fdba91f (diff)
downloadmanaplus-0bda5a9018bb8a8b0511e86d6b0790a5b5127e42.tar.gz
manaplus-0bda5a9018bb8a8b0511e86d6b0790a5b5127e42.tar.bz2
manaplus-0bda5a9018bb8a8b0511e86d6b0790a5b5127e42.tar.xz
manaplus-0bda5a9018bb8a8b0511e86d6b0790a5b5127e42.zip
Move chat command /ipctoggle into actions.
Diffstat (limited to 'src')
-rw-r--r--src/actions/actions.cpp27
-rw-r--r--src/actions/actions.h1
-rw-r--r--src/commands.cpp26
-rw-r--r--src/commands.h5
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h11
-rw-r--r--src/input/pages/other.cpp6
7 files changed, 46 insertions, 31 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 4fb6c7e1d..9273de8ab 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -70,6 +70,7 @@
#include "render/graphics.h"
+#include "net/ipc.h"
#include "net/net.h"
#include "net/playerhandler.h"
#include "net/tradehandler.h"
@@ -495,4 +496,30 @@ impHandler0(openTrade)
return false;
}
+impHandler0(ipcToggle)
+{
+ if (ipc)
+ {
+ IPC::stop();
+ if (!ipc)
+ debugChatTab->chatLog("IPC service stopped.");
+ else
+ debugChatTab->chatLog("Unable to stop IPC service.");
+ }
+ else
+ {
+ IPC::start();
+ if (ipc)
+ {
+ debugChatTab->chatLog(strprintf("IPC service available on port %d",
+ ipc->getPort()));
+ }
+ else
+ {
+ debugChatTab->chatLog("Unable to start IPC service");
+ }
+ }
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/actions.h b/src/actions/actions.h
index 6fb4fa01c..44812e826 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -54,6 +54,7 @@ namespace Actions
decHandler(showKeyboard);
decHandler(showWindows);
decHandler(openTrade);
+ decHandler(ipcToggle);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index cef6939d2..1d273c90a 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -251,32 +251,6 @@ static void outStringNormal(ChatTab *const tab,
}
}
-impHandler0(ipcToggle)
-{
- if (ipc)
- {
- IPC::stop();
- if (!ipc)
- debugChatTab->chatLog("IPC service stopped.");
- else
- debugChatTab->chatLog("Unable to stop IPC service.");
- }
- else
- {
- IPC::start();
- if (ipc)
- {
- debugChatTab->chatLog(strprintf("IPC service available on port %d",
- ipc->getPort()));
- }
- else
- {
- debugChatTab->chatLog("Unable to start IPC service");
- }
- }
- return true;
-}
-
impHandler(where)
{
std::ostringstream where;
diff --git a/src/commands.h b/src/commands.h
index 345996977..c55b7af0f 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -51,7 +51,6 @@ struct CommandInfo final
namespace Commands
{
- decHandler(ipcToggle);
decHandler(where);
decHandler(who);
decHandler(msg);
@@ -140,8 +139,7 @@ namespace Commands
enum
{
- COMMAND_IPC_TOGGLE = 0,
- COMMAND_WHERE,
+ COMMAND_WHERE = 0,
COMMAND_WHO,
COMMAND_MSG,
COMMAND_WHISPER,
@@ -233,7 +231,6 @@ enum
static const CommandInfo commands[] =
{
- {"ipctoggle", &Commands::ipcToggle, -1, false},
{"where", &Commands::where, -1, false},
{"who", &Commands::who, -1, false},
{"msg", Commands::msg, -1, true},
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index d67e60d2d..365f11571 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -344,6 +344,7 @@ namespace InputAction
CLOSE_ALL_CHAT_TABS,
IGNORE_ALL_WHISPERS,
CHAT_ANNOUNCE,
+ IPC_TOGGLE,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 37810b5d7..b1807760d 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -2865,7 +2865,16 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"announce",
- true}
+ true},
+ {"keyIpcToggle",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::ipcToggle,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "ipctoggle",
+ false}
};
#endif // INPUT_INPUTACTIONMAP_H
diff --git a/src/input/pages/other.cpp b/src/input/pages/other.cpp
index 65ee2af90..70b6b95d5 100644
--- a/src/input/pages/other.cpp
+++ b/src/input/pages/other.cpp
@@ -191,6 +191,12 @@ SetupActionData setupActionDataOther[] =
},
{
// TRANSLATORS: input action name
+ N_("Toggle ipc mode"),
+ InputAction::IPC_TOGGLE,
+ "",
+ },
+ {
+ // TRANSLATORS: input action name
N_("Show onscreen keyboard"),
InputAction::SHOW_KEYBOARD,
"",