mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
Formatting
This commit is contained in:
@@ -119,10 +119,10 @@ namespace BlackCore
|
||||
if (m_network && sApp && !sApp->isShuttingDown())
|
||||
{
|
||||
// thread safe update of m_network
|
||||
const QPointer<CAirspaceMonitor> guard(this);
|
||||
const QPointer<CAirspaceMonitor> myself(this);
|
||||
QTimer::singleShot(0, m_network, [ = ]
|
||||
{
|
||||
if (guard.isNull()) { return; }
|
||||
if (myself.isNull()) { return; }
|
||||
if (m_network) { m_network->addInterimPositionReceiver(callsign); }
|
||||
});
|
||||
}
|
||||
@@ -160,6 +160,7 @@ namespace BlackCore
|
||||
// process some other events and hope network answer is received already
|
||||
// CEventLoop::processEventsUntil cannot be used, as a received flight plan might be for another callsign
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
if (!sApp || sApp->isShuttingDown()) { return CFlightPlan(); }
|
||||
if (m_flightPlanCache.contains(callsign))
|
||||
{
|
||||
plan = m_flightPlanCache[callsign];
|
||||
@@ -456,31 +457,42 @@ namespace BlackCore
|
||||
if (!this->isConnected()) { return; }
|
||||
|
||||
const CSimulatedAircraft remoteAircraft = this->getAircraftInRangeForCallsign(callsign);
|
||||
const bool complete = (remoteAircraft.hasValidCallsign() && remoteAircraft.getModel().hasModelString()) || (remoteAircraft.getModel().getModelType() == CAircraftModel::TypeFSInnData);
|
||||
const bool validCs = remoteAircraft.hasValidCallsign();
|
||||
const bool complete = validCs && (
|
||||
(remoteAircraft.getModel().getModelType() == CAircraftModel::TypeFSInnData) || // here we know we have all data
|
||||
(remoteAircraft.hasModelString()) // we cannot expect more info
|
||||
);
|
||||
|
||||
if (trial < 2 && !complete)
|
||||
{
|
||||
this->addReverseLookupMessage(callsign, "Wait for further data");
|
||||
const QPointer<CAirspaceMonitor> guard(this);
|
||||
QTimer::singleShot(1500, this, [ = ]()
|
||||
const QPointer<CAirspaceMonitor> myself(this);
|
||||
QTimer::singleShot(1500 * trial, this, [ = ]()
|
||||
{
|
||||
if (guard.isNull()) { return; }
|
||||
this->sendReadyForModelMatching(callsign, trial + 1); // recursive
|
||||
if (myself.isNull() || !sApp || sApp->isShuttingDown()) { return; }
|
||||
if (!this->isAircraftInRange(callsign))
|
||||
{
|
||||
const CStatusMessage m = CMatchingUtils::logMessage(callsign, "No longer in range", CAirspaceMonitor::getLogCategories());
|
||||
this->addReverseLookupMessage(callsign, m);
|
||||
return;
|
||||
}
|
||||
this->sendReadyForModelMatching(callsign, trial + 1); // recursively
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// some checks for special conditions, e.g. logout -> empty list, but still signals pending
|
||||
if (this->isConnected() && remoteAircraft.hasValidCallsign())
|
||||
if (validCs)
|
||||
{
|
||||
const QString readyMsg = QString("Ready for matching '%1' with model type '%2'").arg(callsign.toQString(), remoteAircraft.getModel().getModelTypeAsString());
|
||||
static const QString readyForMatching("Ready for matching '%1' with model type '%2'");
|
||||
const QString readyMsg = readyForMatching.arg(callsign.toQString(), remoteAircraft.getModel().getModelTypeAsString());
|
||||
const CStatusMessage m = CMatchingUtils::logMessage(callsign, readyMsg, getLogCategories());
|
||||
this->addReverseLookupMessage(callsign, m);
|
||||
emit this->readyForModelMatching(remoteAircraft);
|
||||
}
|
||||
else
|
||||
{
|
||||
const CStatusMessage m = CMatchingUtils::logMessage(callsign, "Ignoring this aircraft, not found in range list, disconnected, or no callsign", getLogCategories());
|
||||
const CStatusMessage m = CMatchingUtils::logMessage(callsign, "Ignoring this aircraft, not found in range list, disconnected, or no callsign", CAirspaceMonitor::getLogCategories());
|
||||
this->addReverseLookupMessage(callsign, m);
|
||||
}
|
||||
}
|
||||
@@ -654,7 +666,7 @@ namespace BlackCore
|
||||
CStatusMessageList *pReverseLookupMessages = this->isReverseLookupMessagesEnabled() ? &reverseLookupMessages : nullptr;
|
||||
CMatchingUtils::addLogDetailsToList(pReverseLookupMessages, callsign, QString("Data from network: aircraft '%1', airline '%2', livery '%3'").
|
||||
arg(aircraftIcaoDesignator, airlineIcaoDesignator, livery),
|
||||
getLogCategories());
|
||||
CAirspaceMonitor::getLogCategories());
|
||||
|
||||
const CClient client = this->getClientOrDefaultForCallsign(callsign);
|
||||
this->addOrUpdateAircraftInRange(callsign, aircraftIcaoDesignator, airlineIcaoDesignator, livery, client.getQueriedModelString(), CAircraftModel::TypeQueriedFromNetwork, pReverseLookupMessages);
|
||||
@@ -688,7 +700,7 @@ namespace BlackCore
|
||||
{
|
||||
const QString resolvedAirlineName = CAircraftMatcher::reverseLookupAirlineName(airlineName);
|
||||
airlineIcao.setName(resolvedAirlineName);
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Setting resolved airline name '%1' from '%2'").arg(resolvedAirlineName, airlineName), getLogCategories());
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Setting resolved airline name '%1' from '%2'").arg(resolvedAirlineName, airlineName), CAirspaceMonitor::getLogCategories());
|
||||
}
|
||||
|
||||
const QString telephony = CAircraftMatcher::reverseLookupTelephonyDesignator(fpRemarks.getRadioTelephony(), callsign, log);
|
||||
@@ -696,7 +708,7 @@ namespace BlackCore
|
||||
{
|
||||
const QString resolvedTelephony = CAircraftMatcher::reverseLookupTelephonyDesignator(telephony);
|
||||
airlineIcao.setTelephonyDesignator(resolvedTelephony);
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Setting resolved telephony designator '%1' from '%2'").arg(resolvedTelephony, telephony), getLogCategories());
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Setting resolved telephony designator '%1' from '%2'").arg(resolvedTelephony, telephony), CAirspaceMonitor::getLogCategories());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,8 +727,8 @@ namespace BlackCore
|
||||
if (foundIcao.isLoadedFromDb()) { aircraftIcao = foundIcao; }
|
||||
}
|
||||
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Quality of aircraft ICAO: %1").arg(aircraftIcao.toQString(true)), getLogCategories());
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Quality of airline ICAO: %1").arg(airlineIcao.toQString(true)), getLogCategories());
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Quality of aircraft ICAO: %1").arg(aircraftIcao.toQString(true)), CAirspaceMonitor::getLogCategories());
|
||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Quality of airline ICAO: %1").arg(airlineIcao.toQString(true)), CAirspaceMonitor::getLogCategories());
|
||||
return CAircraftMatcher::reverseLookupModel(callsign, aircraftIcao, airlineIcao, livery, modelString, type, log);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace BlackCore
|
||||
//! Raw data as received from network
|
||||
void requestedNewAircraft(const BlackMisc::Aviation::CCallsign &callsign, const QString &aircraftDesignator, const QString &airlineDesignator, const QString &livery);
|
||||
|
||||
//! Read for model matching
|
||||
//! Ready for model matching
|
||||
void readyForModelMatching(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft);
|
||||
|
||||
//! An ATIS has been received
|
||||
|
||||
@@ -487,7 +487,7 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CContextSimulator::xCtxAddedRemoteAircraft(const CSimulatedAircraft &remoteAircraft)
|
||||
void CContextSimulator::xCtxAddedRemoteAircraftReadyForModelMatching(const CSimulatedAircraft &remoteAircraft)
|
||||
{
|
||||
if (!this->isSimulatorAvailable()) { return; }
|
||||
const CCallsign callsign = remoteAircraft.getCallsign();
|
||||
@@ -501,8 +501,8 @@ namespace BlackCore
|
||||
CStatusMessageList *pMatchingMessages = m_enableMatchingMessages ? &matchingMessages : nullptr;
|
||||
const CAircraftModel aircraftModel = m_aircraftMatcher.getClosestMatch(remoteAircraft, pMatchingMessages);
|
||||
Q_ASSERT_X(remoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "Mismatching callsigns");
|
||||
this->updateAircraftModel(callsign, aircraftModel, identifier());
|
||||
const CSimulatedAircraft aircraftAfterModelApplied = getAircraftInRangeForCallsign(remoteAircraft.getCallsign());
|
||||
this->updateAircraftModel(callsign, aircraftModel, this->identifier());
|
||||
const CSimulatedAircraft aircraftAfterModelApplied = this->getAircraftInRangeForCallsign(remoteAircraft.getCallsign());
|
||||
m_simulatorPlugin.second->logicallyAddRemoteAircraft(aircraftAfterModelApplied);
|
||||
CMatchingUtils::addLogDetailsToList(pMatchingMessages, callsign, QString("Logically added remote aircraft: %1").arg(aircraftAfterModelApplied.toQString()));
|
||||
this->addMatchingMessages(callsign, matchingMessages);
|
||||
@@ -529,7 +529,7 @@ namespace BlackCore
|
||||
for (const CSimulatedAircraft &simulatedAircraft : aircraft)
|
||||
{
|
||||
BLACK_VERIFY_X(!simulatedAircraft.getCallsign().isEmpty(), Q_FUNC_INFO, "Need callsign");
|
||||
xCtxAddedRemoteAircraft(simulatedAircraft);
|
||||
this->xCtxAddedRemoteAircraftReadyForModelMatching(simulatedAircraft);
|
||||
}
|
||||
m_initallyAddAircrafts = false;
|
||||
}
|
||||
@@ -780,7 +780,7 @@ namespace BlackCore
|
||||
CSimulatedAircraft aircraft = getAircraftInRangeForCallsign(callsign);
|
||||
if (aircraft.getCallsign() != callsign) { return false; } // not found
|
||||
aircraft.setModel(aircraft.getNetworkModel());
|
||||
xCtxAddedRemoteAircraft(aircraft);
|
||||
xCtxAddedRemoteAircraftReadyForModelMatching(aircraft);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,8 +154,8 @@ namespace BlackCore
|
||||
//! \ingroup crosscontextfunction
|
||||
//! @{
|
||||
|
||||
//! Remote aircraft added
|
||||
void xCtxAddedRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft);
|
||||
//! Remote aircraft added and ready for model matching
|
||||
void xCtxAddedRemoteAircraftReadyForModelMatching(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft);
|
||||
|
||||
//! Remove remote aircraft
|
||||
void xCtxRemovedRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
@@ -194,13 +194,13 @@ namespace BlackCore
|
||||
Q_ASSERT_X(this->getCContextNetwork()->airspace(), Q_FUNC_INFO, "No airspace object");
|
||||
|
||||
c = connect(m_contextNetwork, &IContextNetwork::textMessagesReceived,
|
||||
this->getCContextSimulator(), &CContextSimulator::xCtxTextMessagesReceived);
|
||||
this->getCContextSimulator(), &CContextSimulator::xCtxTextMessagesReceived, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
|
||||
// use readyForModelMatching instead of CAirspaceMonitor::addedAircraft, as it contains client information
|
||||
// ready for model matching is sent delayed when all information are available
|
||||
c = connect(m_contextNetwork, &IContextNetwork::readyForModelMatching,
|
||||
this->getCContextSimulator(), &CContextSimulator::xCtxAddedRemoteAircraft, Qt::QueuedConnection);
|
||||
this->getCContextSimulator(), &CContextSimulator::xCtxAddedRemoteAircraftReadyForModelMatching, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(m_contextNetwork, &IContextNetwork::removedAircraft,
|
||||
this->getCContextSimulator(), &CContextSimulator::xCtxRemovedRemoteAircraft, Qt::QueuedConnection);
|
||||
|
||||
@@ -206,8 +206,7 @@ namespace BlackGui
|
||||
const CMetar metar(sGui->getIContextNetwork()->getMetarForAirport(icao));
|
||||
if (metar.hasMessage())
|
||||
{
|
||||
const QString metarText = metar.getMessage() %
|
||||
QStringLiteral("\n\n") % metar.getMetarText();
|
||||
const QString metarText = metar.getMessage() % QStringLiteral("\n\n") % metar.getMetarText();
|
||||
ui->te_AtcStationsOnlineInfo->setText(metarText);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -136,12 +136,14 @@ namespace BlackGui
|
||||
|
||||
//! Data changed
|
||||
//! \remark passing back selected objects so they can be reselected
|
||||
//! \remark condsider modelDataChangedDigest for performance reasons
|
||||
void modelDataChanged(int count, bool withFilter);
|
||||
|
||||
//! Data changed, digest version
|
||||
void modelDataChangedDigest(int count, bool withFilter);
|
||||
|
||||
//! Model has been changed
|
||||
//! Triggered with each change, for performance consider using changedDigest
|
||||
void changed();
|
||||
|
||||
//! Model has been changed, digest signal
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace BlackGui
|
||||
CStatusMessageListModel::CStatusMessageListModel(QObject *parent) :
|
||||
CListModelBase<CStatusMessage, CStatusMessageList, true>("ViewStatusMessageList", parent)
|
||||
{
|
||||
setMode(Detailed);
|
||||
this->setMode(Detailed);
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ViewStatusMessageList", "time");
|
||||
@@ -67,6 +67,5 @@ namespace BlackGui
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -452,9 +452,9 @@ namespace BlackGui
|
||||
bool m_forceColumnsToMaxSize = true; //!< force that columns are extended to full viewport width
|
||||
QWidget *m_filterWidget = nullptr; //!< filter widget or dialog
|
||||
Menu m_menus = MenuDefault; //!< Default menu settings
|
||||
Menus::IMenuDelegate *m_menu = nullptr; //!< custom menu if any
|
||||
Menus::CFontMenu *m_fontMenu = nullptr; //!< font menu if applicable
|
||||
CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if needed
|
||||
Menus::IMenuDelegate *m_menu = nullptr; //!< custom menu if any
|
||||
Menus::CFontMenu *m_fontMenu = nullptr; //!< font menu if applicable
|
||||
CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if needed
|
||||
QMap<MenuFlag, Menus::CMenuActions> m_menuFlagActions; //!< initialized actions
|
||||
BlackMisc::CSettingReadOnly<Settings::TGeneralGui> m_guiSettings { this, &CViewBaseNonTemplate::settingsChanged }; //!< general GUI settings
|
||||
BlackMisc::CSetting<Settings::TViewDirectorySettings> m_dirSettings { this }; //!< directory for load/save
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace BlackMisc
|
||||
CPartsStatus m_currentPartsStatus; //!< this step's status
|
||||
Aviation::CAircraftSituation m_lastInterpolation { Aviation::CAircraftSituation::null() }; //!< latest interpolation
|
||||
|
||||
qint64 m_situationsLastModified { -1 }; //!< whehn situations were last modified
|
||||
qint64 m_situationsLastModified { -1 }; //!< when situations were last modified
|
||||
qint64 m_situationsLastModifiedUsed { -1 }; //!< interpolant based on situations last updated
|
||||
int m_interpolatedSituationsCounter { 0 }; //!< counter for each interpolated situations: statistics, every n-th interpolation ....
|
||||
|
||||
|
||||
@@ -265,17 +265,10 @@ void SwiftGuiStd::onConnectionStatusChanged(INetwork::ConnectionStatus from, INe
|
||||
// sounds
|
||||
switch (to)
|
||||
{
|
||||
case INetwork::Connected:
|
||||
this->playNotifcationSound(CNotificationSounds::NotificationLogin);
|
||||
break;
|
||||
case INetwork::Disconnected:
|
||||
this->playNotifcationSound(CNotificationSounds::NotificationLogoff);
|
||||
break;
|
||||
case INetwork::DisconnectedError:
|
||||
this->playNotifcationSound(CNotificationSounds::NotificationError);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case INetwork::Connected: this->playNotifcationSound(CNotificationSounds::NotificationLogin); break;
|
||||
case INetwork::Disconnected: this->playNotifcationSound(CNotificationSounds::NotificationLogoff); break;
|
||||
case INetwork::DisconnectedError: this->playNotifcationSound(CNotificationSounds::NotificationError); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user