From 6feee9ce3bc787c0a983ffef9d57ae34627cb3ce Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 14 Nov 2017 21:13:51 +0100 Subject: [PATCH] NFM modulator: applied new channel marker signal handling --- plugins/channeltx/modnfm/nfmmodgui.cpp | 31 ++++++------ plugins/channeltx/modnfm/nfmmodgui.h | 56 +++++++++++---------- plugins/channeltx/modnfm/nfmmodplugin.cpp | 2 +- plugins/channeltx/modnfm/nfmmodsettings.cpp | 2 + 4 files changed, 49 insertions(+), 42 deletions(-) diff --git a/plugins/channeltx/modnfm/nfmmodgui.cpp b/plugins/channeltx/modnfm/nfmmodgui.cpp index 812f0915d..d4c5abe81 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.cpp +++ b/plugins/channeltx/modnfm/nfmmodgui.cpp @@ -109,8 +109,10 @@ bool NFMModGUI::handleMessage(const Message& message) } } -void NFMModGUI::channelMarkerChanged() +void NFMModGUI::channelMarkerChangedByCursor() { + ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); + m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); applySettings(); } @@ -313,15 +315,22 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); + m_channelMarker.blockSignals(true); + m_channelMarker.setColor(Qt::red); + m_channelMarker.setBandwidth(12500); + m_channelMarker.setCenterFrequency(0); m_channelMarker.setTitle("NFM Modulator"); - m_channelMarker.setVisible(true); - - connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); + m_channelMarker.setUDPAddress("127.0.0.1"); + m_channelMarker.setUDPSendPort(9999); + m_channelMarker.blockSignals(false); + m_channelMarker.setVisible(true); // activate signal on the last setting only m_deviceUISet->registerTxChannelInstance(NFMMod::m_channelID, this); m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addRollupWidget(this); + connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor())); + ui->play->setEnabled(false); ui->play->setChecked(false); ui->tone->setChecked(false); @@ -360,14 +369,10 @@ void NFMModGUI::applySettings(bool force) { if (m_doApplySettings) { - setTitleColor(m_channelMarker.getColor()); - NFMMod::MsgConfigureChannelizer *msgChan = NFMMod::MsgConfigureChannelizer::create( 48000, m_channelMarker.getCenterFrequency()); m_nfmMod->getInputMessageQueue()->push(msgChan); - ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); - NFMMod::MsgConfigureNFMMod *msg = NFMMod::MsgConfigureNFMMod::create(m_settings, force); m_nfmMod->getInputMessageQueue()->push(msg); } @@ -378,14 +383,16 @@ void NFMModGUI::displaySettings() m_channelMarker.blockSignals(true); m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); m_channelMarker.setBandwidth(m_settings.m_rfBandwidth); - m_channelMarker.setColor(m_settings.m_rgbColor); - setTitleColor(m_settings.m_rgbColor); 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()); blockApplySettings(true); + ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); + ui->rfBW->setCurrentIndex(NFMModSettings::getRFBWIndex(m_settings.m_rfBandwidth)); ui->afBWText->setText(QString("%1k").arg(m_settings.m_afBandwidth / 1000.0)); @@ -412,16 +419,12 @@ void NFMModGUI::displaySettings() void NFMModGUI::leaveEvent(QEvent*) { - blockApplySettings(true); m_channelMarker.setHighlighted(false); - blockApplySettings(false); } void NFMModGUI::enterEvent(QEvent*) { - blockApplySettings(true); m_channelMarker.setHighlighted(true); - blockApplySettings(false); } void NFMModGUI::tick() diff --git a/plugins/channeltx/modnfm/nfmmodgui.h b/plugins/channeltx/modnfm/nfmmodgui.h index 4caa9e732..aba5c6bbf 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.h +++ b/plugins/channeltx/modnfm/nfmmodgui.h @@ -52,33 +52,8 @@ public: virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual bool handleMessage(const Message& message); -private slots: - void channelMarkerChanged(); - void handleSourceMessages(); - - void on_deltaFrequency_changed(qint64 value); - void on_rfBW_currentIndexChanged(int index); - void on_afBW_valueChanged(int value); - void on_fmDev_valueChanged(int value); - void on_toneFrequency_valueChanged(int value); - void on_volume_valueChanged(int value); - void on_channelMute_toggled(bool checked); - void on_tone_toggled(bool checked); - void on_morseKeyer_toggled(bool checked); - void on_mic_toggled(bool checked); - void on_play_toggled(bool checked); - - void on_playLoop_toggled(bool checked); - void on_navTimeSlider_valueChanged(int value); - void on_showFileDialog_clicked(bool checked); - - void on_ctcss_currentIndexChanged(int index); - void on_ctcssOn_toggled(bool checked); - - void onWidgetRolled(QWidget* widget, bool rollDown); - - void configureFileName(); - void tick(); +public slots: + void channelMarkerChangedByCursor(); private: Ui::NFMModGUI* ui; @@ -111,6 +86,33 @@ private: void leaveEvent(QEvent*); void enterEvent(QEvent*); + +private slots: + void handleSourceMessages(); + + void on_deltaFrequency_changed(qint64 value); + void on_rfBW_currentIndexChanged(int index); + void on_afBW_valueChanged(int value); + void on_fmDev_valueChanged(int value); + void on_toneFrequency_valueChanged(int value); + void on_volume_valueChanged(int value); + void on_channelMute_toggled(bool checked); + void on_tone_toggled(bool checked); + void on_morseKeyer_toggled(bool checked); + void on_mic_toggled(bool checked); + void on_play_toggled(bool checked); + + void on_playLoop_toggled(bool checked); + void on_navTimeSlider_valueChanged(int value); + void on_showFileDialog_clicked(bool checked); + + void on_ctcss_currentIndexChanged(int index); + void on_ctcssOn_toggled(bool checked); + + void onWidgetRolled(QWidget* widget, bool rollDown); + + void configureFileName(); + void tick(); }; #endif /* PLUGINS_CHANNELTX_MODNFM_NFMMODGUI_H_ */ diff --git a/plugins/channeltx/modnfm/nfmmodplugin.cpp b/plugins/channeltx/modnfm/nfmmodplugin.cpp index 11679d292..eadc4b79f 100644 --- a/plugins/channeltx/modnfm/nfmmodplugin.cpp +++ b/plugins/channeltx/modnfm/nfmmodplugin.cpp @@ -23,7 +23,7 @@ const PluginDescriptor NFMModPlugin::m_pluginDescriptor = { QString("NFM Modulator"), - QString("3.8.3"), + QString("3.8.4"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/channeltx/modnfm/nfmmodsettings.cpp b/plugins/channeltx/modnfm/nfmmodsettings.cpp index cf4c89ea9..c8918c662 100644 --- a/plugins/channeltx/modnfm/nfmmodsettings.cpp +++ b/plugins/channeltx/modnfm/nfmmodsettings.cpp @@ -55,6 +55,8 @@ void NFMModSettings::resetToDefaults() m_volumeFactor = 1.0f; m_channelMute = false; m_playLoop = false; + m_ctcssOn = false; + m_ctcssIndex = 0; m_rgbColor = QColor(255, 0, 0).rgb(); }