diff --git a/plugins/channelrx/udpsrc/udpsrcgui.cpp b/plugins/channelrx/udpsrc/udpsrcgui.cpp index fbf7afbf0..3726cd0cf 100644 --- a/plugins/channelrx/udpsrc/udpsrcgui.cpp +++ b/plugins/channelrx/udpsrc/udpsrcgui.cpp @@ -95,17 +95,11 @@ bool UDPSrcGUI::handleMessage(const Message& message __attribute__((unused))) return false; } -void UDPSrcGUI::channelMarkerChanged() +void UDPSrcGUI::channelMarkerChangedByCursor() { - //m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); - //m_settings.m_rfBandwidth = m_channelMarker.getBandwidth(); - setWindowTitle(m_channelMarker.getTitle()); - 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(); + ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); + m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + applySettingsImmediate(); } void UDPSrcGUI::tick() @@ -168,25 +162,28 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer()); connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); + m_channelMarker.blockSignals(true); m_channelMarker.setBandwidth(16000); m_channelMarker.setCenterFrequency(0); m_channelMarker.setTitle("UDP Sample Source"); m_channelMarker.setUDPAddress("127.0.0.1"); m_channelMarker.setUDPSendPort(9999); m_channelMarker.setUDPReceivePort(9998); - m_channelMarker.setVisible(true); 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.setSpectrumGUI(ui->spectrumGUI); - connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); - m_deviceUISet->registerRxChannelInstance(UDPSrc::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(); @@ -211,13 +208,16 @@ void UDPSrcGUI::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(); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); + ui->sampleRate->setText(QString("%1").arg(m_settings.m_outputSampleRate, 0)); setSampleFormatIndex(m_settings.m_sampleFormat); @@ -532,20 +532,28 @@ void UDPSrcGUI::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(); + + applySettingsImmediate(); } void UDPSrcGUI::leaveEvent(QEvent*) { - blockApplySettings(true); m_channelMarker.setHighlighted(false); - blockApplySettings(false); } void UDPSrcGUI::enterEvent(QEvent*) { - blockApplySettings(true); m_channelMarker.setHighlighted(true); - blockApplySettings(false); } diff --git a/plugins/channelrx/udpsrc/udpsrcgui.h b/plugins/channelrx/udpsrc/udpsrcgui.h index 69f03a82d..cb03a59b8 100644 --- a/plugins/channelrx/udpsrc/udpsrcgui.h +++ b/plugins/channelrx/udpsrc/udpsrcgui.h @@ -55,24 +55,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_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(); +public slots: + void channelMarkerChangedByCursor(); private: Ui::UDPSrcGUI* ui; @@ -106,6 +90,24 @@ private: void leaveEvent(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