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

WFM Demod: applied new channel marker signal handling

This commit is contained in:
f4exb 2017-11-14 08:27:38 +01:00
parent 20b93b8186
commit 159fcad964
2 changed files with 40 additions and 33 deletions

View File

@ -78,15 +78,11 @@ bool WFMDemodGUI::handleMessage(const Message& message __attribute__((unused)))
return false;
}
void WFMDemodGUI::channelMarkerChanged()
void WFMDemodGUI::channelMarkerChangedByCursor()
{
setWindowTitle(m_channelMarker.getTitle());
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
m_settings.m_udpAddress = m_channelMarker.getUDPAddress(),
m_settings.m_udpPort = m_channelMarker.getUDPSendPort(),
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
displayUDPAddress();
applySettings();
applySettings();
}
void WFMDemodGUI::on_deltaFrequency_changed(qint64 value)
@ -139,6 +135,17 @@ void WFMDemodGUI::onMenuDialogCalled(const QPoint &p)
BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.move(p);
dialog.exec();
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
m_settings.m_udpAddress = m_channelMarker.getUDPAddress(),
m_settings.m_udpPort = m_channelMarker.getUDPSendPort(),
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
setWindowTitle(m_channelMarker.getTitle());
setTitleColor(m_settings.m_rgbColor);
displayUDPAddress();
applySettings();
}
WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent) :
@ -172,22 +179,25 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
ui->rfBW->setCurrentIndex(6);
blockApplySettings(false);
m_channelMarker.blockSignals(true);
m_channelMarker.setBandwidth(WFMDemodSettings::getRFBW(4));
m_channelMarker.setCenterFrequency(0);
m_channelMarker.setTitle("WFM Demodulator");
m_channelMarker.setUDPAddress("127.0.0.1");
m_channelMarker.setUDPSendPort(9999);
m_channelMarker.setColor(m_settings.m_rgbColor);
m_channelMarker.setVisible(true);
setTitleColor(m_channelMarker.getColor());
m_settings.setChannelMarker(&m_channelMarker);
m_channelMarker.blockSignals(false);
m_channelMarker.setVisible(true); // activate signal on the last setting only
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
setTitleColor(m_channelMarker.getColor());
m_settings.setChannelMarker(&m_channelMarker);
m_deviceUISet->registerRxChannelInstance(WFMDemod::m_channelID, this);
m_deviceUISet->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this);
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
displaySettings();
applySettings(true);
}
@ -209,15 +219,11 @@ void WFMDemodGUI::applySettings(bool force)
{
if (m_doApplySettings)
{
setTitleColor(m_channelMarker.getColor());
WFMDemod::MsgConfigureChannelizer *msgChan = WFMDemod::MsgConfigureChannelizer::create(
requiredBW(WFMDemodSettings::getRFBW(ui->rfBW->currentIndex())),
m_channelMarker.getCenterFrequency());
m_wfmDemod->getInputMessageQueue()->push(msgChan);
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
WFMDemod::MsgConfigureWFMDemod* msgConfig = WFMDemod::MsgConfigureWFMDemod::create( m_settings, force);
m_wfmDemod->getInputMessageQueue()->push(msgConfig);
}
@ -227,16 +233,19 @@ void WFMDemodGUI::displaySettings()
{
m_channelMarker.blockSignals(true);
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
m_channelMarker.setColor(m_settings.m_rgbColor);
setTitleColor(m_settings.m_rgbColor);
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
m_channelMarker.blockSignals(false);
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
setTitleColor(m_settings.m_rgbColor);
setWindowTitle(m_channelMarker.getTitle());
displayUDPAddress();
blockApplySettings(true);
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->rfBW->setCurrentIndex(WFMDemodSettings::getRFBWIndex(m_settings.m_rfBandwidth));
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
ui->afBW->setValue(m_settings.m_afBandwidth/1000.0);
ui->afBWText->setText(QString("%1 kHz").arg(m_settings.m_afBandwidth/1000.0));
@ -257,16 +266,12 @@ void WFMDemodGUI::displayUDPAddress()
void WFMDemodGUI::leaveEvent(QEvent*)
{
blockApplySettings(true);
m_channelMarker.setHighlighted(false);
blockApplySettings(false);
}
void WFMDemodGUI::enterEvent(QEvent*)
{
blockApplySettings(true);
m_channelMarker.setHighlighted(true);
blockApplySettings(false);
}
void WFMDemodGUI::tick()

View File

@ -36,17 +36,8 @@ public:
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual bool handleMessage(const Message& message);
private slots:
void channelMarkerChanged();
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_squelch_valueChanged(int value);
void on_audioMute_toggled(bool checked);
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p);
void tick();
public slots:
void channelMarkerChangedByCursor();
private:
Ui::WFMDemodGUI* ui;
@ -82,6 +73,17 @@ private:
return (3*rfBW)/2;
}
}
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_squelch_valueChanged(int value);
void on_audioMute_toggled(bool checked);
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p);
void tick();
};
#endif // INCLUDE_WFMDEMODGUI_H