mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-10 21:50:10 -04:00
New basic channel marker settings with UDP address and port
This commit is contained in:
parent
19bd6b9bb3
commit
7d4eddbeac
@ -35,7 +35,9 @@ ChannelMarker::ChannelMarker(QObject* parent) :
|
||||
m_visible(false),
|
||||
m_highlighted(false),
|
||||
m_color(m_colorTable[m_nextColor]),
|
||||
m_movable(true)
|
||||
m_movable(true),
|
||||
m_udpAddress("127.0.0.1"),
|
||||
m_udpPort(9999)
|
||||
{
|
||||
++m_nextColor;
|
||||
if(m_colorTable[m_nextColor] == 0)
|
||||
@ -95,3 +97,15 @@ void ChannelMarker::setColor(const QColor& color)
|
||||
m_color = color;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void ChannelMarker::setUDPAddress(const QString& udpAddress)
|
||||
{
|
||||
m_udpAddress = udpAddress;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void ChannelMarker::setUDPPort(quint16 port)
|
||||
{
|
||||
m_udpPort = port;
|
||||
emit changed();
|
||||
}
|
||||
|
@ -50,6 +50,13 @@ public:
|
||||
void setMovable(bool movable) { m_movable = movable; }
|
||||
bool getMovable() const { return m_movable; }
|
||||
|
||||
void setUDPAddress(const QString& udpAddress);
|
||||
const QString& getUDPAddress() const { return m_udpAddress; }
|
||||
|
||||
void setUDPPort(quint16 port);
|
||||
quint16 getUDPPort() const { return m_udpPort; }
|
||||
|
||||
|
||||
protected:
|
||||
static QRgb m_colorTable[];
|
||||
static int m_nextColor;
|
||||
@ -64,6 +71,8 @@ protected:
|
||||
bool m_highlighted;
|
||||
QColor m_color;
|
||||
bool m_movable;
|
||||
QString m_udpAddress;
|
||||
quint16 m_udpPort;
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ class SDRANGEL_API BasicChannelSettingsWidget : public QWidget {
|
||||
public:
|
||||
explicit BasicChannelSettingsWidget(ChannelMarker* marker, QWidget* parent = NULL);
|
||||
~BasicChannelSettingsWidget();
|
||||
void setUDPDialogVisible(bool visible);
|
||||
|
||||
private slots:
|
||||
void on_title_textChanged(const QString& text);
|
||||
void on_colorBtn_clicked();
|
||||
void on_red_valueChanged(int value);
|
||||
void on_green_valueChanged(int value);
|
||||
void on_blue_valueChanged(int value);
|
||||
void on_address_textEdited(const QString& arg1);
|
||||
void on_port_textEdited(const QString& arg1);
|
||||
|
||||
private:
|
||||
Ui::BasicChannelSettingsWidget* ui;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>149</width>
|
||||
<height>156</height>
|
||||
<width>363</width>
|
||||
<height>83</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -17,9 +17,12 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Title & Color</string>
|
||||
<string>Channel basics</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
@ -32,91 +35,118 @@
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="titleLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="title">
|
||||
<property name="toolTip">
|
||||
<string>Channel marker title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="title"/>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="colorLayoyt">
|
||||
<item>
|
||||
<widget class="QLabel" name="colorLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="colorBtn">
|
||||
<property name="toolTip">
|
||||
<string>Channel marker color</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="colorText">
|
||||
<property name="text">
|
||||
<string>#ff0000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="colorBtn">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="color">
|
||||
<property name="text">
|
||||
<string>#ff0000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QSlider" name="red">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QSlider" name="green">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QSlider" name="blue">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="udpWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="udpLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="addrLabel">
|
||||
<property name="text">
|
||||
<string>Addr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="address">
|
||||
<property name="toolTip">
|
||||
<string>UDP address</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>127.0.0.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="portLabel">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="port">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>UDP port</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>9999</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>title</tabstop>
|
||||
<tabstop>colorBtn</tabstop>
|
||||
<tabstop>red</tabstop>
|
||||
<tabstop>green</tabstop>
|
||||
<tabstop>blue</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user