mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refs #894, commands can be registered for help
This commit is contained in:
committed by
Mathew Sutcliffe
parent
188669501b
commit
5af5ada4d2
@@ -76,6 +76,33 @@ namespace BlackMisc
|
||||
//! Matches given part
|
||||
bool matchesPart(int index, const QString &toMatch, Qt::CaseSensitivity cs = Qt::CaseInsensitive) const;
|
||||
|
||||
//! Help info
|
||||
struct CommandHtmlHelp
|
||||
{
|
||||
QString command; //!< command
|
||||
QString help; //!< help text
|
||||
|
||||
//! Constructor
|
||||
CommandHtmlHelp(const QString &command, const QString &help) : command(command), help(help)
|
||||
{ }
|
||||
|
||||
//! Compare by command
|
||||
static bool less(const CommandHtmlHelp &a, const CommandHtmlHelp &b)
|
||||
{
|
||||
// may want to check that the pointers aren't zero...
|
||||
return a.command < b.command;
|
||||
}
|
||||
};
|
||||
|
||||
//! Register a command
|
||||
static void registerCommand(const CommandHtmlHelp &command);
|
||||
|
||||
//! Help already registered
|
||||
static bool registered(const QString &helpContext);
|
||||
|
||||
//! HTML commans HELP
|
||||
static QString commandsHtmlHelp();
|
||||
|
||||
private:
|
||||
QString m_originalLine; //!< line as entered by user
|
||||
QString m_cleanedLine; //!< trimmed, no double spaces etc.
|
||||
@@ -84,6 +111,9 @@ namespace BlackMisc
|
||||
QStringList m_knownCommands; //!< known / handled commands
|
||||
bool m_knownCommand = false; //!< known command
|
||||
|
||||
static QList<CommandHtmlHelp> s_commands; //!< all registered commands
|
||||
static QSet<QString> s_registered; //!< registered commands
|
||||
|
||||
//! Avoid wrong usage
|
||||
void setCheckedCommandList(const QStringList &commands);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user