Local Sink: added spectrum scale relative frequemcy display option

pull/1539/head
f4exb 2022-12-15 22:59:55 +01:00
rodzic e070b73104
commit edf464d987
3 zmienionych plików z 38 dodań i 1 usunięć

Wyświetl plik

@ -228,7 +228,13 @@ void LocalSinkGUI::displayRateAndShift()
ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
ui->glSpectrum->setSampleRate(channelSampleRate);
ui->glSpectrum->setCenterFrequency(m_deviceCenterFrequency + shift);
if (ui->relativeSpectrum->isChecked()) {
ui->glSpectrum->setCenterFrequency(0);
} else {
ui->glSpectrum->setCenterFrequency(m_deviceCenterFrequency + shift);
}
m_channelMarker.setCenterFrequency(shift);
m_channelMarker.setBandwidth(channelSampleRate);
}
@ -399,6 +405,19 @@ void LocalSinkGUI::on_decimationFactor_currentIndexChanged(int index)
applyDecimation();
}
void LocalSinkGUI::on_relativeSpectrum_toggled(bool checked)
{
if (checked)
{
ui->glSpectrum->setCenterFrequency(0);
}
else
{
int shift = m_shiftFrequencyFactor * m_basebandSampleRate;
ui->glSpectrum->setCenterFrequency(m_deviceCenterFrequency + shift);
}
}
void LocalSinkGUI::on_position_valueChanged(int value)
{
m_settings.m_filterChainHash = value;
@ -572,6 +591,7 @@ void LocalSinkGUI::tick()
void LocalSinkGUI::makeUIConnections()
{
QObject::connect(ui->decimationFactor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &LocalSinkGUI::on_decimationFactor_currentIndexChanged);
QObject::connect(ui->relativeSpectrum, &ButtonSwitch::toggled, this, &LocalSinkGUI::on_relativeSpectrum_toggled);
QObject::connect(ui->position, &QSlider::valueChanged, this, &LocalSinkGUI::on_position_valueChanged);
QObject::connect(ui->localDevice, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &LocalSinkGUI::on_localDevice_currentIndexChanged);
QObject::connect(ui->localDevicePlay, &ButtonSwitch::toggled, this, &LocalSinkGUI::on_localDevicePlay_toggled);

Wyświetl plik

@ -106,6 +106,7 @@ private:
private slots:
void handleSourceMessages();
void on_decimationFactor_currentIndexChanged(int index);
void on_relativeSpectrum_toggled(bool checked);
void on_position_valueChanged(int value);
void on_localDevice_currentIndexChanged(int index);
void on_localDevicePlay_toggled(bool checked);

Wyświetl plik

@ -194,6 +194,22 @@
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="relativeSpectrum">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Toggle absolute or relative frequency display on spectrum scale</string>
</property>
<property name="text">
<string>REL</string>
</property>
</widget>
</item>
</layout>
</item>
<item>