Register "dot commands" for help (CCommandInput)

This commit is contained in:
Klaus Basan
2019-11-16 03:29:36 +01:00
committed by Mat Sutcliffe
parent 72334af1e8
commit 84cfec81e7
2 changed files with 9 additions and 3 deletions

View File

@@ -26,6 +26,12 @@ namespace BlackGui
CLineEditHistory(parent),
CIdentifiable(this)
{
if (!CSimpleCommandParser::registered("BlackGui::Components::CCommandInput"))
{
CSimpleCommandParser::registerCommand({".tooltip", "toggle dot command tooltip"});
CSimpleCommandParser::registerCommand({".help", "show help"});
}
if (this->placeholderText().isEmpty())
{
this->setPlaceholderText(".dot commands");
@@ -91,7 +97,7 @@ namespace BlackGui
void CCommandInput::onSimulatorPluginChanged(const CSimulatorPluginInfo &info)
{
Q_UNUSED(info);
Q_UNUSED(info)
// different simulators have different commands
m_dsCommandTooltip.inputSignal();
@@ -99,7 +105,7 @@ namespace BlackGui
void CCommandInput::onConnectedServerChanged(const Network::CServer &server)
{
Q_UNUSED(server);
Q_UNUSED(server)
// commands of network
m_dsCommandTooltip.inputSignal();

View File

@@ -149,7 +149,7 @@ namespace BlackMisc
bool CSimpleCommandParser::registered(const QString &helpContext)
{
if (s_registered.contains(helpContext)) { return true; };
if (s_registered.contains(helpContext)) { return true; }
s_registered.insert(helpContext);
return false;
}