mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 03:35:38 +08:00
Guarding by "hasWebDataServices"
This commit is contained in:
committed by
Mat Sutcliffe
parent
70e08fdf8b
commit
14ab60cb73
@@ -1113,10 +1113,10 @@ namespace BlackCore
|
|||||||
|
|
||||||
if (it != m_aliasedStations.end())
|
if (it != m_aliasedStations.end())
|
||||||
{
|
{
|
||||||
if (sApp->getIContextNetwork())
|
if (sApp && sApp->getIContextNetwork())
|
||||||
{
|
{
|
||||||
// Get the callsign for this frequency and fuzzy compare with our alias station
|
// Get the callsign for this frequency and fuzzy compare with our alias station
|
||||||
// !\todo KB 2019-10 replace by com unit channel spacing
|
// !\todo KB 2019-10 replace by COM unit channel spacing
|
||||||
const CComSystem::ChannelSpacing spacing = CComSystem::ChannelSpacing25KHz;
|
const CComSystem::ChannelSpacing spacing = CComSystem::ChannelSpacing25KHz;
|
||||||
const CFrequency f(static_cast<int>(roundedFrequencyHz), CFrequencyUnit::Hz());
|
const CFrequency f(static_cast<int>(roundedFrequencyHz), CFrequencyUnit::Hz());
|
||||||
const CAtcStationList matchingAtcStations = sApp->getIContextNetwork()->getOnlineStationsForFrequency(f, spacing);
|
const CAtcStationList matchingAtcStations = sApp->getIContextNetwork()->getOnlineStationsForFrequency(f, spacing);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
CAircraftMatcher::CAircraftMatcher(const CAircraftMatcherSetup &setup, QObject *parent) : QObject(parent), m_setup(setup)
|
CAircraftMatcher::CAircraftMatcher(const CAircraftMatcherSetup &setup, QObject *parent) : QObject(parent), m_setup(setup)
|
||||||
{
|
{
|
||||||
if (sApp && !sApp->isShuttingDown())
|
if (sApp && sApp->hasWebDataServices())
|
||||||
{
|
{
|
||||||
sApp->getWebDataServices()->synchronizeDbCaches(CEntityFlags::AircraftCategoryEntity);
|
sApp->getWebDataServices()->synchronizeDbCaches(CEntityFlags::AircraftCategoryEntity);
|
||||||
const CAircraftCategoryList categories = sApp->getWebDataServices()->getAircraftCategories();
|
const CAircraftCategoryList categories = sApp->getWebDataServices()->getAircraftCategories();
|
||||||
@@ -513,7 +513,8 @@ namespace BlackCore
|
|||||||
const CCallsign callsign = inModel.getCallsign();
|
const CCallsign callsign = inModel.getCallsign();
|
||||||
|
|
||||||
if (js.isEmpty() && log) { CLogUtilities::addLogDetailsToList(log, callsign, QStringLiteral("Matching script is empty")); }
|
if (js.isEmpty() && log) { CLogUtilities::addLogDetailsToList(log, callsign, QStringLiteral("Matching script is empty")); }
|
||||||
while (!js.isEmpty() && sApp && !sApp->isShuttingDown())
|
|
||||||
|
while (!js.isEmpty() && sApp && sApp->hasWebDataServices())
|
||||||
{
|
{
|
||||||
rv.runScript = true;
|
rv.runScript = true;
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace BlackCore
|
|||||||
connect(m_fsdClient, &CFSDClient::connectionStatusChanged, this, &CAirspaceMonitor::onConnectionStatusChanged);
|
connect(m_fsdClient, &CFSDClient::connectionStatusChanged, this, &CAirspaceMonitor::onConnectionStatusChanged);
|
||||||
|
|
||||||
// AutoConnection: this should also avoid race conditions by updating the bookings
|
// AutoConnection: this should also avoid race conditions by updating the bookings
|
||||||
Q_ASSERT_X(sApp && sApp->getWebDataServices(), Q_FUNC_INFO, "Missing data reader");
|
Q_ASSERT_X(sApp && sApp->hasWebDataServices(), Q_FUNC_INFO, "Missing data reader");
|
||||||
|
|
||||||
// optional readers
|
// optional readers
|
||||||
if (sApp && sApp->getWebDataServices()->getBookingReader())
|
if (sApp && sApp->getWebDataServices()->getBookingReader())
|
||||||
@@ -340,7 +340,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::requestAtcBookingsUpdate()
|
void CAirspaceMonitor::requestAtcBookingsUpdate()
|
||||||
{
|
{
|
||||||
if (!sApp || sApp->isShuttingDown()) { return; }
|
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return; }
|
||||||
sApp->getWebDataServices()->readInBackground(BlackMisc::Network::CEntityFlags::BookingEntity);
|
sApp->getWebDataServices()->readInBackground(BlackMisc::Network::CEntityFlags::BookingEntity);
|
||||||
m_bookingsRequested = true;
|
m_bookingsRequested = true;
|
||||||
}
|
}
|
||||||
@@ -1360,7 +1360,12 @@ namespace BlackCore
|
|||||||
CAircraftSituation correctedSituation(allowTestOffset ? this->addTestAltitudeOffsetToSituation(situation) : situation);
|
CAircraftSituation correctedSituation(allowTestOffset ? this->addTestAltitudeOffsetToSituation(situation) : situation);
|
||||||
bool haveRequestedElevation = false;
|
bool haveRequestedElevation = false;
|
||||||
const bool canLikelySkipNearGround = correctedSituation.canLikelySkipNearGroundInterpolation();
|
const bool canLikelySkipNearGround = correctedSituation.canLikelySkipNearGroundInterpolation();
|
||||||
if (!correctedSituation.hasGroundElevation() && !canLikelySkipNearGround)
|
if (!correctedSituation.hasGroundElevation())
|
||||||
|
{
|
||||||
|
// set a defined state
|
||||||
|
correctedSituation.resetGroundElevation();
|
||||||
|
|
||||||
|
if (!canLikelySkipNearGround)
|
||||||
{
|
{
|
||||||
// fetch from cache or request
|
// fetch from cache or request
|
||||||
const CAircraftSituationList situations = this->remoteAircraftSituations(callsign);
|
const CAircraftSituationList situations = this->remoteAircraftSituations(callsign);
|
||||||
@@ -1404,11 +1409,15 @@ namespace BlackCore
|
|||||||
if (oldSituations.size() > 1)
|
if (oldSituations.size() > 1)
|
||||||
{
|
{
|
||||||
const bool extrapolated = correctedSituation.extrapolateElevation(oldSituations[0], oldSituations[1], oldChanges.frontOrDefault());
|
const bool extrapolated = correctedSituation.extrapolateElevation(oldSituations[0], oldSituations[1], oldChanges.frontOrDefault());
|
||||||
BLACK_AUDIT_X(extrapolated, Q_FUNC_INFO, "Cannot extrapolate");
|
Q_UNUSED(extrapolated)
|
||||||
|
|
||||||
|
// extrapolation only works if there is a provider and already data
|
||||||
|
// BLACK_AUDIT_X(extrapolated, Q_FUNC_INFO, "Cannot extrapolate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // gnd. elevation
|
} // gnd. elevation
|
||||||
}
|
} // can skip?
|
||||||
|
} // have already elevation?
|
||||||
|
|
||||||
// do we already have ground details?
|
// do we already have ground details?
|
||||||
if (situation.getOnGroundDetails() == CAircraftSituation::NotSetGroundDetails)
|
if (situation.getOnGroundDetails() == CAircraftSituation::NotSetGroundDetails)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace BlackGui
|
|||||||
connect(ui->pb_SendToDB, &QPushButton::released, this, &CAutoPublishComponent::sendToDb, Qt::QueuedConnection);
|
connect(ui->pb_SendToDB, &QPushButton::released, this, &CAutoPublishComponent::sendToDb, Qt::QueuedConnection);
|
||||||
connect(ui->pb_DeleteFiles, &QPushButton::released, this, &CAutoPublishComponent::deleteAllFiles, Qt::QueuedConnection);
|
connect(ui->pb_DeleteFiles, &QPushButton::released, this, &CAutoPublishComponent::deleteAllFiles, Qt::QueuedConnection);
|
||||||
|
|
||||||
if (sGui && sGui->getWebDataServices() && sGui->getWebDataServices()->getDatabaseWriter())
|
if (sGui && sGui->hasWebDataServices() && sGui->getWebDataServices()->getDatabaseWriter())
|
||||||
{
|
{
|
||||||
CDatabaseWriter *w = sGui->getWebDataServices()->getDatabaseWriter();
|
CDatabaseWriter *w = sGui->getWebDataServices()->getDatabaseWriter();
|
||||||
connect(w, &CDatabaseWriter::autoPublished, this, &CAutoPublishComponent::onAutoPublished, Qt::QueuedConnection);
|
connect(w, &CDatabaseWriter::autoPublished, this, &CAutoPublishComponent::onAutoPublished, Qt::QueuedConnection);
|
||||||
@@ -77,7 +77,7 @@ namespace BlackGui
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sGui->getWebDataServices())
|
if (!sGui->hasWebDataServices())
|
||||||
{
|
{
|
||||||
this->showOverlayHTMLMessage("No publishing web service!", 5000);
|
this->showOverlayHTMLMessage("No publishing web service!", 5000);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -49,8 +49,13 @@ namespace BlackGui
|
|||||||
this->setAcceptDrops(true);
|
this->setAcceptDrops(true);
|
||||||
this->setAcceptedMetaTypeIds({qMetaTypeId<CAircraftIcaoCode>(), qMetaTypeId<CAircraftIcaoCodeList>()});
|
this->setAcceptedMetaTypeIds({qMetaTypeId<CAircraftIcaoCode>(), qMetaTypeId<CAircraftIcaoCodeList>()});
|
||||||
ui->le_Aircraft->setValidator(new CUpperCaseValidator(this));
|
ui->le_Aircraft->setValidator(new CUpperCaseValidator(this));
|
||||||
|
|
||||||
connect(ui->le_Aircraft, &QLineEdit::editingFinished, this, &CDbAircraftIcaoSelectorComponent::onDataChanged);
|
connect(ui->le_Aircraft, &QLineEdit::editingFinished, this, &CDbAircraftIcaoSelectorComponent::onDataChanged);
|
||||||
|
if (sApp && sApp->hasWebDataServices())
|
||||||
|
{
|
||||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoSelectorComponent::onCodesRead, Qt::QueuedConnection);
|
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoSelectorComponent::onCodesRead, Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
|
||||||
this->onCodesRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, sApp->getWebDataServices()->getAircraftIcaoCodesCount());
|
this->onCodesRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, sApp->getWebDataServices()->getAircraftIcaoCodesCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user