SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Slots | Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
NFMDemodGUI Class Reference

#include <nfmdemodgui.h>

+ Inheritance diagram for NFMDemodGUI:
+ Collaboration diagram for NFMDemodGUI:

Public Slots

void channelMarkerChangedByCursor ()
 
void channelMarkerHighlightedByCursor ()
 

Public Member Functions

virtual void destroy ()
 
void setName (const QString &name)
 
QString getName () const
 
virtual qint64 getCenterFrequency () const
 
virtual void setCenterFrequency (qint64 centerFrequency)
 
void resetToDefaults ()
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 
virtual MessageQueuegetInputMessageQueue ()
 
virtual bool handleMessage (const Message &message)
 
void setCtcssFreq (Real ctcssFreq)
 
- Public Member Functions inherited from RollupWidget
 RollupWidget (QWidget *parent=NULL)
 
void setTitleColor (const QColor &c)
 
void setHighlighted (bool highlighted)
 
- Public Member Functions inherited from PluginInstanceGUI
 PluginInstanceGUI ()
 
virtual ~PluginInstanceGUI ()
 

Static Public Member Functions

static NFMDemodGUIcreate (PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
 

Private Slots

void on_deltaFrequency_changed (qint64 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)
 
void on_deltaSquelch_toggled (bool checked)
 
void on_squelch_valueChanged (int value)
 
void on_ctcss_currentIndexChanged (int index)
 
void on_ctcssOn_toggled (bool checked)
 
void on_highPassFilter_toggled (bool checked)
 
void on_audioMute_toggled (bool checked)
 
void onWidgetRolled (QWidget *widget, bool rollDown)
 
void onMenuDialogCalled (const QPoint &p)
 
void handleInputMessages ()
 
void audioSelect ()
 
void tick ()
 

Private Member Functions

 NFMDemodGUI (PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget *parent=0)
 
virtual ~NFMDemodGUI ()
 
void blockApplySettings (bool block)
 
void applySettings (bool force=false)
 
void displaySettings ()
 
void leaveEvent (QEvent *)
 
void enterEvent (QEvent *)
 

Private Attributes

Ui::NFMDemodGUI * ui
 
PluginAPIm_pluginAPI
 
DeviceUISetm_deviceUISet
 
ChannelMarker m_channelMarker
 
NFMDemodSettings m_settings
 
bool m_basicSettingsShown
 
bool m_doApplySettings
 
NFMDemodm_nfmDemod
 
bool m_squelchOpen
 
uint32_t m_tickCount
 
MessageQueue m_inputMessageQueue
 

Additional Inherited Members

- Signals inherited from RollupWidget
void widgetRolled (QWidget *widget, bool rollDown)
 
- Protected Types inherited from RollupWidget
enum  { VersionMarker = 0xff }
 
enum  ContextMenuType { ContextMenuNone, ContextMenuChannelSettings, ContextMenuStreamSettings }
 
- Protected Member Functions inherited from RollupWidget
int arrangeRollups ()
 
QByteArray saveState (int version=0) const
 
bool restoreState (const QByteArray &state, int version=0)
 
void paintEvent (QPaintEvent *)
 
int paintRollup (QWidget *rollup, int pos, QPainter *p, bool last, const QColor &frame)
 
void resizeEvent (QResizeEvent *size)
 
void mousePressEvent (QMouseEvent *event)
 
bool event (QEvent *event)
 
bool eventFilter (QObject *object, QEvent *event)
 
void resetContextMenuType ()
 
void setStreamIndicator (const QString &indicator)
 
- Protected Attributes inherited from RollupWidget
QColor m_titleColor
 
QColor m_titleTextColor
 
bool m_highlighted
 
ContextMenuType m_contextMenuType
 
QString m_streamIndicator
 

Detailed Description

Definition at line 22 of file nfmdemodgui.h.

Constructor & Destructor Documentation

◆ NFMDemodGUI()

NFMDemodGUI::NFMDemodGUI ( PluginAPI pluginAPI,
DeviceUISet deviceUISet,
BasebandSampleSink rxChannel,
QWidget *  parent = 0 
)
explicitprivate

Definition at line 263 of file nfmdemodgui.cpp.

References DeviceUISet::addChannelMarker(), DeviceUISet::addRollupWidget(), applySettings(), arg(), audioSelect(), blockApplySettings(), channelMarkerChangedByCursor(), channelMarkerHighlightedByCursor(), LevelMeterSignalDB::ColorGreenAndBlue, displaySettings(), NFMDemod::getCtcssToneSet(), getInputMessageQueue(), MainWindow::getInstance(), NFMDemodSettings::getRFBW(), ColorMapper::GrayGold, handleInputMessages(), i, NFMDemod::m_channelIdURI, m_channelMarker, m_deviceUISet, NFMDemodSettings::m_nbRfBW, m_nfmDemod, m_settings, onMenuDialogCalled(), onWidgetRolled(), DeviceUISet::registerRxChannelInstance(), ChannelMarker::setBandwidth(), ChannelMarker::setCenterFrequency(), NFMDemodSettings::setChannelMarker(), ChannelMarker::setColor(), BasebandSampleSink::setMessageQueueToGUI(), ChannelMarker::setTitle(), ChannelMarker::setVisible(), tick(), ui, and RollupWidget::widgetRolled().

Referenced by create().

263  :
264  RollupWidget(parent),
265  ui(new Ui::NFMDemodGUI),
266  m_pluginAPI(pluginAPI),
267  m_deviceUISet(deviceUISet),
268  m_channelMarker(this),
269  m_basicSettingsShown(false),
270  m_doApplySettings(true),
271  m_squelchOpen(false),
272  m_tickCount(0)
273 {
274  ui->setupUi(this);
275  setAttribute(Qt::WA_DeleteOnClose, true);
276 
277  connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
278  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
279 
280  m_nfmDemod = reinterpret_cast<NFMDemod*>(rxChannel); //new NFMDemod(m_deviceUISet->m_deviceSourceAPI);
282 
283  connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
284 
285  CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute);
286  connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect()));
287 
288  blockApplySettings(true);
289 
290  ui->rfBW->clear();
291 
292  for (int i = 0; i < NFMDemodSettings::m_nbRfBW; i++) {
293  ui->rfBW->addItem(QString("%1").arg(NFMDemodSettings::getRFBW(i) / 1000.0, 0, 'f', 2));
294  }
295 
296  int ctcss_nbTones;
297  const Real *ctcss_tones = m_nfmDemod->getCtcssToneSet(ctcss_nbTones);
298 
299  ui->ctcss->addItem("--");
300 
301  for (int i=0; i<ctcss_nbTones; i++)
302  {
303  ui->ctcss->addItem(QString("%1").arg(ctcss_tones[i]));
304  }
305 
306  blockApplySettings(false);
307 
308  ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); // squelch closed
309 
310  ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
311  ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
312  ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
313  ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
314 
315  m_channelMarker.blockSignals(true);
316  m_channelMarker.setColor(Qt::red);
319  m_channelMarker.setTitle("NFM Demodulator");
320  m_channelMarker.blockSignals(false);
321  m_channelMarker.setVisible(true); // activate signal on the last setting only
322 
324 
328 
329  connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
330  connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
331 
332  QChar delta = QChar(0x94, 0x03);
333  ui->deltaSquelch->setText(delta);
334 
335  connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
336 
337  displaySettings();
338  applySettings(true);
339 }
static MainWindow * getInstance()
Definition: mainwindow.h:73
const Real * getCtcssToneSet(int &nbTones) const
Definition: nfmdemod.h:159
void onMenuDialogCalled(const QPoint &p)
void blockApplySettings(bool block)
static int getRFBW(int index)
void displaySettings()
void setChannelMarker(Serializable *channelMarker)
void addChannelMarker(ChannelMarker *channelMarker)
Add channel marker to spectrum.
Definition: deviceuiset.cpp:72
DeviceUISet * m_deviceUISet
Definition: nfmdemodgui.h:48
void audioSelect()
virtual MessageQueue * getInputMessageQueue()
Definition: nfmdemodgui.h:37
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
RollupWidget(QWidget *parent=NULL)
Definition: rollupwidget.cpp:7
static const QString m_channelIdURI
Definition: nfmdemod.h:189
virtual void setMessageQueueToGUI(MessageQueue *queue)
uint32_t m_tickCount
Definition: nfmdemodgui.h:56
PluginAPI * m_pluginAPI
Definition: nfmdemodgui.h:47
void channelMarkerHighlightedByCursor()
void channelMarkerChangedByCursor()
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
void registerRxChannelInstance(const QString &channelName, PluginInstanceGUI *pluginGUI)
Definition: deviceuiset.cpp:82
bool m_doApplySettings
Definition: nfmdemodgui.h:52
void onWidgetRolled(QWidget *widget, bool rollDown)
int32_t i
Definition: decimators.h:244
void addRollupWidget(QWidget *widget)
Add rollup widget to channel window.
Definition: deviceuiset.cpp:77
bool m_squelchOpen
Definition: nfmdemodgui.h:55
void handleInputMessages()
Definition: nfmdemodgui.cpp:99
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
bool m_basicSettingsShown
Definition: nfmdemodgui.h:51
NFMDemod * m_nfmDemod
Definition: nfmdemodgui.h:54
void applySettings(bool force=false)
void setColor(const QColor &color)
void setVisible(bool visible)
void setBandwidth(int bandwidth)
void setTitle(const QString &title)
static const int m_nbRfBW
void setCenterFrequency(int centerFrequency)
void widgetRolled(QWidget *widget, bool rollDown)
float Real
Definition: dsptypes.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~NFMDemodGUI()

NFMDemodGUI::~NFMDemodGUI ( )
privatevirtual

Definition at line 341 of file nfmdemodgui.cpp.

References m_deviceUISet, m_nfmDemod, DeviceUISet::removeRxChannelInstance(), and ui.

342 {
344  delete m_nfmDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
345  delete ui;
346 }
DeviceUISet * m_deviceUISet
Definition: nfmdemodgui.h:48
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
void removeRxChannelInstance(PluginInstanceGUI *pluginGUI)
Definition: deviceuiset.cpp:94
NFMDemod * m_nfmDemod
Definition: nfmdemodgui.h:54
+ Here is the call graph for this function:

Member Function Documentation

◆ applySettings()

void NFMDemodGUI::applySettings ( bool  force = false)
private

Definition at line 348 of file nfmdemodgui.cpp.

References NFMDemod::MsgConfigureNFMDemod::create(), NFMDemod::MsgConfigureChannelizer::create(), ChannelMarker::getCenterFrequency(), BasebandSampleSink::getInputMessageQueue(), m_channelMarker, m_doApplySettings, m_nfmDemod, m_settings, and MessageQueue::push().

Referenced by audioSelect(), channelMarkerChangedByCursor(), deserialize(), NFMDemodGUI(), on_afBW_valueChanged(), on_audioMute_toggled(), on_ctcss_currentIndexChanged(), on_ctcssOn_toggled(), on_deltaFrequency_changed(), on_deltaSquelch_toggled(), on_highPassFilter_toggled(), on_rfBW_currentIndexChanged(), on_squelch_valueChanged(), on_squelchGate_valueChanged(), on_volume_valueChanged(), onMenuDialogCalled(), resetToDefaults(), and setCenterFrequency().

349 {
350  if (m_doApplySettings)
351  {
352  qDebug() << "NFMDemodGUI::applySettings";
353 
356  m_nfmDemod->getInputMessageQueue()->push(channelConfigMsg);
357 
359  m_nfmDemod->getInputMessageQueue()->push(message);
360  }
361 }
int getCenterFrequency() const
Definition: channelmarker.h:42
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgConfigureChannelizer * create(int sampleRate, int centerFrequency)
Definition: nfmdemod.h:83
static MsgConfigureNFMDemod * create(const NFMDemodSettings &settings, bool force)
Definition: nfmdemod.h:60
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
bool m_doApplySettings
Definition: nfmdemodgui.h:52
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
NFMDemod * m_nfmDemod
Definition: nfmdemodgui.h:54
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ audioSelect

void NFMDemodGUI::audioSelect ( )
privateslot

Definition at line 442 of file nfmdemodgui.cpp.

References applySettings(), DSPEngine::instance(), AudioSelectDialog::m_audioDeviceName, NFMDemodSettings::m_audioDeviceName, AudioSelectDialog::m_selected, and m_settings.

Referenced by NFMDemodGUI().

443 {
444  qDebug("NFMDemodGUI::audioSelect");
446  audioSelect.exec();
447 
448  if (audioSelect.m_selected)
449  {
450  m_settings.m_audioDeviceName = audioSelect.m_audioDeviceName;
451  applySettings();
452  }
453 }
void audioSelect()
static DSPEngine * instance()
Definition: dspengine.cpp:51
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blockApplySettings()

void NFMDemodGUI::blockApplySettings ( bool  block)
private

Definition at line 437 of file nfmdemodgui.cpp.

References m_doApplySettings.

Referenced by displaySettings(), handleMessage(), and NFMDemodGUI().

438 {
439  m_doApplySettings = !block;
440 }
bool m_doApplySettings
Definition: nfmdemodgui.h:52
+ Here is the caller graph for this function:

◆ channelMarkerChangedByCursor

void NFMDemodGUI::channelMarkerChangedByCursor ( )
slot

Definition at line 112 of file nfmdemodgui.cpp.

References applySettings(), ChannelMarker::getCenterFrequency(), m_channelMarker, NFMDemodSettings::m_inputFrequencyOffset, m_settings, and ui.

Referenced by NFMDemodGUI().

113 {
114  ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
116  applySettings();
117 }
int getCenterFrequency() const
Definition: channelmarker.h:42
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
int32_t m_inputFrequencyOffset
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ channelMarkerHighlightedByCursor

void NFMDemodGUI::channelMarkerHighlightedByCursor ( )
slot

Definition at line 119 of file nfmdemodgui.cpp.

References ChannelMarker::getHighlighted(), m_channelMarker, and RollupWidget::setHighlighted().

Referenced by NFMDemodGUI().

120 {
122 }
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
bool getHighlighted() const
Definition: channelmarker.h:61
void setHighlighted(bool highlighted)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

NFMDemodGUI * NFMDemodGUI::create ( PluginAPI pluginAPI,
DeviceUISet deviceUISet,
BasebandSampleSink rxChannel 
)
static

Definition at line 19 of file nfmdemodgui.cpp.

References NFMDemodGUI().

Referenced by NFMPlugin::createRxChannelGUI().

20 {
21  NFMDemodGUI* gui = new NFMDemodGUI(pluginAPI, deviceUISet, rxChannel);
22  return gui;
23 }
NFMDemodGUI(PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget *parent=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserialize()

bool NFMDemodGUI::deserialize ( const QByteArray &  data)
virtual

Implements PluginInstanceGUI.

Definition at line 63 of file nfmdemodgui.cpp.

References applySettings(), NFMDemodSettings::deserialize(), displaySettings(), m_settings, and resetToDefaults().

64 {
65  if(m_settings.deserialize(data)) {
67  applySettings(true);
68  return true;
69  } else {
71  return false;
72  }
73 }
bool deserialize(const QByteArray &data)
void displaySettings()
void resetToDefaults()
Definition: nfmdemodgui.cpp:51
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ destroy()

void NFMDemodGUI::destroy ( )
virtual

Implements PluginInstanceGUI.

Definition at line 25 of file nfmdemodgui.cpp.

26 {
27  delete this;
28 }

◆ displaySettings()

void NFMDemodGUI::displaySettings ( )
private

Definition at line 363 of file nfmdemodgui.cpp.

References arg(), blockApplySettings(), ChannelMarker::getCenterFrequency(), NFMDemodSettings::getRFBWIndex(), ChannelMarker::getTitle(), NFMDemodSettings::m_afBandwidth, NFMDemodSettings::m_audioMute, m_channelMarker, NFMDemodSettings::m_ctcssIndex, NFMDemodSettings::m_ctcssOn, NFMDemodSettings::m_deltaSquelch, NFMDemodSettings::m_highPass, NFMDemodSettings::m_inputFrequencyOffset, NFMDemodSettings::m_rfBandwidth, NFMDemodSettings::m_rgbColor, m_settings, NFMDemodSettings::m_squelch, NFMDemodSettings::m_squelchGate, NFMDemodSettings::m_title, NFMDemodSettings::m_volume, ChannelMarker::setBandwidth(), ChannelMarker::setCenterFrequency(), ChannelMarker::setColor(), ChannelMarker::setTitle(), RollupWidget::setTitleColor(), and ui.

Referenced by deserialize(), handleMessage(), NFMDemodGUI(), and resetToDefaults().

364 {
365  m_channelMarker.blockSignals(true);
369  m_channelMarker.blockSignals(false);
371 
373  setWindowTitle(m_channelMarker.getTitle());
374 
375  blockApplySettings(true);
376 
377  ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
378 
380 
381  ui->afBWText->setText(QString("%1 k").arg(m_settings.m_afBandwidth / 1000.0));
382  ui->afBW->setValue(m_settings.m_afBandwidth / 1000.0);
383 
384  ui->volumeText->setText(QString("%1").arg(m_settings.m_volume, 0, 'f', 1));
385  ui->volume->setValue(m_settings.m_volume * 10.0);
386 
387  ui->squelchGateText->setText(QString("%1").arg(m_settings.m_squelchGate * 10.0f, 0, 'f', 0));
388  ui->squelchGate->setValue(m_settings.m_squelchGate);
389 
390  ui->deltaSquelch->setChecked(m_settings.m_deltaSquelch);
391  ui->squelch->setValue(m_settings.m_squelch * 1.0);
392 
394  {
395  ui->squelchText->setText(QString("%1").arg((-m_settings.m_squelch) / 1.0, 0, 'f', 0));
396  ui->squelchText->setToolTip(tr("Squelch AF balance threshold (%)"));
397  ui->squelch->setToolTip(tr("Squelch AF balance threshold (%)"));
398  }
399  else
400  {
401  ui->squelchText->setText(QString("%1").arg(m_settings.m_squelch / 1.0, 0, 'f', 0));
402  ui->squelchText->setToolTip(tr("Squelch power threshold (dB)"));
403  ui->squelch->setToolTip(tr("Squelch power threshold (dB)"));
404  }
405 
406  ui->ctcssOn->setChecked(m_settings.m_ctcssOn);
407  ui->highPassFilter->setChecked(m_settings.m_highPass);
408  ui->audioMute->setChecked(m_settings.m_audioMute);
409 
410  ui->ctcss->setCurrentIndex(m_settings.m_ctcssIndex);
411 
412  blockApplySettings(false);
413 }
int getCenterFrequency() const
Definition: channelmarker.h:42
void blockApplySettings(bool block)
Real m_squelch
deci-Bels
static int getRFBWIndex(int rfbw)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
void setTitleColor(const QColor &c)
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
const QString & getTitle() const
Definition: channelmarker.h:38
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void setColor(const QColor &color)
void setBandwidth(int bandwidth)
void setTitle(const QString &title)
int32_t m_inputFrequencyOffset
void setCenterFrequency(int centerFrequency)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enterEvent()

void NFMDemodGUI::enterEvent ( QEvent *  )
private

Definition at line 420 of file nfmdemodgui.cpp.

References m_channelMarker, and ChannelMarker::setHighlighted().

421 {
423 }
void setHighlighted(bool highlighted)
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
+ Here is the call graph for this function:

◆ getCenterFrequency()

qint64 NFMDemodGUI::getCenterFrequency ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 40 of file nfmdemodgui.cpp.

References ChannelMarker::getCenterFrequency(), and m_channelMarker.

41 {
43 }
int getCenterFrequency() const
Definition: channelmarker.h:42
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
+ Here is the call graph for this function:

◆ getInputMessageQueue()

virtual MessageQueue* NFMDemodGUI::getInputMessageQueue ( )
inlinevirtual

Implements PluginInstanceGUI.

Definition at line 37 of file nfmdemodgui.h.

Referenced by handleInputMessages(), and NFMDemodGUI().

37 { return &m_inputMessageQueue; }
MessageQueue m_inputMessageQueue
Definition: nfmdemodgui.h:57
+ Here is the caller graph for this function:

◆ getName()

QString NFMDemodGUI::getName ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 35 of file nfmdemodgui.cpp.

36 {
37  return objectName();
38 }

◆ handleInputMessages

void NFMDemodGUI::handleInputMessages ( )
privateslot

Definition at line 99 of file nfmdemodgui.cpp.

References getInputMessageQueue(), and handleMessage().

Referenced by NFMDemodGUI().

100 {
101  Message* message;
102 
103  while ((message = getInputMessageQueue()->pop()) != 0)
104  {
105  if (handleMessage(*message))
106  {
107  delete message;
108  }
109  }
110 }
virtual MessageQueue * getInputMessageQueue()
Definition: nfmdemodgui.h:37
virtual bool handleMessage(const Message &message)
Definition: nfmdemodgui.cpp:75
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMessage()

bool NFMDemodGUI::handleMessage ( const Message message)
virtual

Implements PluginInstanceGUI.

Definition at line 75 of file nfmdemodgui.cpp.

References blockApplySettings(), displaySettings(), NFMDemod::MsgReportCTCSSFreq::getFrequency(), NFMDemod::MsgConfigureNFMDemod::getSettings(), m_settings, Message::match(), and setCtcssFreq().

Referenced by handleInputMessages().

76 {
78  {
79  //qDebug("NFMDemodGUI::handleMessage: NFMDemod::MsgReportCTCSSFreq");
81  setCtcssFreq(report.getFrequency());
82  //qDebug("NFMDemodGUI::handleMessage: MsgReportCTCSSFreq: %f", report.getFrequency());
83  return true;
84  }
85  else if (NFMDemod::MsgConfigureNFMDemod::match(message))
86  {
87  qDebug("NFMDemodGUI::handleMessage: NFMDemod::MsgConfigureNFMDemod");
89  m_settings = cfg.getSettings();
90  blockApplySettings(true);
92  blockApplySettings(false);
93  return true;
94  }
95 
96  return false;
97 }
void setCtcssFreq(Real ctcssFreq)
void blockApplySettings(bool block)
void displaySettings()
static bool match(const Message *message)
Definition: message.cpp:45
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
const NFMDemodSettings & getSettings() const
Definition: nfmdemod.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leaveEvent()

void NFMDemodGUI::leaveEvent ( QEvent *  )
private

Definition at line 415 of file nfmdemodgui.cpp.

References m_channelMarker, and ChannelMarker::setHighlighted().

416 {
418 }
void setHighlighted(bool highlighted)
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
+ Here is the call graph for this function:

◆ on_afBW_valueChanged

void NFMDemodGUI::on_afBW_valueChanged ( int  value)
privateslot

Definition at line 141 of file nfmdemodgui.cpp.

References applySettings(), arg(), NFMDemodSettings::m_afBandwidth, m_settings, and ui.

142 {
143  ui->afBWText->setText(QString("%1 k").arg(value));
144  m_settings.m_afBandwidth = value * 1000.0;
145  applySettings();
146 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ on_audioMute_toggled

void NFMDemodGUI::on_audioMute_toggled ( bool  checked)
privateslot

Definition at line 210 of file nfmdemodgui.cpp.

References applySettings(), NFMDemodSettings::m_audioMute, and m_settings.

211 {
212  m_settings.m_audioMute = checked;
213  applySettings();
214 }
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ on_ctcss_currentIndexChanged

void NFMDemodGUI::on_ctcss_currentIndexChanged ( int  index)
privateslot

Definition at line 216 of file nfmdemodgui.cpp.

References applySettings(), NFMDemodSettings::m_ctcssIndex, and m_settings.

217 {
218  m_settings.m_ctcssIndex = index;
219  applySettings();
220 }
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ on_ctcssOn_toggled

void NFMDemodGUI::on_ctcssOn_toggled ( bool  checked)
privateslot

Definition at line 198 of file nfmdemodgui.cpp.

References applySettings(), NFMDemodSettings::m_ctcssOn, and m_settings.

199 {
200  m_settings.m_ctcssOn = checked;
201  applySettings();
202 }
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ on_deltaFrequency_changed

void NFMDemodGUI::on_deltaFrequency_changed ( qint64  value)
privateslot

Definition at line 124 of file nfmdemodgui.cpp.

References applySettings(), ChannelMarker::getCenterFrequency(), m_channelMarker, NFMDemodSettings::m_inputFrequencyOffset, m_settings, and ChannelMarker::setCenterFrequency().

125 {
128  applySettings();
129 }
int getCenterFrequency() const
Definition: channelmarker.h:42
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
int32_t m_inputFrequencyOffset
void setCenterFrequency(int centerFrequency)
+ Here is the call graph for this function:

◆ on_deltaSquelch_toggled

void NFMDemodGUI::on_deltaSquelch_toggled ( bool  checked)
privateslot

Definition at line 162 of file nfmdemodgui.cpp.

References applySettings(), arg(), NFMDemodSettings::m_deltaSquelch, m_settings, and ui.

163 {
164  if (checked)
165  {
166  ui->squelchText->setText(QString("%1").arg((-ui->squelch->value()) / 1.0, 0, 'f', 0));
167  ui->squelchText->setToolTip(tr("Squelch AF balance threshold (%)"));
168  ui->squelch->setToolTip(tr("Squelch AF balance threshold (%)"));
169  }
170  else
171  {
172  ui->squelchText->setText(QString("%1").arg(ui->squelch->value() / 1.0, 0, 'f', 0));
173  ui->squelchText->setToolTip(tr("Squelch power threshold (dB)"));
174  ui->squelch->setToolTip(tr("Squelch power threshold (dB)"));
175  }
176  m_settings.m_deltaSquelch = checked;
177  applySettings();
178 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ on_highPassFilter_toggled

void NFMDemodGUI::on_highPassFilter_toggled ( bool  checked)
privateslot

Definition at line 204 of file nfmdemodgui.cpp.

References applySettings(), NFMDemodSettings::m_highPass, and m_settings.

205 {
206  m_settings.m_highPass = checked;
207  applySettings();
208 }
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ on_rfBW_currentIndexChanged

void NFMDemodGUI::on_rfBW_currentIndexChanged ( int  index)
privateslot

Definition at line 131 of file nfmdemodgui.cpp.

References applySettings(), NFMDemodSettings::getFMDev(), NFMDemodSettings::getRFBW(), m_channelMarker, NFMDemodSettings::m_fmDeviation, NFMDemodSettings::m_rfBandwidth, m_settings, and ChannelMarker::setBandwidth().

132 {
133  qDebug() << "NFMDemodGUI::on_rfBW_currentIndexChanged" << index;
134  //ui->rfBWText->setText(QString("%1 k").arg(m_rfBW[value] / 1000.0));
138  applySettings();
139 }
static int getFMDev(int index)
static int getRFBW(int index)
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
void setBandwidth(int bandwidth)
+ Here is the call graph for this function:

◆ on_squelch_valueChanged

void NFMDemodGUI::on_squelch_valueChanged ( int  value)
privateslot

Definition at line 180 of file nfmdemodgui.cpp.

References applySettings(), arg(), m_settings, NFMDemodSettings::m_squelch, and ui.

181 {
182  if (ui->deltaSquelch->isChecked())
183  {
184  ui->squelchText->setText(QString("%1").arg(-value / 1.0, 0, 'f', 0));
185  ui->squelchText->setToolTip(tr("Squelch AF balance threshold (%)"));
186  ui->squelch->setToolTip(tr("Squelch AF balance threshold (%)"));
187  }
188  else
189  {
190  ui->squelchText->setText(QString("%1").arg(value / 1.0, 0, 'f', 0));
191  ui->squelchText->setToolTip(tr("Squelch power threshold (dB)"));
192  ui->squelch->setToolTip(tr("Squelch power threshold (dB)"));
193  }
194  m_settings.m_squelch = value * 1.0;
195  applySettings();
196 }
Real m_squelch
deci-Bels
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ on_squelchGate_valueChanged

void NFMDemodGUI::on_squelchGate_valueChanged ( int  value)
privateslot

Definition at line 155 of file nfmdemodgui.cpp.

References applySettings(), arg(), m_settings, NFMDemodSettings::m_squelchGate, and ui.

156 {
157  ui->squelchGateText->setText(QString("%1").arg(value * 10.0f, 0, 'f', 0));
158  m_settings.m_squelchGate = value;
159  applySettings();
160 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ on_volume_valueChanged

void NFMDemodGUI::on_volume_valueChanged ( int  value)
privateslot

Definition at line 148 of file nfmdemodgui.cpp.

References applySettings(), arg(), m_settings, NFMDemodSettings::m_volume, and ui.

149 {
150  ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
151  m_settings.m_volume = value / 10.0;
152  applySettings();
153 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:

◆ onMenuDialogCalled

void NFMDemodGUI::onMenuDialogCalled ( const QPoint &  p)
privateslot

Definition at line 232 of file nfmdemodgui.cpp.

References applySettings(), RollupWidget::ContextMenuChannelSettings, ChannelMarker::getCenterFrequency(), ChannelMarker::getColor(), BasicChannelSettingsDialog::getReverseAPIAddress(), BasicChannelSettingsDialog::getReverseAPIChannelIndex(), BasicChannelSettingsDialog::getReverseAPIDeviceIndex(), BasicChannelSettingsDialog::getReverseAPIPort(), ChannelMarker::getTitle(), m_channelMarker, RollupWidget::m_contextMenuType, NFMDemodSettings::m_inputFrequencyOffset, NFMDemodSettings::m_reverseAPIAddress, NFMDemodSettings::m_reverseAPIChannelIndex, NFMDemodSettings::m_reverseAPIDeviceIndex, NFMDemodSettings::m_reverseAPIPort, NFMDemodSettings::m_rgbColor, m_settings, NFMDemodSettings::m_title, NFMDemodSettings::m_useReverseAPI, RollupWidget::resetContextMenuType(), BasicChannelSettingsDialog::setReverseAPIAddress(), BasicChannelSettingsDialog::setReverseAPIChannelIndex(), BasicChannelSettingsDialog::setReverseAPIDeviceIndex(), BasicChannelSettingsDialog::setReverseAPIPort(), RollupWidget::setTitleColor(), BasicChannelSettingsDialog::setUseReverseAPI(), and BasicChannelSettingsDialog::useReverseAPI().

Referenced by NFMDemodGUI().

233 {
235  {
237  dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
238  dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
239  dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
240  dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
241  dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex);
242  dialog.move(p);
243  dialog.exec();
244 
248  m_settings.m_useReverseAPI = dialog.useReverseAPI();
249  m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
250  m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
251  m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
252  m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex();
253 
254  setWindowTitle(m_settings.m_title);
256 
257  applySettings();
258  }
259 
261 }
uint16_t m_reverseAPIPort
int getCenterFrequency() const
Definition: channelmarker.h:42
void resetContextMenuType()
Definition: rollupwidget.h:50
ContextMenuType m_contextMenuType
Definition: rollupwidget.h:33
QString m_reverseAPIAddress
void setTitleColor(const QColor &c)
uint16_t m_reverseAPIChannelIndex
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
const QString & getTitle() const
Definition: channelmarker.h:38
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
uint16_t m_reverseAPIDeviceIndex
void applySettings(bool force=false)
const QColor & getColor() const
Definition: channelmarker.h:64
int32_t m_inputFrequencyOffset
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onWidgetRolled

void NFMDemodGUI::onWidgetRolled ( QWidget *  widget,
bool  rollDown 
)
privateslot

Definition at line 222 of file nfmdemodgui.cpp.

Referenced by NFMDemodGUI().

223 {
224  (void) widget;
225  (void) rollDown;
226  /*
227  if((widget == ui->spectrumContainer) && (m_nfmDemod != NULL))
228  m_nfmDemod->setSpectrum(m_threadedSampleSink->getMessageQueue(), rollDown);
229  */
230 }
+ Here is the caller graph for this function:

◆ resetToDefaults()

void NFMDemodGUI::resetToDefaults ( )
virtual

Implements PluginInstanceGUI.

Definition at line 51 of file nfmdemodgui.cpp.

References applySettings(), displaySettings(), m_settings, and NFMDemodSettings::resetToDefaults().

Referenced by deserialize().

52 {
55  applySettings();
56 }
void displaySettings()
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
void applySettings(bool force=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

QByteArray NFMDemodGUI::serialize ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 58 of file nfmdemodgui.cpp.

References m_settings, and NFMDemodSettings::serialize().

59 {
60  return m_settings.serialize();
61 }
QByteArray serialize() const
NFMDemodSettings m_settings
Definition: nfmdemodgui.h:50
+ Here is the call graph for this function:

◆ setCenterFrequency()

void NFMDemodGUI::setCenterFrequency ( qint64  centerFrequency)
virtual

Implements PluginInstanceGUI.

Definition at line 45 of file nfmdemodgui.cpp.

References applySettings(), m_channelMarker, and ChannelMarker::setCenterFrequency().

46 {
47  m_channelMarker.setCenterFrequency(centerFrequency);
48  applySettings();
49 }
ChannelMarker m_channelMarker
Definition: nfmdemodgui.h:49
void applySettings(bool force=false)
void setCenterFrequency(int centerFrequency)
+ Here is the call graph for this function:

◆ setCtcssFreq()

void NFMDemodGUI::setCtcssFreq ( Real  ctcssFreq)

Definition at line 425 of file nfmdemodgui.cpp.

References arg(), and ui.

Referenced by handleMessage().

426 {
427  if (ctcssFreq == 0)
428  {
429  ui->ctcssText->setText("--");
430  }
431  else
432  {
433  ui->ctcssText->setText(QString("%1").arg(ctcssFreq));
434  }
435 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setName()

void NFMDemodGUI::setName ( const QString &  name)
virtual

Implements PluginInstanceGUI.

Definition at line 30 of file nfmdemodgui.cpp.

31 {
32  setObjectName(name);
33 }

◆ tick

void NFMDemodGUI::tick ( )
privateslot

Definition at line 455 of file nfmdemodgui.cpp.

References arg(), CalcDb::dbPower(), NFMDemod::getMagSqLevels(), NFMDemod::getSquelchOpen(), m_nfmDemod, m_squelchOpen, m_tickCount, and ui.

Referenced by NFMDemodGUI().

456 {
457  double magsqAvg, magsqPeak;
458  int nbMagsqSamples;
459  m_nfmDemod->getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
460  double powDbAvg = CalcDb::dbPower(magsqAvg);
461  double powDbPeak = CalcDb::dbPower(magsqPeak);
462 
463  ui->channelPowerMeter->levelChanged(
464  (100.0f + powDbAvg) / 100.0f,
465  (100.0f + powDbPeak) / 100.0f,
466  nbMagsqSamples);
467 
468  if (m_tickCount % 4 == 0) {
469  ui->channelPower->setText(tr("%1 dB").arg(powDbAvg, 0, 'f', 1));
470  }
471 
472  bool squelchOpen = m_nfmDemod->getSquelchOpen();
473 
474  if (squelchOpen != m_squelchOpen)
475  {
476  if (squelchOpen) {
477  ui->audioMute->setStyleSheet("QToolButton { background-color : green; }");
478  } else {
479  ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
480  }
481 
482  m_squelchOpen = squelchOpen;
483  }
484 
485  m_tickCount++;
486 }
void getMagSqLevels(double &avg, double &peak, int &nbSamples)
Definition: nfmdemod.h:171
static double dbPower(double magsq, double floor=1e-12)
Definition: db.cpp:22
bool getSquelchOpen() const
Definition: nfmdemod.h:169
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::NFMDemodGUI * ui
Definition: nfmdemodgui.h:46
uint32_t m_tickCount
Definition: nfmdemodgui.h:56
bool m_squelchOpen
Definition: nfmdemodgui.h:55
NFMDemod * m_nfmDemod
Definition: nfmdemodgui.h:54
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_basicSettingsShown

bool NFMDemodGUI::m_basicSettingsShown
private

Definition at line 51 of file nfmdemodgui.h.

◆ m_channelMarker

ChannelMarker NFMDemodGUI::m_channelMarker
private

◆ m_deviceUISet

DeviceUISet* NFMDemodGUI::m_deviceUISet
private

Definition at line 48 of file nfmdemodgui.h.

Referenced by NFMDemodGUI(), and ~NFMDemodGUI().

◆ m_doApplySettings

bool NFMDemodGUI::m_doApplySettings
private

Definition at line 52 of file nfmdemodgui.h.

Referenced by applySettings(), and blockApplySettings().

◆ m_inputMessageQueue

MessageQueue NFMDemodGUI::m_inputMessageQueue
private

Definition at line 57 of file nfmdemodgui.h.

◆ m_nfmDemod

NFMDemod* NFMDemodGUI::m_nfmDemod
private

Definition at line 54 of file nfmdemodgui.h.

Referenced by applySettings(), NFMDemodGUI(), tick(), and ~NFMDemodGUI().

◆ m_pluginAPI

PluginAPI* NFMDemodGUI::m_pluginAPI
private

Definition at line 47 of file nfmdemodgui.h.

◆ m_settings

NFMDemodSettings NFMDemodGUI::m_settings
private

◆ m_squelchOpen

bool NFMDemodGUI::m_squelchOpen
private

Definition at line 55 of file nfmdemodgui.h.

Referenced by tick().

◆ m_tickCount

uint32_t NFMDemodGUI::m_tickCount
private

Definition at line 56 of file nfmdemodgui.h.

Referenced by tick().

◆ ui

Ui::NFMDemodGUI* NFMDemodGUI::ui
private

The documentation for this class was generated from the following files: