mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-24 09:54:16 +08:00
Style
This commit is contained in:
committed by
Roland Winklmeier
parent
651ead5b51
commit
a2486981bd
@@ -38,7 +38,7 @@ namespace BlackCore
|
|||||||
PluginExtended &plugin = m_plugins[pluginId];
|
PluginExtended &plugin = m_plugins[pluginId];
|
||||||
if (!plugin.listener)
|
if (!plugin.listener)
|
||||||
{
|
{
|
||||||
ISimulatorFactory *factory = getFactory(pluginId);
|
ISimulatorFactory *factory = this->getFactory(pluginId);
|
||||||
if (!factory)
|
if (!factory)
|
||||||
{
|
{
|
||||||
CLogMessage(this).warning("Could not load plugin '%1'.") << pluginId;
|
CLogMessage(this).warning("Could not load plugin '%1'.") << pluginId;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
if (frequency == this->getFrequencyActive()) { return; } // save all the comparisons / rounding
|
if (frequency == this->getFrequencyActive()) { return; } // save all the comparisons / rounding
|
||||||
CFrequency fRounded(frequency);
|
CFrequency fRounded(frequency);
|
||||||
roundToChannelSpacing(fRounded, this->m_channelSpacing);
|
roundToChannelSpacing(fRounded, m_channelSpacing);
|
||||||
this->CModulator::setFrequencyActive(fRounded);
|
this->CModulator::setFrequencyActive(fRounded);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
if (frequency == this->getFrequencyStandby()) { return; } // save all the comparisons / rounding
|
if (frequency == this->getFrequencyStandby()) { return; } // save all the comparisons / rounding
|
||||||
CFrequency fRounded(frequency);
|
CFrequency fRounded(frequency);
|
||||||
roundToChannelSpacing(fRounded, this->m_channelSpacing);
|
roundToChannelSpacing(fRounded, m_channelSpacing);
|
||||||
this->CModulator::setFrequencyStandby(fRounded);
|
this->CModulator::setFrequencyStandby(fRounded);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,16 +118,16 @@ namespace BlackMisc
|
|||||||
return isValidCivilAviationFrequency(f) || isValidMilitaryFrequency(f);
|
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);
|
const double channelSpacingKHz = CComSystem::channelSpacingToFrequencyKHz(channelSpacing);
|
||||||
double f = frequency.valueRounded(CFrequencyUnit::kHz(), 0);
|
const double f = frequency.valueRounded(CFrequencyUnit::kHz(), 0);
|
||||||
quint32 d = static_cast<quint32>(f / channelSpacingKHz);
|
const quint32 d = static_cast<quint32>(f / channelSpacingKHz);
|
||||||
frequency.switchUnit(CFrequencyUnit::MHz());
|
frequency.switchUnit(CFrequencyUnit::MHz());
|
||||||
double f0 = frequency.valueRounded(CFrequencyUnit::MHz(), 3);
|
const double f0 = frequency.valueRounded(CFrequencyUnit::MHz(), 3);
|
||||||
double f1 = CMathUtils::round(d * (channelSpacingKHz / 1000.0), 3);
|
const double f1 = CMathUtils::round(d * (channelSpacingKHz / 1000.0), 3);
|
||||||
double f2 = CMathUtils::round((d + 1) * (channelSpacingKHz / 1000.0), 3);
|
const double f2 = CMathUtils::round((d + 1) * (channelSpacingKHz / 1000.0), 3);
|
||||||
bool down = qAbs(f1 - f0) < qAbs(f2 - f0); // which is the closest value
|
const bool down = qAbs(f1 - f0) < qAbs(f2 - f0); // which is the closest value
|
||||||
frequency.setCurrentUnitValue(down ? f1 : f2);
|
frequency.setCurrentUnitValue(down ? f1 : f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace BlackMisc
|
|||||||
CComSystem() {}
|
CComSystem() {}
|
||||||
|
|
||||||
//! Constructor
|
//! 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)
|
CModulator(name, activeFrequency, standbyFrequency.isNull() ? activeFrequency : standbyFrequency)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -81,17 +81,17 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Set active frequency
|
//! Set active frequency
|
||||||
//! \remarks will be rounded to channel spacing
|
//! \remarks will be rounded to channel spacing
|
||||||
void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency);
|
void setFrequencyActive(const PhysicalQuantities::CFrequency &frequency);
|
||||||
|
|
||||||
//! Set active frequency
|
//! Set active frequency
|
||||||
//! \remarks will be rounded to channel spacing
|
//! \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?
|
//! 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?
|
//! 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
|
//! Set UNICOM frequency as active
|
||||||
void setActiveUnicom();
|
void setActiveUnicom();
|
||||||
@@ -103,33 +103,33 @@ namespace BlackMisc
|
|||||||
static CComSystem getCom1System(double activeFrequencyMHz, double standbyFrequencyMHz = -1);
|
static CComSystem getCom1System(double activeFrequencyMHz, double standbyFrequencyMHz = -1);
|
||||||
|
|
||||||
//! COM1 unit
|
//! COM1 unit
|
||||||
static CComSystem getCom1System(const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency,
|
static CComSystem getCom1System(const PhysicalQuantities::CFrequency &activeFrequency,
|
||||||
const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency = { 0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit() });
|
const PhysicalQuantities::CFrequency &standbyFrequency = { 0, PhysicalQuantities::CFrequencyUnit::nullUnit() });
|
||||||
|
|
||||||
//! COM2 unit
|
//! COM2 unit
|
||||||
static CComSystem getCom2System(double activeFrequencyMHz, double standbyFrequencyMHz = -1);
|
static CComSystem getCom2System(double activeFrequencyMHz, double standbyFrequencyMHz = -1);
|
||||||
|
|
||||||
//! COM2 unit
|
//! COM2 unit
|
||||||
static CComSystem getCom2System(const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency,
|
static CComSystem getCom2System(const PhysicalQuantities::CFrequency &activeFrequency,
|
||||||
const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency = { 0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit() });
|
const PhysicalQuantities::CFrequency &standbyFrequency = { 0, PhysicalQuantities::CFrequencyUnit::nullUnit() });
|
||||||
|
|
||||||
//! Valid civil aviation frequency?
|
//! Valid civil aviation frequency?
|
||||||
static bool isValidCivilAviationFrequency(const BlackMisc::PhysicalQuantities::CFrequency &f);
|
static bool isValidCivilAviationFrequency(const PhysicalQuantities::CFrequency &f);
|
||||||
|
|
||||||
//! Valid military aviation frequency?
|
//! 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)
|
//! 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
|
//! Round to channel spacing, set MHz as unit
|
||||||
//! \see ChannelSpacing
|
//! \see ChannelSpacing
|
||||||
static void roundToChannelSpacing(BlackMisc::PhysicalQuantities::CFrequency &frequency,
|
static void roundToChannelSpacing(PhysicalQuantities::CFrequency &frequency,
|
||||||
ChannelSpacing channelSpacing);
|
ChannelSpacing channelSpacing);
|
||||||
|
|
||||||
//! Is compareFrequency within channel spacing of setFrequency
|
//! Is compareFrequency within channel spacing of setFrequency
|
||||||
static bool isWithinChannelSpacing(const BlackMisc::PhysicalQuantities::CFrequency &setFrequency,
|
static bool isWithinChannelSpacing(const PhysicalQuantities::CFrequency &setFrequency,
|
||||||
const BlackMisc::PhysicalQuantities::CFrequency &compareFrequency,
|
const PhysicalQuantities::CFrequency &compareFrequency,
|
||||||
ChannelSpacing channelSpacing);
|
ChannelSpacing channelSpacing);
|
||||||
|
|
||||||
//! \copydoc BlackMisc::CValueObject::registerMetadata
|
//! \copydoc BlackMisc::CValueObject::registerMetadata
|
||||||
|
|||||||
Reference in New Issue
Block a user