| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2017 Edouard Griffiths, F4EXB                                   //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 06:39:30 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | #include "udpsourcegui.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-01 00:00:03 +01:00
										 |  |  | #include "device/deviceuiset.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | #include "dsp/spectrumvis.h"
 | 
					
						
							|  |  |  | #include "dsp/dspengine.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | #include "util/simpleserializer.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-14 22:50:28 +02:00
										 |  |  | #include "util/db.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-24 02:05:48 +02:00
										 |  |  | #include "gui/basicchannelsettingsdialog.h"
 | 
					
						
							| 
									
										
										
										
											2019-11-17 11:09:07 +01:00
										 |  |  | #include "gui/devicestreamselectiondialog.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | #include "plugin/pluginapi.h"
 | 
					
						
							| 
									
										
										
										
											2020-10-12 21:59:04 +02:00
										 |  |  | #include "maincore.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | #include "ui_udpsourcegui.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | UDPSourceGUI* UDPSourceGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx) | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     UDPSourceGUI* gui = new UDPSourceGUI(pluginAPI, deviceUISet, channelTx); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |     return gui; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::destroy() | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-08 22:54:58 +01:00
										 |  |  |     delete this; | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::resetToDefaults() | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |     m_settings.resetToDefaults(); | 
					
						
							|  |  |  |     displaySettings(); | 
					
						
							|  |  |  |     applySettings(true); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | QByteArray UDPSourceGUI::serialize() const | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |     return m_settings.serialize(); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | bool UDPSourceGUI::deserialize(const QByteArray& data) | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |     if(m_settings.deserialize(data)) | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-08-26 21:20:35 +02:00
										 |  |  |         displaySettings(); | 
					
						
							| 
									
										
										
										
											2017-08-16 09:53:23 +02:00
										 |  |  |         applySettings(true); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |         return true; | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |         resetToDefaults(); | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | bool UDPSourceGUI::handleMessage(const Message& message) | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-12 15:46:42 +02:00
										 |  |  |     if (UDPSource::MsgConfigureUDPSource::match(message)) | 
					
						
							| 
									
										
										
										
											2018-04-15 18:25:22 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-09-12 15:46:42 +02:00
										 |  |  |         const UDPSource::MsgConfigureUDPSource& cfg = (UDPSource::MsgConfigureUDPSource&) message; | 
					
						
							| 
									
										
										
										
											2018-04-15 18:25:22 +02:00
										 |  |  |         m_settings = cfg.getSettings(); | 
					
						
							|  |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         displaySettings(); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::handleSourceMessages() | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     Message* message; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-28 08:33:05 +02:00
										 |  |  |     while ((message = getInputMessageQueue()->pop()) != 0) | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (handleMessage(*message)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             delete message; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | UDPSourceGUI::UDPSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) : | 
					
						
							| 
									
										
										
										
											2020-10-04 06:16:15 +02:00
										 |  |  |         ChannelGUI(parent), | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         ui(new Ui::UDPSourceGUI), | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |         m_pluginAPI(pluginAPI), | 
					
						
							| 
									
										
										
										
											2017-11-01 00:00:03 +01:00
										 |  |  |         m_deviceUISet(deviceUISet), | 
					
						
							| 
									
										
										
										
											2017-08-17 12:57:45 +02:00
										 |  |  |         m_tickCount(0), | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |         m_channelMarker(this), | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  |         m_rfBandwidthChanged(false), | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |         m_doApplySettings(true) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ui->setupUi(this); | 
					
						
							|  |  |  |     connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); | 
					
						
							| 
									
										
										
										
											2017-08-24 02:05:48 +02:00
										 |  |  |     connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |     setAttribute(Qt::WA_DeleteOnClose, true); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     m_udpSource = (UDPSource*) channelTx; | 
					
						
							| 
									
										
										
										
											2020-04-30 09:57:05 +02:00
										 |  |  |     m_spectrumVis = m_udpSource->getSpectrumVis(); | 
					
						
							|  |  |  |     m_spectrumVis->setGLSpectrum(ui->glSpectrum); | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     m_udpSource->setMessageQueueToGUI(getInputMessageQueue()); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |     ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03))); | 
					
						
							|  |  |  |     ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); | 
					
						
							| 
									
										
										
										
											2020-07-01 13:14:48 +02:00
										 |  |  |     ui->deltaFrequency->setValueRange(false, 8, -99999999, 99999999); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ui->glSpectrum->setCenterFrequency(0); | 
					
						
							|  |  |  |     ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt()); | 
					
						
							|  |  |  |     ui->glSpectrum->setDisplayWaterfall(true); | 
					
						
							|  |  |  |     ui->glSpectrum->setDisplayMaxHold(true); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-12 21:59:04 +02:00
										 |  |  |     connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-14 22:02:40 +01:00
										 |  |  |     m_channelMarker.blockSignals(true); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |     m_channelMarker.setBandwidth(16000); | 
					
						
							|  |  |  |     m_channelMarker.setCenterFrequency(0); | 
					
						
							| 
									
										
										
										
											2017-11-14 22:02:40 +01:00
										 |  |  |     m_channelMarker.setColor(m_settings.m_rgbColor); | 
					
						
							| 
									
										
										
										
											2020-08-24 19:56:04 +02:00
										 |  |  |     m_channelMarker.setTitle("UDP Sample Source"); | 
					
						
							| 
									
										
										
										
											2019-05-30 18:38:10 +02:00
										 |  |  |     m_channelMarker.setSourceOrSinkStream(false); | 
					
						
							| 
									
										
										
										
											2017-11-14 22:02:40 +01:00
										 |  |  |     m_channelMarker.blockSignals(false); | 
					
						
							|  |  |  |     m_channelMarker.setVisible(true); // activate signal on the last setting only
 | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-01 00:00:03 +01:00
										 |  |  |     m_deviceUISet->addChannelMarker(&m_channelMarker); | 
					
						
							|  |  |  |     m_deviceUISet->addRollupWidget(this); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-14 22:02:40 +01:00
										 |  |  |     connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor())); | 
					
						
							| 
									
										
										
										
											2017-08-15 00:20:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 02:33:50 +02:00
										 |  |  |     ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-28 08:33:05 +02:00
										 |  |  |     connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); | 
					
						
							| 
									
										
										
										
											2019-11-15 01:04:24 +01:00
										 |  |  |     m_udpSource->setLevelMeter(ui->volumeMeter); | 
					
						
							| 
									
										
										
										
											2017-11-14 22:02:40 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     displaySettings(); | 
					
						
							|  |  |  |     applySettings(true); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | UDPSourceGUI::~UDPSourceGUI() | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     delete ui; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::blockApplySettings(bool block) | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     m_doApplySettings = !block; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::applySettings(bool force) | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     if (m_doApplySettings) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         UDPSource::MsgConfigureChannelizer *msgChan = UDPSource::MsgConfigureChannelizer::create( | 
					
						
							| 
									
										
										
										
											2017-10-15 22:14:30 +02:00
										 |  |  |                 m_settings.m_inputSampleRate, | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  |                 m_settings.m_inputFrequencyOffset); | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         m_udpSource->getInputMessageQueue()->push(msgChan); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-12 15:46:42 +02:00
										 |  |  |         UDPSource::MsgConfigureUDPSource* message = UDPSource::MsgConfigureUDPSource::create( m_settings, force); | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         m_udpSource->getInputMessageQueue()->push(message); | 
					
						
							| 
									
										
										
										
											2017-10-17 00:14:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |         ui->applyBtn->setEnabled(false); | 
					
						
							| 
									
										
										
										
											2017-08-19 03:42:56 +02:00
										 |  |  |         ui->applyBtn->setStyleSheet("QPushButton { background:rgb(79,79,79); }"); | 
					
						
							| 
									
										
										
										
											2017-08-14 01:39:26 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::displaySettings() | 
					
						
							| 
									
										
										
										
											2017-08-17 04:23:36 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  |     m_channelMarker.blockSignals(true); | 
					
						
							|  |  |  |     m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); | 
					
						
							| 
									
										
										
										
											2017-11-21 22:46:39 +01:00
										 |  |  |     m_channelMarker.setBandwidth(m_settings.m_rfBandwidth); | 
					
						
							|  |  |  |     m_channelMarker.blockSignals(false); | 
					
						
							|  |  |  |     m_channelMarker.setColor(m_settings.m_rgbColor); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     setTitleColor(m_settings.m_rgbColor); | 
					
						
							|  |  |  |     this->setWindowTitle(m_channelMarker.getTitle()); | 
					
						
							| 
									
										
										
										
											2019-11-17 11:09:07 +01:00
										 |  |  |     displayStreamIndex(); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-14 22:02:40 +01:00
										 |  |  |     blockApplySettings(true); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  |     ui->deltaFrequency->setValue(m_settings.m_inputFrequencyOffset); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |     ui->sampleRate->setText(QString("%1").arg(roundf(m_settings.m_inputSampleRate), 0)); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  |     ui->glSpectrum->setSampleRate(m_settings.m_inputSampleRate); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |     ui->rfBandwidth->setText(QString("%1").arg(roundf(m_settings.m_rfBandwidth), 0)); | 
					
						
							|  |  |  |     ui->fmDeviation->setText(QString("%1").arg(m_settings.m_fmDeviation, 0)); | 
					
						
							| 
									
										
										
										
											2017-10-15 23:32:11 +02:00
										 |  |  |     ui->amModPercent->setText(QString("%1").arg(roundf(m_settings.m_amModFactor * 100.0), 0)); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     setSampleFormatIndex(m_settings.m_sampleFormat); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 23:32:11 +02:00
										 |  |  |     ui->channelMute->setChecked(m_settings.m_channelMute); | 
					
						
							|  |  |  |     ui->autoRWBalance->setChecked(m_settings.m_autoRWBalance); | 
					
						
							|  |  |  |     ui->stereoInput->setChecked(m_settings.m_stereoInput); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->gainInText->setText(tr("%1").arg(m_settings.m_gainIn, 0, 'f', 1)); | 
					
						
							|  |  |  |     ui->gainIn->setValue(roundf(m_settings.m_gainIn * 10.0)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->gainOutText->setText(tr("%1").arg(m_settings.m_gainOut, 0, 'f', 1)); | 
					
						
							|  |  |  |     ui->gainOut->setValue(roundf(m_settings.m_gainOut * 10.0)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_settings.m_squelchEnabled) { | 
					
						
							|  |  |  |         ui->squelchText->setText(tr("%1").arg(m_settings.m_squelch, 0, 'f', 0)); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         ui->squelchText->setText("---"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->squelch->setValue(roundf(m_settings.m_squelch)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->squelchGateText->setText(tr("%1").arg(roundf(m_settings.m_squelchGate * 1000.0), 0, 'f', 0)); | 
					
						
							|  |  |  |     ui->squelchGate->setValue(roundf(m_settings.m_squelchGate * 100.0)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-19 23:03:21 +02:00
										 |  |  |     ui->localUDPAddress->setText(m_settings.m_udpAddress); | 
					
						
							|  |  |  |     ui->localUDPPort->setText(tr("%1").arg(m_settings.m_udpPort)); | 
					
						
							| 
									
										
										
										
											2020-08-24 19:56:04 +02:00
										 |  |  |     ui->multicastAddress->setText(m_settings.m_multicastAddress); | 
					
						
							|  |  |  |     ui->multicastJoin->setChecked(m_settings.m_multicastJoin); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-15 18:25:22 +02:00
										 |  |  |     ui->applyBtn->setEnabled(false); | 
					
						
							|  |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-14 22:02:40 +01:00
										 |  |  |     blockApplySettings(false); | 
					
						
							| 
									
										
										
										
											2017-08-17 04:23:36 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-17 11:09:07 +01:00
										 |  |  | void UDPSourceGUI::displayStreamIndex() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (m_deviceUISet->m_deviceMIMOEngine) { | 
					
						
							|  |  |  |         setStreamIndicator(tr("%1").arg(m_settings.m_streamIndex)); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         setStreamIndicator("S"); // single channel indicator
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::channelMarkerChangedByCursor() | 
					
						
							| 
									
										
										
										
											2017-08-14 21:27:39 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-14 22:02:40 +01:00
										 |  |  |     ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); | 
					
						
							|  |  |  |     m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); | 
					
						
							| 
									
										
										
										
											2017-08-14 21:27:39 +02:00
										 |  |  |     applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_deltaFrequency_changed(qint64 value) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  |     m_settings.m_inputFrequencyOffset = value; | 
					
						
							| 
									
										
										
										
											2018-01-02 16:23:31 +01:00
										 |  |  |     m_channelMarker.setCenterFrequency(value); | 
					
						
							|  |  |  |     applySettings(); | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_sampleFormat_currentIndexChanged(int index) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     if (index == (int) UDPSourceSettings::FormatNFM) { | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  |         ui->fmDeviation->setEnabled(true); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     if (index == (int) UDPSourceSettings::FormatAM) { | 
					
						
							| 
									
										
										
										
											2017-08-19 01:46:52 +02:00
										 |  |  |         ui->amModPercent->setEnabled(true); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         ui->amModPercent->setEnabled(false); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |     setSampleFormat(index); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  |     ui->applyBtn->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-08-19 03:42:56 +02:00
										 |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_localUDPAddress_editingFinished() | 
					
						
							| 
									
										
										
										
											2018-04-19 23:03:21 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     m_settings.m_udpAddress = ui->localUDPAddress->text(); | 
					
						
							|  |  |  |     ui->applyBtn->setEnabled(true); | 
					
						
							|  |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_localUDPPort_editingFinished() | 
					
						
							| 
									
										
										
										
											2018-04-19 23:03:21 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     bool ok; | 
					
						
							|  |  |  |     quint16 udpPort = ui->localUDPPort->text().toInt(&ok); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if((!ok) || (udpPort < 1024)) { | 
					
						
							|  |  |  |         udpPort = 9998; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_settings.m_udpPort = udpPort; | 
					
						
							|  |  |  |     ui->localUDPPort->setText(tr("%1").arg(m_settings.m_udpPort)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->applyBtn->setEnabled(true); | 
					
						
							|  |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-24 19:56:04 +02:00
										 |  |  | void UDPSourceGUI::on_multicastAddress_editingFinished() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_multicastAddress = ui->multicastAddress->text(); | 
					
						
							|  |  |  |     ui->applyBtn->setEnabled(true); | 
					
						
							|  |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void UDPSourceGUI::on_multicastJoin_toggled(bool checked) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_settings.m_multicastJoin = checked; | 
					
						
							|  |  |  |     ui->applyBtn->setEnabled(true); | 
					
						
							|  |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  | void UDPSourceGUI::on_sampleRate_textEdited(const QString& arg1) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  |     (void) arg1; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:14:30 +02:00
										 |  |  |     bool ok; | 
					
						
							|  |  |  |     Real inputSampleRate = ui->sampleRate->text().toDouble(&ok); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ((!ok) || (inputSampleRate < 1000)) { | 
					
						
							|  |  |  |         m_settings.m_inputSampleRate = 48000; | 
					
						
							|  |  |  |         ui->sampleRate->setText(QString("%1").arg(m_settings.m_inputSampleRate, 0)); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_inputSampleRate = inputSampleRate; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  |     ui->applyBtn->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-08-19 03:42:56 +02:00
										 |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  | void UDPSourceGUI::on_rfBandwidth_textEdited(const QString& arg1) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  |     (void) arg1; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:14:30 +02:00
										 |  |  |     bool ok; | 
					
						
							|  |  |  |     Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-21 22:46:39 +01:00
										 |  |  |     if ((!ok) || (rfBandwidth > m_settings.m_inputSampleRate)) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-10-15 22:14:30 +02:00
										 |  |  |         m_settings.m_rfBandwidth = m_settings.m_inputSampleRate; | 
					
						
							|  |  |  |         ui->rfBandwidth->setText(QString("%1").arg(m_settings.m_rfBandwidth, 0)); | 
					
						
							| 
									
										
										
										
											2017-11-21 22:46:39 +01:00
										 |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-10-15 22:14:30 +02:00
										 |  |  |         m_settings.m_rfBandwidth = rfBandwidth; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-21 22:46:39 +01:00
										 |  |  |     m_rfBandwidthChanged = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  |     ui->applyBtn->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-08-19 03:42:56 +02:00
										 |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  | void UDPSourceGUI::on_fmDeviation_textEdited(const QString& arg1) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  |     (void) arg1; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |     bool ok; | 
					
						
							|  |  |  |     int fmDeviation = ui->fmDeviation->text().toInt(&ok); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ((!ok) || (fmDeviation < 1)) { | 
					
						
							|  |  |  |         m_settings.m_fmDeviation = 2500; | 
					
						
							|  |  |  |         ui->fmDeviation->setText(QString("%1").arg(m_settings.m_fmDeviation)); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_fmDeviation = fmDeviation; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  |     ui->applyBtn->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-08-19 03:42:56 +02:00
										 |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  | void UDPSourceGUI::on_amModPercent_textEdited(const QString& arg1) | 
					
						
							| 
									
										
										
										
											2017-08-19 01:46:52 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-13 08:51:14 +01:00
										 |  |  |     (void) arg1; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |     bool ok; | 
					
						
							|  |  |  |     int amModPercent = ui->amModPercent->text().toInt(&ok); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ((!ok) || (amModPercent < 1) || (amModPercent > 100)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         m_settings.m_amModFactor = 0.95; | 
					
						
							|  |  |  |         ui->amModPercent->setText(QString("%1").arg(95)); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_amModFactor = amModPercent / 100.0; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-19 01:46:52 +02:00
										 |  |  |     ui->applyBtn->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-08-19 03:42:56 +02:00
										 |  |  |     ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); | 
					
						
							| 
									
										
										
										
											2017-08-19 01:46:52 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_gainIn_valueChanged(int value) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:32:11 +02:00
										 |  |  |     m_settings.m_gainIn = value / 10.0; | 
					
						
							|  |  |  |     ui->gainInText->setText(tr("%1").arg(m_settings.m_gainIn, 0, 'f', 1)); | 
					
						
							| 
									
										
										
										
											2017-08-25 15:29:45 +02:00
										 |  |  |     applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_gainOut_valueChanged(int value) | 
					
						
							| 
									
										
										
										
											2017-08-25 15:29:45 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:32:11 +02:00
										 |  |  |     m_settings.m_gainOut = value / 10.0; | 
					
						
							|  |  |  |     ui->gainOutText->setText(tr("%1").arg(m_settings.m_gainOut, 0, 'f', 1)); | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  |     applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_squelch_valueChanged(int value) | 
					
						
							| 
									
										
										
										
											2017-08-17 04:23:36 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:32:11 +02:00
										 |  |  |     m_settings.m_squelchEnabled = (value != -100); | 
					
						
							|  |  |  |     m_settings.m_squelch = value * 1.0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_settings.m_squelchEnabled) { | 
					
						
							|  |  |  |         ui->squelchText->setText(tr("%1").arg(m_settings.m_squelch, 0, 'f', 0)); | 
					
						
							|  |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2017-08-17 20:23:17 +02:00
										 |  |  |         ui->squelchText->setText("---"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-17 04:23:36 +02:00
										 |  |  |     applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_squelchGate_valueChanged(int value) | 
					
						
							| 
									
										
										
										
											2017-08-19 00:52:10 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:32:11 +02:00
										 |  |  |     m_settings.m_squelchGate = value / 100.0; | 
					
						
							|  |  |  |     ui->squelchGateText->setText(tr("%1").arg(roundf(value * 10.0), 0, 'f', 0)); | 
					
						
							| 
									
										
										
										
											2017-08-19 00:52:10 +02:00
										 |  |  |     applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_channelMute_toggled(bool checked) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:32:11 +02:00
										 |  |  |     m_settings.m_channelMute = checked; | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  |     applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_applyBtn_clicked() | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  |     if (m_rfBandwidthChanged) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-11-21 22:46:39 +01:00
										 |  |  |         m_channelMarker.setBandwidth(m_settings.m_rfBandwidth); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:08:27 +02:00
										 |  |  |         m_rfBandwidthChanged = false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-11-21 22:46:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ui->glSpectrum->setSampleRate(m_settings.m_inputSampleRate); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     applySettings(); | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_resetUDPReadIndex_clicked() | 
					
						
							| 
									
										
										
										
											2017-08-18 17:51:11 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     m_udpSource->resetReadIndex(); | 
					
						
							| 
									
										
										
										
											2017-08-18 17:51:11 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_autoRWBalance_toggled(bool checked) | 
					
						
							| 
									
										
										
										
											2017-08-25 02:21:34 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:32:11 +02:00
										 |  |  |     m_settings.m_autoRWBalance = checked; | 
					
						
							| 
									
										
										
										
											2017-08-25 02:21:34 +02:00
										 |  |  |     applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::on_stereoInput_toggled(bool checked) | 
					
						
							| 
									
										
										
										
											2017-08-25 09:48:07 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:32:11 +02:00
										 |  |  |     m_settings.m_stereoInput = checked; | 
					
						
							| 
									
										
										
										
											2017-08-25 09:48:07 +02:00
										 |  |  |     applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::onWidgetRolled(QWidget* widget, bool rollDown) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     if ((widget == ui->spectrumBox) && (m_udpSource != 0)) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         m_udpSource->setSpectrum(rollDown); | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::onMenuDialogCalled(const QPoint &p) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-05-09 21:07:05 +02:00
										 |  |  |     if (m_contextMenuType == ContextMenuChannelSettings) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         BasicChannelSettingsDialog dialog(&m_channelMarker, this); | 
					
						
							|  |  |  |         dialog.setUseReverseAPI(m_settings.m_useReverseAPI); | 
					
						
							|  |  |  |         dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress); | 
					
						
							|  |  |  |         dialog.setReverseAPIPort(m_settings.m_reverseAPIPort); | 
					
						
							|  |  |  |         dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex); | 
					
						
							|  |  |  |         dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         dialog.move(p); | 
					
						
							|  |  |  |         dialog.exec(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); | 
					
						
							|  |  |  |         m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); | 
					
						
							|  |  |  |         m_settings.m_useReverseAPI = dialog.useReverseAPI(); | 
					
						
							|  |  |  |         m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); | 
					
						
							|  |  |  |         m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); | 
					
						
							|  |  |  |         m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex(); | 
					
						
							|  |  |  |         m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         setWindowTitle(m_channelMarker.getTitle()); | 
					
						
							|  |  |  |         setTitleColor(m_settings.m_rgbColor); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         applySettings(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-11-17 11:09:07 +01:00
										 |  |  |     else if ((m_contextMenuType == ContextMenuStreamSettings) && (m_deviceUISet->m_deviceMIMOEngine)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         DeviceStreamSelectionDialog dialog(this); | 
					
						
							|  |  |  |         dialog.setNumberOfStreams(m_udpSource->getNumberOfDeviceStreams()); | 
					
						
							|  |  |  |         dialog.setStreamIndex(m_settings.m_streamIndex); | 
					
						
							|  |  |  |         dialog.move(p); | 
					
						
							|  |  |  |         dialog.exec(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         m_settings.m_streamIndex = dialog.getSelectedStreamIndex(); | 
					
						
							|  |  |  |         m_channelMarker.clearStreamIndexes(); | 
					
						
							|  |  |  |         m_channelMarker.addStreamIndex(m_settings.m_streamIndex); | 
					
						
							|  |  |  |         displayStreamIndex(); | 
					
						
							|  |  |  |         applySettings(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-11-14 22:02:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-09 21:07:05 +02:00
										 |  |  |     resetContextMenuType(); | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::leaveEvent(QEvent*) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     m_channelMarker.setHighlighted(false); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::enterEvent(QEvent*) | 
					
						
							| 
									
										
										
										
											2017-08-14 16:09:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     m_channelMarker.setHighlighted(true); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::tick() | 
					
						
							| 
									
										
										
										
											2017-08-14 22:50:28 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     m_channelPowerAvg(m_udpSource->getMagSq()); | 
					
						
							|  |  |  |     m_inPowerAvg(m_udpSource->getInMagSq()); | 
					
						
							| 
									
										
										
										
											2017-08-17 04:23:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-17 12:57:45 +02:00
										 |  |  |     if (m_tickCount % 4 == 0) | 
					
						
							| 
									
										
										
										
											2017-08-17 04:23:36 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-02-03 10:33:02 +01:00
										 |  |  |         double powDb = CalcDb::dbPower(m_channelPowerAvg.asDouble()); | 
					
						
							| 
									
										
										
										
											2017-08-17 04:23:36 +02:00
										 |  |  |         ui->channelPower->setText(tr("%1 dB").arg(powDb, 0, 'f', 1)); | 
					
						
							| 
									
										
										
										
											2018-02-03 10:33:02 +01:00
										 |  |  |         double inPowDb = CalcDb::dbPower(m_inPowerAvg.asDouble()); | 
					
						
							| 
									
										
										
										
											2017-08-17 04:23:36 +02:00
										 |  |  |         ui->inputPower->setText(tr("%1").arg(inPowDb, 0, 'f', 1)); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-08-16 03:33:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     int32_t bufferGauge = m_udpSource->getBufferGauge(); | 
					
						
							| 
									
										
										
										
											2017-08-16 03:33:05 +02:00
										 |  |  |     ui->bufferGaugeNegative->setValue((bufferGauge < 0 ? -bufferGauge : 0)); | 
					
						
							|  |  |  |     ui->bufferGaugePositive->setValue((bufferGauge < 0 ? 0 : bufferGauge)); | 
					
						
							|  |  |  |     QString s = QString::number(bufferGauge, 'f', 0); | 
					
						
							|  |  |  |     ui->bufferRWBalanceText->setText(tr("%1").arg(s)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |     if (m_udpSource->getSquelchOpen()) { | 
					
						
							| 
									
										
										
										
											2017-08-17 04:23:36 +02:00
										 |  |  |         ui->channelMute->setStyleSheet("QToolButton { background-color : green; }"); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         ui->channelMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-08-17 12:57:45 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     m_tickCount++; | 
					
						
							| 
									
										
										
										
											2017-08-14 22:50:28 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::setSampleFormatIndex(const UDPSourceSettings::SampleFormat& sampleFormat) | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     switch(sampleFormat) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         case UDPSourceSettings::FormatSnLE: | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             ui->sampleFormat->setCurrentIndex(0); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |             ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |             ui->stereoInput->setChecked(true); | 
					
						
							|  |  |  |             ui->stereoInput->setEnabled(false); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             break; | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         case UDPSourceSettings::FormatNFM: | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             ui->sampleFormat->setCurrentIndex(1); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |             ui->fmDeviation->setEnabled(true); | 
					
						
							|  |  |  |             ui->stereoInput->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             break; | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         case UDPSourceSettings::FormatLSB: | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             ui->sampleFormat->setCurrentIndex(2); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |             ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |             ui->stereoInput->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             break; | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         case UDPSourceSettings::FormatUSB: | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             ui->sampleFormat->setCurrentIndex(3); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |             ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |             ui->stereoInput->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             break; | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         case UDPSourceSettings::FormatAM: | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             ui->sampleFormat->setCurrentIndex(4); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |             ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |             ui->stereoInput->setEnabled(true); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             break; | 
					
						
							|  |  |  |         default: | 
					
						
							|  |  |  |             ui->sampleFormat->setCurrentIndex(0); | 
					
						
							| 
									
										
										
										
											2017-10-16 00:28:01 +02:00
										 |  |  |             ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |             ui->stereoInput->setChecked(true); | 
					
						
							|  |  |  |             ui->stereoInput->setEnabled(false); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |             break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  | void UDPSourceGUI::setSampleFormat(int index) | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     switch(index) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     case 0: | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         m_settings.m_sampleFormat = UDPSourceSettings::FormatSnLE; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |         ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |         ui->stereoInput->setChecked(true); | 
					
						
							|  |  |  |         ui->stereoInput->setEnabled(false); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     case 1: | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         m_settings.m_sampleFormat = UDPSourceSettings::FormatNFM; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |         ui->fmDeviation->setEnabled(true); | 
					
						
							|  |  |  |         ui->stereoInput->setEnabled(true); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     case 2: | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         m_settings.m_sampleFormat = UDPSourceSettings::FormatLSB; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |         ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |         ui->stereoInput->setEnabled(true); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     case 3: | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         m_settings.m_sampleFormat = UDPSourceSettings::FormatUSB; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |         ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |         ui->stereoInput->setEnabled(true); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     case 4: | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         m_settings.m_sampleFormat = UDPSourceSettings::FormatAM; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |         ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |         ui->stereoInput->setEnabled(true); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     default: | 
					
						
							| 
									
										
										
										
											2018-09-11 22:36:16 +02:00
										 |  |  |         m_settings.m_sampleFormat = UDPSourceSettings::FormatSnLE; | 
					
						
							| 
									
										
										
										
											2017-10-15 22:55:00 +02:00
										 |  |  |         ui->fmDeviation->setEnabled(false); | 
					
						
							|  |  |  |         ui->stereoInput->setChecked(true); | 
					
						
							|  |  |  |         ui->stereoInput->setEnabled(false); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 |