mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-24 18:04:14 +08:00
Ref T658, renamed to "MatchingScriptReturnValues" because it is NO object to be used in matching script
This commit is contained in:
committed by
Mat Sutcliffe
parent
4e24edcb0a
commit
7b6650db32
@@ -261,7 +261,7 @@ namespace BlackCore
|
|||||||
if (useMatchingScript && setup.doRunMsMatchingStageScript())
|
if (useMatchingScript && setup.doRunMsMatchingStageScript())
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QStringLiteral("Matching script: Matching stage script used"));
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QStringLiteral("Matching script: Matching stage script used"));
|
||||||
const MSReturnValues rv = CAircraftMatcher::matchingStageScript(remoteAircraft.getModel(), matchedModel, setup, modelSet, log);
|
const MatchingScriptReturnValues rv = CAircraftMatcher::matchingStageScript(remoteAircraft.getModel(), matchedModel, setup, modelSet, log);
|
||||||
if (rv.runScriptAndModified())
|
if (rv.runScriptAndModified())
|
||||||
{
|
{
|
||||||
matchedModel = rv.model;
|
matchedModel = rv.model;
|
||||||
@@ -325,28 +325,28 @@ namespace BlackCore
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
MSReturnValues CAircraftMatcher::reverseLookupScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, CStatusMessageList *log)
|
MatchingScriptReturnValues CAircraftMatcher::reverseLookupScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, CStatusMessageList *log)
|
||||||
{
|
{
|
||||||
if (!setup.doRunMsReverseLookupScript()) { return MSReturnValues(inModel); }
|
if (!setup.doRunMsReverseLookupScript()) { return MatchingScriptReturnValues(inModel); }
|
||||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return inModel; }
|
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return inModel; }
|
||||||
const QString js = CFileUtils::readFileToString(setup.getMsReverseLookupFile());
|
const QString js = CFileUtils::readFileToString(setup.getMsReverseLookupFile());
|
||||||
static const CAircraftModelList noModelSet;
|
static const CAircraftModelList noModelSet;
|
||||||
const MSReturnValues rv = CAircraftMatcher::matchingScript(js, inModel, inModel, setup, noModelSet, ReverseLookup, log);
|
const MatchingScriptReturnValues rv = CAircraftMatcher::matchingScript(js, inModel, inModel, setup, noModelSet, ReverseLookup, log);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
MSReturnValues CAircraftMatcher::matchingStageScript(const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, CStatusMessageList *log)
|
MatchingScriptReturnValues CAircraftMatcher::matchingStageScript(const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, CStatusMessageList *log)
|
||||||
{
|
{
|
||||||
if (!setup.doRunMsMatchingStageScript()) { return MSReturnValues(inModel); }
|
if (!setup.doRunMsMatchingStageScript()) { return MatchingScriptReturnValues(inModel); }
|
||||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return inModel; }
|
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return inModel; }
|
||||||
const QString js = CFileUtils::readFileToString(setup.getMsMatchingStageFile());
|
const QString js = CFileUtils::readFileToString(setup.getMsMatchingStageFile());
|
||||||
const MSReturnValues rv = CAircraftMatcher::matchingScript(js, inModel, matchedModel, setup, modelSet, MatchingStage, log);
|
const MatchingScriptReturnValues rv = CAircraftMatcher::matchingScript(js, inModel, matchedModel, setup, modelSet, MatchingStage, log);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
MSReturnValues CAircraftMatcher::matchingScript(const QString &js, const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, MatchingScript ms, CStatusMessageList *log)
|
MatchingScriptReturnValues CAircraftMatcher::matchingScript(const QString &js, const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, MatchingScript ms, CStatusMessageList *log)
|
||||||
{
|
{
|
||||||
MSReturnValues rv(inModel);
|
MatchingScriptReturnValues rv(inModel);
|
||||||
QString logMessage;
|
QString logMessage;
|
||||||
const CCallsign callsign = inModel.getCallsign();
|
const CCallsign callsign = inModel.getCallsign();
|
||||||
|
|
||||||
@@ -668,7 +668,7 @@ namespace BlackCore
|
|||||||
CAircraftModel reverseModel = reverseLookupModel(modelToLookup, networkLiveryInfo, log);
|
CAircraftModel reverseModel = reverseLookupModel(modelToLookup, networkLiveryInfo, log);
|
||||||
if (!setup.doRunMsReverseLookupScript()) { return reverseModel; }
|
if (!setup.doRunMsReverseLookupScript()) { return reverseModel; }
|
||||||
const CCallsign cs = modelToLookup.getCallsign();
|
const CCallsign cs = modelToLookup.getCallsign();
|
||||||
const MSReturnValues rv = reverseLookupScript(reverseModel, setup, log);
|
const MatchingScriptReturnValues rv = reverseLookupScript(reverseModel, setup, log);
|
||||||
if (rv.runScriptModifiedAndRerun())
|
if (rv.runScriptModifiedAndRerun())
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, cs, QStringLiteral("Matching script: Modified value and requested rerun"));
|
CMatchingUtils::addLogDetailsToList(log, cs, QStringLiteral("Matching script: Modified value and requested rerun"));
|
||||||
|
|||||||
@@ -92,15 +92,15 @@ namespace BlackCore
|
|||||||
//! Run the network reverse lookup script
|
//! Run the network reverse lookup script
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
//! \ingroup reverselookup
|
//! \ingroup reverselookup
|
||||||
static BlackMisc::Simulation::MSReturnValues reverseLookupScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, BlackMisc::CStatusMessageList *log);
|
static BlackMisc::Simulation::MatchingScriptReturnValues reverseLookupScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, BlackMisc::CStatusMessageList *log);
|
||||||
|
|
||||||
//! Run the matching stage lookup script
|
//! Run the matching stage lookup script
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
static BlackMisc::Simulation::MSReturnValues matchingStageScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftModel &matchedModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, const BlackMisc::Simulation::CAircraftModelList &modelSet, BlackMisc::CStatusMessageList *log);
|
static BlackMisc::Simulation::MatchingScriptReturnValues matchingStageScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftModel &matchedModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, const BlackMisc::Simulation::CAircraftModelList &modelSet, BlackMisc::CStatusMessageList *log);
|
||||||
|
|
||||||
//! Run the matching script
|
//! Run the matching script
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
static BlackMisc::Simulation::MSReturnValues matchingScript(const QString &js,
|
static BlackMisc::Simulation::MatchingScriptReturnValues matchingScript(const QString &js,
|
||||||
const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftModel &matchedModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup,
|
const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftModel &matchedModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup,
|
||||||
const BlackMisc::Simulation::CAircraftModelList &modelSet, BlackMisc::Simulation::MatchingScript ms,
|
const BlackMisc::Simulation::CAircraftModelList &modelSet, BlackMisc::Simulation::MatchingScript ms,
|
||||||
BlackMisc::CStatusMessageList *log);
|
BlackMisc::CStatusMessageList *log);
|
||||||
|
|||||||
@@ -847,7 +847,7 @@ namespace BlackCore
|
|||||||
// Script
|
// Script
|
||||||
if (runMatchinScript && setup.doRunMsReverseLookupScript())
|
if (runMatchinScript && setup.doRunMsReverseLookupScript())
|
||||||
{
|
{
|
||||||
const MSReturnValues rv = CAircraftMatcher::reverseLookupScript(lookupModel, setup, log);
|
const MatchingScriptReturnValues rv = CAircraftMatcher::reverseLookupScript(lookupModel, setup, log);
|
||||||
if (rv.runScriptAndModified())
|
if (rv.runScriptAndModified())
|
||||||
{
|
{
|
||||||
if (rv.runScriptAndRerun())
|
if (rv.runScriptAndRerun())
|
||||||
|
|||||||
@@ -272,12 +272,12 @@ namespace BlackGui
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
MSReturnValues CModelMatcherComponent::matchingScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, CStatusMessageList &msgs)
|
MatchingScriptReturnValues CModelMatcherComponent::matchingScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, CStatusMessageList &msgs)
|
||||||
{
|
{
|
||||||
// Script
|
// Script
|
||||||
if (setup.doRunMsReverseLookupScript())
|
if (setup.doRunMsReverseLookupScript())
|
||||||
{
|
{
|
||||||
const MSReturnValues rv = CAircraftMatcher::reverseLookupScript(inModel, setup, &msgs);
|
const MatchingScriptReturnValues rv = CAircraftMatcher::reverseLookupScript(inModel, setup, &msgs);
|
||||||
if (rv.runScriptAndModified())
|
if (rv.runScriptAndModified())
|
||||||
{
|
{
|
||||||
return rv;
|
return rv;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace BlackGui
|
|||||||
BlackMisc::Simulation::CAircraftModel defaultModel() const;
|
BlackMisc::Simulation::CAircraftModel defaultModel() const;
|
||||||
|
|
||||||
//! Run matching script
|
//! Run matching script
|
||||||
static BlackMisc::Simulation::MSReturnValues matchingScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, BlackMisc::CStatusMessageList &msgs);
|
static BlackMisc::Simulation::MatchingScriptReturnValues matchingScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, BlackMisc::CStatusMessageList &msgs);
|
||||||
|
|
||||||
QScopedPointer<Ui::CModelMatcherComponent> ui;
|
QScopedPointer<Ui::CModelMatcherComponent> ui;
|
||||||
QPointer<Views::CAircraftModelView> m_workbenchView; //!< an external workbenc
|
QPointer<Views::CAircraftModelView> m_workbenchView; //!< an external workbenc
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ namespace BlackMisc
|
|||||||
BLACKMISC_EXPORT const QString &msToString(MatchingScript ms);
|
BLACKMISC_EXPORT const QString &msToString(MatchingScript ms);
|
||||||
|
|
||||||
//! Return values
|
//! Return values
|
||||||
struct MSReturnValues
|
struct MatchingScriptReturnValues
|
||||||
{
|
{
|
||||||
//! Ctor
|
//! Ctor
|
||||||
MSReturnValues(const BlackMisc::Simulation::CAircraftModel &model) : model(model) {}
|
MatchingScriptReturnValues(const BlackMisc::Simulation::CAircraftModel &model) : model(model) {}
|
||||||
|
|
||||||
BlackMisc::Simulation::CAircraftModel model; //!< the model
|
BlackMisc::Simulation::CAircraftModel model; //!< the model
|
||||||
bool modified = false; //!< modified?
|
bool modified = false; //!< modified?
|
||||||
|
|||||||
Reference in New Issue
Block a user