@@ -97,7 +97,7 @@ namespace swift::core::afv::clients
9797 if (!hasContexts ()) { return ; }
9898
9999 // Disconnect all previously connect signals between the AfvClient and the required contexts
100- for (auto context : QVector<QObject *> { sApp ->getIContextOwnAircraft (), sApp ->getIContextNetwork () })
100+ for (auto * context : QVector<QObject *> { sApp ->getIContextOwnAircraft (), sApp ->getIContextNetwork () })
101101 {
102102 this ->disconnect (context);
103103 context->disconnect (this );
@@ -465,11 +465,8 @@ namespace swift::core::afv::clients
465465 if (!enabledTransceivers.contains (id)) { return false ; }
466466
467467 const auto transceivers = this ->getTransceivers (); // threadsafe
468- for (const TransceiverDto &dto : transceivers)
469- {
470- if (dto.id == id) { return true ; }
471- }
472- return false ;
468+ return std::any_of (transceivers.cbegin (), transceivers.cend (),
469+ [&id](const TransceiverDto &dto) { return dto.id == id; });
473470 }
474471
475472 bool CAfvClient::isEnabledComUnit (CComSystem::ComUnit comUnit) const
@@ -507,7 +504,7 @@ namespace swift::core::afv::clients
507504
508505 void CAfvClient::updateComFrequency (CComSystem::ComUnit comUnit, const CFrequency &comFrequency)
509506 {
510- const quint32 freqHz = static_cast <quint32>(comFrequency.valueInteger (CFrequencyUnit::Hz ()));
507+ const auto freqHz = static_cast <quint32>(comFrequency.valueInteger (CFrequencyUnit::Hz ()));
511508 this ->updateComFrequency (comUnitToTransceiverId (comUnit), freqHz);
512509 }
513510
@@ -592,11 +589,8 @@ namespace swift::core::afv::clients
592589 bool CAfvClient::isTransmittingTransceiver (quint16 id) const
593590 {
594591 QMutexLocker lock (&m_mutexTransceivers);
595- for (const TxTransceiverDto &dto : m_transmittingTransceivers)
596- {
597- if (dto.id == id) { return true ; }
598- }
599- return false ;
592+ return std::any_of (m_transmittingTransceivers.cbegin (), m_transmittingTransceivers.cend (),
593+ [&id](const TxTransceiverDto &dto) { return dto.id == id; });
600594 }
601595
602596 bool CAfvClient::isTransmittingComUnit (CComSystem::ComUnit comUnit) const
@@ -747,21 +741,17 @@ namespace swift::core::afv::clients
747741 double CAfvClient::getComOutputVolumeDb (CComSystem::ComUnit comUnit) const
748742 {
749743 QMutexLocker lock (&m_mutexVolume);
750- if (comUnit == CComSystem::Com1)
751- return m_outputVolumeDbCom1;
752- else if (comUnit == CComSystem::Com2)
753- return m_outputVolumeDbCom2;
744+ if (comUnit == CComSystem::Com1) return m_outputVolumeDbCom1;
745+ if (comUnit == CComSystem::Com2) return m_outputVolumeDbCom2;
754746 qFatal (" Invalid COM unit" );
755747 return 0 ;
756748 }
757749
758750 double CAfvClient::getOutputGainRatio (CComSystem::ComUnit comUnit) const
759751 {
760752 QMutexLocker lock (&m_mutexVolume);
761- if (comUnit == CComSystem::Com1)
762- return m_outputGainRatioCom1;
763- else if (comUnit == CComSystem::Com2)
764- return m_outputGainRatioCom2;
753+ if (comUnit == CComSystem::Com1) return m_outputGainRatioCom1;
754+ if (comUnit == CComSystem::Com2) return m_outputGainRatioCom2;
765755 qFatal (" Invalid COM unit" );
766756 return 0 ;
767757 }
@@ -784,7 +774,7 @@ namespace swift::core::afv::clients
784774 {
785775 QMutexLocker lock (&m_mutexVolume);
786776 if (comUnit == CComSystem::Com1) { return m_outputVolumeCom1Normalized; }
787- else if (comUnit == CComSystem::Com2) { return m_outputVolumeCom2Normalized; }
777+ if (comUnit == CComSystem::Com2) { return m_outputVolumeCom2Normalized; }
788778 qFatal (" Invalid ComUnit" );
789779 return 0 ;
790780 }
@@ -1069,7 +1059,10 @@ namespace swift::core::afv::clients
10691059 const int failures = ++m_heartBeatFailures;
10701060 if (failures < 2 ) { return ; }
10711061
1072- QString un, pw, cs, client;
1062+ QString un;
1063+ QString pw;
1064+ QString cs;
1065+ QString client;
10731066 {
10741067 QMutexLocker lock (&m_mutexConnection);
10751068 un = m_connection->getUserName ();
@@ -1331,17 +1324,17 @@ namespace swift::core::afv::clients
13311324 {
13321325 QMutexLocker lock (&m_mutex);
13331326 CFrequency roundedFrequency (static_cast <int >(roundedFrequencyHz), CFrequencyUnit::Hz ());
1334- const auto it = std::find_if (
1335- m_aliasedStations. constBegin (), m_aliasedStations. constEnd (), [roundedFrequency](const StationDto &d) {
1336- if (d.frequencyAliasHz > 100000000 &&
1337- roundedFrequency.value (CFrequencyUnit::Hz ()) > 100000000 ) // both VHF
1338- {
1339- const int aliasedFreqHz = static_cast < int >( qRound (d.frequencyAliasHz / 1000.0 ) ) * 1000 ;
1340- return CComSystem::isSameFrequency (CFrequency (aliasedFreqHz, CFrequencyUnit::Hz ()),
1341- roundedFrequency);
1342- }
1343- return d.frequencyAliasHz == roundedFrequency.value (CFrequencyUnit::Hz ());
1344- });
1327+ const auto it = std::find_if (m_aliasedStations. constBegin (), m_aliasedStations. constEnd (),
1328+ [roundedFrequency](const StationDto &d) {
1329+ if (d.frequencyAliasHz > 100000000 &&
1330+ roundedFrequency.value (CFrequencyUnit::Hz ()) > 100000000 ) // both VHF
1331+ {
1332+ const int aliasedFreqHz = qRound (d.frequencyAliasHz / 1000.0 ) * 1000 ;
1333+ return CComSystem::isSameFrequency (
1334+ CFrequency (aliasedFreqHz, CFrequencyUnit::Hz ()), roundedFrequency);
1335+ }
1336+ return d.frequencyAliasHz == roundedFrequency.value (CFrequencyUnit::Hz ());
1337+ });
13451338
13461339 if (it != m_aliasedStations.constEnd ())
13471340 {
0 commit comments