diff --git a/plugins/channelrx/tcpsrc/tcpsrcgui.cpp b/plugins/channelrx/tcpsrc/tcpsrcgui.cpp index eca5daef8..db13a0fd7 100644 --- a/plugins/channelrx/tcpsrc/tcpsrcgui.cpp +++ b/plugins/channelrx/tcpsrc/tcpsrcgui.cpp @@ -107,8 +107,10 @@ bool TCPSrcGUI::handleMessage(const Message& message) } } -void TCPSrcGUI::channelMarkerChanged() +void TCPSrcGUI::channelMarkerChangedByCursor() { + ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); + m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); applySettings(); } @@ -152,23 +154,27 @@ TCPSrcGUI::TCPSrcGUI(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.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 - connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); + setTitleColor(m_channelMarker.getColor()); m_deviceUISet->registerRxChannelInstance(TCPSrc::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); m_settings.setSpectrumGUI(ui->spectrumGUI); m_settings.setChannelMarker(&m_channelMarker); + displaySettings(); applySettings(); } @@ -296,13 +302,17 @@ void TCPSrcGUI::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()); + blockApplySettings(true); + ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); + ui->sampleRate->setText(QString("%1").arg(m_settings.m_outputSampleRate, 0)); setSampleFormatIndex(m_settings.m_sampleFormat); @@ -312,6 +322,8 @@ void TCPSrcGUI::displaySettings() ui->volumeText->setText(QString("%1").arg(ui->volume->value())); ui->glSpectrum->setSampleRate(m_settings.m_outputSampleRate); + + blockApplySettings(false); } void TCPSrcGUI::setSampleFormatIndex(const TCPSrcSettings::SampleFormat& sampleFormat) diff --git a/plugins/channelrx/tcpsrc/tcpsrcgui.h b/plugins/channelrx/tcpsrc/tcpsrcgui.h index f2649d8e8..79630a45f 100644 --- a/plugins/channelrx/tcpsrc/tcpsrcgui.h +++ b/plugins/channelrx/tcpsrc/tcpsrcgui.h @@ -39,17 +39,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_tcpPort_textEdited(const QString& arg1); - void on_applyBtn_clicked(); - void onWidgetRolled(QWidget* widget, bool rollDown); - void on_volume_valueChanged(int value); - void tick(); +public slots: + void channelMarkerChangedByCursor(); private: Ui::TCPSrcGUI* ui; @@ -84,6 +75,17 @@ private: void addConnection(quint32 id, const QHostAddress& peerAddress, int peerPort); void delConnection(quint32 id); + +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_tcpPort_textEdited(const QString& arg1); + void on_applyBtn_clicked(); + void onWidgetRolled(QWidget* widget, bool rollDown); + void on_volume_valueChanged(int value); + void tick(); }; #endif // INCLUDE_TCPSRCGUI_H