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(); }
|
||||
const QString name() const
|
||||
{ return QString().fromStdString(d.name()); }
|
||||
const QString description() const
|
||||
const QString systemDescription() const
|
||||
{ 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
|
||||
{ return QString().fromStdString(d.notes()); }
|
||||
const QString userName() const
|
||||
|
@ -32,6 +32,8 @@ PortConfigDialog::PortConfigDialog(
|
||||
|
||||
setupUi(this);
|
||||
|
||||
description->setPlaceholderText(portConfig_.description().c_str());
|
||||
description->setText(portConfig_.user_description().c_str());
|
||||
switch(portConfig_.transmit_mode())
|
||||
{
|
||||
case OstProto::kSequentialTransmit:
|
||||
@ -80,6 +82,8 @@ void PortConfigDialog::accept()
|
||||
{
|
||||
OstProto::Port pc;
|
||||
|
||||
pc.set_user_description(description->text().toStdString());
|
||||
|
||||
if (sequentialStreamsButton->isChecked())
|
||||
pc.set_transmit_mode(OstProto::kSequentialTransmit);
|
||||
else if (interleavedStreamsButton->isChecked())
|
||||
@ -109,6 +113,11 @@ void PortConfigDialog::accept()
|
||||
pc.set_is_tracking_stream_stats(streamStatsButton->isChecked());
|
||||
|
||||
// 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())
|
||||
portConfig_.set_transmit_mode(pc.transmit_mode());
|
||||
else
|
||||
|
@ -6,14 +6,27 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>244</width>
|
||||
<height>257</height>
|
||||
<width>248</width>
|
||||
<height>292</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Port Config</string>
|
||||
</property>
|
||||
<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>
|
||||
<widget class="QGroupBox" name="transmitModeBox">
|
||||
<property name="title">
|
||||
@ -102,6 +115,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>description</tabstop>
|
||||
<tabstop>sequentialStreamsButton</tabstop>
|
||||
<tabstop>interleavedStreamsButton</tabstop>
|
||||
<tabstop>reserveButton</tabstop>
|
||||
<tabstop>exclusiveControlButton</tabstop>
|
||||
<tabstop>streamStatsButton</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@ -614,6 +614,8 @@ void PortsWindow::on_actionPort_Configuration_triggered()
|
||||
// TODO: extend Port::protoDataCopyInto() to accept an optional param
|
||||
// which says copy only modifiable fields
|
||||
//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_is_tracking_stream_stats(port.trackStreamStats());
|
||||
config.set_is_exclusive_control(port.hasExclusiveControl());
|
||||
|
@ -216,6 +216,7 @@ message Port {
|
||||
|
||||
optional double speed = 10; // in Mbps
|
||||
optional uint32 mtu = 11;
|
||||
optional string user_description = 12;
|
||||
}
|
||||
|
||||
message PortConfigList {
|
||||
|
@ -103,6 +103,10 @@ bool AbstractPort::modify(const OstProto::Port &port)
|
||||
bool ret = true;
|
||||
|
||||
//! \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())
|
||||
{
|
||||
bool val = port.is_exclusive_control();
|
||||
|
Loading…
Reference in New Issue
Block a user