Formatting, minor tweaks

This commit is contained in:
Klaus Basan
2018-02-07 02:03:27 +01:00
parent b78d057c59
commit 10f942e702
13 changed files with 87 additions and 79 deletions

View File

@@ -705,21 +705,23 @@ namespace BlackCore
// some checks for special conditions, e.g. logout -> empty list, but still signals pending
if (this->isConnected() && remoteAircraft.hasValidCallsign())
{
const QString msg = QString("Ready for matching '%1' with model type '%2'").arg(callsign.toQString(), remoteAircraft.getModel().getModelTypeAsString());
const CStatusMessage m = CMatchingUtils::logMessage(callsign, msg, getLogCategories());
const QString readyMsg = QString("Ready for matching '%1' with model type '%2'").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", getLogCategories());
const CStatusMessage m = CMatchingUtils::logMessage(callsign, "Ignoring this aircraft, not found in range list, disconnected, or no callsign", getLogCategories());
this->addReverseLookupMessage(callsign, m);
}
}
void CAirspaceMonitor::onAtcPositionUpdate(const CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range)
{
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread");
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Need sApp");
if (!this->isConnected()) { return; }
const CAtcStationList stationsWithCallsign = m_atcStationsOnline.findByCallsign(callsign);
if (stationsWithCallsign.isEmpty())
@@ -959,7 +961,7 @@ namespace BlackCore
{
const QString resolvedTelephony = CAircraftMatcher::reverseLookupTelephonyDesignator(telephony);
airlineIcao.setTelephonyDesignator(resolvedTelephony);
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Setting resolved telephoy designator '%1' from '%2'").arg(resolvedTelephony, telephony), getLogCategories());
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Setting resolved telephony designator '%1' from '%2'").arg(resolvedTelephony, telephony), getLogCategories());
}
}

View File

@@ -104,14 +104,19 @@ namespace BlackCore
virtual bool updateAircraftRendered(const BlackMisc::Aviation::CCallsign &callsign, bool rendered) override;
virtual bool updateAircraftGroundElevation(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Geo::CElevationPlane &elevation) override;
virtual void updateMarkAllAsNotRendered() override;
virtual void enableReverseLookupMessages(bool enabled) override;
virtual bool isReverseLookupMessagesEnabled() const override;
virtual BlackMisc::CStatusMessageList getReverseLookupMessages(const BlackMisc::Aviation::CCallsign &callsign) const override;
virtual BlackMisc::CStatusMessageList getAircraftPartsHistory(const BlackMisc::Aviation::CCallsign &callsign) const override;
virtual bool isAircraftPartsHistoryEnabled() const override;
virtual void enableAircraftPartsHistory(bool enabled) override;
//! @}
//! \ingroup remoteaircraftprovider
//! \ingroup reverselookup
//! @{
virtual void enableReverseLookupMessages(bool enabled) override;
virtual bool isReverseLookupMessagesEnabled() const override;
virtual BlackMisc::CStatusMessageList getReverseLookupMessages(const BlackMisc::Aviation::CCallsign &callsign) const override;
//! @}
//! Returns the list of users we know about
BlackMisc::Network::CUserList getUsers() const;
@@ -289,6 +294,9 @@ namespace BlackCore
//! Connected with network?
bool isConnected() const;
//! Get the currently connected server
const BlackMisc::Network::CServer getConnectedServer() const;
//! Supports VATSIM data file
bool supportsVatsimDataFile() const;
@@ -342,23 +350,23 @@ namespace BlackCore
//! Send the information if aircraft and(!) client are available
//! \note it can take some time to obtain all data for model matching, so function recursively calls itself if something is still missing (trial)
//! \sa reverseLookupModelWithFlightplanData
void sendReadyForModelMatching(const BlackMisc::Aviation::CCallsign &callsign, int trial = 1);
//! Reverse lookup messages
//! \threadsafe
//! \ingroup reverselookup
//! @{
void addReverseLookupMessages(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::CStatusMessageList &messages);
//! Reverse lookup messages
//! \threadsafe
void addReverseLookupMessage(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::CStatusMessage &message);
//! Reverse lookup messages
//! \threadsafe
void addReverseLookupMessage(
const BlackMisc::Aviation::CCallsign &callsign, const QString &message,
BlackMisc::CStatusMessage::StatusSeverity severity = BlackMisc::CStatusMessage::SeverityInfo);
//! @}
//! Reverse lookup, if available flight plan data are considered
//! \remark this is where a model is created based on network data
//! \ingroup reverselookup
BlackMisc::Simulation::CAircraftModel reverseLookupModelWithFlightplanData(
const BlackMisc::Aviation::CCallsign &callsign, const QString &aircraftIcao,
const QString &airlineIcao, const QString &livery, const QString &modelString,

View File

@@ -415,6 +415,9 @@ namespace BlackCore
BLACK_VERIFY_X(!callsign.isEmpty(), Q_FUNC_INFO, "Remote aircraft with empty callsign");
if (callsign.isEmpty()) { return; }
// here we find the best simulator model for a resolved model
// in the first step we already tried to find accurate ICAO codes etc.
// coming from CAirspaceMonitor::sendReadyForModelMatching
CStatusMessageList matchingMessages;
CStatusMessageList *pMatchingMessages = m_enableMatchingMessages ? &matchingMessages : nullptr;
const CAircraftModel aircraftModel = m_aircraftMatcher.getClosestMatch(remoteAircraft, pMatchingMessages);
@@ -423,8 +426,8 @@ namespace BlackCore
const CSimulatedAircraft aircraftAfterModelApplied = getAircraftInRangeForCallsign(remoteAircraft.getCallsign());
m_simulatorPlugin.second->logicallyAddRemoteAircraft(aircraftAfterModelApplied);
CMatchingUtils::addLogDetailsToList(pMatchingMessages, callsign, QString("Logically added remote aircraft: %1").arg(aircraftAfterModelApplied.toQString()));
addMatchingMessages(callsign, matchingMessages);
emit modelMatchingCompleted(remoteAircraft);
this->addMatchingMessages(callsign, matchingMessages);
emit this->modelMatchingCompleted(remoteAircraft);
}
void CContextSimulator::xCtxRemovedRemoteAircraft(const CCallsign &callsign)

View File

@@ -15,9 +15,7 @@
#include "blackcore/blackcoreexport.h"
#include "blackcore/db/databasereader.h"
#include "blackcore/data/dbcaches.h"
#include "blackmisc/aviation/aircrafticaocode.h"
#include "blackmisc/aviation/aircrafticaocodelist.h"
#include "blackmisc/aviation/airlineicaocode.h"
#include "blackmisc/aviation/airlineicaocodelist.h"
#include "blackmisc/network/entityflags.h"
#include "blackmisc/network/url.h"

View File

@@ -101,21 +101,21 @@ namespace BlackCore
CAircraftModel CModelDataReader::getModelForModelString(const QString &modelString) const
{
if (modelString.isEmpty()) { return CAircraftModel(); }
const CAircraftModelList models(getModels());
const CAircraftModelList models(this->getModels());
return models.findFirstByModelStringOrDefault(modelString);
}
CAircraftModel CModelDataReader::getModelForDbKey(int dbKey) const
{
if (dbKey < 0) { return CAircraftModel(); }
const CAircraftModelList models(getModels());
const CAircraftModelList models(this->getModels());
return models.findByKey(dbKey);
}
CAircraftModelList CModelDataReader::getModelsForAircraftDesignatorAndLiveryCombinedCode(const QString &aircraftDesignator, const QString &combinedCode)
{
if (aircraftDesignator.isEmpty()) { return CAircraftModelList(); }
const CAircraftModelList models(getModels());
const CAircraftModelList models(this->getModels());
return models.findByAircraftDesignatorAndLiveryCombinedCode(aircraftDesignator, combinedCode);
}