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

UDP source: applied new channel marker signal handling

This commit is contained in:
f4exb 2017-11-14 08:35:18 +01:00
parent 159fcad964
commit d7eee52ad0
2 changed files with 48 additions and 38 deletions

View File

@ -95,17 +95,11 @@ bool UDPSrcGUI::handleMessage(const Message& message __attribute__((unused)))
return false; return false;
} }
void UDPSrcGUI::channelMarkerChanged() void UDPSrcGUI::channelMarkerChangedByCursor()
{ {
//m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
//m_settings.m_rfBandwidth = m_channelMarker.getBandwidth(); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
setWindowTitle(m_channelMarker.getTitle()); applySettingsImmediate();
m_settings.m_udpAddress = m_channelMarker.getUDPAddress(),
m_settings.m_udpPort = m_channelMarker.getUDPSendPort(),
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
setTitleColor(m_settings.m_rgbColor);
displayUDPAddress();
applySettings();
} }
void UDPSrcGUI::tick() void UDPSrcGUI::tick()
@ -168,25 +162,28 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer()); ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer());
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
m_channelMarker.blockSignals(true);
m_channelMarker.setBandwidth(16000); m_channelMarker.setBandwidth(16000);
m_channelMarker.setCenterFrequency(0); m_channelMarker.setCenterFrequency(0);
m_channelMarker.setTitle("UDP Sample Source"); m_channelMarker.setTitle("UDP Sample Source");
m_channelMarker.setUDPAddress("127.0.0.1"); m_channelMarker.setUDPAddress("127.0.0.1");
m_channelMarker.setUDPSendPort(9999); m_channelMarker.setUDPSendPort(9999);
m_channelMarker.setUDPReceivePort(9998); m_channelMarker.setUDPReceivePort(9998);
m_channelMarker.setVisible(true);
m_channelMarker.setColor(m_settings.m_rgbColor); m_channelMarker.setColor(m_settings.m_rgbColor);
setTitleColor(m_channelMarker.getColor()); 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.setChannelMarker(&m_channelMarker);
m_settings.setSpectrumGUI(ui->spectrumGUI); m_settings.setSpectrumGUI(ui->spectrumGUI);
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
m_deviceUISet->registerRxChannelInstance(UDPSrc::m_channelID, this); m_deviceUISet->registerRxChannelInstance(UDPSrc::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->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
displaySettings(); displaySettings();
@ -211,13 +208,16 @@ void UDPSrcGUI::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.setColor(m_settings.m_rgbColor); m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
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());
displayUDPAddress();
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->sampleRate->setText(QString("%1").arg(m_settings.m_outputSampleRate, 0)); ui->sampleRate->setText(QString("%1").arg(m_settings.m_outputSampleRate, 0));
setSampleFormatIndex(m_settings.m_sampleFormat); setSampleFormatIndex(m_settings.m_sampleFormat);
@ -532,20 +532,28 @@ void UDPSrcGUI::onMenuDialogCalled(const QPoint &p)
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.move(p); dialog.move(p);
dialog.exec(); 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();
applySettingsImmediate();
} }
void UDPSrcGUI::leaveEvent(QEvent*) void UDPSrcGUI::leaveEvent(QEvent*)
{ {
blockApplySettings(true);
m_channelMarker.setHighlighted(false); m_channelMarker.setHighlighted(false);
blockApplySettings(false);
} }
void UDPSrcGUI::enterEvent(QEvent*) void UDPSrcGUI::enterEvent(QEvent*)
{ {
blockApplySettings(true);
m_channelMarker.setHighlighted(true); m_channelMarker.setHighlighted(true);
blockApplySettings(false);
} }

View File

@ -55,24 +55,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 on_deltaFrequency_changed(qint64 value);
void on_sampleFormat_currentIndexChanged(int index);
void on_sampleRate_textEdited(const QString& arg1);
void on_rfBandwidth_textEdited(const QString& arg1);
void on_fmDeviation_textEdited(const QString& arg1);
void on_audioActive_toggled(bool active);
void on_audioStereo_toggled(bool stereo);
void on_applyBtn_clicked();
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p);
void on_gain_valueChanged(int value);
void on_volume_valueChanged(int value);
void on_squelch_valueChanged(int value);
void on_squelchGate_valueChanged(int value);
void on_agc_toggled(bool agc);
void tick();
private: private:
Ui::UDPSrcGUI* ui; Ui::UDPSrcGUI* ui;
@ -106,6 +90,24 @@ private:
void leaveEvent(QEvent*); void leaveEvent(QEvent*);
void enterEvent(QEvent*); void enterEvent(QEvent*);
private slots:
void on_deltaFrequency_changed(qint64 value);
void on_sampleFormat_currentIndexChanged(int index);
void on_sampleRate_textEdited(const QString& arg1);
void on_rfBandwidth_textEdited(const QString& arg1);
void on_fmDeviation_textEdited(const QString& arg1);
void on_audioActive_toggled(bool active);
void on_audioStereo_toggled(bool stereo);
void on_applyBtn_clicked();
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p);
void on_gain_valueChanged(int value);
void on_volume_valueChanged(int value);
void on_squelch_valueChanged(int value);
void on_squelchGate_valueChanged(int value);
void on_agc_toggled(bool agc);
void tick();
}; };
#endif // INCLUDE_UDPSRCGUI_H #endif // INCLUDE_UDPSRCGUI_H