19 namespace swift::misc::aviation
25 m_frequencyActive = m_frequencyStandby;
26 m_frequencyStandby = a;
32 return m_frequencyActive;
38 return m_frequencyStandby;
44 m_frequencyActive = frequency;
50 m_frequencyStandby = frequency;
56 return m_volumeReceive;
62 return m_volumeTransmit;
68 if (volume >= 100) { m_volumeReceive = 100; }
69 else if (volume <= 0) { m_volumeReceive = 0; }
70 else { m_volumeReceive = volume; }
76 if (volume >= 100) { m_volumeTransmit = 100; }
77 else if (volume <= 0) { m_volumeTransmit = 0; }
78 else { m_volumeTransmit = volume; }
84 return m_transmitEnabled;
90 return m_receiveEnabled;
96 m_transmitEnabled = enable;
102 m_receiveEnabled = enable;
105 template <
class AVIO>
111 template <
class AVIO>
114 if (index.
isMyself()) {
return QVariant::fromValue(*derived()); }
115 const ColumnIndex i = index.
frontCasted<ColumnIndex>();
118 case IndexActiveFrequency:
return this->getFrequencyActive().propertyByIndex(index.
copyFrontRemoved());
119 case IndexStandbyFrequency:
return this->getFrequencyStandby().propertyByIndex(index.
copyFrontRemoved());
120 case IndexEnabledTransmit:
return QVariant::fromValue(this->isTransmitEnabled());
121 case IndexEnabledReceive:
return QVariant::fromValue(this->isReceiveEnabled());
122 case IndexTransmitVolume:
return QVariant::fromValue(this->getVolumeTransmit());
123 case IndexReceiveVolume:
return QVariant::fromValue(this->getVolumeReceive());
128 template <
class AVIO>
133 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Wrong index to base template");
139 case IndexActiveFrequency: m_frequencyActive.setPropertyByIndex(index.
copyFrontRemoved(), variant);
break;
140 case IndexStandbyFrequency: m_frequencyStandby.setPropertyByIndex(index.
copyFrontRemoved(), variant);
break;
141 case IndexEnabledTransmit: this->setTransmitEnabled(variant.toBool());
break;
142 case IndexEnabledReceive: this->setReceiveEnabled(variant.toBool());
break;
143 case IndexTransmitVolume: this->setVolumeTransmit(variant.toInt());
break;
144 case IndexReceiveVolume: this->setVolumeReceive(variant.toInt());
break;
149 template <
class AVIO>
154 return m_frequencyActive.comparePropertyByIndex(index.
copyFrontRemoved(), compareValue.m_frequencyActive);
159 case IndexActiveFrequency:
160 return m_frequencyActive.comparePropertyByIndex(index.
copyFrontRemoved(), compareValue.m_frequencyActive);
161 case IndexStandbyFrequency:
162 return m_frequencyStandby.comparePropertyByIndex(index.
copyFrontRemoved(), compareValue.m_frequencyStandby);
163 case IndexEnabledTransmit:
return Compare::compare(this->isTransmitEnabled(), compareValue.isTransmitEnabled());
164 case IndexEnabledReceive:
return Compare::compare(this->isReceiveEnabled(), compareValue.isReceiveEnabled());
165 case IndexTransmitVolume:
return Compare::compare(this->getVolumeTransmit(), compareValue.getVolumeTransmit());
166 case IndexReceiveVolume:
return Compare::compare(this->getVolumeReceive(), compareValue.getVolumeReceive());
169 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Compare failed");
173 template <
class AVIO>
176 static_assert(!std::is_polymorphic_v<AVIO>,
"Must not use virtual functions for value classes");
179 template <
class AVIO>
183 : m_name(name), m_frequencyActive(activeFrequency), m_frequencyStandby(standbyFrequency)
185 static_assert(!std::is_polymorphic_v<AVIO>,
"Must not use virtual functions for value classes");
188 template <
class AVIO>
191 QString s(this->getName());
192 s.append(
" Active: ").append(m_frequencyActive.valueRoundedWithUnit(3, i18n));
193 s.append(
" Standby: ").append(m_frequencyStandby.valueRoundedWithUnit(3, i18n));
197 template <
class AVIO>
204 template <
class AVIO>
211 template <
class AVIO>
214 static QString n(
"COM1");
218 template <
class AVIO>
221 static QString n(
"COM2");
225 template <
class AVIO>
228 static QString n(
"COM3");
232 template <
class AVIO>
235 static QString n(
"NAV1");
239 template <
class AVIO>
242 static QString n(
"NAV2");
246 template <
class AVIO>
249 static QString n(
"NAV3");
Non-owning reference to a CPropertyIndex with a subset of its features.
Q_REQUIRED_RESULT CPropertyIndexRef copyFrontRemoved() const
Copy with first element removed.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
Mix of the most commonly used mixin classes.
bool isTransmitEnabled() const
Enabled?
static const QString & NameNav2()
NAV2.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
void setVolumeReceive(int volume)
Output volume 0.100.
void setFrequencyStandbyKHz(double frequencyKHz)
Set standby frequency.
static const QString & NameCom3()
COM3.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QString getName() const
Name.
int getVolumeTransmit() const
Input volume 0..100.
void setTransmitEnabled(bool enable)
Enabled?
swift::misc::physical_quantities::CFrequency getFrequencyStandby() const
Standby frequency.
int getVolumeReceive() const
Output volume 0..100.
static const QString & NameNav3()
NAV3.
static const QString & NameCom1()
COM1.
void setVolumeTransmit(int volume)
Input volume 0..100.
static const QString & NameNav1()
NAV1.
bool isReceiveEnabled() const
Enabled?
ColumnIndex
Column indexes.
void setFrequencyStandby(const swift::misc::physical_quantities::CFrequency &frequency)
Set standby frequency.
QString convertToQString(bool i18n=false) const
Cast as QString.
swift::misc::physical_quantities::CFrequency getFrequencyActive() const
Active frequency.
int comparePropertyByIndex(swift::misc::CPropertyIndexRef index, const AVIO &compareValue) const
Compare by property index.
void toggleActiveStandby()
Toggle active and standby frequencies.
CModulator()
Default constructor.
void setFrequencyActive(const swift::misc::physical_quantities::CFrequency &frequency)
Set active frequency.
void setReceiveEnabled(bool enable)
Enabled?
static const QString & NameCom2()
COM2.
void setFrequencyActiveKHz(double frequencyKHz)
Set active frequency.
Specialized class for frequency (hertz, mega hertz, kilo hertz).
static CFrequencyUnit kHz()
Kilohertz.