sign: Add Stream Stats button to GUI port config

This commit is contained in:
Srivats P 2016-11-21 18:39:55 +05:30
parent b1e960b858
commit bf161811b4
6 changed files with 34 additions and 0 deletions

View File

@ -98,6 +98,8 @@ public:
{ return d.is_exclusive_control(); }
OstProto::TransmitMode transmitMode()
{ return d.transmit_mode(); }
bool trackStreamStats()
{ return d.track_stream_stats(); }
double averagePacketRate()
{ return avgPacketsPerSec_; }
double averageBitRate()

View File

@ -67,10 +67,12 @@ PortConfigDialog::PortConfigDialog(
qDebug("reservedBy_ = %d", reservedBy_);
exclusiveControlButton->setChecked(portConfig_.is_exclusive_control());
streamStatsButton->setChecked(portConfig_.track_stream_stats());
// Disable UI elements based on portState
if (portState.is_transmit_on()) {
transmitModeBox->setDisabled(true);
streamStatsButton->setDisabled(true);
}
}
@ -103,6 +105,7 @@ void PortConfigDialog::accept()
}
pc.set_is_exclusive_control(exclusiveControlButton->isChecked());
pc.set_track_stream_stats(streamStatsButton->isChecked());
// Update fields that have changed, clear the rest
if (pc.transmit_mode() != portConfig_.transmit_mode())
@ -120,5 +123,10 @@ void PortConfigDialog::accept()
else
portConfig_.clear_is_exclusive_control();
if (pc.track_stream_stats() != portConfig_.track_stream_stats())
portConfig_.set_track_stream_stats(pc.track_stream_stats());
else
portConfig_.clear_track_stream_stats();
QDialog::accept();
}

View File

@ -69,6 +69,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="streamStatsButton" >
<property name="text" >
<string>Stream Statistics</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >

View File

@ -726,6 +726,7 @@ void PortsWindow::on_actionPort_Configuration_triggered()
// which says copy only modifiable fields
//plm->port(current).protoDataCopyInto(&config);
config.set_transmit_mode(port.transmitMode());
config.set_track_stream_stats(port.trackStreamStats());
config.set_is_exclusive_control(port.hasExclusiveControl());
config.set_user_name(port.userName().toStdString());

View File

@ -78,6 +78,12 @@ bool AbstractPort::canModify(const OstProto::Port &port, bool *dirty)
allow = !isTransmitOn();
}
if (port.has_track_stream_stats()
&& (port.track_stream_stats() != data_.track_stream_stats())) {
*dirty = true;
allow = !isTransmitOn();
}
return allow;
}
@ -98,6 +104,9 @@ bool AbstractPort::modify(const OstProto::Port &port)
if (port.has_transmit_mode())
data_.set_transmit_mode(port.transmit_mode());
if (port.has_track_stream_stats())
setTrackStreamStats(port.track_stream_stats());
if (port.has_user_name()) {
data_.set_user_name(port.user_name());
}
@ -181,6 +190,11 @@ void AbstractPort::addNote(QString note)
data_.set_notes(notes.toStdString());
}
bool AbstractPort::setTrackStreamStats(bool enable)
{
data_.set_track_stream_stats(enable);
}
AbstractPort::Accuracy AbstractPort::rateAccuracy()
{
return rateAccuracy_;

View File

@ -90,6 +90,8 @@ public:
bool isDirty() { return isSendQueueDirty_; }
void setDirty() { isSendQueueDirty_ = true; }
virtual bool setTrackStreamStats(bool enable);
Accuracy rateAccuracy();
virtual bool setRateAccuracy(Accuracy accuracy);