| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | // Copyright (C) 2023 Edouard Griffiths, F4EXB                                   //
 | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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                  //
 | 
					
						
							|  |  |  | // (at your option) any later version.                                           //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QDebug>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QTime>
 | 
					
						
							|  |  |  | #include <QDateTime>
 | 
					
						
							|  |  |  | #include <QString>
 | 
					
						
							|  |  |  | #include <QMessageBox>
 | 
					
						
							|  |  |  | #include <QFileDialog>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | #include "ui_aaroniartsainputgui.h"
 | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | #include "plugin/pluginapi.h"
 | 
					
						
							|  |  |  | #include "gui/colormapper.h"
 | 
					
						
							|  |  |  | #include "gui/glspectrum.h"
 | 
					
						
							|  |  |  | #include "gui/basicdevicesettingsdialog.h"
 | 
					
						
							|  |  |  | #include "gui/dialogpositioner.h"
 | 
					
						
							|  |  |  | #include "dsp/dspengine.h"
 | 
					
						
							|  |  |  | #include "dsp/dspcommands.h"
 | 
					
						
							|  |  |  | #include "util/db.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "mainwindow.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | #include "aaroniartsainputgui.h"
 | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | #include "device/deviceapi.h"
 | 
					
						
							|  |  |  | #include "device/deviceuiset.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | AaroniaRTSAInputGui::AaroniaRTSAInputGui(DeviceUISet *deviceUISet, QWidget* parent) : | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  |     DeviceGUI(parent), | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  |     ui(new Ui::AaroniaRTSAInputGui), | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  |     m_settings(), | 
					
						
							|  |  |  |     m_doApplySettings(true), | 
					
						
							|  |  |  |     m_forceSettings(true), | 
					
						
							|  |  |  |     m_sampleSource(0), | 
					
						
							|  |  |  |     m_tickCount(0), | 
					
						
							|  |  |  |     m_lastEngineState(DeviceAPI::StNotStarted) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  |     qDebug("AaroniaRTSAInputGui::AaroniaRTSAInputGui"); | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  |     m_deviceUISet = deviceUISet; | 
					
						
							|  |  |  |     setAttribute(Qt::WA_DeleteOnClose, true); | 
					
						
							|  |  |  |     m_sampleSource = m_deviceUISet->m_deviceAPI->getSampleSource(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	m_statusTooltips.push_back("Idle");          // 0
 | 
					
						
							| 
									
										
										
										
											2023-03-22 17:57:21 +01:00
										 |  |  | 	m_statusTooltips.push_back("Unstable");      // 1
 | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | 	m_statusTooltips.push_back("Connected");     // 2
 | 
					
						
							|  |  |  | 	m_statusTooltips.push_back("Error");         // 3
 | 
					
						
							|  |  |  | 	m_statusTooltips.push_back("Disconnected");  // 4
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	m_statusColors.push_back("gray");               // Idle
 | 
					
						
							| 
									
										
										
										
											2023-03-22 17:57:21 +01:00
										 |  |  | 	m_statusColors.push_back("rgb(232, 212, 35)");  // Unstable (yellow)
 | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | 	m_statusColors.push_back("rgb(35, 138, 35)");   // Connected (green)
 | 
					
						
							|  |  |  | 	m_statusColors.push_back("rgb(232, 85, 85)");   // Error (red)
 | 
					
						
							|  |  |  | 	m_statusColors.push_back("rgb(232, 85, 232)");  // Disconnected (magenta)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->setupUi(getContents()); | 
					
						
							|  |  |  |     sizeToContents(); | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  |     getContents()->setStyleSheet("#AaroniaRTSAInputGui { background-color: rgb(64, 64, 64); }"); | 
					
						
							| 
									
										
										
										
											2023-04-05 09:38:02 +02:00
										 |  |  |     m_helpURL = "plugins/samplesource/aaroniartsainput/readme.md"; | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  |     ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); | 
					
						
							|  |  |  |     ui->centerFrequency->setValueRange(9, 0, 999999999); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 07:57:09 +01:00
										 |  |  |     ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow)); | 
					
						
							|  |  |  |     ui->sampleRate->setValueRange(8, 2000U, 20000000U); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  |     displaySettings(); | 
					
						
							|  |  |  |     makeUIConnections(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); | 
					
						
							|  |  |  |     connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); | 
					
						
							|  |  |  |     m_statusTimer.start(500); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection); | 
					
						
							|  |  |  |     m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | AaroniaRTSAInputGui::~AaroniaRTSAInputGui() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     delete ui; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::destroy() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     delete this; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::resetToDefaults() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_settings.resetToDefaults(); | 
					
						
							|  |  |  |     displaySettings(); | 
					
						
							|  |  |  |     m_forceSettings = true; | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | QByteArray AaroniaRTSAInputGui::serialize() const | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     return m_settings.serialize(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | bool AaroniaRTSAInputGui::deserialize(const QByteArray& data) | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     if(m_settings.deserialize(data)) { | 
					
						
							|  |  |  |         displaySettings(); | 
					
						
							|  |  |  |         m_forceSettings = true; | 
					
						
							|  |  |  |         sendSettings(); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         resetToDefaults(); | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::on_startStop_toggled(bool checked) | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     if (m_doApplySettings) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  | 		AaroniaRTSAInput::MsgStartStop *message = AaroniaRTSAInput::MsgStartStop::create(checked); | 
					
						
							|  |  |  |         m_sampleSource->getInputMessageQueue()->push(message); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::on_centerFrequency_changed(quint64 value) | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_settings.m_centerFrequency = value * 1000; | 
					
						
							|  |  |  |     m_settingsKeys.append("centerFrequency"); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::on_sampleRate_changed(quint64 value) | 
					
						
							| 
									
										
										
										
											2023-03-24 07:57:09 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_settings.m_sampleRate = value; | 
					
						
							|  |  |  |     m_settingsKeys.append("sampleRate"); | 
					
						
							|  |  |  |     sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::on_serverAddress_returnPressed() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	on_serverAddressApplyButton_clicked(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::on_serverAddressApplyButton_clicked() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	QString serverAddress = ui->serverAddress->text(); | 
					
						
							|  |  |  |     QUrl url(serverAddress); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (QStringList{"ws", "wss", "http", "https"}.contains(url.scheme())) { | 
					
						
							|  |  |  |         m_settings.m_serverAddress = QString("%1:%2").arg(url.host()).arg(url.port()); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         m_settings.m_serverAddress = serverAddress; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_settingsKeys.append("serverAddress"); | 
					
						
							|  |  |  | 	sendSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::displaySettings() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     blockApplySettings(true); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); | 
					
						
							|  |  |  | 	ui->serverAddress->setText(m_settings.m_serverAddress); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     blockApplySettings(false); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::sendSettings() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     if (!m_updateTimer.isActive()) { | 
					
						
							|  |  |  |         m_updateTimer.start(100); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::updateHardware() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     if (m_doApplySettings) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  | 		AaroniaRTSAInput::MsgConfigureAaroniaRTSA* message = AaroniaRTSAInput::MsgConfigureAaroniaRTSA::create(m_settings, m_settingsKeys, m_forceSettings); | 
					
						
							|  |  |  |         m_sampleSource->getInputMessageQueue()->push(message); | 
					
						
							|  |  |  |         m_forceSettings = false; | 
					
						
							|  |  |  |         m_settingsKeys.clear(); | 
					
						
							|  |  |  |         m_updateTimer.stop(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::updateStatus() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     int state = m_deviceUISet->m_deviceAPI->state(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (m_lastEngineState != state) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         switch (state) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             case DeviceAPI::StNotStarted: | 
					
						
							|  |  |  |                 ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |             case DeviceAPI::StIdle: | 
					
						
							|  |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : blue; }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |             case DeviceAPI::StRunning: | 
					
						
							|  |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : green; }"); | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |             case DeviceAPI::StError: | 
					
						
							|  |  |  |                 ui->startStop->setStyleSheet("QToolButton { background-color : red; }"); | 
					
						
							|  |  |  |                 QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage()); | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |             default: | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         m_lastEngineState = state; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | bool AaroniaRTSAInputGui::handleMessage(const Message& message) | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     if (AaroniaRTSAInput::MsgConfigureAaroniaRTSA::match(message)) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  |         qDebug("AaroniaRTSAInputGui::handleMessage: MsgConfigureAaroniaRTSA"); | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  |         const AaroniaRTSAInput::MsgConfigureAaroniaRTSA& cfg = (AaroniaRTSAInput::MsgConfigureAaroniaRTSA&) message; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (cfg.getForce()) { | 
					
						
							|  |  |  |             m_settings = cfg.getSettings(); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings()); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         displaySettings(); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (AaroniaRTSAInput::MsgStartStop::match(message)) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  |         qDebug("AaroniaRTSAInputGui::handleMessage: MsgStartStop"); | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | 		AaroniaRTSAInput::MsgStartStop& notif = (AaroniaRTSAInput::MsgStartStop&) message; | 
					
						
							|  |  |  |         blockApplySettings(true); | 
					
						
							|  |  |  |         ui->startStop->setChecked(notif.getStartStop()); | 
					
						
							|  |  |  |         blockApplySettings(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 	else if (AaroniaRTSAInput::MsgSetStatus::match(message)) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | 		qDebug("AaroniaRTSAInputGui::handleMessage: MsgSetStatus"); | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | 		AaroniaRTSAInput::MsgSetStatus& notif = (AaroniaRTSAInput::MsgSetStatus&) message; | 
					
						
							|  |  |  | 		int status = notif.getStatus(); | 
					
						
							|  |  |  | 		ui->statusIndicator->setToolTip(m_statusTooltips[status]); | 
					
						
							|  |  |  | 		ui->statusIndicator->setStyleSheet("QLabel { background-color: " + | 
					
						
							|  |  |  | 			m_statusColors[status] + "; border-radius: 7px; }"); | 
					
						
							|  |  |  | 		return true; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::handleInputMessages() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     Message* message; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     while ((message = m_inputMessageQueue.pop()) != 0) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (DSPSignalNotification::match(*message)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             DSPSignalNotification* notif = (DSPSignalNotification*) message; | 
					
						
							|  |  |  |             m_deviceSampleRate = notif->getSampleRate(); | 
					
						
							|  |  |  |             m_deviceCenterFrequency = notif->getCenterFrequency(); | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  |             qDebug("AaroniaRTSAInputGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  |                     notif->getSampleRate(), | 
					
						
							|  |  |  |                     notif->getCenterFrequency()); | 
					
						
							|  |  |  |             updateSampleRateAndFrequency(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             delete message; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             if (handleMessage(*message)) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 delete message; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::updateSampleRateAndFrequency() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_deviceUISet->getSpectrum()->setSampleRate(m_deviceSampleRate); | 
					
						
							|  |  |  |     m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); | 
					
						
							| 
									
										
										
										
											2023-03-23 01:30:12 +01:00
										 |  |  | 	// ui->deviceRateText->setText(tr("%1M").arg((float)m_deviceSampleRate / 1000 / 1000));
 | 
					
						
							|  |  |  |     ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_deviceSampleRate / 1000.0f, 'g', 5))); | 
					
						
							| 
									
										
										
										
											2023-03-22 17:57:21 +01:00
										 |  |  |     blockApplySettings(true); | 
					
						
							| 
									
										
										
										
											2023-03-19 13:25:06 +01:00
										 |  |  |     ui->centerFrequency->setValue(m_deviceCenterFrequency / 1000); | 
					
						
							| 
									
										
										
										
											2023-03-24 07:57:09 +01:00
										 |  |  |     ui->sampleRate->setValue(m_deviceSampleRate); | 
					
						
							| 
									
										
										
										
											2023-03-22 17:57:21 +01:00
										 |  |  |     blockApplySettings(false); | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::openDeviceSettingsDialog(const QPoint& p) | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     if (m_contextMenuType == ContextMenuDeviceSettings) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         BasicDeviceSettingsDialog dialog(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.move(p); | 
					
						
							|  |  |  |         new DialogPositioner(&dialog, false); | 
					
						
							|  |  |  |         dialog.exec(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         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_settingsKeys.append("useReverseAPI"); | 
					
						
							|  |  |  |         m_settingsKeys.append("reverseAPIAddress"); | 
					
						
							|  |  |  |         m_settingsKeys.append("reverseAPIPort"); | 
					
						
							|  |  |  |         m_settingsKeys.append("reverseAPIDeviceIndex"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         sendSettings(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     resetContextMenuType(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  | void AaroniaRTSAInputGui::makeUIConnections() | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2023-03-24 18:26:26 +01:00
										 |  |  |     QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &AaroniaRTSAInputGui::on_startStop_toggled); | 
					
						
							|  |  |  |     QObject::connect(ui->centerFrequency, &ValueDial::changed, this, &AaroniaRTSAInputGui::on_centerFrequency_changed); | 
					
						
							|  |  |  |     QObject::connect(ui->sampleRate, &ValueDial::changed, this, &AaroniaRTSAInputGui::on_sampleRate_changed); | 
					
						
							|  |  |  |     QObject::connect(ui->serverAddress, &QLineEdit::returnPressed, this, &AaroniaRTSAInputGui::on_serverAddress_returnPressed); | 
					
						
							|  |  |  |     QObject::connect(ui->serverAddressApplyButton, &QPushButton::clicked, this, &AaroniaRTSAInputGui::on_serverAddressApplyButton_clicked); | 
					
						
							| 
									
										
										
										
											2023-03-18 12:48:21 +01:00
										 |  |  | } |