Issue #77 getLogCategories returns a simple QStringList instead of our own class

This commit is contained in:
Mat Sutcliffe
2020-10-28 16:48:31 +00:00
parent 05d28017e7
commit 63e8de8f00
156 changed files with 862 additions and 833 deletions

View File

@@ -28,9 +28,9 @@ namespace BlackCore
{
namespace Audio
{
const CLogCategoryList &CReceiverSampleProvider::getLogCategories()
const QStringList &CReceiverSampleProvider::getLogCategories()
{
static const CLogCategoryList cats { CLogCategory::audio(), CLogCategory::vatsimSpecific() };
static const QStringList cats { CLogCategories::audio(), CLogCategories::vatsimSpecific() };
return cats;
}

View File

@@ -43,7 +43,7 @@ namespace BlackCore
public:
//! Log.categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Ctor
CReceiverSampleProvider(const QAudioFormat &audioFormat, quint16 id, int voiceInputNumber, QObject *parent = nullptr);

View File

@@ -49,9 +49,9 @@ namespace BlackCore
constexpr double CAfvClient::MaxDbOut;
constexpr quint32 CAfvClient::UniCom;
const CLogCategoryList &CAfvClient::getLogCategories()
const QStringList &CAfvClient::getLogCategories()
{
static const CLogCategoryList cats { CLogCategory::audio(), CLogCategory::vatsimSpecific() };
static const QStringList cats { CLogCategories::audio(), CLogCategories::vatsimSpecific() };
return cats;
}

View File

@@ -60,7 +60,7 @@ namespace BlackCore
public:
//! Categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Connection status
enum ConnectionStatus { Disconnected, Connected };

View File

@@ -32,9 +32,9 @@ namespace BlackCore
{
namespace Connection
{
const CLogCategoryList &CApiServerConnection::getLogCategories()
const QStringList &CApiServerConnection::getLogCategories()
{
static const CLogCategoryList cats { CLogCategory::audio(), CLogCategory::vatsimSpecific() };
static const QStringList cats { CLogCategories::audio(), CLogCategories::vatsimSpecific() };
return cats;
}

View File

@@ -50,7 +50,7 @@ namespace BlackCore
};
//! Categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Constructor
CApiServerConnection(const QString &address, QObject *parent = nullptr);

View File

@@ -19,9 +19,9 @@ namespace BlackCore
{
namespace Connection
{
const CLogCategoryList &CClientConnectionData::getLogCategories()
const QStringList &CClientConnectionData::getLogCategories()
{
static const CLogCategoryList cats { CLogCategory::audio(), CLogCategory::vatsimSpecific() };
static const QStringList cats { CLogCategories::audio(), CLogCategories::vatsimSpecific() };
return cats;
}

View File

@@ -32,7 +32,7 @@ namespace BlackCore
{
public:
//! Categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Ctor
CClientConnectionData() = default;

View File

@@ -40,9 +40,9 @@ using namespace BlackMisc::Simulation;
namespace BlackCore
{
const CLogCategoryList &CAircraftMatcher::getLogCategories()
const QStringList &CAircraftMatcher::getLogCategories()
{
static const CLogCategoryList cats { CLogCategory::matching() };
static const QStringList cats { CLogCategories::matching() };
return cats;
}
@@ -594,7 +594,7 @@ namespace BlackCore
if (ms.isError())
{
const QString msg = QStringLiteral("Matching script error: %1 '%2'").arg(ms.property("lineNumber").toInt()).arg(ms.toString());
CLogMessage(getLogCategories()).warning(msg);
CLogMessage(static_cast<CAircraftMatcher *>(nullptr)).warning(msg);
if (log) { CLogUtilities::addLogDetailsToList(log, callsign, msg); }
}
else

View File

@@ -52,7 +52,7 @@ namespace BlackCore
public:
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Constructor
CAircraftMatcher(const BlackMisc::Simulation::CAircraftMatcherSetup &setup, QObject *parent = nullptr);

View File

@@ -152,9 +152,9 @@ namespace BlackCore
return r;
}
const CLogCategoryList &CAirspaceMonitor::getLogCategories()
const QStringList &CAirspaceMonitor::getLogCategories()
{
static const CLogCategoryList cats { CLogCategory::matching(), CLogCategory::network() };
static const QStringList cats { CLogCategories::matching(), CLogCategories::network() };
return cats;
}

View File

@@ -72,7 +72,7 @@ namespace BlackCore
public:
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Constructor
CAirspaceMonitor(BlackMisc::Simulation::IOwnAircraftProvider *ownAircraft,

View File

@@ -1337,9 +1337,9 @@ namespace BlackCore
return e;
}
const BlackMisc::CLogCategoryList &CApplication::getLogCategories()
const QStringList &CApplication::getLogCategories()
{
static const CLogCategoryList l({ CLogCategory("swift.application"), CLogCategory("swift." + executable())});
static const QStringList l({ "swift.application", "swift." % executable()});
return l;
}

View File

@@ -103,7 +103,7 @@ namespace BlackCore
static CApplication *instance();
//! Own log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Constructor
CApplication(BlackMisc::CApplicationInfo::Application application, bool init = true);

View File

@@ -16,9 +16,9 @@ namespace BlackCore
{
namespace Context
{
const CLogCategoryList &IContext::getLogCategories()
const QStringList &IContext::getLogCategories()
{
static const CLogCategoryList cats { BlackMisc::CLogCategory::context() };
static const QStringList cats { BlackMisc::CLogCategories::context() };
return cats;
}

View File

@@ -45,7 +45,7 @@ namespace BlackCore
virtual ~IContext() override {}
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Using local implementing object?
bool isUsingImplementingObject() const
@@ -159,7 +159,7 @@ namespace BlackCore
//! Empty context called
void logEmptyContextWarning(const QString &functionName) const
{
BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).warning(u"Empty context called, details: %1") << functionName;
BlackMisc::CLogMessage(this, BlackMisc::CLogCategories::contextSlot()).warning(u"Empty context called, details: %1") << functionName;
}
//! Called when shutdown is about to be called

View File

@@ -46,19 +46,19 @@ namespace BlackCore
BlackMisc::CValueCachePacket CContextApplication::getAllSettings() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return CSettingsCache::instance()->getAllValuesWithTimestamps();
}
QStringList CContextApplication::getUnsavedSettingsKeys() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return CSettingsCache::instance()->getAllUnsavedKeys();
}
CSettingsDictionary CContextApplication::getUnsavedSettingsKeysDescribed() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
const QStringList keys = CSettingsCache::instance()->getAllUnsavedKeys();
CSettingsDictionary result;
for (const QString &key : keys) { result.insert(key, CSettingsCache::instance()->getHumanReadableName(key)); }
@@ -72,19 +72,19 @@ namespace BlackCore
BlackMisc::CStatusMessage CContextApplication::saveSettings(const QString &keyPrefix)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << keyPrefix; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << keyPrefix; }
return CSettingsCache::instance()->saveToStore(keyPrefix);
}
BlackMisc::CStatusMessage CContextApplication::saveSettingsByKey(const QStringList &keys)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << keys.join(", "); }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << keys.join(", "); }
return CSettingsCache::instance()->saveToStore(keys);
}
BlackMisc::CStatusMessage CContextApplication::loadSettings()
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return CSettingsCache::instance()->loadFromStore();
}
@@ -114,7 +114,7 @@ namespace BlackCore
bool CContextApplication::writeToFile(const QString &fileName, const QString &content)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << fileName << content.left(25); }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << fileName << content.left(25); }
if (fileName.isEmpty()) { return false; }
QFile file(fileName);
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
@@ -128,7 +128,7 @@ namespace BlackCore
CIdentifier CContextApplication::registerApplication(const CIdentifier &application)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << application; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << application; }
if (!m_registeredApplications.contains(application))
{
@@ -143,7 +143,7 @@ namespace BlackCore
void CContextApplication::unregisterApplication(const CIdentifier &application)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << application; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << application; }
int r = m_registeredApplications.remove(application);
this->cleanupRegisteredApplications();
if (r > 0) { emit registrationChanged(); }
@@ -157,7 +157,7 @@ namespace BlackCore
CIdentifierList CContextApplication::getRegisteredApplications() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
//static const int outdatedMs = qRound(1.5 * PingIdentifiersMs);
//return m_registeredApplications.findAfterNowMinusOffset(outdatedMs);
return m_registeredApplications;
@@ -165,13 +165,13 @@ namespace BlackCore
CIdentifier CContextApplication::getApplicationIdentifier() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return this->identifier();
}
QString CContextApplication::readFromFile(const QString &fileName) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << fileName; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << fileName; }
QFile file(fileName);
QString content;
if (fileName.isEmpty()) return content;
@@ -186,14 +186,14 @@ namespace BlackCore
bool CContextApplication::removeFile(const QString &fileName)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << fileName; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << fileName; }
if (fileName.isEmpty()) { return false; }
return QFile::remove(fileName);
}
bool CContextApplication::existsFile(const QString &fileName) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << fileName; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << fileName; }
if (fileName.isEmpty()) return false;
return QFile::exists(fileName);
}

View File

@@ -205,7 +205,7 @@ namespace BlackCore
{
if (!sApp || origin.isFromLocalMachine()) { return; }
sApp->getInputManager()->callFunctionsBy(action, argument);
CLogMessage(this, CLogCategory::contextSlot()).debug() << "Calling function" << action << "from origin" << origin.getMachineName();
CLogMessage(this, CLogCategories::contextSlot()).debug() << "Calling function" << action << "from origin" << origin.getMachineName();
}
} // namespace
} // namespace

View File

@@ -498,7 +498,7 @@ namespace BlackCore
void CContextAudioBase::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << notification; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << notification; }
const CSettings settings = m_audioSettings.getThreadLocal();
const bool play = !considerSettings || settings.isNotificationFlagSet(notification);

View File

@@ -240,15 +240,15 @@ namespace BlackCore
CStatusMessage CContextNetwork::connectToNetwork(const CServer &server, const QString &extraLiveryString, bool sendLivery, const QString &extraModelString, bool sendModelString, const CCallsign &partnerCallsign, CLoginMode mode)
{
if (!this->canUseFsd()) { return { CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, u"Invalid FSD state (shutdown)") }; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (!this->canUseFsd()) { return { CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityInfo, u"Invalid FSD state (shutdown)") }; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
QString msg;
if (!server.getUser().hasCredentials()) { return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, u"Invalid user credentials"); }
if (!this->ownAircraft().getAircraftIcaoCode().hasDesignator()) { return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, u"Invalid ICAO data for own aircraft"); }
if (!server.getUser().hasCredentials()) { return CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityError, u"Invalid user credentials"); }
if (!this->ownAircraft().getAircraftIcaoCode().hasDesignator()) { return CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityError, u"Invalid ICAO data for own aircraft"); }
if (!CNetworkUtils::canConnect(server, msg, 5000)) { return CStatusMessage(CStatusMessage::SeverityError, msg); }
if (m_fsdClient->isConnected()) { return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, u"Already connected"); }
if (this->isPendingConnection()) { return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, u"Pending connection, please wait"); }
if (m_fsdClient->isConnected()) { return CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityError, u"Already connected"); }
if (this->isPendingConnection()) { return CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityError, u"Pending connection, please wait"); }
this->getIContextOwnAircraft()->updateOwnAircraftPilot(server.getUser());
const CSimulatedAircraft ownAircraft(this->ownAircraft());
@@ -300,7 +300,7 @@ namespace BlackCore
m_fsdClient->setAtcRating(AtcRating::Observer);
m_fsdClient->connectToServer();
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, u"Connection pending " % server.getAddress() % u' ' % QString::number(server.getPort()));
return CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityInfo, u"Connection pending " % server.getAddress() % u' ' % QString::number(server.getPort()));
}
CServer CContextNetwork::getConnectedServer() const
@@ -312,29 +312,29 @@ namespace BlackCore
CLoginMode CContextNetwork::getLoginMode() const
{
if (!this->canUseFsd()) { return {}; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_fsdClient->getLoginMode();
}
CStatusMessage CContextNetwork::disconnectFromNetwork()
{
if (!this->canUseFsd()) { return { CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, u"Invalid FSD state (shutdown)") }; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (!this->canUseFsd()) { return { CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityInfo, u"Invalid FSD state (shutdown)") }; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_fsdClient->isConnected() || m_fsdClient->isPendingConnection())
{
m_fsdClient->disconnectFromServer();
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, u"Connection terminating");
return CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityInfo, u"Connection terminating");
}
else
{
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityWarning, u"Already disconnected");
return CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityWarning, u"Already disconnected");
}
}
bool CContextNetwork::isConnected() const
{
if (!this->canUseFsd()) { return false; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_fsdClient->isConnected();
}
@@ -558,13 +558,13 @@ namespace BlackCore
void CContextNetwork::sendTextMessages(const CTextMessageList &textMessages)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << textMessages; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << textMessages; }
m_fsdClient->sendTextMessages(textMessages);
}
void CContextNetwork::sendFlightPlan(const CFlightPlan &flightPlan)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << flightPlan; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << flightPlan; }
m_fsdClient->sendFlightPlan(flightPlan);
m_fsdClient->sendClientQueryFlightPlan(this->ownAircraft().getCallsign());
}
@@ -572,27 +572,27 @@ namespace BlackCore
CFlightPlan CContextNetwork::loadFlightPlanFromNetwork(const CCallsign &callsign) const
{
if (!this->canUseFsd()) { return {}; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->loadFlightPlanFromNetwork(callsign);
}
CUserList CContextNetwork::getUsers() const
{
if (!this->canUseAirspaceMonitor()) { return {}; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->getUsers();
}
CUserList CContextNetwork::getUsersForCallsigns(const CCallsignSet &callsigns) const
{
if (!this->canUseAirspaceMonitor() || callsigns.isEmpty()) { return {}; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->getUsersForCallsigns(callsigns);
}
CUser CContextNetwork::getUserForCallsign(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
CCallsignSet callsigns;
callsigns.push_back(callsign);
const CUserList users = this->getUsersForCallsigns(callsigns);
@@ -603,21 +603,21 @@ namespace BlackCore
CClientList CContextNetwork::getClients() const
{
if (!this->canUseAirspaceMonitor()) { return {}; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->getClients();
}
CClientList CContextNetwork::getClientsForCallsigns(const CCallsignSet &callsigns) const
{
if (!this->canUseAirspaceMonitor()) { return {}; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->getClientsForCallsigns(callsigns);
}
bool CContextNetwork::setOtherClient(const CClient &client)
{
if (!this->canUseAirspaceMonitor()) { return false; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->setOtherClient(client);
}
@@ -653,20 +653,20 @@ namespace BlackCore
CServerList CContextNetwork::getVatsimFsdServers() const
{
Q_ASSERT_X(sApp->getWebDataServices(), Q_FUNC_INFO, "Missing data reader");
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return sApp->getWebDataServices()->getVatsimFsdServers();
}
CServerList CContextNetwork::getVatsimVoiceServers() const
{
Q_ASSERT_X(sApp->getWebDataServices(), Q_FUNC_INFO, "Missing data reader");
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return sApp->getWebDataServices()->getVatsimVoiceServers();
}
void CContextNetwork::onFsdConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to)
{
// if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << from << to; }
// if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << from << to; }
if (to.isDisconnected())
{
@@ -759,7 +759,7 @@ namespace BlackCore
void CContextNetwork::updateMetars(const CMetarList &metars)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
CLogMessage(this).info(u"%1 METARs updated") << metars.size();
}
@@ -880,7 +880,7 @@ namespace BlackCore
CAtcStationList CContextNetwork::getAtcStationsOnline(bool recalculateDistance) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
CAtcStationList stations = m_airspace->getAtcStationsOnline();
if (!recalculateDistance || !this->getIContextOwnAircraft()) { return stations; }
stations.calculcateAndUpdateRelativeDistanceAndBearing(this->getIContextOwnAircraft()->getOwnAircraftSituation());
@@ -897,7 +897,7 @@ namespace BlackCore
CAtcStationList CContextNetwork::getAtcStationsBooked(bool recalculateDistance) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
CAtcStationList stations = m_airspace->getAtcStationsBooked();
if (!recalculateDistance || !this->getIContextOwnAircraft()) { return stations; }
stations.calculcateAndUpdateRelativeDistanceAndBearing(this->getIContextOwnAircraft()->getOwnAircraftSituation());
@@ -906,61 +906,61 @@ namespace BlackCore
CSimulatedAircraftList CContextNetwork::getAircraftInRange() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->getAircraftInRange();
}
CCallsignSet CContextNetwork::getAircraftInRangeCallsigns() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->getAircraftInRangeCallsigns();
}
int CContextNetwork::getAircraftInRangeCount() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->getAircraftInRangeCount();
}
bool CContextNetwork::isAircraftInRange(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->isAircraftInRange(callsign);
}
bool CContextNetwork::isVtolAircraft(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->isVtolAircraft(callsign);
}
CSimulatedAircraft CContextNetwork::getAircraftInRangeForCallsign(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return m_airspace->getAircraftInRangeForCallsign(callsign);
}
CAircraftModel CContextNetwork::getAircraftInRangeModelForCallsign(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return m_airspace->getAircraftInRangeModelForCallsign(callsign);
}
CStatusMessageList CContextNetwork::getReverseLookupMessages(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return m_airspace->getReverseLookupMessages(callsign);
}
ReverseLookupLogging CContextNetwork::isReverseLookupMessagesEnabled() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->isReverseLookupMessagesEnabled();
}
void CContextNetwork::enableReverseLookupMessages(ReverseLookupLogging enable)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << enable; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << enable; }
const ReverseLookupLogging revEnabled = m_airspace->isReverseLookupMessagesEnabled();
if (revEnabled == enable) { return; }
m_airspace->enableReverseLookupMessages(enable);
@@ -969,76 +969,76 @@ namespace BlackCore
CStatusMessageList CContextNetwork::getAircraftPartsHistory(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return m_airspace->getAircraftPartsHistory(callsign);
}
CAircraftPartsList CContextNetwork::getRemoteAircraftParts(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return m_airspace->remoteAircraftParts(callsign);
}
int CContextNetwork::getRemoteAircraftSupportingPartsCount() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->getRemoteAircraftSupportingPartsCount();
}
bool CContextNetwork::isAircraftPartsHistoryEnabled() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->isAircraftPartsHistoryEnabled();
}
void CContextNetwork::enableAircraftPartsHistory(bool enabled)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << enabled; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << enabled; }
m_airspace->enableAircraftPartsHistory(enabled);
emit IContext::changedLogOrDebugSettings();
}
int CContextNetwork::aircraftSituationsAdded() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->aircraftSituationsAdded();
}
int CContextNetwork::aircraftPartsAdded() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->aircraftPartsAdded();
}
qint64 CContextNetwork::situationsLastModified(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->situationsLastModified(callsign);
}
qint64 CContextNetwork::partsLastModified(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->partsLastModified(callsign);
}
QString CContextNetwork::getNetworkStatistics(bool reset, const QString &separator)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_fsdClient) { return QString(); }
return m_fsdClient->getNetworkStatisticsAsText(reset, separator);
}
bool CContextNetwork::setNetworkStatisticsEnable(bool enabled)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_fsdClient) { return false; }
return m_fsdClient->setStatisticsEnable(enabled);
}
bool CContextNetwork::testAddAltitudeOffset(const CCallsign &callsign, const CLength &offset)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->testAddAltitudeOffset(callsign, offset);
}
@@ -1050,26 +1050,26 @@ namespace BlackCore
CAtcStation CContextNetwork::getOnlineStationForCallsign(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return m_airspace->getAtcStationsOnline().findFirstByCallsign(callsign);
}
CAtcStationList CContextNetwork::getOnlineStationsForFrequency(const CFrequency &frequency, CComSystem::ChannelSpacing channelSpacing) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->getAtcStationsOnline().findIfFrequencyIsWithinSpacing(frequency, channelSpacing);
}
bool CContextNetwork::isOnlineStation(const CCallsign &callsign) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return m_airspace->getAtcStationsOnline().containsCallsign(callsign);
}
void CContextNetwork::requestAircraftDataUpdates()
{
if (!canUseAirspaceMonitor()) { return; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!this->isConnected()) { return; }
m_airspace->requestAircraftDataUpdates();
@@ -1079,7 +1079,7 @@ namespace BlackCore
void CContextNetwork::requestAtisUpdates()
{
if (!canUseAirspaceMonitor()) { return; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!this->isConnected()) { return; }
m_airspace->requestAtisUpdates();
@@ -1089,7 +1089,7 @@ namespace BlackCore
bool CContextNetwork::updateAircraftEnabled(const CCallsign &callsign, bool enabledForRendering)
{
if (!canUseAirspaceMonitor()) { return false; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << enabledForRendering; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign << enabledForRendering; }
const bool c = m_airspace->updateAircraftEnabled(callsign, enabledForRendering);
if (c)
{
@@ -1103,14 +1103,14 @@ namespace BlackCore
bool CContextNetwork::setAircraftEnabledFlag(const CCallsign &callsign, bool enabledForRendering)
{
if (!canUseAirspaceMonitor()) { return false; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return m_airspace->setAircraftEnabledFlag(callsign, enabledForRendering);
}
bool CContextNetwork::updateAircraftModel(const CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
{
if (!canUseAirspaceMonitor()) { return false; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << model; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign << model; }
const bool c = m_airspace->updateAircraftModel(callsign, model, originator);
if (c)
{
@@ -1124,7 +1124,7 @@ namespace BlackCore
bool CContextNetwork::updateAircraftNetworkModel(const CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
{
if (!canUseAirspaceMonitor()) { return false; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << model; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign << model; }
const bool c = m_airspace->updateAircraftNetworkModel(callsign, model, originator);
if (c)
{
@@ -1137,7 +1137,7 @@ namespace BlackCore
bool CContextNetwork::updateFastPositionEnabled(const CCallsign &callsign, bool enableFastPositonUpdates)
{
if (!canUseAirspaceMonitor()) { return false; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << enableFastPositonUpdates; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign << enableFastPositonUpdates; }
const bool c = m_airspace->updateFastPositionEnabled(callsign, enableFastPositonUpdates);
if (c)
{
@@ -1150,7 +1150,7 @@ namespace BlackCore
bool CContextNetwork::updateAircraftSupportingGndFLag(const CCallsign &callsign, bool supportGndFlag)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << supportGndFlag; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign << supportGndFlag; }
const bool c = m_airspace->setClientGndCapability(callsign, supportGndFlag);
if (c)
{
@@ -1164,7 +1164,7 @@ namespace BlackCore
bool CContextNetwork::updateCG(const Aviation::CCallsign &callsign, const CLength &cg)
{
if (!canUseAirspaceMonitor()) { return false; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << cg.valueRoundedWithUnit(1); }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign << cg.valueRoundedWithUnit(1); }
const bool c = m_airspace->updateCG(callsign, cg);
return c;
}
@@ -1172,7 +1172,7 @@ namespace BlackCore
CCallsignSet CContextNetwork::updateCGForModel(const QString &modelString, const CLength &cg)
{
if (!canUseAirspaceMonitor()) { return {}; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString << cg.valueRoundedWithUnit(1); }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << modelString << cg.valueRoundedWithUnit(1); }
const CCallsignSet set = m_airspace->updateCGForModel(modelString, cg);
return set;
}
@@ -1180,7 +1180,7 @@ namespace BlackCore
bool CContextNetwork::updateCGAndModelString(const CCallsign &callsign, const CLength &cg, const QString &modelString)
{
if (!canUseAirspaceMonitor()) { return false; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << cg.valueRoundedWithUnit(1) << modelString; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign << cg.valueRoundedWithUnit(1) << modelString; }
const bool c = m_airspace->updateCGAndModelString(callsign, cg, modelString);
return c;
}
@@ -1188,7 +1188,7 @@ namespace BlackCore
void CContextNetwork::requestAtcBookingsUpdate() const
{
if (!canUseAirspaceMonitor()) { return; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
m_airspace->requestAtcBookingsUpdate();
}
@@ -1252,7 +1252,7 @@ namespace BlackCore
int CContextNetwork::reInitializeAllAircraft()
{
if (!canUseAirspaceMonitor()) { return 0; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_airspace->reInitializeAllAircraft();
}
@@ -1304,14 +1304,14 @@ namespace BlackCore
void CContextNetwork::setFastPositionEnabledCallsigns(CCallsignSet &callsigns)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsigns; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsigns; }
Q_ASSERT(m_fsdClient);
m_fsdClient->setInterimPositionReceivers(callsigns);
}
CCallsignSet CContextNetwork::getFastPositionEnabledCallsigns() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
Q_ASSERT(m_fsdClient);
return m_fsdClient->getInterimPositionReceivers();
}
@@ -1319,55 +1319,55 @@ namespace BlackCore
QString CContextNetwork::getLibraryInfo(bool detailed) const
{
if (!this->canUseFsd()) { return QString(); }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << detailed; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << detailed; }
return "";
}
void CContextNetwork::testRequestAircraftConfig(const CCallsign &callsign)
{
if (!this->canUseFsd()) { return; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
m_fsdClient->sendClientQueryAircraftConfig(callsign);
}
void CContextNetwork::testCreateDummyOnlineAtcStations(int number)
{
if (!this->canUseAirspaceMonitor()) { return; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << number; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << number; }
m_airspace->testCreateDummyOnlineAtcStations(number);
}
void CContextNetwork::testAddAircraftParts(const CCallsign &callsign, const CAircraftParts &parts, bool incremental)
{
if (!this->canUseAirspaceMonitor()) { return; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << parts << incremental; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << parts << incremental; }
m_airspace->testAddAircraftParts(callsign, parts, incremental);
}
void CContextNetwork::testReceivedAtisMessage(const CCallsign &callsign, const CInformationMessage &msg)
{
if (!this->canUseFsd()) { return; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign.asString(); }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign.asString(); }
emit this->fsdClient()->atisReplyReceived(callsign, msg);
}
void CContextNetwork::testReceivedTextMessages(const CTextMessageList &textMessages)
{
if (!this->canUseFsd()) { return; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << textMessages.toQString(); }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << textMessages.toQString(); }
emit this->fsdClient()->textMessagesReceived(textMessages);
}
CMetar CContextNetwork::getMetarForAirport(const CAirportIcaoCode &airportIcaoCode) const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << airportIcaoCode; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << airportIcaoCode; }
if (!sApp || !sApp->getWebDataServices()) { return {}; }
return sApp->getWebDataServices()->getMetarForAirport(airportIcaoCode);
}
CAtcStationList CContextNetwork::getSelectedAtcStations() const
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
CAtcStation com1Station = m_airspace->getAtcStationForComUnit(this->ownAircraft().getCom1System());
CAtcStation com2Station = m_airspace->getAtcStationForComUnit(this->ownAircraft().getCom2System());

View File

@@ -89,21 +89,21 @@ namespace BlackCore
CSimulatedAircraft CContextOwnAircraft::getOwnAircraft() const
{
if (m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) {CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
QReadLocker l(&m_lockAircraft);
return m_ownAircraft;
}
CComSystem CContextOwnAircraft::getOwnComSystem(CComSystem::ComUnit unit) const
{
if (m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) {CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
QReadLocker l(&m_lockAircraft);
return m_ownAircraft.getComSystem(unit);
}
CTransponder CContextOwnAircraft::getOwnTransponder() const
{
if (m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) {CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
QReadLocker l(&m_lockAircraft);
return m_ownAircraft.getTransponder();
}
@@ -334,7 +334,7 @@ namespace BlackCore
bool CContextOwnAircraft::updateOwnPosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude, const CAltitude &pressureAltitude)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << position << altitude; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << position << altitude; }
QWriteLocker l(&m_lockAircraft);
bool changed = (m_ownAircraft.getPosition() != position);
if (changed) { m_ownAircraft.setPosition(position); }
@@ -355,7 +355,7 @@ namespace BlackCore
bool CContextOwnAircraft::updateCockpit(const CComSystem &com1, const CComSystem &com2, const CTransponder &transponder, const CIdentifier &originator)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder; }
bool changed;
{
QWriteLocker l(&m_lockAircraft);
@@ -372,7 +372,7 @@ namespace BlackCore
bool CContextOwnAircraft::updateTransponderMode(const CTransponder::TransponderMode &transponderMode, const CIdentifier &originator)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << transponderMode; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << transponderMode; }
bool changed;
{
QWriteLocker l(&m_lockAircraft);
@@ -476,7 +476,7 @@ namespace BlackCore
void CContextOwnAircraft::setAudioOutputVolume(int outputVolume)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << outputVolume; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << outputVolume; }
CContextAudioBase *audio = qobject_cast<CContextAudioBase *>(this->getIContextAudio());
if (audio) { audio->setVoiceOutputVolume(outputVolume); }
}

View File

@@ -198,14 +198,14 @@ namespace BlackCore
int CContextSimulator::checkListeners()
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_plugins) { return 0; }
return m_plugins->checkAvailableListeners();
}
int CContextSimulator::getSimulatorStatus() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return 0; }
return m_simulatorPlugin.second->getSimulatorStatus();
}
@@ -213,7 +213,7 @@ namespace BlackCore
CSimulatorPluginInfo CContextSimulator::getSimulatorPluginInfo() const
{
static const CSimulatorPluginInfo unspecified;
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return unspecified; }
if (m_simulatorPlugin.first.getSimulator().contains("emulated", Qt::CaseInsensitive)) { return m_simulatorPlugin.second->getSimulatorPluginInfo(); }
return m_simulatorPlugin.first;
@@ -221,14 +221,14 @@ namespace BlackCore
CSimulatorInternals CContextSimulator::getSimulatorInternals() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CSimulatorInternals(); }
return m_simulatorPlugin.second->getSimulatorInternals();
}
CAirportList CContextSimulator::getAirportsInRange(bool recalculateDistance) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
// If no ISimulator object is available, return a dummy.
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CAirportList(); }
return m_simulatorPlugin.second->getAirportsInRange(recalculateDistance);
@@ -236,7 +236,7 @@ namespace BlackCore
CAircraftModelList CContextSimulator::getModelSet() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
const CSimulatorInfo simulator = this->getModelSetLoaderSimulator();
if (!simulator.isSingleSimulator()) { return CAircraftModelList(); }
@@ -246,7 +246,7 @@ namespace BlackCore
CSimulatorInfo CContextSimulator::getModelSetLoaderSimulator() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_simulatorPlugin.second)
{
if (m_simulatorPlugin.second->isConnected())
@@ -265,7 +265,7 @@ namespace BlackCore
void CContextSimulator::setModelSetLoaderSimulator(const CSimulatorInfo &simulator)
{
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (this->isSimulatorAvailable()) { return; } // if a plugin is loaded, do ignore this
m_modelSetSimulator.set(simulator);
const CAircraftModelList models = this->getModelSet(); // cache synced
@@ -274,13 +274,13 @@ namespace BlackCore
CSimulatorInfo CContextSimulator::simulatorsWithInitializedModelSet() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().simulatorsWithInitializedCache();
}
CStatusMessageList CContextSimulator::verifyPrerequisites() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
CStatusMessageList msgs;
if (!sApp || !sApp->isNetworkAccessible())
{
@@ -296,20 +296,20 @@ namespace BlackCore
QStringList CContextSimulator::getModelSetStrings() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return this->getModelSet().getModelStringList(false);
}
bool CContextSimulator::isKnownModelInSet(const QString &modelString) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
const bool known = this->getModelSet().containsModelString(modelString);
return known;
}
int CContextSimulator::removeModelsFromSet(const CAircraftModelList &removeModels)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (removeModels.isEmpty()) { return 0; }
const CSimulatorInfo simulator = m_modelSetSimulator.get();
if (!simulator.isSingleSimulator()) { return 0; }
@@ -326,48 +326,48 @@ namespace BlackCore
QStringList CContextSimulator::getModelSetCompleterStrings(bool sorted) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << sorted; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << sorted; }
return this->getModelSet().toCompleterStrings(sorted);
}
int CContextSimulator::getModelSetCount() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return 0; }
return this->getModelSet().size();
}
void CContextSimulator::disableModelsForMatching(const CAircraftModelList &removedModels, bool incremental)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return; }
m_aircraftMatcher.disableModelsForMatching(removedModels, incremental);
}
CAircraftModelList CContextSimulator::getDisabledModelsForMatching() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CAircraftModelList(); }
return m_aircraftMatcher.getDisabledModelsForMatching();
}
void CContextSimulator::restoreDisabledModels()
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return; }
m_aircraftMatcher.restoreDisabledModels();
}
bool CContextSimulator::isValidationInProgress() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_validator) { return false; }
return m_validator->isValidating();
}
bool CContextSimulator::triggerModelSetValidation(const CSimulatorInfo &simulator)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_validator) { return false; }
const QString simDir = simulator.isSingleSimulator() ? m_multiSimulatorSettings.getSimulatorDirectoryOrDefault(simulator) : "";
return m_validator->triggerValidation(simulator, simDir);
@@ -375,7 +375,7 @@ namespace BlackCore
CAircraftModelList CContextSimulator::getModelSetModelsStartingWith(const QString &modelString) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << modelString; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CAircraftModelList(); }
return this->getModelSet().findModelsStartingWith(modelString);
@@ -383,7 +383,7 @@ namespace BlackCore
bool CContextSimulator::setTimeSynchronization(bool enable, const CTime &offset)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return false; }
const bool c = m_simulatorPlugin.second->setTimeSynchronization(enable, offset);
@@ -395,42 +395,42 @@ namespace BlackCore
bool CContextSimulator::isTimeSynchronized() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return false; }
return m_simulatorPlugin.second->isTimeSynchronized();
}
CInterpolationAndRenderingSetupGlobal CContextSimulator::getInterpolationAndRenderingSetupGlobal() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return m_renderSettings.get(); }
return m_simulatorPlugin.second->getInterpolationSetupGlobal();
}
CInterpolationSetupList CContextSimulator::getInterpolationAndRenderingSetupsPerCallsign() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CInterpolationSetupList(); }
return m_simulatorPlugin.second->getInterpolationSetupsPerCallsign();
}
CInterpolationAndRenderingSetupPerCallsign CContextSimulator::getInterpolationAndRenderingSetupPerCallsignOrDefault(const CCallsign &callsign) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CInterpolationAndRenderingSetupPerCallsign(); }
return m_simulatorPlugin.second->getInterpolationSetupPerCallsignOrDefault(callsign);
}
bool CContextSimulator::setInterpolationAndRenderingSetupsPerCallsign(const CInterpolationSetupList &setups, bool ignoreSameAsGlobal)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return false; }
return m_simulatorPlugin.second->setInterpolationSetupsPerCallsign(setups, ignoreSameAsGlobal);
}
void CContextSimulator::setInterpolationAndRenderingSetupGlobal(const CInterpolationAndRenderingSetupGlobal &setup)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << setup; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << setup; }
// anyway save for future reference
const CStatusMessage m = m_renderSettings.setAndSave(setup);
@@ -443,7 +443,7 @@ namespace BlackCore
CStatusMessageList CContextSimulator::getInterpolationMessages(const CCallsign &callsign) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (callsign.isEmpty()) { return CStatusMessageList(); }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CStatusMessageList(); }
return m_simulatorPlugin.second->getInterpolationMessages(callsign);
@@ -451,7 +451,7 @@ namespace BlackCore
CTime CContextSimulator::getTimeSynchronizationOffset() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CTime(0, CTimeUnit::hrmin()); }
return m_simulatorPlugin.second->getTimeSynchronizationOffset();
}
@@ -975,19 +975,19 @@ namespace BlackCore
CStatusMessageList CContextSimulator::getMatchingMessages(const CCallsign &callsign) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
return m_matchingMessages[callsign];
}
MatchingLog CContextSimulator::isMatchingMessagesEnabled() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_logMatchingMessages;
}
void CContextSimulator::enableMatchingMessages(MatchingLog enabled)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << matchingLogToString(enabled); }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << matchingLogToString(enabled); }
if (m_logMatchingMessages == enabled) { return; }
m_logMatchingMessages = enabled;
emit IContext::changedLogOrDebugSettings();
@@ -995,7 +995,7 @@ namespace BlackCore
CMatchingStatistics CContextSimulator::getCurrentMatchingStatistics(bool missingOnly) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << missingOnly; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << missingOnly; }
const CMatchingStatistics statistics = m_aircraftMatcher.getCurrentStatistics();
return missingOnly ?
statistics.findMissingOnly() :
@@ -1004,7 +1004,7 @@ namespace BlackCore
void CContextSimulator::setMatchingSetup(const CAircraftMatcherSetup &setup)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << setup.toQString(); }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << setup.toQString(); }
m_aircraftMatcher.setSetup(setup);
const CStatusMessage msg = m_matchingSettings.setAndSave(setup);
CLogMessage::preformatted(msg);
@@ -1012,13 +1012,13 @@ namespace BlackCore
CAircraftMatcherSetup CContextSimulator::getMatchingSetup() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
return m_aircraftMatcher.getSetup();
}
CStatusMessageList CContextSimulator::copyFsxTerrainProbe(const CSimulatorInfo &simulator)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << simulator.toQString(); }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << simulator.toQString(); }
CStatusMessageList msgs;
if (!simulator.isFsxP3DFamily())
@@ -1098,7 +1098,7 @@ namespace BlackCore
else if (p1 == "parts") { rs.setEnabledAircraftParts(on); }
else { return false; }
this->setInterpolationAndRenderingSetupGlobal(rs);
CLogMessage(this, CLogCategory::cmdLine()).info(u"Setup is: '%1'") << rs.toQString(true);
CLogMessage(this, CLogCategories::cmdLine()).info(u"Setup is: '%1'") << rs.toQString(true);
return true;
}
if (parser.matchesCommand("plugin") || parser.matchesCommand("drv") || parser.matchesCommand("driver"))
@@ -1117,21 +1117,21 @@ namespace BlackCore
void CContextSimulator::highlightAircraft(const CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const CTime &displayTime)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << aircraftToHighlight << enableHighlight << displayTime; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << aircraftToHighlight << enableHighlight << displayTime; }
if (!m_simulatorPlugin.second) { return; }
m_simulatorPlugin.second->highlightAircraft(aircraftToHighlight, enableHighlight, displayTime);
}
bool CContextSimulator::followAircraft(const CCallsign &callsign)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
if (!m_simulatorPlugin.second) { return false; }
return m_simulatorPlugin.second->followAircraft(callsign);
}
void CContextSimulator::recalculateAllAircraft()
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second) { return; }
m_simulatorPlugin.second->recalculateAllAircraft();
}
@@ -1155,41 +1155,41 @@ namespace BlackCore
bool CContextSimulator::isWeatherActivated() const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return m_isWeatherActivated; }
return m_simulatorPlugin.second->isWeatherActivated();
}
void CContextSimulator::setWeatherActivated(bool activated)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return; }
m_simulatorPlugin.second->setWeatherActivated(activated);
}
void CContextSimulator::requestWeatherGrid(const CCoordinateGeodetic &position, const CIdentifier &identifier)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << identifier; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << identifier; }
m_weatherManager.requestWeatherGrid(position, identifier);
}
bool CContextSimulator::requestElevationBySituation(const CAircraftSituation &situation)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << situation; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << situation; }
if (!m_simulatorPlugin.second || !m_simulatorPlugin.second->isConnected()) { return false; }
return m_simulatorPlugin.second->requestElevationBySituation(situation);
}
CElevationPlane CContextSimulator::findClosestElevationWithinRange(const CCoordinateGeodetic &reference, const CLength &range) const
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << reference.convertToQString(true) << range; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << reference.convertToQString(true) << range; }
if (!m_simulatorPlugin.second || !m_simulatorPlugin.second->isConnected()) { return CElevationPlane::null(); }
return m_simulatorPlugin.second->findClosestElevationWithinRange(reference, range);
}
int CContextSimulator::doMatchingsAgain()
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
const CCallsignSet callsigns = this->getAircraftInRangeCallsigns();
if (callsigns.isEmpty()) { return 0; }
int delayMs = 25;
@@ -1208,7 +1208,7 @@ namespace BlackCore
bool CContextSimulator::doMatchingAgain(const CCallsign &callsign)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign.asString(); }
if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign.asString(); }
if (!this->isAircraftInRange(callsign)) { return false; }
if (!this->isSimulatorAvailable()) { return false; }

View File

@@ -28,9 +28,9 @@ namespace BlackCore
{
namespace Db
{
const CLogCategoryList &CBackgroundDataUpdater::getLogCategories()
const QStringList &CBackgroundDataUpdater::getLogCategories()
{
static const CLogCategoryList cats({ CLogCategory::worker(), CLogCategory::modelSetCache(), CLogCategory::modelCache() });
static const QStringList cats({ CLogCategories::worker(), CLogCategories::modelSetCache(), CLogCategories::modelCache() });
return cats;
}

View File

@@ -33,7 +33,7 @@ namespace BlackCore
public:
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Constructor
CBackgroundDataUpdater(QObject *owner);

View File

@@ -35,9 +35,9 @@ namespace BlackCore
{
namespace Db
{
const CLogCategoryList &CDatabaseAuthenticationService::getLogCategories()
const QStringList &CDatabaseAuthenticationService::getLogCategories()
{
static const CLogCategoryList cats { CLogCategory::swiftDbWebservice() };
static const QStringList cats { CLogCategories::swiftDbWebservice() };
return cats;
}

View File

@@ -34,7 +34,7 @@ namespace BlackCore
public:
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Constructor
CDatabaseAuthenticationService(QObject *parent = nullptr);

View File

@@ -710,12 +710,12 @@ namespace BlackCore
return ts.toUTC().toString(Qt::ISODate);
}
const CLogCategoryList &CDatabaseReader::getLogCategories()
const QStringList &CDatabaseReader::getLogCategories()
{
static const CLogCategoryList cats = CThreadedReader::getLogCategories().with(
static const QStringList cats = CThreadedReader::getLogCategories() + QStringList
{
CLogCategory::swiftDbWebservice(), CLogCategory::webservice()
});
CLogCategories::swiftDbWebservice(), CLogCategories::webservice()
};
return cats;
}

View File

@@ -283,7 +283,7 @@ namespace BlackCore
virtual bool readFromJsonFilesInBackground(const QString &dir, BlackMisc::Network::CEntityFlags::Entity whatToRead, bool overrideNewer) = 0;
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Transform JSON data to response struct data
//! \private used also for samples, that`s why it is declared public

View File

@@ -23,9 +23,9 @@ namespace BlackCore
{
namespace Db
{
const CLogCategoryList &CDatabaseUtils::getLogCategories()
const QStringList &CDatabaseUtils::getLogCategories()
{
static const BlackMisc::CLogCategoryList cats { CLogCategory::modelCache(), CLogCategory::modelSetCache() };
static const QStringList cats { CLogCategories::modelCache(), CLogCategories::modelSetCache() };
return cats;
}

View File

@@ -34,7 +34,7 @@ namespace BlackCore
CDatabaseUtils() = delete;
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Consolidate models with simulator model data (aka "models on disk")
//! \remark kept here with the other consolidate functions, but actually DB independent

View File

@@ -150,11 +150,11 @@ namespace BlackCore
return n;
}
const CLogCategoryList &CDatabaseWriter::getLogCategories()
const QStringList &CDatabaseWriter::getLogCategories()
{
static const CLogCategoryList cats
static const QStringList cats
{
CLogCategory::swiftDbWebservice(), CLogCategory::webservice()
CLogCategories::swiftDbWebservice(), CLogCategories::webservice()
};
return cats;
}
@@ -208,7 +208,7 @@ namespace BlackCore
void CDatabaseWriter::postedAutoPublishResponse(QNetworkReply *nwReplyPtr)
{
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategory::swiftDbWebservice()}));
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategories::swiftDbWebservice()}));
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> nwReply(nwReplyPtr);
if (m_shutdown || !sApp)
{

View File

@@ -59,7 +59,7 @@ namespace BlackCore
const BlackMisc::Network::CUrlLogList &getWriteLog() const { return m_writeLog; }
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
signals:
//! Published models, the response to \sa asyncPublishModels

View File

@@ -22,12 +22,12 @@ namespace BlackCore
{
namespace Db
{
const CLogCategoryList &CNetworkWatchdog::getLogCategories()
const QStringList &CNetworkWatchdog::getLogCategories()
{
static const CLogCategoryList cats = CContinuousWorker::getLogCategories().with(
static const QStringList cats = CContinuousWorker::getLogCategories() + QStringList
{
CLogCategory::swiftDbWebservice(), CLogCategory::webservice(), CLogCategory::network()
});
CLogCategories::swiftDbWebservice(), CLogCategories::webservice(), CLogCategories::network()
};
return cats;
}

View File

@@ -32,7 +32,7 @@ namespace BlackCore
public:
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Ctor
explicit CNetworkWatchdog(bool networkAccessible, QObject *owner);

View File

@@ -82,13 +82,13 @@ namespace BlackCore
return escaped;
}
const CLogCategoryList &CFSDClient::getLogCategories()
const QStringList &CFSDClient::getLogCategories()
{
static const CLogCategoryList cats = []
static const QStringList cats = []
{
CLogCategoryList cl = CContinuousWorker::getLogCategories();
cl.push_back(CLogCategory::network());
cl.push_back(CLogCategory::fsd());
QStringList cl = CContinuousWorker::getLogCategories();
cl.push_back(CLogCategories::network());
cl.push_back(CLogCategories::fsd());
return cl;
}();
return cats;

View File

@@ -84,7 +84,7 @@ namespace BlackCore
public:
//! Categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Ctor
CFSDClient(BlackMisc::Network::IClientProvider *clientProvider,

View File

@@ -42,7 +42,7 @@ namespace BlackCore
BLACK_VERIFY_X(false, Q_FUNC_INFO, msg);
}
CLogMessage(CLogCategory::fsd()).info(u"%1. Please report this to the DEVELOPERS!") << message;
CLogMessage(CLogCategories::fsd()).info(u"%1. Please report this to the DEVELOPERS!") << message;
}
}

View File

@@ -432,9 +432,9 @@ namespace BlackCore
}
}
const CLogCategoryList &CSetupReader::getLogCategories()
const QStringList &CSetupReader::getLogCategories()
{
static const CLogCategoryList cats({ CLogCategory("swift.setupreader"), CLogCategory::webservice(), CLogCategory::startup()});
static const QStringList cats({ "swift.setupreader", CLogCategories::webservice(), CLogCategories::startup()});
return cats;
}

View File

@@ -50,7 +50,7 @@ namespace BlackCore
public:
//! Categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Has a given cmd line argument for bootstrap URL?
bool hasCmdLineBootstrapUrl() const;

View File

@@ -46,9 +46,9 @@ using namespace BlackCore::Db;
namespace BlackCore
{
const CLogCategoryList &ISimulator::getLogCategories()
const QStringList &ISimulator::getLogCategories()
{
static const CLogCategoryList cats({ CLogCategory::driver(), CLogCategory::plugin() });
static const QStringList cats({ CLogCategories::driver(), CLogCategories::plugin() });
return cats;
}

View File

@@ -82,7 +82,7 @@ namespace BlackCore
Q_FLAG(SimulatorStatus)
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Render all aircraft if number of aircraft >= MaxAircraftInfinite
const int MaxAircraftInfinite = 100;

View File

@@ -26,9 +26,9 @@ using namespace BlackCore::Vatsim;
namespace BlackCore
{
const CLogCategoryList &CThreadedReader::getLogCategories()
const QStringList &CThreadedReader::getLogCategories()
{
static const BlackMisc::CLogCategoryList cats { BlackMisc::CLogCategory::worker() };
static const QStringList cats { BlackMisc::CLogCategories::worker() };
return cats;
}
@@ -218,7 +218,7 @@ namespace BlackCore
{
if (msg.isEmpty()) { return; }
CStatusMessage logMsg(msg);
logMsg.addCategory(CLogCategory::dataInconsistency());
logMsg.addCategory(CLogCategories::dataInconsistency());
if (funcInfo)
{
const QByteArray m(logMsg.getMessage().toLatin1());

View File

@@ -38,7 +38,7 @@ namespace BlackCore
public:
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Destructor
virtual ~CThreadedReader();

View File

@@ -1004,9 +1004,9 @@ namespace BlackCore
return entities;
}
const CLogCategoryList &CWebDataServices::getLogCategories()
const QStringList &CWebDataServices::getLogCategories()
{
static const BlackMisc::CLogCategoryList cats { CLogCategory("swift.datareader"), CLogCategory::webservice() };
static const QStringList cats { "swift.datareader", CLogCategories::webservice() };
return cats;
}

View File

@@ -91,7 +91,7 @@ namespace BlackCore
public:
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
static const QStringList &getLogCategories();
//! Constructor, only allowed from BlackCore::CApplication
CWebDataServices(CWebReaderFlags::WebReader readerFlags, const BlackCore::Db::CDatabaseReaderConfigList &dbReaderConfig, BlackMisc::Restricted<CApplication>, QObject *parent = nullptr);