diff --git a/src/blackcore/context/context.h b/src/blackcore/context/context.h index 0bc8d5dab..51280d565 100644 --- a/src/blackcore/context/context.h +++ b/src/blackcore/context/context.h @@ -136,10 +136,6 @@ namespace BlackCore::Context void changedLogOrDebugSettings(); protected: - CCoreFacadeConfig::ContextMode m_mode; //!< How context is used - qint64 m_contextId; //!< unique identifer, avoid redirection rountrips - bool m_debugEnabled = false; //!< debug messages enabled - //! Constructor IContext(CCoreFacadeConfig::ContextMode mode, QObject *parent); @@ -163,6 +159,11 @@ namespace BlackCore::Context //! Standard message when status message is returned in empty context static const BlackMisc::CStatusMessage &statusMessageEmptyContext(); + + private: + CCoreFacadeConfig::ContextMode m_mode; //!< How context is used + qint64 m_contextId; //!< unique identifer, avoid redirection rountrips + bool m_debugEnabled = false; //!< debug messages enabled }; } // ns #endif // guard diff --git a/src/blackcore/context/contextapplicationimpl.cpp b/src/blackcore/context/contextapplicationimpl.cpp index deb75bee0..121157189 100644 --- a/src/blackcore/context/contextapplicationimpl.cpp +++ b/src/blackcore/context/contextapplicationimpl.cpp @@ -25,7 +25,7 @@ namespace BlackCore::Context CContextApplication *CContextApplication::registerWithDBus(BlackMisc::CDBusServer *server) { - if (!server || m_mode != CCoreFacadeConfig::LocalInDBusServer) { return this; } + if (!server || getMode() != CCoreFacadeConfig::LocalInDBusServer) { return this; } server->addObject(IContextApplication::ObjectPath(), this); return this; } @@ -38,19 +38,19 @@ namespace BlackCore::Context BlackMisc::CValueCachePacket CContextApplication::getAllSettings() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } return CSettingsCache::instance()->getAllValuesWithTimestamps(); } QStringList CContextApplication::getUnsavedSettingsKeys() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } return CSettingsCache::instance()->getAllUnsavedKeys(); } CSettingsDictionary CContextApplication::getUnsavedSettingsKeysDescribed() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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)); } @@ -64,19 +64,19 @@ namespace BlackCore::Context BlackMisc::CStatusMessage CContextApplication::saveSettings(const QString &keyPrefix) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << keyPrefix; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << keys.join(", "); } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << keys.join(", "); } return CSettingsCache::instance()->saveToStore(keys); } BlackMisc::CStatusMessage CContextApplication::loadSettings() { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } return CSettingsCache::instance()->loadFromStore(); } @@ -106,7 +106,7 @@ namespace BlackCore::Context CIdentifier CContextApplication::registerApplication(const CIdentifier &application) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << application; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << application; } if (!m_registeredApplications.contains(application)) { @@ -121,7 +121,7 @@ namespace BlackCore::Context void CContextApplication::unregisterApplication(const CIdentifier &application) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << application; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << application; } int r = m_registeredApplications.remove(application); this->cleanupRegisteredApplications(); if (r > 0) { emit registrationChanged(); } @@ -135,7 +135,7 @@ namespace BlackCore::Context CIdentifierList CContextApplication::getRegisteredApplications() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } // static const int outdatedMs = qRound(1.5 * PingIdentifiersMs); // return m_registeredApplications.findAfterNowMinusOffset(outdatedMs); return m_registeredApplications; @@ -143,7 +143,7 @@ namespace BlackCore::Context CIdentifier CContextApplication::getApplicationIdentifier() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } return this->identifier(); } } // ns diff --git a/src/blackcore/context/contextaudio.cpp b/src/blackcore/context/contextaudio.cpp index d9c28dd71..83ceeaeec 100644 --- a/src/blackcore/context/contextaudio.cpp +++ b/src/blackcore/context/contextaudio.cpp @@ -509,7 +509,7 @@ namespace BlackCore::Context void CContextAudioBase::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << notification; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << notification; } const CSettings settings = m_audioSettings.getThreadLocal(); const bool play = !considerSettings || settings.isNotificationFlagSet(notification); diff --git a/src/blackcore/context/contextaudioimpl.cpp b/src/blackcore/context/contextaudioimpl.cpp index 78f75ebb4..e1b3b024a 100644 --- a/src/blackcore/context/contextaudioimpl.cpp +++ b/src/blackcore/context/contextaudioimpl.cpp @@ -23,7 +23,7 @@ namespace BlackCore::Context CContextAudio *CContextAudio::registerWithDBus(CDBusServer *server) { - if (!server || m_mode != CCoreFacadeConfig::LocalInDBusServer) { return this; } + if (!server || getMode() != CCoreFacadeConfig::LocalInDBusServer) { return this; } // remark that registers all SIGNALS, not only the interface ons server->addObject(IContextAudio::ObjectPath(), this); diff --git a/src/blackcore/context/contextnetworkimpl.cpp b/src/blackcore/context/contextnetworkimpl.cpp index ead99e4e4..910b7b020 100644 --- a/src/blackcore/context/contextnetworkimpl.cpp +++ b/src/blackcore/context/contextnetworkimpl.cpp @@ -108,7 +108,7 @@ namespace BlackCore::Context CContextNetwork *CContextNetwork::registerWithDBus(BlackMisc::CDBusServer *server) { - if (!server || m_mode != CCoreFacadeConfig::LocalInDBusServer) return this; + if (!server || getMode() != CCoreFacadeConfig::LocalInDBusServer) return this; server->addObject(IContextNetwork::ObjectPath(), this); return this; } diff --git a/src/blackcore/context/contextownaircraftimpl.cpp b/src/blackcore/context/contextownaircraftimpl.cpp index 37c8903dc..16036dba6 100644 --- a/src/blackcore/context/contextownaircraftimpl.cpp +++ b/src/blackcore/context/contextownaircraftimpl.cpp @@ -74,28 +74,28 @@ namespace BlackCore::Context CContextOwnAircraft *CContextOwnAircraft::registerWithDBus(CDBusServer *server) { - if (!server || m_mode != CCoreFacadeConfig::LocalInDBusServer) { return this; } + if (!server || getMode() != CCoreFacadeConfig::LocalInDBusServer) { return this; } server->addObject(IContextOwnAircraft::ObjectPath(), this); return this; } CSimulatedAircraft CContextOwnAircraft::getOwnAircraft() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } QReadLocker l(&m_lockAircraft); return m_ownAircraft.getTransponder(); } @@ -309,7 +309,7 @@ namespace BlackCore::Context bool CContextOwnAircraft::updateOwnPosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude, const CAltitude &pressureAltitude) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << position << altitude; } + if (isDebugEnabled()) { 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); } @@ -330,7 +330,7 @@ namespace BlackCore::Context bool CContextOwnAircraft::updateCockpit(const CComSystem &com1, const CComSystem &com2, const CTransponder &transponder, const CIdentifier &originator) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder; } bool changed; { QWriteLocker l(&m_lockAircraft); @@ -347,7 +347,7 @@ namespace BlackCore::Context bool CContextOwnAircraft::updateTransponderMode(const CTransponder::TransponderMode &transponderMode, const CIdentifier &originator) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << transponderMode; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << transponderMode; } bool changed; { QWriteLocker l(&m_lockAircraft); diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index 144dd409f..06ea53dc5 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -108,7 +108,7 @@ namespace BlackCore::Context CContextSimulator *CContextSimulator::registerWithDBus(CDBusServer *server) { - if (!server || m_mode != CCoreFacadeConfig::LocalInDBusServer) { return this; } + if (!server || getMode() != CCoreFacadeConfig::LocalInDBusServer) { return this; } server->addObject(CContextSimulator::ObjectPath(), this); return this; } @@ -187,14 +187,14 @@ namespace BlackCore::Context int CContextSimulator::checkListeners() { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return 0; } return m_simulatorPlugin.second->getSimulatorStatus(); } @@ -202,7 +202,7 @@ namespace BlackCore::Context CSimulatorPluginInfo CContextSimulator::getSimulatorPluginInfo() const { static const CSimulatorPluginInfo unspecified; - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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; @@ -210,14 +210,14 @@ namespace BlackCore::Context CSimulatorInternals CContextSimulator::getSimulatorInternals() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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); @@ -225,7 +225,7 @@ namespace BlackCore::Context CAircraftModelList CContextSimulator::getModelSet() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } const CSimulatorInfo simulator = this->getModelSetLoaderSimulator(); if (!simulator.isSingleSimulator()) { return CAircraftModelList(); } @@ -235,7 +235,7 @@ namespace BlackCore::Context CSimulatorInfo CContextSimulator::getModelSetLoaderSimulator() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } if (m_simulatorPlugin.second) { if (m_simulatorPlugin.second->isConnected()) @@ -254,7 +254,7 @@ namespace BlackCore::Context void CContextSimulator::setModelSetLoaderSimulator(const CSimulatorInfo &simulator) { Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator"); - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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 @@ -263,13 +263,13 @@ namespace BlackCore::Context CSimulatorInfo CContextSimulator::simulatorsWithInitializedModelSet() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().simulatorsWithInitializedCache(); } CStatusMessageList CContextSimulator::verifyPrerequisites() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } CStatusMessageList msgs; const CSimulatorInfo simulators = this->simulatorsWithInitializedModelSet(); if (simulators.isNoSimulator()) @@ -281,20 +281,20 @@ namespace BlackCore::Context QStringList CContextSimulator::getModelSetStrings() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } if (removeModels.isEmpty()) { return 0; } const CSimulatorInfo simulator = m_modelSetSimulator.get(); if (!simulator.isSingleSimulator()) { return 0; } @@ -311,48 +311,48 @@ namespace BlackCore::Context QStringList CContextSimulator::getModelSetCompleterStrings(bool sorted) const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << sorted; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << sorted; } return this->getModelSet().toCompleterStrings(sorted); } int CContextSimulator::getModelSetCount() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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); @@ -360,7 +360,7 @@ namespace BlackCore::Context CAircraftModelList CContextSimulator::getModelSetModelsStartingWith(const QString &modelString) const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << modelString; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << modelString; } if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CAircraftModelList(); } return this->getModelSet().findModelsStartingWith(modelString); @@ -368,7 +368,7 @@ namespace BlackCore::Context bool CContextSimulator::setTimeSynchronization(bool enable, const CTime &offset) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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); @@ -380,42 +380,42 @@ namespace BlackCore::Context bool CContextSimulator::isTimeSynchronized() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << setup; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << setup; } // anyway save for future reference const CStatusMessage m = m_renderSettings.setAndSave(setup); @@ -428,7 +428,7 @@ namespace BlackCore::Context CStatusMessageList CContextSimulator::getInterpolationMessages(const CCallsign &callsign) const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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); @@ -436,7 +436,7 @@ namespace BlackCore::Context CTime CContextSimulator::getTimeSynchronizationOffset() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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(); } @@ -963,19 +963,19 @@ namespace BlackCore::Context CStatusMessageList CContextSimulator::getMatchingMessages(const CCallsign &callsign) const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; } return m_matchingMessages[callsign]; } MatchingLog CContextSimulator::isMatchingMessagesEnabled() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } return m_logMatchingMessages; } void CContextSimulator::enableMatchingMessages(MatchingLog enabled) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << matchingLogToString(enabled); } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << matchingLogToString(enabled); } if (m_logMatchingMessages == enabled) { return; } m_logMatchingMessages = enabled; emit IContext::changedLogOrDebugSettings(); @@ -983,7 +983,7 @@ namespace BlackCore::Context CMatchingStatistics CContextSimulator::getCurrentMatchingStatistics(bool missingOnly) const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << missingOnly; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << missingOnly; } const CMatchingStatistics statistics = m_aircraftMatcher.getCurrentStatistics(); return missingOnly ? statistics.findMissingOnly() : @@ -992,7 +992,7 @@ namespace BlackCore::Context void CContextSimulator::setMatchingSetup(const CAircraftMatcherSetup &setup) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << setup.toQString(); } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << setup.toQString(); } m_aircraftMatcher.setSetup(setup); const CStatusMessage msg = m_matchingSettings.setAndSave(setup); CLogMessage::preformatted(msg); @@ -1000,13 +1000,13 @@ namespace BlackCore::Context CAircraftMatcherSetup CContextSimulator::getMatchingSetup() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } return m_aircraftMatcher.getSetup(); } CStatusMessageList CContextSimulator::copyFsxTerrainProbe(const CSimulatorInfo &simulator) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << simulator.toQString(); } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << simulator.toQString(); } CStatusMessageList msgs; if (!simulator.isFsxP3DFamily()) @@ -1097,14 +1097,14 @@ namespace BlackCore::Context bool CContextSimulator::followAircraft(const CCallsign &callsign) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } if (!m_simulatorPlugin.second) { return; } m_simulatorPlugin.second->recalculateAllAircraft(); } @@ -1127,41 +1127,41 @@ namespace BlackCore::Context bool CContextSimulator::isWeatherActivated() const { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << identifier; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << situation; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << reference.convertToQString(true) << range; } + if (isDebugEnabled()) { 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, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } const CCallsignSet callsigns = this->getAircraftInRangeCallsigns(); if (callsigns.isEmpty()) { return 0; } int delayMs = 25; @@ -1179,7 +1179,7 @@ namespace BlackCore::Context bool CContextSimulator::doMatchingAgain(const CCallsign &callsign) { - if (m_debugEnabled) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign.asString(); } + if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign.asString(); } if (!this->isAircraftInRange(callsign)) { return false; } if (!this->isSimulatorAvailable()) { return false; }