mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Ref T231, Ref T236, Ref T238 help for "dot commands" will be refreshed
* an new simulator can cause a changed help * we update the help based on context signals now
This commit is contained in:
@@ -10,9 +10,14 @@
|
||||
#include "blackgui/components/commandinput.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackcore/context/contextapplication.h"
|
||||
#include "blackcore/context/contextsimulator.h"
|
||||
#include "blackcore/context/contextnetwork.h"
|
||||
#include "blackmisc/simplecommandparser.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore::Context;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -27,11 +32,19 @@ namespace BlackGui
|
||||
this->setPlaceholderText(".dot commands");
|
||||
}
|
||||
|
||||
QTimer::singleShot(5000, &m_dsCommandTooltip, &CDigestSignal::inputSignal);
|
||||
if (sGui && sGui->supportsContexts())
|
||||
{
|
||||
if (sGui->getIContextSimulator())
|
||||
{
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorPluginChanged, this, &CCommandInput::onSimulatorPluginChanged);
|
||||
}
|
||||
if (sGui->getIContextNetwork())
|
||||
{
|
||||
connect(sGui->getIContextNetwork(), &IContextNetwork::connectedServerChanged, this, &CCommandInput::onConnectedServerChanged);
|
||||
}
|
||||
}
|
||||
connect(this, &CCommandInput::returnPressed, this, &CCommandInput::validateCommand);
|
||||
|
||||
// set tooltip: shorty after, and later when application is initialized
|
||||
QTimer::singleShot(5000, this, &CCommandInput::setCommandTooltip);
|
||||
QTimer::singleShot(30000, this, &CCommandInput::setCommandTooltip);
|
||||
}
|
||||
|
||||
void CCommandInput::validateCommand()
|
||||
@@ -60,5 +73,21 @@ namespace BlackGui
|
||||
sGui->getIContextApplication()->dotCommandsHtmlHelp() :
|
||||
CSimpleCommandParser::commandsHtmlHelp());
|
||||
}
|
||||
|
||||
void CCommandInput::onSimulatorPluginChanged(const CSimulatorPluginInfo &info)
|
||||
{
|
||||
Q_UNUSED(info);
|
||||
|
||||
// different simulators have different commands
|
||||
m_dsCommandTooltip.inputSignal();
|
||||
}
|
||||
|
||||
void CCommandInput::onConnectedServerChanged(const Network::CServer &server)
|
||||
{
|
||||
Q_UNUSED(server);
|
||||
|
||||
// commands of network
|
||||
m_dsCommandTooltip.inputSignal();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user