diff --git a/src/blackcore/simulatorcommon.cpp b/src/blackcore/simulatorcommon.cpp index ca11785b2..7b28c7639 100644 --- a/src/blackcore/simulatorcommon.cpp +++ b/src/blackcore/simulatorcommon.cpp @@ -371,19 +371,12 @@ namespace BlackCore { if (this->isMyIdentifier(originator)) { return false; } if (commandLine.isEmpty()) { return false; } - CSimpleCommandParser parser( - { - ".plugin", ".drv", ".driver", - }); + CSimpleCommandParser parser({ ".plugin", ".drv", ".driver" }); parser.parse(commandLine); if (!parser.isKnownCommand()) { return false; } // .plugin unload - if (parser.matchesPart(1, "unload")) - { - this->unload(); - return true; - } + if (parser.matchesPart(1, "unload")) { this->unload(); return true; } // .plugin log interpolator const QString part1(parser.part(1).toLower().trimmed()); @@ -447,6 +440,17 @@ namespace BlackCore return this->parseDetails(parser); } + void CSimulatorCommon::registerHelp() + { + if (BlackMisc::CSimpleCommandParser::registered("BlackCore::CSimulatorCommon")) { return; } + BlackMisc::CSimpleCommandParser::registerCommand({".drv", "alias: .driver .plugin"}); + BlackMisc::CSimpleCommandParser::registerCommand({".drv logint callsign", "log interpolator for callsign"}); + BlackMisc::CSimpleCommandParser::registerCommand({".drv logint off", "no log information for interpolator"}); + BlackMisc::CSimpleCommandParser::registerCommand({".drv logint write", "write interpolator log to file"}); + BlackMisc::CSimpleCommandParser::registerCommand({".drv logint clear", "clear current log"}); + BlackMisc::CSimpleCommandParser::registerCommand({".drv spline|linear ", "set spline/linear interpolator for one/all callsign(s)"}); + } + void CSimulatorCommon::ps_oneSecondTimer() { blinkHighlightedAircraft(); diff --git a/src/blackcore/simulatorcommon.h b/src/blackcore/simulatorcommon.h index 025c5e572..0f57c3ced 100644 --- a/src/blackcore/simulatorcommon.h +++ b/src/blackcore/simulatorcommon.h @@ -101,16 +101,7 @@ namespace BlackCore virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override; //! Register help - static void registerHelp() - { - if (BlackMisc::CSimpleCommandParser::registered("BlackCore::CSimulatorCommon")) { return; } - BlackMisc::CSimpleCommandParser::registerCommand({".drv", "alias: .driver .plugin"}); - BlackMisc::CSimpleCommandParser::registerCommand({".drv logint callsign", "log interpolator for callsign"}); - BlackMisc::CSimpleCommandParser::registerCommand({".drv logint off", "no log information for interpolator"}); - BlackMisc::CSimpleCommandParser::registerCommand({".drv logint write", "write interpolator log to file"}); - BlackMisc::CSimpleCommandParser::registerCommand({".drv logint clear", "clear current log"}); - BlackMisc::CSimpleCommandParser::registerCommand({".drv spline|linear ", "set spline/linear interpolator for one/all callsign(s)"}); - } + static void registerHelp(); // --------- ISimulator implementations ------------ diff --git a/src/blackmisc/simplecommandparser.cpp b/src/blackmisc/simplecommandparser.cpp index b9d61eb80..55a561322 100644 --- a/src/blackmisc/simplecommandparser.cpp +++ b/src/blackmisc/simplecommandparser.cpp @@ -157,10 +157,17 @@ namespace BlackMisc static const QString html("\n%1\n
"); static const QString row("%1%2"); + static const QString rowHeader("%1%2%3%4"); QString rows; QList cmds(s_commands); qSort(cmds.begin(), cmds.end(), CommandHtmlHelp::less); + + static const QString cmdCol(QString().fill('-', 20)); + static const QString textCol(QString().fill('-', 40)); + rows += "" + rowHeader.arg("command", "synopsis", "command", "synopsis") + "\n"; + rows += "" + rowHeader.arg(cmdCol, textCol, cmdCol, textCol) + "\n"; + for (int i = 0; i < cmds.size(); i++) { CommandHtmlHelp help = cmds[i]; diff --git a/src/blackmisc/simplecommandparser.h b/src/blackmisc/simplecommandparser.h index 7142dbb02..e3d660bcb 100644 --- a/src/blackmisc/simplecommandparser.h +++ b/src/blackmisc/simplecommandparser.h @@ -99,7 +99,7 @@ namespace BlackMisc //! Help already registered static bool registered(const QString &helpContext); - //! HTML commans HELP + //! HTML commands HELP static QString commandsHtmlHelp(); private: diff --git a/src/plugins/simulator/fscommon/simulatorfscommon.cpp b/src/plugins/simulator/fscommon/simulatorfscommon.cpp index 9bb8c723f..c4b0b0ba9 100644 --- a/src/plugins/simulator/fscommon/simulatorfscommon.cpp +++ b/src/plugins/simulator/fscommon/simulatorfscommon.cpp @@ -67,6 +67,13 @@ namespace BlackSimPlugin return false; } + void CSimulatorFsCommon::registerHelp() + { + if (BlackMisc::CSimpleCommandParser::registered("BlackSimPlugin::FsCommon::CSimulatorFsCommon")) { return; } + BlackMisc::CSimpleCommandParser::registerCommand({".drv", "alias: .driver .plugin"}); + BlackMisc::CSimpleCommandParser::registerCommand({".drv fsuipc on|off", "FSUIPC on|off if applicable"}); + } + bool CSimulatorFsCommon::disconnectFrom() { if (this->m_fsuipc) { this->m_fsuipc->disconnect(); } diff --git a/src/plugins/simulator/fscommon/simulatorfscommon.h b/src/plugins/simulator/fscommon/simulatorfscommon.h index 3afb2c60d..7537994d9 100644 --- a/src/plugins/simulator/fscommon/simulatorfscommon.h +++ b/src/plugins/simulator/fscommon/simulatorfscommon.h @@ -72,12 +72,7 @@ namespace BlackSimPlugin virtual bool parseDetails(const BlackMisc::CSimpleCommandParser &parser) override; //! Register help - static void registerHelp() - { - if (BlackMisc::CSimpleCommandParser::registered("BlackSimPlugin::FsCommon::CSimulatorFsCommon")) { return; } - BlackMisc::CSimpleCommandParser::registerCommand({".drv", "alias: .driver .plugin"}); - BlackMisc::CSimpleCommandParser::registerCommand({".drv fsuipc on|off", "FSUIPC on|off if applicable"}); - } + static void registerHelp(); QString m_simulatorName; //!< name of simulator QString m_simulatorDetails; //!< describes version etc.