1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-28 15:56:33 -04:00

NFM demod: GUI: use combo box for RF demodulator bandwidths

This commit is contained in:
f4exb 2016-04-01 00:18:49 +02:00
parent 0c4d4ee385
commit dbad815b2a
3 changed files with 54 additions and 26 deletions

View File

@ -55,7 +55,7 @@ void NFMDemodGUI::resetToDefaults()
{
blockApplySettings(true);
ui->rfBW->setValue(4);
ui->rfBW->setCurrentIndex(4);
ui->afBW->setValue(3);
ui->volume->setValue(20);
ui->squelchGate->setValue(5);
@ -72,7 +72,7 @@ QByteArray NFMDemodGUI::serialize() const
{
SimpleSerializer s(1);
s.writeS32(1, m_channelMarker.getCenterFrequency());
s.writeS32(2, ui->rfBW->value());
s.writeS32(2, ui->rfBW->currentIndex());
s.writeS32(3, ui->afBW->value());
s.writeS32(4, ui->volume->value());
s.writeS32(5, ui->squelch->value());
@ -107,7 +107,7 @@ bool NFMDemodGUI::deserialize(const QByteArray& data)
d.readS32(1, &tmp, 0);
m_channelMarker.setCenterFrequency(tmp);
d.readS32(2, &tmp, 4);
ui->rfBW->setValue(tmp);
ui->rfBW->setCurrentIndex(tmp);
d.readS32(3, &tmp, 3);
ui->afBW->setValue(tmp);
d.readS32(4, &tmp, 20);
@ -175,10 +175,11 @@ void NFMDemodGUI::on_deltaFrequency_changed(quint64 value)
}
}
void NFMDemodGUI::on_rfBW_valueChanged(int value)
void NFMDemodGUI::on_rfBW_currentIndexChanged(int index)
{
ui->rfBWText->setText(QString("%1 k").arg(m_rfBW[value] / 1000.0));
m_channelMarker.setBandwidth(m_rfBW[value]);
qDebug() << "NFMDemodGUI::on_rfBW_currentIndexChanged" << index;
//ui->rfBWText->setText(QString("%1 k").arg(m_rfBW[value] / 1000.0));
m_channelMarker.setBandwidth(m_rfBW[index]);
applySettings();
}
@ -256,6 +257,14 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
blockApplySettings(true);
ui->rfBW->clear();
for (int i = 0; i < m_nbRfBW; i++) {
ui->rfBW->addItem(QString("%1").arg(m_rfBW[i] / 1000.0, 0, 'f', 2));
}
blockApplySettings(false);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
@ -320,7 +329,7 @@ void NFMDemodGUI::applySettings()
ui->deltaMinus->setChecked(m_channelMarker.getCenterFrequency() < 0);
m_nfmDemod->configure(m_nfmDemod->getInputMessageQueue(),
m_rfBW[ui->rfBW->value()],
m_rfBW[ui->rfBW->currentIndex()],
ui->afBW->value() * 1000.0,
ui->volume->value() / 10.0,
ui->squelchGate->value(), // in 10ths of ms

View File

@ -40,7 +40,7 @@ private slots:
void viewChanged();
void on_deltaFrequency_changed(quint64 value);
void on_deltaMinus_toggled(bool minus);
void on_rfBW_valueChanged(int value);
void on_rfBW_currentIndexChanged(int index);
void on_afBW_valueChanged(int value);
void on_volume_valueChanged(int value);
void on_squelchGate_valueChanged(int value);

View File

@ -153,37 +153,34 @@
</widget>
</item>
<item>
<widget class="QSlider" name="rfBW">
<widget class="QComboBox" name="rfBW">
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Demodulator (RF) bandwidth</string>
<string>RF demodulator bandwidth (kHz)</string>
</property>
<property name="maximum">
<number>8</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>4</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="rfBWText">
<widget class="QLabel" name="rfBWUnitText">
<property name="minimumSize">
<size>
<width>40</width>
<width>10</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>12.5 k</string>
<string>k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@ -200,6 +197,19 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="afLabel">
<property name="text">
@ -216,7 +226,7 @@
</size>
</property>
<property name="toolTip">
<string>Audio bandwidth</string>
<string>Audio bandwidth (kHz)</string>
</property>
<property name="minimum">
<number>1</number>
@ -270,6 +280,9 @@
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Sound volume</string>
</property>
<property name="maximum">
<number>100</number>
</property>
@ -295,6 +308,9 @@
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Sound volume</string>
</property>
<property name="text">
<string>2.0</string>
</property>
@ -331,6 +347,9 @@
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Squelch threshold (dB)</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>