1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Local Sink: added spectrum scale relative frequemcy display option

This commit is contained in:
f4exb 2022-12-15 22:59:55 +01:00
parent e070b73104
commit edf464d987
3 changed files with 38 additions and 1 deletions

View File

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

View File

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

View File

@ -194,6 +194,22 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item> <item>