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

New basic channel marker settings with UDP address and port

This commit is contained in:
f4exb
2017-08-23 23:43:11 +02:00
parent 19bd6b9bb3
commit 7d4eddbeac
5 changed files with 170 additions and 115 deletions
+30 -28
View File
@@ -11,10 +11,9 @@ BasicChannelSettingsWidget::BasicChannelSettingsWidget(ChannelMarker* marker, QW
{
ui->setupUi(this);
ui->title->setText(m_channelMarker->getTitle());
ui->address->setText(m_channelMarker->getUDPAddress());
ui->port->setText(QString("%1").arg(m_channelMarker->getUDPPort()));
paintColor();
ui->red->setValue(m_channelMarker->getColor().red());
ui->green->setValue(m_channelMarker->getColor().green());
ui->blue->setValue(m_channelMarker->getColor().blue());
}
BasicChannelSettingsWidget::~BasicChannelSettingsWidget()
@@ -34,44 +33,47 @@ void BasicChannelSettingsWidget::on_colorBtn_clicked()
if(c.isValid()) {
m_channelMarker->setColor(c);
paintColor();
ui->red->setValue(m_channelMarker->getColor().red());
ui->green->setValue(m_channelMarker->getColor().green());
ui->blue->setValue(m_channelMarker->getColor().blue());
}
}
void BasicChannelSettingsWidget::on_address_textEdited(const QString& arg1)
{
m_channelMarker->setUDPAddress(arg1);
}
void BasicChannelSettingsWidget::on_port_textEdited(const QString& arg1)
{
bool ok;
int udpPort = arg1.toInt(&ok);
if((!ok) || (udpPort < 1024) || (udpPort > 65535))
{
udpPort = 9999;
}
m_channelMarker->setUDPPort(udpPort);
}
void BasicChannelSettingsWidget::paintColor()
{
QColor c(m_channelMarker->getColor());
QPixmap pm(24, 24);
pm.fill(c);
ui->colorBtn->setIcon(pm);
ui->color->setText(tr("#%1%2%3")
ui->colorText->setText(tr("#%1%2%3")
.arg(c.red(), 2, 16, QChar('0'))
.arg(c.green(), 2, 16, QChar('0'))
.arg(c.blue(), 2, 16, QChar('0')));
}
void BasicChannelSettingsWidget::on_red_valueChanged(int value)
void BasicChannelSettingsWidget::setUDPDialogVisible(bool visible)
{
QColor c(m_channelMarker->getColor());
c.setRed(value);
m_channelMarker->setColor(c);
paintColor();
}
void BasicChannelSettingsWidget::on_green_valueChanged(int value)
{
QColor c(m_channelMarker->getColor());
c.setGreen(value);
m_channelMarker->setColor(c);
paintColor();
}
void BasicChannelSettingsWidget::on_blue_valueChanged(int value)
{
QColor c(m_channelMarker->getColor());
c.setBlue(value);
m_channelMarker->setColor(c);
paintColor();
if (visible)
{
ui->udpWidget->show();
}
else
{
ui->udpWidget->hide();
}
}