mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-17 13:51:47 -05:00
UDP Sink: use settings in GUI (3)
This commit is contained in:
parent
898fcce31e
commit
76f20aa2e5
@ -85,13 +85,13 @@ QByteArray UDPSinkGUI::serialize() const
|
|||||||
s.writeReal(5, m_settings.m_rfBandwidth);
|
s.writeReal(5, m_settings.m_rfBandwidth);
|
||||||
s.writeBlob(6, m_channelMarker.serialize());
|
s.writeBlob(6, m_channelMarker.serialize());
|
||||||
s.writeBlob(7, ui->spectrumGUI->serialize());
|
s.writeBlob(7, ui->spectrumGUI->serialize());
|
||||||
s.writeS32(10, ui->gainOut->value());
|
s.writeS32(10, roundf(m_settings.m_gainOut * 10.0));
|
||||||
s.writeS32(11, m_settings.m_fmDeviation);
|
s.writeS32(11, m_settings.m_fmDeviation);
|
||||||
s.writeBool(13, ui->stereoInput->isChecked());
|
s.writeBool(13, m_settings.m_stereoInput);
|
||||||
s.writeS32(14, ui->squelch->value());
|
s.writeS32(14, roundf(m_settings.m_squelch));
|
||||||
s.writeS32(15, ui->squelchGate->value());
|
s.writeS32(15, ui->squelchGate->value());
|
||||||
s.writeBool(16, ui->autoRWBalance->isChecked());
|
s.writeBool(16, m_settings.m_autoRWBalance);
|
||||||
s.writeS32(17, ui->gainIn->value());
|
s.writeS32(17, roundf(m_settings.m_gainIn * 10.0));
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,23 +131,21 @@ bool UDPSinkGUI::deserialize(const QByteArray& data)
|
|||||||
d.readBlob(7, &bytetmp);
|
d.readBlob(7, &bytetmp);
|
||||||
ui->spectrumGUI->deserialize(bytetmp);
|
ui->spectrumGUI->deserialize(bytetmp);
|
||||||
d.readS32(10, &s32tmp, 10);
|
d.readS32(10, &s32tmp, 10);
|
||||||
ui->gainOut->setValue(s32tmp);
|
m_settings.m_gainOut = s32tmp / 10.0;
|
||||||
ui->gainOutText->setText(tr("%1").arg(s32tmp/10.0, 0, 'f', 1));
|
|
||||||
d.readS32(11, &s32tmp, 2500);
|
d.readS32(11, &s32tmp, 2500);
|
||||||
m_settings.m_fmDeviation = s32tmp * 1.0;
|
m_settings.m_fmDeviation = s32tmp * 1.0;
|
||||||
d.readBool(13, &booltmp, true);
|
d.readBool(13, &booltmp, true);
|
||||||
ui->stereoInput->setChecked(booltmp);
|
m_settings.m_stereoInput = booltmp;
|
||||||
d.readS32(14, &s32tmp, -60);
|
d.readS32(14, &s32tmp, -60);
|
||||||
ui->squelch->setValue(s32tmp);
|
m_settings.m_squelch = s32tmp * 1.0;
|
||||||
ui->squelchText->setText(tr("%1").arg(s32tmp*1.0, 0, 'f', 0));
|
m_settings.m_squelchEnabled = (s32tmp != -100);
|
||||||
d.readS32(15, &s32tmp, 5);
|
d.readS32(15, &s32tmp, 5);
|
||||||
ui->squelchGate->setValue(s32tmp);
|
ui->squelchGate->setValue(s32tmp);
|
||||||
ui->squelchGateText->setText(tr("%1").arg(s32tmp*10.0, 0, 'f', 0));
|
ui->squelchGateText->setText(tr("%1").arg(s32tmp*10.0, 0, 'f', 0));
|
||||||
d.readBool(16, &booltmp, true);
|
d.readBool(16, &booltmp, true);
|
||||||
ui->autoRWBalance->setChecked(booltmp);
|
m_settings.m_autoRWBalance = booltmp;
|
||||||
d.readS32(17, &s32tmp, 10);
|
d.readS32(17, &s32tmp, 10);
|
||||||
ui->gainIn->setValue(s32tmp);
|
m_settings.m_gainIn = s32tmp / 10.0;
|
||||||
ui->gainInText->setText(tr("%1").arg(s32tmp/10.0, 0, 'f', 1));
|
|
||||||
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
m_channelMarker.blockSignals(false);
|
m_channelMarker.blockSignals(false);
|
||||||
@ -281,14 +279,14 @@ void UDPSinkGUI::applySettings(bool force)
|
|||||||
m_settings.m_amModFactor,
|
m_settings.m_amModFactor,
|
||||||
m_channelMarker.getUDPAddress(),
|
m_channelMarker.getUDPAddress(),
|
||||||
m_channelMarker.getUDPReceivePort(),
|
m_channelMarker.getUDPReceivePort(),
|
||||||
ui->channelMute->isChecked(),
|
m_settings.m_channelMute,
|
||||||
ui->gainIn->value() / 10.0f,
|
m_settings.m_gainIn,
|
||||||
ui->gainOut->value() / 10.0f,
|
m_settings.m_gainOut,
|
||||||
ui->squelch->value() * 1.0f,
|
m_settings.m_squelch,
|
||||||
ui->squelchGate->value() * 0.01f,
|
m_settings.m_squelchGate,
|
||||||
ui->squelch->value() != -100,
|
m_settings.m_squelchEnabled,
|
||||||
ui->autoRWBalance->isChecked(),
|
m_settings.m_autoRWBalance,
|
||||||
ui->stereoInput->isChecked(),
|
m_settings.m_stereoInput,
|
||||||
force);
|
force);
|
||||||
|
|
||||||
ui->applyBtn->setEnabled(false);
|
ui->applyBtn->setEnabled(false);
|
||||||
@ -301,14 +299,31 @@ void UDPSinkGUI::displaySettings()
|
|||||||
ui->sampleRate->setText(QString("%1").arg(roundf(m_settings.m_inputSampleRate), 0));
|
ui->sampleRate->setText(QString("%1").arg(roundf(m_settings.m_inputSampleRate), 0));
|
||||||
ui->rfBandwidth->setText(QString("%1").arg(roundf(m_settings.m_rfBandwidth), 0));
|
ui->rfBandwidth->setText(QString("%1").arg(roundf(m_settings.m_rfBandwidth), 0));
|
||||||
ui->fmDeviation->setText(QString("%1").arg(m_settings.m_fmDeviation, 0));
|
ui->fmDeviation->setText(QString("%1").arg(m_settings.m_fmDeviation, 0));
|
||||||
ui->amModPercent->setText(QString("%1").arg(roundf(m_settings.m_amModFactor), 0));
|
ui->amModPercent->setText(QString("%1").arg(roundf(m_settings.m_amModFactor * 100.0), 0));
|
||||||
|
|
||||||
setSampleFormatIndex(m_settings.m_sampleFormat);
|
setSampleFormatIndex(m_settings.m_sampleFormat);
|
||||||
|
|
||||||
ui->gainInText->setText(tr("%1").arg(ui->gainIn->value()/10.0, 0, 'f', 1));
|
ui->channelMute->setChecked(m_settings.m_channelMute);
|
||||||
ui->gainOutText->setText(tr("%1").arg(ui->gainOut->value()/10.0, 0, 'f', 1));
|
ui->autoRWBalance->setChecked(m_settings.m_autoRWBalance);
|
||||||
ui->squelchText->setText(tr("%1").arg(ui->squelch->value()*1.0, 0, 'f', 0));
|
ui->stereoInput->setChecked(m_settings.m_stereoInput);
|
||||||
ui->squelchGateText->setText(tr("%1").arg(ui->squelchGate->value()*10.0, 0, 'f', 0));
|
|
||||||
|
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));
|
||||||
|
|
||||||
ui->addressText->setText(tr("%1:%2").arg(m_channelMarker.getUDPAddress()).arg(m_channelMarker.getUDPReceivePort()));
|
ui->addressText->setText(tr("%1:%2").arg(m_channelMarker.getUDPAddress()).arg(m_channelMarker.getUDPReceivePort()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,38 +426,42 @@ void UDPSinkGUI::on_amModPercent_textEdited(const QString& arg1 __attribute__((u
|
|||||||
|
|
||||||
void UDPSinkGUI::on_gainIn_valueChanged(int value)
|
void UDPSinkGUI::on_gainIn_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->gainInText->setText(tr("%1").arg(value/10.0, 0, 'f', 1));
|
m_settings.m_gainIn = value / 10.0;
|
||||||
|
ui->gainInText->setText(tr("%1").arg(m_settings.m_gainIn, 0, 'f', 1));
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_gainOut_valueChanged(int value)
|
void UDPSinkGUI::on_gainOut_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->gainOutText->setText(tr("%1").arg(value/10.0, 0, 'f', 1));
|
m_settings.m_gainOut = value / 10.0;
|
||||||
|
ui->gainOutText->setText(tr("%1").arg(m_settings.m_gainOut, 0, 'f', 1));
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_squelch_valueChanged(int value)
|
void UDPSinkGUI::on_squelch_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if (value == -100) // means disabled
|
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 {
|
||||||
ui->squelchText->setText("---");
|
ui->squelchText->setText("---");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->squelchText->setText(tr("%1").arg(value*1.0, 0, 'f', 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_squelchGate_valueChanged(int value)
|
void UDPSinkGUI::on_squelchGate_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->squelchGateText->setText(tr("%1").arg(value*10.0, 0, 'f', 0));
|
m_settings.m_squelchGate = value / 100.0;
|
||||||
|
ui->squelchGateText->setText(tr("%1").arg(roundf(value * 10.0), 0, 'f', 0));
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_channelMute_toggled(bool checked __attribute__((unused)))
|
void UDPSinkGUI::on_channelMute_toggled(bool checked)
|
||||||
{
|
{
|
||||||
|
m_settings.m_channelMute = checked;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,13 +475,15 @@ void UDPSinkGUI::on_resetUDPReadIndex_clicked()
|
|||||||
m_udpSink->resetReadIndex(m_udpSink->getInputMessageQueue());
|
m_udpSink->resetReadIndex(m_udpSink->getInputMessageQueue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_autoRWBalance_toggled(bool checked __attribute__((unused)))
|
void UDPSinkGUI::on_autoRWBalance_toggled(bool checked)
|
||||||
{
|
{
|
||||||
|
m_settings.m_autoRWBalance = checked;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_stereoInput_toggled(bool checked __attribute__((unused)))
|
void UDPSinkGUI::on_stereoInput_toggled(bool checked)
|
||||||
{
|
{
|
||||||
|
m_settings.m_stereoInput = checked;
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user