Ref T231, Ref T236, Ref T238 made command parsing function mandatory for contexts

* we can send commands to any context
* to send to all contexts use the facade
* application relays to facade
This commit is contained in:
Klaus Basan
2018-01-28 04:46:52 +01:00
parent ebd916f6d8
commit bdda413386
7 changed files with 18 additions and 13 deletions

View File

@@ -23,6 +23,7 @@
#include <QObject>
#include <QString>
#include <QtGlobal>
#include <QStringBuilder>
namespace BlackMisc { class CLogCategoryList; }
namespace BlackCore
@@ -125,9 +126,16 @@ namespace BlackCore
//! Debug enabled?
bool isDebugEnabled() const;
// ---------------------------------------------------------------
// All context must implement those functions
// ---------------------------------------------------------------
//! Id and path name for round trip protection
virtual QString getPathAndContextId() const = 0;
//! Parse a given command line
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) = 0;
signals:
//! Log or debug values changed
void changedLogOrDebugSettings();
@@ -145,7 +153,7 @@ namespace BlackCore
//! Path and context id
QString buildPathAndContextId(const QString &path) const
{
return QString(path) + ":" + QString::number(this->getUniqueId());
return path % QStringLiteral(":") % QString::number(this->getUniqueId());
}
//! Relay signals from this class

View File

@@ -149,6 +149,12 @@ namespace BlackCore
Q_UNUSED(argument);
Q_UNUSED(origin);
}
bool IContextApplication::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
{
if (!this->getRuntime()) { return false; }
return this->getRuntime()->parseCommandLine(commandLine, originator);
}
} // ns
} // ns

View File

@@ -205,6 +205,9 @@ namespace BlackCore
//! Remote enabled version of file exists
virtual bool existsFile(const QString &fileName) const = 0;
//! Forward to facade
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
//! The HTML help for dot commands
virtual QString dotCommandsHtmlHelp() const = 0;

View File

@@ -173,9 +173,6 @@ namespace BlackCore
//! Is loobback enabled?
virtual bool isAudioLoopbackEnabled() const = 0;
//! Command line was entered
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) = 0;
};
} // ns
} // ns

View File

@@ -245,9 +245,6 @@ namespace BlackCore
//! Load flight plan (from network)
virtual BlackMisc::Aviation::CFlightPlan loadFlightPlanFromNetwork(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
//! Command line was entered
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) = 0;
//! Use the selected COM1/2 frequencies, and get the corresponding voice room for it
virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const = 0;

View File

@@ -139,9 +139,6 @@ namespace BlackCore
//! Automatic voice room resolution for frequencies
virtual void enableAutomaticVoiceRoomResolution(bool enable) = 0;
//! Parse command line
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) = 0;
//! Default situation
//! \remark normally used when no driver is attached
static const BlackMisc::Aviation::CAircraftSituation &getDefaultSituation();

View File

@@ -209,9 +209,6 @@ namespace BlackCore
//! Request weather grid. Argument identifier is past in the signal to identify the requestor
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) = 0;
//! Parse a given command line
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) = 0;
//! Current matching statistics
virtual BlackMisc::Simulation::CMatchingStatistics getCurrentMatchingStatistics(bool missingOnly) const = 0;