1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 05:11:49 -05:00

NFM modulator: applied new channel marker signal handling

This commit is contained in:
f4exb 2017-11-14 21:13:51 +01:00
parent 178f672771
commit 6feee9ce3b
4 changed files with 49 additions and 42 deletions

View File

@ -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(); applySettings();
} }
@ -313,15 +315,22 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); 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.setTitle("NFM Modulator");
m_channelMarker.setVisible(true); m_channelMarker.setUDPAddress("127.0.0.1");
m_channelMarker.setUDPSendPort(9999);
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); m_channelMarker.blockSignals(false);
m_channelMarker.setVisible(true); // activate signal on the last setting only
m_deviceUISet->registerTxChannelInstance(NFMMod::m_channelID, this); m_deviceUISet->registerTxChannelInstance(NFMMod::m_channelID, this);
m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this); m_deviceUISet->addRollupWidget(this);
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
ui->play->setEnabled(false); ui->play->setEnabled(false);
ui->play->setChecked(false); ui->play->setChecked(false);
ui->tone->setChecked(false); ui->tone->setChecked(false);
@ -360,14 +369,10 @@ void NFMModGUI::applySettings(bool force)
{ {
if (m_doApplySettings) if (m_doApplySettings)
{ {
setTitleColor(m_channelMarker.getColor());
NFMMod::MsgConfigureChannelizer *msgChan = NFMMod::MsgConfigureChannelizer::create( NFMMod::MsgConfigureChannelizer *msgChan = NFMMod::MsgConfigureChannelizer::create(
48000, m_channelMarker.getCenterFrequency()); 48000, m_channelMarker.getCenterFrequency());
m_nfmMod->getInputMessageQueue()->push(msgChan); m_nfmMod->getInputMessageQueue()->push(msgChan);
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
NFMMod::MsgConfigureNFMMod *msg = NFMMod::MsgConfigureNFMMod::create(m_settings, force); NFMMod::MsgConfigureNFMMod *msg = NFMMod::MsgConfigureNFMMod::create(m_settings, force);
m_nfmMod->getInputMessageQueue()->push(msg); m_nfmMod->getInputMessageQueue()->push(msg);
} }
@ -378,14 +383,16 @@ void NFMModGUI::displaySettings()
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth); 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.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()); setWindowTitle(m_channelMarker.getTitle());
blockApplySettings(true); blockApplySettings(true);
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->rfBW->setCurrentIndex(NFMModSettings::getRFBWIndex(m_settings.m_rfBandwidth)); ui->rfBW->setCurrentIndex(NFMModSettings::getRFBWIndex(m_settings.m_rfBandwidth));
ui->afBWText->setText(QString("%1k").arg(m_settings.m_afBandwidth / 1000.0)); ui->afBWText->setText(QString("%1k").arg(m_settings.m_afBandwidth / 1000.0));
@ -412,16 +419,12 @@ void NFMModGUI::displaySettings()
void NFMModGUI::leaveEvent(QEvent*) void NFMModGUI::leaveEvent(QEvent*)
{ {
blockApplySettings(true);
m_channelMarker.setHighlighted(false); m_channelMarker.setHighlighted(false);
blockApplySettings(false);
} }
void NFMModGUI::enterEvent(QEvent*) void NFMModGUI::enterEvent(QEvent*)
{ {
blockApplySettings(true);
m_channelMarker.setHighlighted(true); m_channelMarker.setHighlighted(true);
blockApplySettings(false);
} }
void NFMModGUI::tick() void NFMModGUI::tick()

View File

@ -52,33 +52,8 @@ public:
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);
private slots: public slots:
void channelMarkerChanged(); void channelMarkerChangedByCursor();
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();
private: private:
Ui::NFMModGUI* ui; Ui::NFMModGUI* ui;
@ -111,6 +86,33 @@ private:
void leaveEvent(QEvent*); void leaveEvent(QEvent*);
void enterEvent(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_ */ #endif /* PLUGINS_CHANNELTX_MODNFM_NFMMODGUI_H_ */

View File

@ -23,7 +23,7 @@
const PluginDescriptor NFMModPlugin::m_pluginDescriptor = { const PluginDescriptor NFMModPlugin::m_pluginDescriptor = {
QString("NFM Modulator"), QString("NFM Modulator"),
QString("3.8.3"), QString("3.8.4"),
QString("(c) Edouard Griffiths, F4EXB"), QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"), QString("https://github.com/f4exb/sdrangel"),
true, true,

View File

@ -55,6 +55,8 @@ void NFMModSettings::resetToDefaults()
m_volumeFactor = 1.0f; m_volumeFactor = 1.0f;
m_channelMute = false; m_channelMute = false;
m_playLoop = false; m_playLoop = false;
m_ctcssOn = false;
m_ctcssIndex = 0;
m_rgbColor = QColor(255, 0, 0).rgb(); m_rgbColor = QColor(255, 0, 0).rgb();
} }