From 20b93b81868c9d79f5d42d04ccf3e811ed9bcdb3 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 14 Nov 2017 02:01:44 +0100 Subject: [PATCH] SSB Demod: applied new channel marker signal handling --- plugins/channelrx/demodssb/ssbdemodgui.cpp | 41 +++++++++++----------- plugins/channelrx/demodssb/ssbdemodgui.h | 38 ++++++++++---------- plugins/channelrx/demodssb/ssbplugin.cpp | 2 +- 3 files changed, 42 insertions(+), 39 deletions(-) diff --git a/plugins/channelrx/demodssb/ssbdemodgui.cpp b/plugins/channelrx/demodssb/ssbdemodgui.cpp index 3083e2d6f..72f5e3551 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.cpp +++ b/plugins/channelrx/demodssb/ssbdemodgui.cpp @@ -81,9 +81,11 @@ bool SSBDemodGUI::handleMessage(const Message& message __attribute__((unused))) return false; } -void SSBDemodGUI::viewChanged() +void SSBDemodGUI::channelMarkerChangedByCursor() { - applySettings(); + ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); + m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + applySettings(); } void SSBDemodGUI::on_audioBinaural_toggled(bool binaural) @@ -220,24 +222,27 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); - m_channelMarker.setColor(Qt::green); + m_channelMarker.blockSignals(true); + m_channelMarker.setColor(Qt::green); m_channelMarker.setBandwidth(6000); m_channelMarker.setCenterFrequency(0); m_channelMarker.setTitle("SSB Demodulator"); m_channelMarker.setUDPAddress("127.0.0.1"); m_channelMarker.setUDPSendPort(9999); - m_channelMarker.setVisible(true); + m_channelMarker.blockSignals(false); + m_channelMarker.setVisible(true); // activate signal on the last setting only + setTitleColor(m_channelMarker.getColor()); m_settings.setChannelMarker(&m_channelMarker); m_settings.setSpectrumGUI(ui->spectrumGUI); - connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); - m_deviceUISet->registerRxChannelInstance(SSBDemod::m_channelID, this); m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addRollupWidget(this); + connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor())); + ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); displaySettings(); @@ -263,9 +268,6 @@ void SSBDemodGUI::applySettings(bool force) { if (m_doApplySettings) { - setTitleColor(m_channelMarker.getColor()); - ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); - SSBDemod::MsgConfigureChannelizer* channelConfigMsg = SSBDemod::MsgConfigureChannelizer::create( 48000, m_channelMarker.getCenterFrequency()); m_ssbDemod->getInputMessageQueue()->push(channelConfigMsg); @@ -365,15 +367,10 @@ void SSBDemodGUI::applyBandwidths(bool force) void SSBDemodGUI::displaySettings() { - bool applySettingsWereBlocked = blockApplySettings(true); - m_channelMarker.blockSignals(true); - m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); m_channelMarker.setBandwidth(m_settings.m_rfBandwidth * 2); m_channelMarker.setLowCutoff(m_settings.m_lowCutoff); - m_channelMarker.setColor(m_settings.m_rgbColor); - setTitleColor(m_settings.m_rgbColor); if (m_settings.m_dsb) { m_channelMarker.setSidebands(ChannelMarker::dsb); @@ -386,8 +383,16 @@ void SSBDemodGUI::displaySettings() } 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->agc->setChecked(m_settings.m_agc); ui->agcClamping->setChecked(m_settings.m_agcClamping); ui->audioBinaural->setChecked(m_settings.m_audioBinaural); @@ -438,12 +443,12 @@ void SSBDemodGUI::displaySettings() s = QString::number(ui->agcThresholdGate->value(), 'f', 0); ui->agcThresholdGateText->setText(s); - blockApplySettings(applySettingsWereBlocked); + blockApplySettings(false); } void SSBDemodGUI::displayUDPAddress() { - //TODO: ui->copyAudioToUDP->setToolTip(QString("Copy audio output to UDP %1:%2").arg(m_channelMarker.getUDPAddress()).arg(m_channelMarker.getUDPSendPort())); + //TODO: ui->copyAudioToUDP->setToolTip(QString("Copy audio output to UDP %1:%2").arg(m_settings.m_udpAddress).arg(m_settings.m_udpPort)); } void SSBDemodGUI::displayAGCPowerThreshold(int value) @@ -461,16 +466,12 @@ void SSBDemodGUI::displayAGCPowerThreshold(int value) void SSBDemodGUI::leaveEvent(QEvent*) { - bool applySettingsWereBlocked = blockApplySettings(true); m_channelMarker.setHighlighted(false); - blockApplySettings(applySettingsWereBlocked); } void SSBDemodGUI::enterEvent(QEvent*) { - bool applySettingsWereBlocked = blockApplySettings(true); m_channelMarker.setHighlighted(true); - blockApplySettings(applySettingsWereBlocked); } void SSBDemodGUI::tick() diff --git a/plugins/channelrx/demodssb/ssbdemodgui.h b/plugins/channelrx/demodssb/ssbdemodgui.h index dfc053aaf..51ac02d84 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.h +++ b/plugins/channelrx/demodssb/ssbdemodgui.h @@ -38,24 +38,8 @@ public: virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual bool handleMessage(const Message& message); -private slots: - void viewChanged(); - void on_deltaFrequency_changed(qint64 value); - void on_audioBinaural_toggled(bool binaural); - void on_audioFlipChannels_toggled(bool flip); - void on_dsb_toggled(bool dsb); - void on_BW_valueChanged(int value); - void on_lowCut_valueChanged(int value); - void on_volume_valueChanged(int value); - void on_agc_toggled(bool checked); - void on_agcClamping_toggled(bool checked); - void on_agcTimeLog2_valueChanged(int value); - void on_agcPowerThreshold_valueChanged(int value); - void on_agcThresholdGate_valueChanged(int value); - void on_audioMute_toggled(bool checked); - void on_spanLog2_valueChanged(int value); - void onWidgetRolled(QWidget* widget, bool rollDown); - void tick(); +public slots: + void channelMarkerChangedByCursor(); private: Ui::SSBDemodGUI* ui; @@ -88,6 +72,24 @@ private: void leaveEvent(QEvent*); void enterEvent(QEvent*); + +private slots: + void on_deltaFrequency_changed(qint64 value); + void on_audioBinaural_toggled(bool binaural); + void on_audioFlipChannels_toggled(bool flip); + void on_dsb_toggled(bool dsb); + void on_BW_valueChanged(int value); + void on_lowCut_valueChanged(int value); + void on_volume_valueChanged(int value); + void on_agc_toggled(bool checked); + void on_agcClamping_toggled(bool checked); + void on_agcTimeLog2_valueChanged(int value); + void on_agcPowerThreshold_valueChanged(int value); + void on_agcThresholdGate_valueChanged(int value); + void on_audioMute_toggled(bool checked); + void on_spanLog2_valueChanged(int value); + void onWidgetRolled(QWidget* widget, bool rollDown); + void tick(); }; #endif // INCLUDE_SSBDEMODGUI_H diff --git a/plugins/channelrx/demodssb/ssbplugin.cpp b/plugins/channelrx/demodssb/ssbplugin.cpp index 0c24b3de3..63e710335 100644 --- a/plugins/channelrx/demodssb/ssbplugin.cpp +++ b/plugins/channelrx/demodssb/ssbplugin.cpp @@ -8,7 +8,7 @@ const PluginDescriptor SSBPlugin::m_pluginDescriptor = { QString("SSB Demodulator"), - QString("3.8.3"), + QString("3.8.4"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true,