You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.8 KiB
79 lines
1.8 KiB
#include <QPainter> |
|
#include <QColorDialog> |
|
#include "gui/basicchannelsettingswidget.h" |
|
#include "dsp/channelmarker.h" |
|
#include "ui_basicchannelsettingswidget.h" |
|
|
|
BasicChannelSettingsWidget::BasicChannelSettingsWidget(ChannelMarker* marker, QWidget* parent) : |
|
QWidget(parent), |
|
ui(new Ui::BasicChannelSettingsWidget), |
|
m_channelMarker(marker) |
|
{ |
|
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(); |
|
} |
|
|
|
BasicChannelSettingsWidget::~BasicChannelSettingsWidget() |
|
{ |
|
delete ui; |
|
} |
|
|
|
void BasicChannelSettingsWidget::on_title_textChanged(const QString& text) |
|
{ |
|
m_channelMarker->setTitle(text); |
|
} |
|
|
|
void BasicChannelSettingsWidget::on_colorBtn_clicked() |
|
{ |
|
QColor c = m_channelMarker->getColor(); |
|
c = QColorDialog::getColor(c, this, tr("Select Color for Channel")); |
|
if(c.isValid()) { |
|
m_channelMarker->setColor(c); |
|
paintColor(); |
|
} |
|
} |
|
|
|
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->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::setUDPDialogVisible(bool visible) |
|
{ |
|
if (visible) |
|
{ |
|
ui->udpWidget->show(); |
|
} |
|
else |
|
{ |
|
ui->udpWidget->hide(); |
|
} |
|
}
|
|
|