summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp3
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp16
-rw-r--r--src/gui/widgets/itemlinkhandler.h3
-rw-r--r--src/settings.h2
5 files changed, 19 insertions, 6 deletions
diff --git a/src/client.cpp b/src/client.cpp
index f1c77f728..3259f2265 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1819,6 +1819,9 @@ void Client::initPaths()
{
settings.gmCommandSymbol = paths.getStringValue("gmCommandSymbol");
settings.gmCharCommandSymbol = paths.getStringValue("gmCharCommandSymbol");
+ settings.linkCommandSymbol = paths.getStringValue("linkCommandSymbol");
+ if (settings.linkCommandSymbol.empty())
+ settings.linkCommandSymbol = "=";
}
void Client::initTradeFilter()
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 4bb76b435..a72008372 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -632,6 +632,7 @@ DefaultsData* getPathsDefaults()
AddDEF("cutInsDir", "graphics/cutins");
AddDEF("gmCommandSymbol", "@");
AddDEF("gmCharCommandSymbol", "#");
+ AddDEF("linkCommandSymbol", "=");
AddDEF("palettesDir", "");
AddDEF("defaultPaletteFile", "palette.gpl");
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 86d0a5eec..a8e90acd7 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -23,6 +23,7 @@
#include "gui/widgets/itemlinkhandler.h"
#include "itemcolormanager.h"
+#include "settings.h"
#include "gui/viewport.h"
@@ -59,14 +60,16 @@ ItemLinkHandler::~ItemLinkHandler()
{
}
-void ItemLinkHandler::handleCommandLink(const std::string &link)
+void ItemLinkHandler::handleCommandLink(const std::string &link,
+ const std::string &prefix)
{
std::string cmd;
std::string args;
- if (!parse2Str(link.substr(1), cmd, args))
+ const std::string cmdStr = link.substr(prefix.size());
+ if (!parse2Str(cmdStr, cmd, args))
{
- cmd = link.substr(1);
+ cmd = cmdStr;
args.clear();
}
inputManager.executeRemoteChatCommand(cmd, args, nullptr);
@@ -158,7 +161,6 @@ void ItemLinkHandler::handleSearchLink(const std::string &link)
void ItemLinkHandler::handleLink(const std::string &link,
MouseEvent *const event)
{
- logger->log("link: " + link);
if (strStartWith(link, "http://") || strStartWith(link, "https://"))
{
handleHttpLink(link, event);
@@ -171,9 +173,13 @@ void ItemLinkHandler::handleLink(const std::string &link,
{
handleHelpLink(link);
}
+ else if (strStartWith(link, settings.linkCommandSymbol))
+ {
+ handleCommandLink(link, settings.linkCommandSymbol);
+ }
else if (strStartWith(link, "="))
{
- handleCommandLink(link);
+ handleCommandLink(link, "=");
}
else
{
diff --git a/src/gui/widgets/itemlinkhandler.h b/src/gui/widgets/itemlinkhandler.h
index 25d6dbe41..6350b9fc3 100644
--- a/src/gui/widgets/itemlinkhandler.h
+++ b/src/gui/widgets/itemlinkhandler.h
@@ -40,7 +40,8 @@ class ItemLinkHandler final : public LinkHandler
MouseEvent *event) override final;
private:
- static void handleCommandLink(const std::string &link);
+ static void handleCommandLink(const std::string &link,
+ const std::string &prefix);
static void handleHelpLink(const std::string &link);
diff --git a/src/settings.h b/src/settings.h
index 81e01e2ae..50a8cb51c 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -52,6 +52,7 @@ class Settings final
windowCaption(),
gmCommandSymbol("@"),
gmCharCommandSymbol("#"),
+ linkCommandSymbol("="),
updateMirrors(),
options(),
guiAlpha(1.0F),
@@ -102,6 +103,7 @@ class Settings final
std::string windowCaption;
std::string gmCommandSymbol;
std::string gmCharCommandSymbol;
+ std::string linkCommandSymbol;
std::vector<std::string> updateMirrors;
Options options;
float guiAlpha;