mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
Ref T180, dot commands to set rendering setup
* enable parts/debug messages via dot command * allow to log to console via application context
This commit is contained in:
@@ -62,6 +62,9 @@ namespace BlackCore
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"hotkeyActionsRegistered", this, SIGNAL(hotkeyActionsRegistered(QStringList, BlackMisc::CIdentifier)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"requestDisplayOnConsole", this, SIGNAL(requestDisplayOnConsole(QString)));
|
||||
Q_UNUSED(s);
|
||||
this->relayBaseClassSignals(serviceName, connection, IContextApplication::ObjectPath(), IContextApplication::InterfaceName());
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace BlackCore
|
||||
m_plugins->collectPlugins();
|
||||
restoreSimulatorPlugins();
|
||||
|
||||
CContextSimulator::registerHelp();
|
||||
connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CContextSimulator::ps_modelSetChanged);
|
||||
connect(&m_modelSetLoader, &CAircraftModelSetLoader::cacheChanged, this, &CContextSimulator::ps_modelSetChanged);
|
||||
|
||||
@@ -626,12 +627,32 @@ namespace BlackCore
|
||||
if (commandLine.isEmpty()) { return false; }
|
||||
CSimpleCommandParser parser(
|
||||
{
|
||||
".plugin",
|
||||
".drv", ".driver" // forwarded to driver
|
||||
".plugin", ".drv", ".driver", // forwarded to driver
|
||||
".ris" // rendering interpolator setup
|
||||
});
|
||||
parser.parse(commandLine);
|
||||
if (!parser.isKnownCommand()) { return false; }
|
||||
|
||||
if (parser.matchesCommand("ris"))
|
||||
{
|
||||
CInterpolationAndRenderingSetup rs = this->getInterpolationAndRenderingSetup();
|
||||
const QString p1 = parser.part(1);
|
||||
if (p1 == "show")
|
||||
{
|
||||
if (this->getIContextApplication())
|
||||
{
|
||||
emit this->getIContextApplication()->requestDisplayOnConsole(rs.toQString(true));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!parser.hasPart(2)) { return false; }
|
||||
const bool on = stringToBool(parser.part(2));
|
||||
if (p1 == "debug") { rs.setDriverDebuggingMessages(on); }
|
||||
else if (p1 == "parts") { rs.setEnabledAircraftParts(on); }
|
||||
else { return false; }
|
||||
this->setInterpolationAndRenderingSetup(rs);
|
||||
CLogMessage(this, CLogCategory::cmdLine()).info("Setup is: '%1'") << rs.toQString(true);
|
||||
return true;
|
||||
}
|
||||
if (parser.matchesCommand("plugin") || parser.matchesCommand("drv") || parser.matchesCommand("driver"))
|
||||
{
|
||||
if (!m_simulatorPlugin.second) { return false; }
|
||||
|
||||
@@ -107,12 +107,26 @@ namespace BlackCore
|
||||
//! \addtogroup swiftdotcommands
|
||||
//! @{
|
||||
//! <pre>
|
||||
//! .plugin forwarded to plugin, see details there
|
||||
//! .driver .drv forwarded to plugin (same as above)
|
||||
//! .plugin forwarded to plugin, see details there
|
||||
//! .driver .drv forwarded to plugin (same as above)
|
||||
//! .ris show show interpolation setup in console
|
||||
//! .ris debug on|off interpolation/rendering setup, debug messages
|
||||
//! .ris parts on|off interpolation/rendering setup, aircraft parts
|
||||
//! </pre>
|
||||
//! @}
|
||||
//! \copydoc IContextSimulator::parseCommandLine
|
||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
||||
|
||||
//! Register dot commands
|
||||
static void registerHelp()
|
||||
{
|
||||
if (BlackMisc::CSimpleCommandParser::registered("BlackCore::CContextSimulator")) { return; }
|
||||
BlackMisc::CSimpleCommandParser::registerCommand({".ris", "rendering/interpolation setup"});
|
||||
BlackMisc::CSimpleCommandParser::registerCommand({".ris show", "display rendering/interpolation setup on console"});
|
||||
BlackMisc::CSimpleCommandParser::registerCommand({".ris debug on|off", "rendering/interpolation debug messages"});
|
||||
BlackMisc::CSimpleCommandParser::registerCommand({".ris parts on|off", "aircraft parts"});
|
||||
}
|
||||
|
||||
// ----------------------------- context interface -----------------------------
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user