From 51a18d231af590ff9c84018b1060feb1709d5679 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 10 May 2015 15:13:29 +0200 Subject: [PATCH] use ValueDial for NFM channel shift thus allowing fine tuning --- plugins/channel/nfm/nfmdemodgui.cpp | 29 ++++- plugins/channel/nfm/nfmdemodgui.h | 2 + plugins/channel/nfm/nfmdemodgui.ui | 180 ++++++++++++++++------------ 3 files changed, 131 insertions(+), 80 deletions(-) diff --git a/plugins/channel/nfm/nfmdemodgui.cpp b/plugins/channel/nfm/nfmdemodgui.cpp index 109b06108..ecc25482b 100644 --- a/plugins/channel/nfm/nfmdemodgui.cpp +++ b/plugins/channel/nfm/nfmdemodgui.cpp @@ -2,8 +2,6 @@ #include #include "nfmdemodgui.h" #include "ui_nfmdemodgui.h" -#include "nfmdemodgui.h" -#include "ui_nfmdemodgui.h" #include "dsp/threadedsamplesink.h" #include "dsp/channelizer.h" #include "nfmdemod.h" @@ -13,6 +11,8 @@ #include "util/simpleserializer.h" #include "gui/basicchannelsettingswidget.h" +#include + const int NFMDemodGUI::m_rfBW[] = { 5000, 6250, 8330, 10000, 12500, 15000, 20000, 25000, 40000 }; @@ -39,7 +39,7 @@ void NFMDemodGUI::resetToDefaults() ui->afBW->setValue(3); ui->volume->setValue(20); ui->squelch->setValue(-40); - ui->fcenter->display(0); + ui->deltaFrequency->setValue(0); ui->spectrumGUI->resetToDefaults(); applySettings(); } @@ -102,6 +102,26 @@ void NFMDemodGUI::viewChanged() applySettings(); } +void NFMDemodGUI::on_deltaMinus_clicked(bool minus) +{ + int deltaFrequency = m_channelMarker->getCenterFrequency(); + bool minusDelta = (deltaFrequency < 0); + + if (minus ^ minusDelta) // sign change + { + m_channelMarker->setCenterFrequency(-deltaFrequency); + } +} + +void NFMDemodGUI::on_deltaFrequency_changed(quint64 value) +{ + if (ui->deltaMinus->isChecked()) { + m_channelMarker->setCenterFrequency(-value); + } else { + m_channelMarker->setCenterFrequency(value); + } +} + void NFMDemodGUI::on_rfBW_valueChanged(int value) { ui->rfBWText->setText(QString("%1 kHz").arg(m_rfBW[value] / 1000.0)); @@ -203,7 +223,8 @@ void NFMDemodGUI::applySettings() m_channelizer->configure(m_threadedSampleSink->getMessageQueue(), 48000, m_channelMarker->getCenterFrequency()); - ui->fcenter->display(m_channelMarker->getCenterFrequency()); + ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency())); + ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0); m_nfmDemod->configure(m_threadedSampleSink->getMessageQueue(), m_rfBW[ui->rfBW->value()], ui->afBW->value() * 1000.0, diff --git a/plugins/channel/nfm/nfmdemodgui.h b/plugins/channel/nfm/nfmdemodgui.h index edfb80860..ff26c5151 100644 --- a/plugins/channel/nfm/nfmdemodgui.h +++ b/plugins/channel/nfm/nfmdemodgui.h @@ -34,6 +34,8 @@ public: private slots: void viewChanged(); + void on_deltaFrequency_changed(quint64 value); + void on_deltaMinus_clicked(bool minus); void on_rfBW_valueChanged(int value); void on_afBW_valueChanged(int value); void on_volume_valueChanged(int value); diff --git a/plugins/channel/nfm/nfmdemodgui.ui b/plugins/channel/nfm/nfmdemodgui.ui index 51953cafe..381f38ecd 100644 --- a/plugins/channel/nfm/nfmdemodgui.ui +++ b/plugins/channel/nfm/nfmdemodgui.ui @@ -41,10 +41,16 @@ 3 - - - - RF Bandwidth + + + + 100 + + + 20 + + + Qt::Horizontal @@ -64,6 +70,46 @@ + + + + Qt::RightToLeft + + + Minus + + + + + + + Squelch + + + + + + + AF Bandwidth + + + + + + + -100 + + + 0 + + + -40 + + + Qt::Horizontal + + + @@ -80,10 +126,26 @@ - - + + - AF Bandwidth + RF Bandwidth + + + + + + + + 50 + 0 + + + + 3 kHz + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -106,15 +168,8 @@ - - - - Volume - - - - - + + 50 @@ -122,30 +177,17 @@ - 3 kHz + -40dB Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - Squelch - - - - - - - 100 - - - 20 - - - Qt::Horizontal + Volume @@ -165,58 +207,38 @@ - - - - -100 + + + + + 0 + 0 + - - 0 - - - -40 - - - Qt::Horizontal - - - - - - 50 - 0 + 32 + 16 - - -40dB + + + Monospace + 12 + - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + Qt::StrongFocus - - - - - - df (Hz) - - - - - - <html><head/><body><p>Frequency shift from center frequency</p></body></html> + Demod shift frequency from center in Hz - - true - - - 7 - - - QLCDNumber::Flat + + + + + + Hz @@ -292,6 +314,12 @@
gui/rollupwidget.h
1 + + ValueDial + QWidget +
gui/valuedial.h
+ 1 +