mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-11 06:25:33 +08:00
Smaller improvements in matching messages/style
This commit is contained in:
committed by
Mat Sutcliffe
parent
96fc62e393
commit
7ee2814c73
@@ -822,7 +822,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (isDBModel)
|
if (isDBModel)
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Found model in DB for model string '%1'").arg(model.getModelStringAndDbKey()));
|
CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Found model in DB for model string '%1' dist: '%2' descr.: '%3'").arg(model.getModelStringAndDbKey(), model.getDistributor().getDbKey(), model.getDescription()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -510,8 +510,9 @@ namespace BlackCore
|
|||||||
// checking for min. situations ensures the aircraft is stable, can be interpolated ...
|
// checking for min. situations ensures the aircraft is stable, can be interpolated ...
|
||||||
const CSimulatedAircraft remoteAircraft = this->getAircraftInRangeForCallsign(callsign);
|
const CSimulatedAircraft remoteAircraft = this->getAircraftInRangeForCallsign(callsign);
|
||||||
const bool validCs = remoteAircraft.hasValidCallsign();
|
const bool validCs = remoteAircraft.hasValidCallsign();
|
||||||
const bool minSituations = validCs && this->remoteAircraftSituationsCount(callsign) > 1;
|
const bool minSituations = this->remoteAircraftSituationsCount(callsign) > 1;
|
||||||
const bool complete = minSituations && (
|
const bool complete = validCs &&
|
||||||
|
minSituations && (
|
||||||
(remoteAircraft.getModel().getModelType() == CAircraftModel::TypeFSInnData) || // here we know we have all data
|
(remoteAircraft.getModel().getModelType() == CAircraftModel::TypeFSInnData) || // here we know we have all data
|
||||||
(remoteAircraft.hasModelString()) // we cannot expect more info
|
(remoteAircraft.hasModelString()) // we cannot expect more info
|
||||||
);
|
);
|
||||||
@@ -749,12 +750,13 @@ namespace BlackCore
|
|||||||
emit this->requestedNewAircraft(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery);
|
emit this->requestedNewAircraft(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftModel CAirspaceMonitor::reverseLookupModelWithFlightplanData(const CCallsign &callsign, const QString &aircraftIcaoString,
|
CAircraftModel CAirspaceMonitor::reverseLookupModelWithFlightplanData(
|
||||||
const QString &airlineIcaoString, const QString &liveryString, const QString &modelString,
|
const CCallsign &callsign, const QString &aircraftIcaoString,
|
||||||
CAircraftModel::ModelType type, CStatusMessageList *log, bool runMatchinScript)
|
const QString &airlineIcaoString, const QString &liveryString, const QString &modelString,
|
||||||
|
CAircraftModel::ModelType type, CStatusMessageList *log, bool runMatchinScript)
|
||||||
{
|
{
|
||||||
const int modelSetCount = this->getModelSetCount();
|
const int modelSetCount = this->getModelSetCount();
|
||||||
CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Reverse lookup (with FP data) model set: %1").arg(modelSetCount), CAirspaceMonitor::getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Reverse lookup (with FP data) model set count: %1").arg(modelSetCount), CAirspaceMonitor::getLogCategories());
|
||||||
|
|
||||||
const DBTripleIds ids = CAircraftModel::parseNetworkLiveryString(liveryString);
|
const DBTripleIds ids = CAircraftModel::parseNetworkLiveryString(liveryString);
|
||||||
const bool hasAnyId = ids.hasAnyId();
|
const bool hasAnyId = ids.hasAnyId();
|
||||||
@@ -775,7 +777,11 @@ namespace BlackCore
|
|||||||
CAirlineIcaoCode airlineIcao;
|
CAirlineIcaoCode airlineIcao;
|
||||||
CAircraftIcaoCode aircraftIcao;
|
CAircraftIcaoCode aircraftIcao;
|
||||||
|
|
||||||
if (hasAnyId)
|
if (!setup.isReverseLookupSwiftLiveryIds())
|
||||||
|
{
|
||||||
|
CMatchingUtils::addLogDetailsToList(log, callsign, QStringLiteral("Reverse lookup of livery string '%1' disabled").arg(liveryString));
|
||||||
|
}
|
||||||
|
else if (hasAnyId)
|
||||||
{
|
{
|
||||||
if (ids.model >= 0)
|
if (ids.model >= 0)
|
||||||
{
|
{
|
||||||
@@ -941,7 +947,7 @@ namespace BlackCore
|
|||||||
if (!myself) { return; }
|
if (!myself) { return; }
|
||||||
myself->addNewAircraftInRange(ac);
|
myself->addNewAircraftInRange(ac);
|
||||||
if (!readyForModelMatching) { return; }
|
if (!readyForModelMatching) { return; }
|
||||||
myself->sendReadyForModelMatching(ac.getCallsign());
|
myself->sendReadyForModelMatching(ac.getCallsign()); // airspace monitor adding all aicraft
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -984,19 +990,23 @@ namespace BlackCore
|
|||||||
const CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery,
|
const CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery,
|
||||||
const QString &modelString, CAircraftModel::ModelType modelType, CStatusMessageList *log)
|
const QString &modelString, CAircraftModel::ModelType modelType, CStatusMessageList *log)
|
||||||
{
|
{
|
||||||
CAircraftModel model = this->reverseLookupModelWithFlightplanData(callsign, aircraftIcao, airlineIcao, livery, modelString, modelType, log);
|
|
||||||
const CSimulatedAircraft aircraft = this->getAircraftInRangeForCallsign(callsign);
|
const CSimulatedAircraft aircraft = this->getAircraftInRangeForCallsign(callsign);
|
||||||
|
|
||||||
if (aircraft.hasValidCallsign())
|
if (aircraft.hasValidCallsign())
|
||||||
{
|
{
|
||||||
model.updateMissingParts(aircraft.getModel());
|
// only if we do not have a DB model yet
|
||||||
// Use anonymous as originator here, since the remote aircraft provider is ourselves and the call to updateAircraftModel() would
|
if (!aircraft.getModel().hasValidDbKey())
|
||||||
// return without doing anything.
|
{
|
||||||
this->updateAircraftModel(callsign, model, CIdentifier::null());
|
CAircraftModel model = this->reverseLookupModelWithFlightplanData(callsign, aircraftIcao, airlineIcao, livery, modelString, modelType, log);
|
||||||
this->updateAircraftNetworkModel(callsign, model, CIdentifier::null());
|
model.updateMissingParts(aircraft.getModel());
|
||||||
|
// Use anonymous as originator here, since the remote aircraft provider is ourselves and the call to updateAircraftModel() would
|
||||||
|
// return without doing anything.
|
||||||
|
this->updateAircraftModel(callsign, model, CIdentifier::null());
|
||||||
|
this->updateAircraftNetworkModel(callsign, model, CIdentifier::null());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const CAircraftModel model = this->reverseLookupModelWithFlightplanData(callsign, aircraftIcao, airlineIcao, livery, modelString, modelType, log);
|
||||||
const CSimulatedAircraft initAircraft(model);
|
const CSimulatedAircraft initAircraft(model);
|
||||||
this->addNewAircraftInRange(initAircraft);
|
this->addNewAircraftInRange(initAircraft);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,11 +202,12 @@ namespace BlackMisc
|
|||||||
QString CAirlineIcaoCode::convertToQString(bool i18n) const
|
QString CAirlineIcaoCode::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
return this->getDesignatorDbKey() %
|
const QString s = this->getDesignatorDbKey() %
|
||||||
(this->hasName() ? u' ' % m_name : QString()) %
|
(this->hasName() ? u' ' % m_name : QString()) %
|
||||||
u" Op: " % boolToYesNo(this->isOperating()) %
|
u" Op: " % boolToYesNo(this->isOperating()) %
|
||||||
u" VA: " % boolToYesNo(this->isVirtualAirline()) %
|
u" VA: " % boolToYesNo(this->isVirtualAirline()) %
|
||||||
u" Mil: " % boolToYesNo(this->isMilitary());
|
u" Mil: " % boolToYesNo(this->isMilitary());
|
||||||
|
return s.trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
CVariant CAirlineIcaoCode::propertyByIndex(const CPropertyIndex &index) const
|
CVariant CAirlineIcaoCode::propertyByIndex(const CPropertyIndex &index) const
|
||||||
@@ -330,7 +331,7 @@ namespace BlackMisc
|
|||||||
CAirlineIcaoCode CAirlineIcaoCode::thisOrCallsignCode(const CCallsign &callsign) const
|
CAirlineIcaoCode CAirlineIcaoCode::thisOrCallsignCode(const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (this->hasValidDbKey()) { return *this; }
|
if (this->hasValidDbKey()) { return *this; }
|
||||||
if (callsign.isEmpty()) { return *this; }
|
if (callsign.isEmpty()) { return *this; }
|
||||||
const QString callsignAirline = callsign.getAirlinePrefix();
|
const QString callsignAirline = callsign.getAirlinePrefix();
|
||||||
if (callsignAirline.isEmpty()) { return *this; }
|
if (callsignAirline.isEmpty()) { return *this; }
|
||||||
if (callsignAirline == m_designator) { return *this; }
|
if (callsignAirline == m_designator) { return *this; }
|
||||||
|
|||||||
@@ -214,10 +214,10 @@ namespace BlackSimPlugin
|
|||||||
bool CSimulatorEmulated::changeInternalCom(const CSimulatedAircraft &aircraft)
|
bool CSimulatorEmulated::changeInternalCom(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (aircraft.getCom1System() != m_myAircraft.getCom1System()) { changed = true; }
|
if (aircraft.getCom1System() != m_myAircraft.getCom1System()) { changed = true; }
|
||||||
if (aircraft.getCom2System() != m_myAircraft.getCom2System()) { changed = true; }
|
if (aircraft.getCom2System() != m_myAircraft.getCom2System()) { changed = true; }
|
||||||
if (aircraft.getTransponder() != m_myAircraft.getTransponder()) { changed = true; }
|
if (aircraft.getTransponder() != m_myAircraft.getTransponder()) { changed = true; }
|
||||||
if (aircraft.getSelcal() != m_myAircraft.getSelcal()) { changed = true; }
|
if (aircraft.getSelcal() != m_myAircraft.getSelcal()) { changed = true; }
|
||||||
|
|
||||||
if (!changed) { return false; }
|
if (!changed) { return false; }
|
||||||
m_myAircraft.setCockpit(aircraft);
|
m_myAircraft.setCockpit(aircraft);
|
||||||
@@ -307,6 +307,13 @@ namespace BlackSimPlugin
|
|||||||
m_renderedAircraft.push_back(aircraft); // my simulator list
|
m_renderedAircraft.push_back(aircraft); // my simulator list
|
||||||
this->updateAircraftRendered(cs, true); // in provider
|
this->updateAircraftRendered(cs, true); // in provider
|
||||||
emit this->aircraftRenderingChanged(aircraft);
|
emit this->aircraftRenderingChanged(aircraft);
|
||||||
|
|
||||||
|
// debugging/logging (just here for debugging purposes)
|
||||||
|
const CAircraftModel networkModel = remoteAircraft.getNetworkModel();
|
||||||
|
const CAircraftModel currentModel = remoteAircraft.getModel();
|
||||||
|
Q_UNUSED(networkModel);
|
||||||
|
Q_UNUSED(currentModel);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace BlackSimPlugin
|
|||||||
m_pendingAddedTimer.setObjectName(this->objectName().append(":m_pendingAddedTimer"));
|
m_pendingAddedTimer.setObjectName(this->objectName().append(":m_pendingAddedTimer"));
|
||||||
connect(&m_fastTimer, &QTimer::timeout, this, &CSimulatorXPlane::fastTimerTimeout);
|
connect(&m_fastTimer, &QTimer::timeout, this, &CSimulatorXPlane::fastTimerTimeout);
|
||||||
connect(&m_slowTimer, &QTimer::timeout, this, &CSimulatorXPlane::slowTimerTimeout);
|
connect(&m_slowTimer, &QTimer::timeout, this, &CSimulatorXPlane::slowTimerTimeout);
|
||||||
connect(&m_airportUpdater, &QTimer::timeout, this, &CSimulatorXPlane::updateAirportsInRange);
|
connect(&m_airportUpdater, &QTimer::timeout, this, &CSimulatorXPlane::updateAirportsInRange);
|
||||||
connect(&m_pendingAddedTimer, &QTimer::timeout, this, &CSimulatorXPlane::addNextPendingAircraft);
|
connect(&m_pendingAddedTimer, &QTimer::timeout, this, &CSimulatorXPlane::addNextPendingAircraft);
|
||||||
m_fastTimer.start(100);
|
m_fastTimer.start(100);
|
||||||
m_slowTimer.start(1000);
|
m_slowTimer.start(1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user