mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-05-06 14:14:17 -04:00
Add active only button. Increase poll frequency. Support channels that don't have a frequency offset.
This commit is contained in:
parent
eab2e1b10a
commit
e3e2f5bb20
Binary file not shown.
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 49 KiB |
@ -269,6 +269,7 @@ void FreqDisplayGUI::displaySettings()
|
||||
}
|
||||
ui->displayMode->setCurrentIndex(static_cast<int>(m_settings.m_displayMode));
|
||||
ui->speech->setChecked(m_settings.m_speechEnabled);
|
||||
ui->activeOnly->setChecked(m_settings.m_activeOnly);
|
||||
ui->transparentBackground->setChecked(m_settings.m_transparentBackground);
|
||||
ui->frequencyUnits->setCurrentIndex(static_cast<int>(m_settings.m_frequencyUnits));
|
||||
ui->showUnits->setChecked(m_settings.m_showUnits);
|
||||
@ -471,6 +472,22 @@ void FreqDisplayGUI::updateFrequencyText()
|
||||
const auto& selectedChannel = m_availableChannels.at(channelListIndex);
|
||||
const FreqDisplaySettings::DisplayMode mode = m_settings.m_displayMode;
|
||||
|
||||
if (m_settings.m_activeOnly)
|
||||
{
|
||||
// Only display frequency if channel is unmuted and squelch open
|
||||
// If not, we clear the frequency display
|
||||
int squelchValue;
|
||||
int audioMuteValue;
|
||||
bool hasSquelch = ChannelWebAPIUtils::getChannelReportValue(selectedChannel.m_superIndex, selectedChannel.m_index, "squelch", squelchValue);
|
||||
bool hasAudioMute = ChannelWebAPIUtils::getChannelSetting(selectedChannel.m_superIndex, selectedChannel.m_index, "audioMute", audioMuteValue);
|
||||
if ((hasSquelch && !squelchValue) || (hasAudioMute && audioMuteValue))
|
||||
{
|
||||
setLabelText(tr(""));
|
||||
updateFrequencyFont();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Frequency ---
|
||||
QString freqText;
|
||||
if (mode == FreqDisplaySettings::Frequency || mode == FreqDisplaySettings::Both)
|
||||
@ -484,11 +501,9 @@ void FreqDisplayGUI::updateFrequencyText()
|
||||
updateFrequencyFont();
|
||||
return;
|
||||
}
|
||||
if (!ChannelWebAPIUtils::getFrequencyOffset(selectedChannel.m_superIndex, selectedChannel.m_index, offsetHz))
|
||||
{
|
||||
setLabelText(tr("Offset unavailable"));
|
||||
updateFrequencyFont();
|
||||
return;
|
||||
// Not all channels have an offset
|
||||
if (!ChannelWebAPIUtils::getFrequencyOffset(selectedChannel.m_superIndex, selectedChannel.m_index, offsetHz)) {
|
||||
offsetHz = 0;
|
||||
}
|
||||
|
||||
const qint64 absoluteFrequency = qRound64(centerFrequencyHz) + static_cast<qint64>(offsetHz);
|
||||
@ -864,6 +879,12 @@ QString FreqDisplayGUI::formatFrequency(qint64 frequencyHz) const
|
||||
}
|
||||
}
|
||||
|
||||
void FreqDisplayGUI::on_activeOnly_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_activeOnly = checked;
|
||||
applySetting("activeOnly");
|
||||
}
|
||||
|
||||
void FreqDisplayGUI::on_transparentBackground_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_transparentBackground = checked;
|
||||
@ -920,6 +941,7 @@ void FreqDisplayGUI::makeUIConnections()
|
||||
connect(ui->displayMode, qOverload<int>(&QComboBox::currentIndexChanged), this, &FreqDisplayGUI::on_displayMode_currentIndexChanged);
|
||||
connect(ui->speech, &ButtonSwitch::toggled, this, &FreqDisplayGUI::on_speech_toggled);
|
||||
connect(ui->fontFamily, &QFontComboBox::currentFontChanged, this, &FreqDisplayGUI::on_fontFamily_currentFontChanged);
|
||||
connect(ui->activeOnly, &ButtonSwitch::toggled, this, &FreqDisplayGUI::on_activeOnly_toggled);
|
||||
connect(ui->transparentBackground, &ButtonSwitch::toggled, this, &FreqDisplayGUI::on_transparentBackground_toggled);
|
||||
connect(ui->frequencyUnits, qOverload<int>(&QComboBox::currentIndexChanged), this, &FreqDisplayGUI::on_frequencyUnits_currentIndexChanged);
|
||||
connect(ui->showUnits, &ButtonSwitch::toggled, this, &FreqDisplayGUI::on_showUnits_toggled);
|
||||
|
||||
@ -127,8 +127,8 @@ private:
|
||||
static QString textForSpeech(const QString& displayText);
|
||||
#endif
|
||||
|
||||
static constexpr const char* m_rxTxChannelKinds = "RT";
|
||||
static constexpr int m_pollIntervalMs = 1000;
|
||||
static constexpr const char* m_rxTxChannelKinds = "RTM";
|
||||
static constexpr int m_pollIntervalMs = 250;
|
||||
static constexpr int m_minimumFrequencyFontPointSize = 10;
|
||||
/// Reference point size used when probing text metrics in updateFrequencyFont().
|
||||
/// Large enough that integer rounding in QFontMetrics is negligible.
|
||||
@ -170,6 +170,7 @@ private slots:
|
||||
void on_displayMode_currentIndexChanged(int index);
|
||||
void on_speech_toggled(bool checked);
|
||||
void on_fontFamily_currentFontChanged(const QFont& font);
|
||||
void on_activeOnly_toggled(bool checked);
|
||||
void on_transparentBackground_toggled(bool checked);
|
||||
void on_frequencyUnits_currentIndexChanged(int index);
|
||||
void on_showUnits_toggled(bool checked);
|
||||
|
||||
@ -107,6 +107,16 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="activeOnly">
|
||||
<property name="toolTip">
|
||||
<string>When checked, display frequency / power only when channel is active (unmuted and squelch open)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>A</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="transparentBackground">
|
||||
<property name="toolTip">
|
||||
|
||||
@ -52,6 +52,7 @@ void FreqDisplaySettings::resetToDefaults()
|
||||
m_reverseAPIPort = 8888;
|
||||
m_reverseAPIFeatureSetIndex = 0;
|
||||
m_reverseAPIFeatureIndex = 0;
|
||||
m_activeOnly = false;
|
||||
}
|
||||
|
||||
QByteArray FreqDisplaySettings::serialize() const
|
||||
@ -82,6 +83,7 @@ QByteArray FreqDisplaySettings::serialize() const
|
||||
s.writeU32(20, m_reverseAPIPort);
|
||||
s.writeU32(21, m_reverseAPIFeatureSetIndex);
|
||||
s.writeU32(22, m_reverseAPIFeatureIndex);
|
||||
s.writeBool(23, m_activeOnly);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -144,6 +146,8 @@ bool FreqDisplaySettings::deserialize(const QByteArray& data)
|
||||
d.readU32(22, &utmp, 0);
|
||||
m_reverseAPIFeatureIndex = utmp > 99 ? 99 : utmp;
|
||||
|
||||
d.readBool(23, &m_activeOnly);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -218,4 +222,7 @@ void FreqDisplaySettings::applySettings(const QStringList& settingsKeys, const F
|
||||
if (settingsKeys.contains("reverseAPIFeatureIndex")) {
|
||||
m_reverseAPIFeatureIndex = settings.m_reverseAPIFeatureIndex;
|
||||
}
|
||||
if (settingsKeys.contains("activeOnly")) {
|
||||
m_activeOnly = settings.m_activeOnly;
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +63,7 @@ struct FreqDisplaySettings
|
||||
uint16_t m_reverseAPIPort;
|
||||
uint16_t m_reverseAPIFeatureSetIndex;
|
||||
uint16_t m_reverseAPIFeatureIndex;
|
||||
bool m_activeOnly; //!< Only display frequency/power for channels that are active (unmuted and squelch open)
|
||||
|
||||
FreqDisplaySettings();
|
||||
~FreqDisplaySettings() = default;
|
||||
|
||||
@ -24,7 +24,13 @@ Choose the text to display:
|
||||
* Power - displays the selected channel's (1) power in dB.
|
||||
* Frequency & Power - displays the selected channel's (1) centre frequency in Hz and power in dB.
|
||||
|
||||
<h3>3: T - Transparent</h3>
|
||||
<h3>3: A - Active Only</h3>
|
||||
|
||||
When active only is checked, the frequency / power will only be displayed for a channel if the channel is "active", which means its audio is unmuted and squelch is open.
|
||||
If not active, the frequency / power text will be cleared.
|
||||
When active only is unchecked, frequency / power will be displayed and spoken, regardless of the channel's audio mute or squelch.
|
||||
|
||||
<h3>4: T - Transparent</h3>
|
||||
|
||||
When Transparent mode is checked, only the centre frequency and/or power will be displayed with a transparent background,
|
||||
so it can be overlaid on other windows.
|
||||
@ -34,11 +40,11 @@ so it can be overlaid on other windows.
|
||||
When in transparent mode, the text can be repositioning by clicking and dragging it.
|
||||
To exit transparent mode, right click on any of the text, and select "Exit transparent mode" from the pop-up menu.
|
||||
|
||||
<h3>4: Speech</h3>
|
||||
<h3>5: Speech</h3>
|
||||
|
||||
When Speech mode is checked, whenever the displayed frequency and/or power value changes, the new value will be spoken.
|
||||
|
||||
<h3>5: Units</h3>
|
||||
<h3>6: Units</h3>
|
||||
|
||||
Specify the units for the frequency value:
|
||||
|
||||
@ -47,31 +53,31 @@ Specify the units for the frequency value:
|
||||
* MHz
|
||||
* GHz
|
||||
|
||||
<h3>6: U - Display Units</h3>
|
||||
<h3>7: U - Display Units</h3>
|
||||
|
||||
When the U button is checked, units will be displayed and spoken.
|
||||
|
||||
<h3>7: Freq DP - Frequency Decimal Places</h3>
|
||||
<h3>8: Freq DP - Frequency Decimal Places</h3>
|
||||
|
||||
Freq DP specifies the number of decimal places used to display frequency values, when the units (5) are not Hz.
|
||||
Freq DP specifies the number of decimal places used to display frequency values, when the units (6) are not Hz.
|
||||
|
||||
<h3>8: Power DP - Power Decimal Places</h3>
|
||||
<h3>9: Power DP - Power Decimal Places</h3>
|
||||
|
||||
Power DP specifies the number of decimal places used to display power values.
|
||||
|
||||
<h3>9: Font</h3>
|
||||
<h3>10: Font</h3>
|
||||
|
||||
Select the font used to display frequency and power values.
|
||||
|
||||
<h3>10: Font Colour</h3>
|
||||
<h3>11: Font Colour</h3>
|
||||
|
||||
Select the colour for the font used to display frequency and power values.
|
||||
|
||||
<h3>11: DS - Drop Shadow</h3>
|
||||
<h3>12: DS - Drop Shadow</h3>
|
||||
|
||||
Check to enable a drop shadow behind the frequency and power text, which can improve readability against complex backgrounds when in transparent mode.
|
||||
|
||||
<h3>12: Drop Shadow Colour</h3>
|
||||
<h3>13: Drop Shadow Colour</h3>
|
||||
|
||||
Select the colour for the drop shadow used behind the frequency and power text.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user