Allow user to add a port description
If a user description is available, that is shown in the ports window other wise the system determined description is shown. Updates #223
This commit is contained in:
parent
82db82d85b
commit
42091e5221
@ -88,8 +88,15 @@ public:
|
|||||||
{ return d.port_id().id(); }
|
{ return d.port_id().id(); }
|
||||||
const QString name() const
|
const QString name() const
|
||||||
{ return QString().fromStdString(d.name()); }
|
{ return QString().fromStdString(d.name()); }
|
||||||
const QString description() const
|
const QString systemDescription() const
|
||||||
{ return QString().fromStdString(d.description()); }
|
{ return QString().fromStdString(d.description()); }
|
||||||
|
const QString userDescription() const
|
||||||
|
{ return QString().fromStdString(d.user_description()); }
|
||||||
|
const QString description() const
|
||||||
|
{
|
||||||
|
return userDescription().isEmpty() ?
|
||||||
|
systemDescription() : userDescription();
|
||||||
|
}
|
||||||
const QString notes() const
|
const QString notes() const
|
||||||
{ return QString().fromStdString(d.notes()); }
|
{ return QString().fromStdString(d.notes()); }
|
||||||
const QString userName() const
|
const QString userName() const
|
||||||
|
@ -32,6 +32,8 @@ PortConfigDialog::PortConfigDialog(
|
|||||||
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
description->setPlaceholderText(portConfig_.description().c_str());
|
||||||
|
description->setText(portConfig_.user_description().c_str());
|
||||||
switch(portConfig_.transmit_mode())
|
switch(portConfig_.transmit_mode())
|
||||||
{
|
{
|
||||||
case OstProto::kSequentialTransmit:
|
case OstProto::kSequentialTransmit:
|
||||||
@ -80,6 +82,8 @@ void PortConfigDialog::accept()
|
|||||||
{
|
{
|
||||||
OstProto::Port pc;
|
OstProto::Port pc;
|
||||||
|
|
||||||
|
pc.set_user_description(description->text().toStdString());
|
||||||
|
|
||||||
if (sequentialStreamsButton->isChecked())
|
if (sequentialStreamsButton->isChecked())
|
||||||
pc.set_transmit_mode(OstProto::kSequentialTransmit);
|
pc.set_transmit_mode(OstProto::kSequentialTransmit);
|
||||||
else if (interleavedStreamsButton->isChecked())
|
else if (interleavedStreamsButton->isChecked())
|
||||||
@ -109,6 +113,11 @@ void PortConfigDialog::accept()
|
|||||||
pc.set_is_tracking_stream_stats(streamStatsButton->isChecked());
|
pc.set_is_tracking_stream_stats(streamStatsButton->isChecked());
|
||||||
|
|
||||||
// Update fields that have changed, clear the rest
|
// Update fields that have changed, clear the rest
|
||||||
|
if (pc.user_description() != portConfig_.user_description())
|
||||||
|
portConfig_.set_user_description(pc.user_description());
|
||||||
|
else
|
||||||
|
portConfig_.clear_user_description();
|
||||||
|
|
||||||
if (pc.transmit_mode() != portConfig_.transmit_mode())
|
if (pc.transmit_mode() != portConfig_.transmit_mode())
|
||||||
portConfig_.set_transmit_mode(pc.transmit_mode());
|
portConfig_.set_transmit_mode(pc.transmit_mode());
|
||||||
else
|
else
|
||||||
|
@ -6,14 +6,27 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>244</width>
|
<width>248</width>
|
||||||
<height>257</height>
|
<height>292</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Port Config</string>
|
<string>Port Config</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Description</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>description</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="description"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="transmitModeBox">
|
<widget class="QGroupBox" name="transmitModeBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -102,6 +115,14 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>description</tabstop>
|
||||||
|
<tabstop>sequentialStreamsButton</tabstop>
|
||||||
|
<tabstop>interleavedStreamsButton</tabstop>
|
||||||
|
<tabstop>reserveButton</tabstop>
|
||||||
|
<tabstop>exclusiveControlButton</tabstop>
|
||||||
|
<tabstop>streamStatsButton</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
@ -614,6 +614,8 @@ void PortsWindow::on_actionPort_Configuration_triggered()
|
|||||||
// TODO: extend Port::protoDataCopyInto() to accept an optional param
|
// TODO: extend Port::protoDataCopyInto() to accept an optional param
|
||||||
// which says copy only modifiable fields
|
// which says copy only modifiable fields
|
||||||
//plm->port(current).protoDataCopyInto(&config);
|
//plm->port(current).protoDataCopyInto(&config);
|
||||||
|
config.set_description(port.systemDescription().toStdString());
|
||||||
|
config.set_user_description(port.userDescription().toStdString());
|
||||||
config.set_transmit_mode(port.transmitMode());
|
config.set_transmit_mode(port.transmitMode());
|
||||||
config.set_is_tracking_stream_stats(port.trackStreamStats());
|
config.set_is_tracking_stream_stats(port.trackStreamStats());
|
||||||
config.set_is_exclusive_control(port.hasExclusiveControl());
|
config.set_is_exclusive_control(port.hasExclusiveControl());
|
||||||
|
@ -216,6 +216,7 @@ message Port {
|
|||||||
|
|
||||||
optional double speed = 10; // in Mbps
|
optional double speed = 10; // in Mbps
|
||||||
optional uint32 mtu = 11;
|
optional uint32 mtu = 11;
|
||||||
|
optional string user_description = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PortConfigList {
|
message PortConfigList {
|
||||||
|
@ -103,6 +103,10 @@ bool AbstractPort::modify(const OstProto::Port &port)
|
|||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
//! \todo Use reflection to find out which fields are set
|
//! \todo Use reflection to find out which fields are set
|
||||||
|
if (port.has_user_description()) {
|
||||||
|
data_.set_user_description(port.user_description());
|
||||||
|
}
|
||||||
|
|
||||||
if (port.has_is_exclusive_control())
|
if (port.has_is_exclusive_control())
|
||||||
{
|
{
|
||||||
bool val = port.is_exclusive_control();
|
bool val = port.is_exclusive_control();
|
||||||
|
Loading…
Reference in New Issue
Block a user