diff --git a/src/blackcore/pluginmanagersimulator.cpp b/src/blackcore/pluginmanagersimulator.cpp index 7191402f4..b16f2666b 100644 --- a/src/blackcore/pluginmanagersimulator.cpp +++ b/src/blackcore/pluginmanagersimulator.cpp @@ -38,7 +38,7 @@ namespace BlackCore PluginExtended &plugin = m_plugins[pluginId]; if (!plugin.listener) { - ISimulatorFactory *factory = getFactory(pluginId); + ISimulatorFactory *factory = this->getFactory(pluginId); if (!factory) { CLogMessage(this).warning("Could not load plugin '%1'.") << pluginId; diff --git a/src/blackmisc/aviation/comsystem.cpp b/src/blackmisc/aviation/comsystem.cpp index ac825f1f7..c081d40fa 100644 --- a/src/blackmisc/aviation/comsystem.cpp +++ b/src/blackmisc/aviation/comsystem.cpp @@ -45,7 +45,7 @@ namespace BlackMisc { if (frequency == this->getFrequencyActive()) { return; } // save all the comparisons / rounding CFrequency fRounded(frequency); - roundToChannelSpacing(fRounded, this->m_channelSpacing); + roundToChannelSpacing(fRounded, m_channelSpacing); this->CModulator::setFrequencyActive(fRounded); } @@ -53,7 +53,7 @@ namespace BlackMisc { if (frequency == this->getFrequencyStandby()) { return; } // save all the comparisons / rounding CFrequency fRounded(frequency); - roundToChannelSpacing(fRounded, this->m_channelSpacing); + roundToChannelSpacing(fRounded, m_channelSpacing); this->CModulator::setFrequencyStandby(fRounded); } @@ -118,16 +118,16 @@ namespace BlackMisc return isValidCivilAviationFrequency(f) || isValidMilitaryFrequency(f); } - void CComSystem::roundToChannelSpacing(PhysicalQuantities::CFrequency &frequency, ChannelSpacing channelSpacing) + void CComSystem::roundToChannelSpacing(CFrequency &frequency, ChannelSpacing channelSpacing) { - double channelSpacingKHz = CComSystem::channelSpacingToFrequencyKHz(channelSpacing); - double f = frequency.valueRounded(CFrequencyUnit::kHz(), 0); - quint32 d = static_cast(f / channelSpacingKHz); + const double channelSpacingKHz = CComSystem::channelSpacingToFrequencyKHz(channelSpacing); + const double f = frequency.valueRounded(CFrequencyUnit::kHz(), 0); + const quint32 d = static_cast(f / channelSpacingKHz); frequency.switchUnit(CFrequencyUnit::MHz()); - double f0 = frequency.valueRounded(CFrequencyUnit::MHz(), 3); - double f1 = CMathUtils::round(d * (channelSpacingKHz / 1000.0), 3); - double f2 = CMathUtils::round((d + 1) * (channelSpacingKHz / 1000.0), 3); - bool down = qAbs(f1 - f0) < qAbs(f2 - f0); // which is the closest value + const double f0 = frequency.valueRounded(CFrequencyUnit::MHz(), 3); + const double f1 = CMathUtils::round(d * (channelSpacingKHz / 1000.0), 3); + const double f2 = CMathUtils::round((d + 1) * (channelSpacingKHz / 1000.0), 3); + const bool down = qAbs(f1 - f0) < qAbs(f2 - f0); // which is the closest value frequency.setCurrentUnitValue(down ? f1 : f2); } diff --git a/src/blackmisc/aviation/comsystem.h b/src/blackmisc/aviation/comsystem.h index e82f9ab1c..2b40b8304 100644 --- a/src/blackmisc/aviation/comsystem.h +++ b/src/blackmisc/aviation/comsystem.h @@ -67,7 +67,7 @@ namespace BlackMisc CComSystem() {} //! Constructor - CComSystem(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency = { 0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit() }): + CComSystem(const QString &name, const PhysicalQuantities::CFrequency &activeFrequency, const PhysicalQuantities::CFrequency &standbyFrequency = { 0, PhysicalQuantities::CFrequencyUnit::nullUnit() }): CModulator(name, activeFrequency, standbyFrequency.isNull() ? activeFrequency : standbyFrequency) { } @@ -81,17 +81,17 @@ namespace BlackMisc //! Set active frequency //! \remarks will be rounded to channel spacing - void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency); + void setFrequencyActive(const PhysicalQuantities::CFrequency &frequency); //! Set active frequency //! \remarks will be rounded to channel spacing - void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency); + void setFrequencyStandby(const PhysicalQuantities::CFrequency &frequency); //! Is active frequency within 8.3383kHz channel? - bool isActiveFrequencyWithin8_33kHzChannel(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) const; + bool isActiveFrequencyWithin8_33kHzChannel(const PhysicalQuantities::CFrequency &comFrequency) const; //! Is active frequency within 25kHz channel? - bool isActiveFrequencyWithin25kHzChannel(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) const; + bool isActiveFrequencyWithin25kHzChannel(const PhysicalQuantities::CFrequency &comFrequency) const; //! Set UNICOM frequency as active void setActiveUnicom(); @@ -103,33 +103,33 @@ namespace BlackMisc static CComSystem getCom1System(double activeFrequencyMHz, double standbyFrequencyMHz = -1); //! COM1 unit - static CComSystem getCom1System(const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, - const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency = { 0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit() }); + static CComSystem getCom1System(const PhysicalQuantities::CFrequency &activeFrequency, + const PhysicalQuantities::CFrequency &standbyFrequency = { 0, PhysicalQuantities::CFrequencyUnit::nullUnit() }); //! COM2 unit static CComSystem getCom2System(double activeFrequencyMHz, double standbyFrequencyMHz = -1); //! COM2 unit - static CComSystem getCom2System(const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, - const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency = { 0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit() }); + static CComSystem getCom2System(const PhysicalQuantities::CFrequency &activeFrequency, + const PhysicalQuantities::CFrequency &standbyFrequency = { 0, PhysicalQuantities::CFrequencyUnit::nullUnit() }); //! Valid civil aviation frequency? - static bool isValidCivilAviationFrequency(const BlackMisc::PhysicalQuantities::CFrequency &f); + static bool isValidCivilAviationFrequency(const PhysicalQuantities::CFrequency &f); //! Valid military aviation frequency? - static bool isValidMilitaryFrequency(const BlackMisc::PhysicalQuantities::CFrequency &f); + static bool isValidMilitaryFrequency(const PhysicalQuantities::CFrequency &f); //! Valid COM frequency (either civil or military) - static bool isValidComFrequency(const BlackMisc::PhysicalQuantities::CFrequency &f); + static bool isValidComFrequency(const PhysicalQuantities::CFrequency &f); //! Round to channel spacing, set MHz as unit //! \see ChannelSpacing - static void roundToChannelSpacing(BlackMisc::PhysicalQuantities::CFrequency &frequency, + static void roundToChannelSpacing(PhysicalQuantities::CFrequency &frequency, ChannelSpacing channelSpacing); //! Is compareFrequency within channel spacing of setFrequency - static bool isWithinChannelSpacing(const BlackMisc::PhysicalQuantities::CFrequency &setFrequency, - const BlackMisc::PhysicalQuantities::CFrequency &compareFrequency, + static bool isWithinChannelSpacing(const PhysicalQuantities::CFrequency &setFrequency, + const PhysicalQuantities::CFrequency &compareFrequency, ChannelSpacing channelSpacing); //! \copydoc BlackMisc::CValueObject::registerMetadata