2017-10-07 06:55:17 -04:00
|
|
|
#include "tcpsrcgui.h"
|
2016-10-02 07:18:07 -04:00
|
|
|
|
2016-10-10 19:17:55 -04:00
|
|
|
#include <device/devicesourceapi.h>
|
2017-10-31 03:24:05 -04:00
|
|
|
#include "device/deviceuiset.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
#include "plugin/pluginapi.h"
|
|
|
|
#include "dsp/spectrumvis.h"
|
2015-08-17 02:29:34 -04:00
|
|
|
#include "dsp/dspengine.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
#include "util/simpleserializer.h"
|
2015-11-18 00:05:13 -05:00
|
|
|
#include "util/db.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
#include "ui_tcpsrcgui.h"
|
2015-11-18 00:05:13 -05:00
|
|
|
#include "mainwindow.h"
|
2017-10-07 06:55:17 -04:00
|
|
|
#include "tcpsrc.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2017-11-08 19:03:05 -05:00
|
|
|
TCPSrcGUI* TCPSrcGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
|
2014-05-18 11:52:39 -04:00
|
|
|
{
|
2017-11-08 19:03:05 -05:00
|
|
|
TCPSrcGUI* gui = new TCPSrcGUI(pluginAPI, deviceUISet, rxChannel);
|
2014-05-18 11:52:39 -04:00
|
|
|
return gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TCPSrcGUI::destroy()
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TCPSrcGUI::setName(const QString& name)
|
|
|
|
{
|
|
|
|
setObjectName(name);
|
|
|
|
}
|
|
|
|
|
2015-07-18 20:07:40 -04:00
|
|
|
qint64 TCPSrcGUI::getCenterFrequency() const
|
|
|
|
{
|
2015-08-24 18:52:37 -04:00
|
|
|
return m_channelMarker.getCenterFrequency();
|
2015-07-18 20:07:40 -04:00
|
|
|
}
|
|
|
|
|
2015-09-28 21:35:14 -04:00
|
|
|
void TCPSrcGUI::setCenterFrequency(qint64 centerFrequency)
|
|
|
|
{
|
|
|
|
m_channelMarker.setCenterFrequency(centerFrequency);
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2015-06-06 21:30:28 -04:00
|
|
|
QString TCPSrcGUI::getName() const
|
|
|
|
{
|
|
|
|
return objectName();
|
|
|
|
}
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
void TCPSrcGUI::resetToDefaults()
|
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
m_settings.resetToDefaults();
|
|
|
|
displaySettings();
|
|
|
|
applySettings();
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray TCPSrcGUI::serialize() const
|
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
return m_settings.serialize();
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool TCPSrcGUI::deserialize(const QByteArray& data)
|
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
if(m_settings.deserialize(data))
|
|
|
|
{
|
|
|
|
qDebug("TCPSrcGUI::deserialize: m_squelchGate: %d", m_settings.m_squelchGate);
|
|
|
|
displaySettings();
|
|
|
|
applySettings();
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
2015-08-17 02:29:34 -04:00
|
|
|
bool TCPSrcGUI::handleMessage(const Message& message)
|
2014-05-18 11:52:39 -04:00
|
|
|
{
|
2015-08-17 02:29:34 -04:00
|
|
|
if (TCPSrc::MsgTCPSrcConnection::match(message))
|
|
|
|
{
|
|
|
|
TCPSrc::MsgTCPSrcConnection& con = (TCPSrc::MsgTCPSrcConnection&) message;
|
|
|
|
|
|
|
|
if(con.getConnect())
|
|
|
|
{
|
|
|
|
addConnection(con.getID(), con.getPeerAddress(), con.getPeerPort());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delConnection(con.getID());
|
|
|
|
}
|
|
|
|
|
2015-11-18 21:26:46 -05:00
|
|
|
qDebug() << "TCPSrcGUI::handleMessage: TCPSrc::MsgTCPSrcConnection: " << con.getConnect()
|
|
|
|
<< " ID: " << con.getID()
|
2015-08-17 02:29:34 -04:00
|
|
|
<< " peerAddress: " << con.getPeerAddress()
|
|
|
|
<< " peerPort: " << con.getPeerPort();
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
return true;
|
2015-08-17 02:29:34 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-05-18 11:52:39 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-14 02:39:45 -05:00
|
|
|
void TCPSrcGUI::channelMarkerChangedByCursor()
|
2014-05-18 11:52:39 -04:00
|
|
|
{
|
2017-11-14 02:39:45 -05:00
|
|
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
|
|
|
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
2014-05-18 11:52:39 -04:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2017-11-14 16:58:35 -05:00
|
|
|
void TCPSrcGUI::channelMarkerHighlightedByCursor()
|
|
|
|
{
|
|
|
|
setHighlighted(m_channelMarker.getHighlighted());
|
|
|
|
}
|
|
|
|
|
2015-11-18 00:05:13 -05:00
|
|
|
void TCPSrcGUI::tick()
|
|
|
|
{
|
2017-05-16 17:39:49 -04:00
|
|
|
double powDb = CalcDb::dbPower(m_tcpSrc->getMagSq());
|
2015-11-18 00:05:13 -05:00
|
|
|
m_channelPowerDbAvg.feed(powDb);
|
|
|
|
ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
|
|
|
|
}
|
|
|
|
|
2017-11-08 19:03:05 -05:00
|
|
|
TCPSrcGUI::TCPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent) :
|
2014-05-18 11:52:39 -04:00
|
|
|
RollupWidget(parent),
|
|
|
|
ui(new Ui::TCPSrcGUI),
|
|
|
|
m_pluginAPI(pluginAPI),
|
2017-10-31 03:24:05 -04:00
|
|
|
m_deviceUISet(deviceUISet),
|
2015-11-18 00:05:13 -05:00
|
|
|
m_tcpSrc(0),
|
2015-08-24 18:52:37 -04:00
|
|
|
m_channelMarker(this),
|
2015-11-18 00:05:13 -05:00
|
|
|
m_channelPowerDbAvg(40,0),
|
2017-10-07 04:24:25 -04:00
|
|
|
m_rfBandwidthChanged(false),
|
2015-08-18 19:02:52 -04:00
|
|
|
m_doApplySettings(true)
|
2014-05-18 11:52:39 -04:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->connectedClientsBox->hide();
|
|
|
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
|
|
|
|
|
|
|
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
2017-11-08 19:03:05 -05:00
|
|
|
m_tcpSrc = (TCPSrc*) rxChannel; //new TCPSrc(m_deviceUISet->m_deviceSourceAPI);
|
2017-10-07 06:55:17 -04:00
|
|
|
m_tcpSrc->setSpectrum(m_spectrumVis);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2017-05-17 17:05:47 -04:00
|
|
|
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
2017-05-16 12:27:36 -04:00
|
|
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
2017-05-17 13:36:36 -04:00
|
|
|
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
2015-11-17 23:36:29 -05:00
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
ui->glSpectrum->setCenterFrequency(0);
|
|
|
|
ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt());
|
|
|
|
ui->glSpectrum->setDisplayWaterfall(true);
|
|
|
|
ui->glSpectrum->setDisplayMaxHold(true);
|
2015-08-17 02:29:34 -04:00
|
|
|
m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), 64, 10, FFTWindow::BlackmanHarris);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2017-10-24 07:45:10 -04:00
|
|
|
ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer());
|
|
|
|
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
2015-11-18 00:05:13 -05:00
|
|
|
|
2017-11-14 02:39:45 -05:00
|
|
|
m_channelMarker.blockSignals(true);
|
2015-08-24 18:52:37 -04:00
|
|
|
m_channelMarker.setBandwidth(16000);
|
|
|
|
m_channelMarker.setCenterFrequency(0);
|
2017-10-07 04:24:25 -04:00
|
|
|
m_channelMarker.setColor(m_settings.m_rgbColor);
|
2017-11-14 02:39:45 -05:00
|
|
|
m_channelMarker.blockSignals(false);
|
|
|
|
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
2016-05-16 13:37:53 -04:00
|
|
|
|
2017-11-14 02:39:45 -05:00
|
|
|
setTitleColor(m_channelMarker.getColor());
|
2016-05-16 13:37:53 -04:00
|
|
|
|
2017-11-22 19:19:32 -05:00
|
|
|
m_deviceUISet->registerRxChannelInstance(TCPSrc::m_channelIdURI, this);
|
2017-10-31 03:24:05 -04:00
|
|
|
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
|
|
|
m_deviceUISet->addRollupWidget(this);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2017-11-14 02:39:45 -05:00
|
|
|
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
2017-11-14 16:58:35 -05:00
|
|
|
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
2017-11-14 02:39:45 -05:00
|
|
|
|
2015-08-17 02:29:34 -04:00
|
|
|
ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2017-10-07 06:55:17 -04:00
|
|
|
m_settings.setSpectrumGUI(ui->spectrumGUI);
|
|
|
|
m_settings.setChannelMarker(&m_channelMarker);
|
|
|
|
|
2017-11-14 02:39:45 -05:00
|
|
|
displaySettings();
|
2017-10-07 06:55:17 -04:00
|
|
|
applySettings();
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
TCPSrcGUI::~TCPSrcGUI()
|
|
|
|
{
|
2017-10-31 17:37:57 -04:00
|
|
|
m_deviceUISet->removeRxChannelInstance(this);
|
2017-11-08 19:03:05 -05:00
|
|
|
delete m_tcpSrc; // TODO: check this: when the GUI closes it has to delete the demodulator
|
2014-05-18 11:52:39 -04:00
|
|
|
delete m_spectrumVis;
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2015-08-18 19:02:52 -04:00
|
|
|
void TCPSrcGUI::blockApplySettings(bool block)
|
|
|
|
{
|
|
|
|
m_doApplySettings = !block;
|
|
|
|
}
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
void TCPSrcGUI::applySettings()
|
|
|
|
{
|
2015-08-23 22:09:36 -04:00
|
|
|
if (m_doApplySettings)
|
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
ui->glSpectrum->setSampleRate(m_settings.m_outputSampleRate);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2017-10-07 06:55:17 -04:00
|
|
|
TCPSrc::MsgConfigureChannelizer* channelConfigMsg = TCPSrc::MsgConfigureChannelizer::create(
|
|
|
|
m_settings.m_outputSampleRate, m_channelMarker.getCenterFrequency());
|
|
|
|
m_tcpSrc->getInputMessageQueue()->push(channelConfigMsg);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2017-10-07 04:44:58 -04:00
|
|
|
TCPSrc::MsgConfigureTCPSrc* message = TCPSrc::MsgConfigureTCPSrc::create( m_settings, false);
|
|
|
|
m_tcpSrc->getInputMessageQueue()->push(message);
|
2015-08-23 22:09:36 -04:00
|
|
|
}
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
2017-05-17 13:36:36 -04:00
|
|
|
void TCPSrcGUI::on_deltaFrequency_changed(qint64 value)
|
2015-11-17 23:36:29 -05:00
|
|
|
{
|
2017-05-17 13:36:36 -04:00
|
|
|
m_channelMarker.setCenterFrequency(value);
|
2017-10-07 04:24:25 -04:00
|
|
|
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
|
|
|
applySettings();
|
2015-11-17 23:36:29 -05:00
|
|
|
}
|
|
|
|
|
2017-10-07 04:24:25 -04:00
|
|
|
void TCPSrcGUI::on_sampleFormat_currentIndexChanged(int index)
|
2014-05-18 11:52:39 -04:00
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
setSampleFormat(index);
|
|
|
|
|
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
2017-05-25 14:13:34 -04:00
|
|
|
void TCPSrcGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused)))
|
2014-05-18 11:52:39 -04:00
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
bool ok;
|
|
|
|
Real outputSampleRate = ui->sampleRate->text().toDouble(&ok);
|
|
|
|
|
|
|
|
if((!ok) || (outputSampleRate < 1000))
|
|
|
|
{
|
|
|
|
m_settings.m_outputSampleRate = 48000;
|
|
|
|
ui->sampleRate->setText(QString("%1").arg(outputSampleRate, 0));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_settings.m_outputSampleRate = outputSampleRate;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
2017-05-25 14:13:34 -04:00
|
|
|
void TCPSrcGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((unused)))
|
2014-05-18 11:52:39 -04:00
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
bool ok;
|
|
|
|
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
|
|
|
|
|
|
|
|
if((!ok) || (rfBandwidth > m_settings.m_outputSampleRate))
|
|
|
|
{
|
|
|
|
m_settings.m_rfBandwidth = m_settings.m_outputSampleRate;
|
|
|
|
ui->rfBandwidth->setText(QString("%1").arg(m_settings.m_rfBandwidth, 0));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_settings.m_rfBandwidth = rfBandwidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_rfBandwidthChanged = true;
|
|
|
|
|
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
2017-05-25 14:13:34 -04:00
|
|
|
void TCPSrcGUI::on_tcpPort_textEdited(const QString& arg1 __attribute__((unused)))
|
2014-05-18 11:52:39 -04:00
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
bool ok;
|
|
|
|
int tcpPort = ui->tcpPort->text().toInt(&ok);
|
|
|
|
|
|
|
|
if((!ok) || (tcpPort < 1) || (tcpPort > 65535))
|
|
|
|
{
|
|
|
|
m_settings.m_tcpPort = 9999;
|
|
|
|
ui->tcpPort->setText(QString("%1").arg(m_settings.m_tcpPort, 0));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_settings.m_tcpPort = tcpPort;
|
|
|
|
}
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
ui->applyBtn->setEnabled(true);
|
2017-10-07 04:24:25 -04:00
|
|
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void TCPSrcGUI::on_applyBtn_clicked()
|
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
if (m_rfBandwidthChanged)
|
|
|
|
{
|
|
|
|
blockApplySettings(true);
|
|
|
|
m_channelMarker.setBandwidth((int) m_settings.m_rfBandwidth);
|
|
|
|
m_rfBandwidthChanged = false;
|
|
|
|
blockApplySettings(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->glSpectrum->setSampleRate(m_settings.m_outputSampleRate);
|
|
|
|
|
|
|
|
ui->applyBtn->setEnabled(false);
|
|
|
|
ui->applyBtn->setStyleSheet("QPushButton { background:rgb(79,79,79); }");
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2017-10-07 04:24:25 -04:00
|
|
|
void TCPSrcGUI::displaySettings()
|
|
|
|
{
|
|
|
|
m_channelMarker.blockSignals(true);
|
|
|
|
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
2017-11-14 02:39:45 -05:00
|
|
|
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
2017-11-19 12:18:17 -05:00
|
|
|
m_channelMarker.setTitle(m_settings.m_title);
|
2017-10-07 04:24:25 -04:00
|
|
|
m_channelMarker.blockSignals(false);
|
2017-11-14 02:39:45 -05:00
|
|
|
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
2017-10-07 04:24:25 -04:00
|
|
|
|
2017-11-14 02:39:45 -05:00
|
|
|
setTitleColor(m_settings.m_rgbColor);
|
2017-10-11 19:21:30 -04:00
|
|
|
setWindowTitle(m_channelMarker.getTitle());
|
|
|
|
|
2017-11-14 02:39:45 -05:00
|
|
|
blockApplySettings(true);
|
|
|
|
|
2017-10-07 04:24:25 -04:00
|
|
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
2017-11-14 02:39:45 -05:00
|
|
|
|
2017-10-07 04:24:25 -04:00
|
|
|
ui->sampleRate->setText(QString("%1").arg(m_settings.m_outputSampleRate, 0));
|
|
|
|
setSampleFormatIndex(m_settings.m_sampleFormat);
|
|
|
|
|
|
|
|
ui->rfBandwidth->setText(QString("%1").arg(m_settings.m_rfBandwidth, 0));
|
|
|
|
|
|
|
|
ui->volume->setValue(m_settings.m_volume);
|
|
|
|
ui->volumeText->setText(QString("%1").arg(ui->volume->value()));
|
|
|
|
|
|
|
|
ui->glSpectrum->setSampleRate(m_settings.m_outputSampleRate);
|
2017-11-14 02:39:45 -05:00
|
|
|
|
|
|
|
blockApplySettings(false);
|
2017-10-07 04:24:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void TCPSrcGUI::setSampleFormatIndex(const TCPSrcSettings::SampleFormat& sampleFormat)
|
|
|
|
{
|
|
|
|
switch(sampleFormat)
|
|
|
|
{
|
|
|
|
case TCPSrcSettings::FormatS16LE:
|
|
|
|
ui->sampleFormat->setCurrentIndex(0);
|
|
|
|
break;
|
|
|
|
case TCPSrcSettings::FormatNFM:
|
|
|
|
ui->sampleFormat->setCurrentIndex(1);
|
|
|
|
break;
|
|
|
|
case TCPSrcSettings::FormatSSB:
|
|
|
|
ui->sampleFormat->setCurrentIndex(2);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ui->sampleFormat->setCurrentIndex(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TCPSrcGUI::setSampleFormat(int index)
|
|
|
|
{
|
|
|
|
switch(index)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m_settings.m_sampleFormat = TCPSrcSettings::FormatS16LE;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_settings.m_sampleFormat = TCPSrcSettings::FormatNFM;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m_settings.m_sampleFormat = TCPSrcSettings::FormatSSB;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
m_settings.m_sampleFormat = TCPSrcSettings::FormatS16LE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TCPSrcGUI::on_volume_valueChanged(int value)
|
2014-12-28 14:04:26 -05:00
|
|
|
{
|
2017-10-07 04:24:25 -04:00
|
|
|
ui->volume->setValue(value);
|
|
|
|
ui->volumeText->setText(QString("%1").arg(value));
|
2014-12-28 14:04:26 -05:00
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
void TCPSrcGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
|
|
|
{
|
2015-08-17 02:29:34 -04:00
|
|
|
if ((widget == ui->spectrumBox) && (m_tcpSrc != 0))
|
|
|
|
{
|
|
|
|
m_tcpSrc->setSpectrum(m_tcpSrc->getInputMessageQueue(), rollDown);
|
|
|
|
}
|
2014-05-18 11:52:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void TCPSrcGUI::addConnection(quint32 id, const QHostAddress& peerAddress, int peerPort)
|
|
|
|
{
|
|
|
|
QStringList l;
|
|
|
|
l.append(QString("%1:%2").arg(peerAddress.toString()).arg(peerPort));
|
|
|
|
new QTreeWidgetItem(ui->connections, l, id);
|
|
|
|
ui->connectedClientsBox->setWindowTitle(tr("Connected Clients (%1)").arg(ui->connections->topLevelItemCount()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TCPSrcGUI::delConnection(quint32 id)
|
|
|
|
{
|
2015-08-17 02:29:34 -04:00
|
|
|
for(int i = 0; i < ui->connections->topLevelItemCount(); i++)
|
|
|
|
{
|
|
|
|
if(ui->connections->topLevelItem(i)->type() == (int)id)
|
|
|
|
{
|
2014-05-18 11:52:39 -04:00
|
|
|
delete ui->connections->topLevelItem(i);
|
|
|
|
ui->connectedClientsBox->setWindowTitle(tr("Connected Clients (%1)").arg(ui->connections->topLevelItemCount()));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|