mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
Ref T171, made remote aircraft provider and web service "protected slots" -> "protected"
* Unlike in other cases, the remote aircraft provider slots are also very frequently called. So besides "style", it might be also useful here to avoid the extra MOC layers. * Also renamed 2 web service signals and made web service connections Qt::QueuedConnection
This commit is contained in:
@@ -59,23 +59,23 @@ namespace BlackCore
|
||||
m_remoteAircraftProviderConnections.append(
|
||||
m_remoteAircraftProvider->connectRemoteAircraftProviderSignals(
|
||||
this, // receiver must match object in bind
|
||||
std::bind(&CSimulatorCommon::ps_remoteProviderAddAircraftSituation, this, std::placeholders::_1),
|
||||
std::bind(&CSimulatorCommon::ps_remoteProviderAddAircraftParts, this, std::placeholders::_1, std::placeholders::_2),
|
||||
std::bind(&CSimulatorCommon::ps_remoteProviderRemovedAircraft, this, std::placeholders::_1),
|
||||
std::bind(&CSimulatorCommon::ps_recalculateRenderedAircraft, this, std::placeholders::_1))
|
||||
std::bind(&CSimulatorCommon::onRemoteProviderAddedAircraftSituation, this, std::placeholders::_1),
|
||||
std::bind(&CSimulatorCommon::onRemoteProviderAddedAircraftParts, this, std::placeholders::_1, std::placeholders::_2),
|
||||
std::bind(&CSimulatorCommon::onRemoteProviderRemovedAircraft, this, std::placeholders::_1),
|
||||
std::bind(&CSimulatorCommon::onRecalculatedRenderedAircraft, this, std::placeholders::_1))
|
||||
);
|
||||
|
||||
// timer
|
||||
connect(&m_oneSecondTimer, &QTimer::timeout, this, &CSimulatorCommon::ps_oneSecondTimer);
|
||||
connect(&m_oneSecondTimer, &QTimer::timeout, this, &CSimulatorCommon::oneSecondTimerTimeout);
|
||||
this->m_oneSecondTimer.setObjectName(this->objectName().append(":m_oneSecondTimer"));
|
||||
this->m_oneSecondTimer.start(1000);
|
||||
|
||||
// swift data
|
||||
if (sApp && sApp->getWebDataServices())
|
||||
if (sApp && sApp->hasWebDataServices())
|
||||
{
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::allSwiftDbDataRead, this, &CSimulatorCommon::ps_allSwiftDataRead);
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbAirportsRead, this, &CSimulatorCommon::ps_airportsRead);
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbModelMatchingEntities, this, &CSimulatorCommon::ps_modelMatchingEntities);
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::allSwiftDbDataRead, this, &CSimulatorCommon::onSwiftDbAllDataRead, Qt::QueuedConnection);
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbAirportsRead, this, &CSimulatorCommon::onSwiftDbAirportsRead, Qt::QueuedConnection);
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbModelMatchingEntitiesRead, this, &CSimulatorCommon::onSwiftDbModelMatchingEntitiesRead, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
// info
|
||||
@@ -243,7 +243,7 @@ namespace BlackCore
|
||||
else
|
||||
{
|
||||
// we wait for the data
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbModelMatchingEntities, this, [ = ]
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbModelMatchingEntitiesRead, this, [ = ]
|
||||
{
|
||||
this->reverseLookupAndUpdateOwnAircraftModel(model);
|
||||
});
|
||||
@@ -286,17 +286,17 @@ namespace BlackCore
|
||||
return reverseModel;
|
||||
}
|
||||
|
||||
void CSimulatorCommon::ps_allSwiftDataRead()
|
||||
void CSimulatorCommon::onSwiftDbAllDataRead()
|
||||
{
|
||||
// void, can be overridden in specialized drivers
|
||||
}
|
||||
|
||||
void CSimulatorCommon::ps_modelMatchingEntities()
|
||||
void CSimulatorCommon::onSwiftDbModelMatchingEntitiesRead()
|
||||
{
|
||||
// void, can be overridden in specialized drivers
|
||||
}
|
||||
|
||||
void CSimulatorCommon::ps_airportsRead()
|
||||
void CSimulatorCommon::onSwiftDbAirportsRead()
|
||||
{
|
||||
// void, can be overridden in specialized drivers
|
||||
}
|
||||
@@ -461,12 +461,12 @@ namespace BlackCore
|
||||
CSimpleCommandParser::registerCommand({".drv spline|linear <callsign>", "set spline/linear interpolator for one/all callsign(s)"});
|
||||
}
|
||||
|
||||
void CSimulatorCommon::ps_oneSecondTimer()
|
||||
void CSimulatorCommon::oneSecondTimerTimeout()
|
||||
{
|
||||
this->blinkHighlightedAircraft();
|
||||
}
|
||||
|
||||
void CSimulatorCommon::ps_recalculateRenderedAircraft(const CAirspaceAircraftSnapshot &snapshot)
|
||||
void CSimulatorCommon::onRecalculatedRenderedAircraft(const CAirspaceAircraftSnapshot &snapshot)
|
||||
{
|
||||
if (!snapshot.isValidSnapshot()) { return;}
|
||||
|
||||
@@ -516,18 +516,18 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CSimulatorCommon::ps_remoteProviderAddAircraftSituation(const CAircraftSituation &situation)
|
||||
void CSimulatorCommon::onRemoteProviderAddedAircraftSituation(const CAircraftSituation &situation)
|
||||
{
|
||||
Q_UNUSED(situation);
|
||||
}
|
||||
|
||||
void CSimulatorCommon::ps_remoteProviderAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const CAircraftParts &parts)
|
||||
void CSimulatorCommon::onRemoteProviderAddedAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const CAircraftParts &parts)
|
||||
{
|
||||
Q_UNUSED(callsign);
|
||||
Q_UNUSED(parts);
|
||||
}
|
||||
|
||||
void CSimulatorCommon::ps_remoteProviderRemovedAircraft(const CCallsign &callsign)
|
||||
void CSimulatorCommon::onRemoteProviderRemovedAircraft(const CCallsign &callsign)
|
||||
{
|
||||
Q_UNUSED(callsign);
|
||||
}
|
||||
|
||||
@@ -106,34 +106,6 @@ namespace BlackCore
|
||||
|
||||
// --------- ISimulator implementations ------------
|
||||
|
||||
protected slots:
|
||||
//! \name Connected with remote aircraft provider signals
|
||||
//! @{
|
||||
//! Slow timer used to highlight aircraft, can be used for other things too
|
||||
virtual void ps_oneSecondTimer();
|
||||
|
||||
//! Recalculate the rendered aircraft, this happens when restrictions are applied (max. aircraft, range)
|
||||
virtual void ps_recalculateRenderedAircraft(const BlackMisc::Simulation::CAirspaceAircraftSnapshot &snapshot);
|
||||
|
||||
//! Provider added situation
|
||||
virtual void ps_remoteProviderAddAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! Provider added parts
|
||||
virtual void ps_remoteProviderAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts);
|
||||
|
||||
//! Provider removed aircraft
|
||||
virtual void ps_remoteProviderRemovedAircraft(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
//! @}
|
||||
|
||||
//! All swift data read from DB
|
||||
virtual void ps_allSwiftDataRead();
|
||||
|
||||
//! DB models read
|
||||
virtual void ps_modelMatchingEntities();
|
||||
|
||||
//! DB Airports read
|
||||
virtual void ps_airportsRead();
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CSimulatorCommon(const BlackMisc::Simulation::CSimulatorPluginInfo &info,
|
||||
@@ -148,6 +120,28 @@ namespace BlackCore
|
||||
virtual bool logicallyRemoveRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
//! @}
|
||||
|
||||
//! \name When swift DB data are read
|
||||
//! @{
|
||||
virtual void onSwiftDbAllDataRead();
|
||||
virtual void onSwiftDbModelMatchingEntitiesRead();
|
||||
virtual void onSwiftDbAirportsRead();
|
||||
//! @}
|
||||
|
||||
//! \name Connected with remote aircraft provider signals
|
||||
//! @{
|
||||
//! Recalculate the rendered aircraft, this happens when restrictions are applied (max. aircraft, range)
|
||||
virtual void onRecalculatedRenderedAircraft(const BlackMisc::Simulation::CAirspaceAircraftSnapshot &snapshot);
|
||||
|
||||
//! Provider added situation
|
||||
virtual void onRemoteProviderAddedAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! Provider added parts
|
||||
virtual void onRemoteProviderAddedAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts);
|
||||
|
||||
//! Provider removed aircraft
|
||||
virtual void onRemoteProviderRemovedAircraft(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
//! @}
|
||||
|
||||
//! New plugin info
|
||||
//! \remark normally only used by
|
||||
void setNewPluginInfo(const BlackMisc::Simulation::CSimulatorPluginInfo &info, const BlackMisc::Simulation::CAircraftModel &defaultModel);
|
||||
@@ -197,12 +191,15 @@ namespace BlackCore
|
||||
//! Show log messages?
|
||||
bool showDebugLogMessage() const;
|
||||
|
||||
//! Slow timer used to highlight aircraft, can be used for other things too
|
||||
virtual void oneSecondTimerTimeout();
|
||||
|
||||
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
|
||||
bool m_autoCalcAirportDistance = true; //!< automatically calculate airport distance and bearing
|
||||
BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< default model
|
||||
int m_statsUpdateAircraftCountMs = 0; //!< statistics update count
|
||||
qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics update time
|
||||
qint64 m_statsUpdateAircraftTimeAvgMs = 0; //!< statistics update time
|
||||
BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< default model
|
||||
BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object
|
||||
BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log interpolation
|
||||
mutable QReadWriteLock m_interpolationRenderingSetupMutex; //!< mutex protecting setup object
|
||||
|
||||
@@ -1187,11 +1187,11 @@ namespace BlackCore
|
||||
|
||||
if (m_swiftDbEntitiesRead.testFlag(CEntityFlags::AllIcaoEntities) && signalEntitiesAlreadyRead(CEntityFlags::AllIcaoEntities))
|
||||
{
|
||||
emit swiftDbAllIcaoEntities();
|
||||
emit swiftDbAllIcaoEntitiesRead();
|
||||
}
|
||||
if (m_swiftDbEntitiesRead.testFlag(CEntityFlags::ModelMatchingEntities) && signalEntitiesAlreadyRead(CEntityFlags::ModelMatchingEntities))
|
||||
{
|
||||
emit swiftDbModelMatchingEntities();
|
||||
emit swiftDbModelMatchingEntitiesRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,10 +460,10 @@ namespace BlackCore
|
||||
void swiftDbAirportsRead();
|
||||
|
||||
//! All ICAO entities
|
||||
void swiftDbAllIcaoEntities();
|
||||
void swiftDbAllIcaoEntitiesRead();
|
||||
|
||||
//! All entities needed for model matching
|
||||
void swiftDbModelMatchingEntities();
|
||||
void swiftDbModelMatchingEntitiesRead();
|
||||
//! @}
|
||||
|
||||
public slots:
|
||||
|
||||
Reference in New Issue
Block a user