sign: Disable Port TxMode/StreamsType config in GUI based on port state
This commit is contained in:
parent
1f4a825042
commit
2185bf2855
@ -20,7 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "portconfigdialog.h"
|
||||
#include "settings.h"
|
||||
|
||||
PortConfigDialog::PortConfigDialog(OstProto::Port &portConfig, QWidget *parent)
|
||||
PortConfigDialog::PortConfigDialog(
|
||||
OstProto::Port &portConfig,
|
||||
const OstProto::PortState &portState,
|
||||
QWidget *parent)
|
||||
: QDialog(parent), portConfig_(portConfig)
|
||||
{
|
||||
QString currentUser(portConfig_.user_name().c_str());
|
||||
@ -77,6 +80,12 @@ PortConfigDialog::PortConfigDialog(OstProto::Port &portConfig, QWidget *parent)
|
||||
Q_ASSERT(false); // Unreachable!!!
|
||||
break;
|
||||
}
|
||||
|
||||
// Disable UI elements based on portState
|
||||
if (portState.is_transmit_on()) {
|
||||
transmitModeBox->setDisabled(true);
|
||||
signedStreamsButton->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void PortConfigDialog::accept()
|
||||
|
@ -27,7 +27,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
class PortConfigDialog : public QDialog, public Ui::PortConfigDialog
|
||||
{
|
||||
public:
|
||||
PortConfigDialog(OstProto::Port &portConfig, QWidget *parent);
|
||||
PortConfigDialog(OstProto::Port &portConfig,
|
||||
const OstProto::PortState& portState,
|
||||
QWidget *parent);
|
||||
|
||||
private:
|
||||
virtual void accept();
|
||||
|
@ -718,18 +718,19 @@ void PortsWindow::on_actionPort_Configuration_triggered()
|
||||
if (!plm->isPort(current))
|
||||
return;
|
||||
|
||||
Port &port = plm->port(current);
|
||||
OstProto::Port config;
|
||||
// XXX: we don't call Port::protoDataCopyInto() to get config b'coz
|
||||
// we want only the modifiable fields populated to send to Drone
|
||||
// TODO: extend Port::protoDataCopyInto() to accept an optional param
|
||||
// which says copy only modifiable fields
|
||||
//plm->port(current).protoDataCopyInto(&config);
|
||||
config.set_transmit_mode(plm->port(current).transmitMode());
|
||||
config.set_streams_type(plm->port(current).streamsType());
|
||||
config.set_is_exclusive_control(plm->port(current).hasExclusiveControl());
|
||||
config.set_user_name(plm->port(current).userName().toStdString());
|
||||
config.set_transmit_mode(port.transmitMode());
|
||||
config.set_streams_type(port.streamsType());
|
||||
config.set_is_exclusive_control(port.hasExclusiveControl());
|
||||
config.set_user_name(port.userName().toStdString());
|
||||
|
||||
PortConfigDialog dialog(config, this);
|
||||
PortConfigDialog dialog(config, port.getStats().state(), this);
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
plm->portGroup(current.parent()).modifyPort(current.row(), config);
|
||||
|
Loading…
Reference in New Issue
Block a user