1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-04 15:04:38 -04:00

Reverse API: BasicChannelSettingsDialog changes. Applied to AM demod GUI

This commit is contained in:
f4exb
2018-12-13 23:52:09 +01:00
parent f9062881fc
commit e7f123390f
7 changed files with 162 additions and 3 deletions
+51 -1
View File
@@ -15,6 +15,9 @@ BasicChannelSettingsDialog::BasicChannelSettingsDialog(ChannelMarker* marker, QW
ui->title->setText(m_channelMarker->getTitle());
m_color = m_channelMarker->getColor();
ui->fScaleDisplayType->setCurrentIndex((int) m_channelMarker->getFrequencyScaleDisplayType());
setUseReverseAPI(false);
setReverseAPIAddress("127.0.0.1");
setReverseAPIPort(8888);
paintColor();
}
@@ -23,6 +26,29 @@ BasicChannelSettingsDialog::~BasicChannelSettingsDialog()
delete ui;
}
void BasicChannelSettingsDialog::setUseReverseAPI(bool useReverseAPI)
{
m_useReverseAPI = useReverseAPI;
ui->reverseAPI->setChecked(m_useReverseAPI);
}
void BasicChannelSettingsDialog::setReverseAPIAddress(const QString& address)
{
m_reverseAPIAddress = address;
ui->reverseAPIAddress->setText(m_reverseAPIAddress);
}
void BasicChannelSettingsDialog::setReverseAPIPort(uint16_t port)
{
if (port < 1024) {
return;
} else {
m_reverseAPIPort = port;
}
ui->reverseAPIPort->setText(tr("%1").arg(m_reverseAPIPort));
}
void BasicChannelSettingsDialog::paintColor()
{
QPixmap pm(24, 24);
@@ -38,12 +64,36 @@ void BasicChannelSettingsDialog::on_colorBtn_clicked()
{
QColor c = m_color;
c = QColorDialog::getColor(c, this, tr("Select Color for Channel"), QColorDialog::DontUseNativeDialog);
if(c.isValid()) {
if (c.isValid())
{
m_color = c;
paintColor();
}
}
void BasicChannelSettingsDialog::on_reverseAPI_toggled(bool checked)
{
m_useReverseAPI = checked;
}
void BasicChannelSettingsDialog::on_reverseAPIAddress_returnPressed()
{
m_reverseAPIAddress = ui->reverseAPIAddress->text();
}
void BasicChannelSettingsDialog::on_reverseAPIPort_returnPressed()
{
bool dataOk;
int reverseAPIPort = ui->reverseAPIPort->text().toInt(&dataOk);
if((!dataOk) || (reverseAPIPort < 1024) || (reverseAPIPort > 65535)) {
return;
} else {
m_reverseAPIPort = reverseAPIPort;
}
}
void BasicChannelSettingsDialog::accept()
{
m_channelMarker->blockSignals(true);