mirror of https://github.com/f4exb/sdrangel.git
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_visible(false),
|
||||||
m_highlighted(false),
|
m_highlighted(false),
|
||||||
m_color(m_colorTable[m_nextColor]),
|
m_color(m_colorTable[m_nextColor]),
|
||||||
m_movable(true)
|
m_movable(true),
|
||||||
|
m_udpAddress("127.0.0.1"),
|
||||||
|
m_udpPort(9999)
|
||||||
{
|
{
|
||||||
++m_nextColor;
|
++m_nextColor;
|
||||||
if(m_colorTable[m_nextColor] == 0)
|
if(m_colorTable[m_nextColor] == 0)
|
||||||
|
@ -95,3 +97,15 @@ void ChannelMarker::setColor(const QColor& color)
|
||||||
m_color = color;
|
m_color = color;
|
||||||
emit changed();
|
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; }
|
void setMovable(bool movable) { m_movable = movable; }
|
||||||
bool getMovable() const { return m_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:
|
protected:
|
||||||
static QRgb m_colorTable[];
|
static QRgb m_colorTable[];
|
||||||
static int m_nextColor;
|
static int m_nextColor;
|
||||||
|
@ -64,6 +71,8 @@ protected:
|
||||||
bool m_highlighted;
|
bool m_highlighted;
|
||||||
QColor m_color;
|
QColor m_color;
|
||||||
bool m_movable;
|
bool m_movable;
|
||||||
|
QString m_udpAddress;
|
||||||
|
quint16 m_udpPort;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
|
|
|
@ -11,10 +11,9 @@ BasicChannelSettingsWidget::BasicChannelSettingsWidget(ChannelMarker* marker, QW
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->title->setText(m_channelMarker->getTitle());
|
ui->title->setText(m_channelMarker->getTitle());
|
||||||
|
ui->address->setText(m_channelMarker->getUDPAddress());
|
||||||
|
ui->port->setText(QString("%1").arg(m_channelMarker->getUDPPort()));
|
||||||
paintColor();
|
paintColor();
|
||||||
ui->red->setValue(m_channelMarker->getColor().red());
|
|
||||||
ui->green->setValue(m_channelMarker->getColor().green());
|
|
||||||
ui->blue->setValue(m_channelMarker->getColor().blue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicChannelSettingsWidget::~BasicChannelSettingsWidget()
|
BasicChannelSettingsWidget::~BasicChannelSettingsWidget()
|
||||||
|
@ -34,44 +33,47 @@ void BasicChannelSettingsWidget::on_colorBtn_clicked()
|
||||||
if(c.isValid()) {
|
if(c.isValid()) {
|
||||||
m_channelMarker->setColor(c);
|
m_channelMarker->setColor(c);
|
||||||
paintColor();
|
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()
|
void BasicChannelSettingsWidget::paintColor()
|
||||||
{
|
{
|
||||||
QColor c(m_channelMarker->getColor());
|
QColor c(m_channelMarker->getColor());
|
||||||
QPixmap pm(24, 24);
|
QPixmap pm(24, 24);
|
||||||
pm.fill(c);
|
pm.fill(c);
|
||||||
ui->colorBtn->setIcon(pm);
|
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.red(), 2, 16, QChar('0'))
|
||||||
.arg(c.green(), 2, 16, QChar('0'))
|
.arg(c.green(), 2, 16, QChar('0'))
|
||||||
.arg(c.blue(), 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());
|
if (visible)
|
||||||
c.setRed(value);
|
{
|
||||||
m_channelMarker->setColor(c);
|
ui->udpWidget->show();
|
||||||
paintColor();
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
void BasicChannelSettingsWidget::on_green_valueChanged(int value)
|
ui->udpWidget->hide();
|
||||||
{
|
}
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,13 @@ class SDRANGEL_API BasicChannelSettingsWidget : public QWidget {
|
||||||
public:
|
public:
|
||||||
explicit BasicChannelSettingsWidget(ChannelMarker* marker, QWidget* parent = NULL);
|
explicit BasicChannelSettingsWidget(ChannelMarker* marker, QWidget* parent = NULL);
|
||||||
~BasicChannelSettingsWidget();
|
~BasicChannelSettingsWidget();
|
||||||
|
void setUDPDialogVisible(bool visible);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_title_textChanged(const QString& text);
|
void on_title_textChanged(const QString& text);
|
||||||
void on_colorBtn_clicked();
|
void on_colorBtn_clicked();
|
||||||
void on_red_valueChanged(int value);
|
void on_address_textEdited(const QString& arg1);
|
||||||
void on_green_valueChanged(int value);
|
void on_port_textEdited(const QString& arg1);
|
||||||
void on_blue_valueChanged(int value);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BasicChannelSettingsWidget* ui;
|
Ui::BasicChannelSettingsWidget* ui;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>149</width>
|
<width>363</width>
|
||||||
<height>156</height>
|
<height>83</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -17,9 +17,12 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Title & Color</string>
|
<string>Channel basics</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -32,91 +35,118 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<item>
|
||||||
<number>3</number>
|
<layout class="QHBoxLayout" name="titleLayout">
|
||||||
</property>
|
<item>
|
||||||
<item row="0" column="0">
|
<widget class="QLabel" name="label">
|
||||||
<widget class="QLabel" name="label">
|
<property name="sizePolicy">
|
||||||
<property name="sizePolicy">
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
<horstretch>0</horstretch>
|
||||||
<horstretch>0</horstretch>
|
<verstretch>0</verstretch>
|
||||||
<verstretch>0</verstretch>
|
</sizepolicy>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="text">
|
<string>Title</string>
|
||||||
<string>Title</string>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="title">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Channel marker title</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" colspan="2">
|
<item>
|
||||||
<widget class="QLineEdit" name="title"/>
|
<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>
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QWidget" name="udpWidget" native="true">
|
||||||
<property name="sizePolicy">
|
<layout class="QHBoxLayout" name="udpLayout">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
<item>
|
||||||
<horstretch>0</horstretch>
|
<widget class="QLabel" name="addrLabel">
|
||||||
<verstretch>0</verstretch>
|
<property name="text">
|
||||||
</sizepolicy>
|
<string>Addr</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
</widget>
|
||||||
<string>Color</string>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
</widget>
|
<widget class="QLineEdit" name="address">
|
||||||
</item>
|
<property name="toolTip">
|
||||||
<item row="1" column="1">
|
<string>UDP address</string>
|
||||||
<widget class="QToolButton" name="colorBtn">
|
</property>
|
||||||
<property name="text">
|
<property name="inputMask">
|
||||||
<string/>
|
<string>000.000.000.000</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="text">
|
||||||
</item>
|
<string>127.0.0.1</string>
|
||||||
<item row="1" column="2">
|
</property>
|
||||||
<widget class="QLabel" name="color">
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>#ff0000</string>
|
<item>
|
||||||
</property>
|
<widget class="QLabel" name="portLabel">
|
||||||
</widget>
|
<property name="text">
|
||||||
</item>
|
<string>Port</string>
|
||||||
<item row="2" column="1" colspan="2">
|
</property>
|
||||||
<widget class="QSlider" name="red">
|
</widget>
|
||||||
<property name="maximum">
|
</item>
|
||||||
<number>255</number>
|
<item>
|
||||||
</property>
|
<widget class="QLineEdit" name="port">
|
||||||
<property name="orientation">
|
<property name="maximumSize">
|
||||||
<enum>Qt::Horizontal</enum>
|
<size>
|
||||||
</property>
|
<width>60</width>
|
||||||
</widget>
|
<height>16777215</height>
|
||||||
</item>
|
</size>
|
||||||
<item row="3" column="1" colspan="2">
|
</property>
|
||||||
<widget class="QSlider" name="green">
|
<property name="toolTip">
|
||||||
<property name="maximum">
|
<string>UDP port</string>
|
||||||
<number>255</number>
|
</property>
|
||||||
</property>
|
<property name="inputMask">
|
||||||
<property name="orientation">
|
<string>00000</string>
|
||||||
<enum>Qt::Horizontal</enum>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>9999</string>
|
||||||
</item>
|
</property>
|
||||||
<item row="4" column="1" colspan="2">
|
</widget>
|
||||||
<widget class="QSlider" name="blue">
|
</item>
|
||||||
<property name="maximum">
|
</layout>
|
||||||
<number>255</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
|
||||||
<tabstop>title</tabstop>
|
|
||||||
<tabstop>colorBtn</tabstop>
|
|
||||||
<tabstop>red</tabstop>
|
|
||||||
<tabstop>green</tabstop>
|
|
||||||
<tabstop>blue</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Reference in New Issue