Fix persistence of CAT serial/network port.

Enhanced the  logic for saving  and restoring to/from settings  of the
shared configuration field for CAT serial port and CAT network port so
that  old  values are  not  discarded  and  new values  are  correctly
recovered on restart.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4245 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-09-04 09:59:27 +00:00
parent 8ec955ff37
commit 8e50ba4924

View File

@ -1124,17 +1124,11 @@ void Configuration::impl::set_rig_invariants ()
{ {
case TransceiverFactory::Capabilities::serial: case TransceiverFactory::Capabilities::serial:
fill_port_combo_box (ui_->CAT_port_combo_box); fill_port_combo_box (ui_->CAT_port_combo_box);
if (ui_->CAT_port_combo_box->currentText ().isEmpty ()) ui_->CAT_port_combo_box->setCurrentText (rig_params_.CAT_serial_port_);
{ if (ui_->CAT_port_combo_box->currentText ().isEmpty () && ui_->CAT_port_combo_box->count ())
if (ui_->CAT_port_combo_box->count ())
{ {
ui_->CAT_port_combo_box->setCurrentText (ui_->CAT_port_combo_box->itemText (0)); ui_->CAT_port_combo_box->setCurrentText (ui_->CAT_port_combo_box->itemText (0));
} }
}
else
{
ui_->CAT_port_combo_box->setCurrentText (rig_params_.CAT_serial_port_);
}
ui_->CAT_control_group_box->setEnabled (true); ui_->CAT_control_group_box->setEnabled (true);
ui_->CAT_port_label->setText (tr ("Serial Port:")); ui_->CAT_port_label->setText (tr ("Serial Port:"));
@ -1142,11 +1136,7 @@ void Configuration::impl::set_rig_invariants ()
break; break;
case TransceiverFactory::Capabilities::network: case TransceiverFactory::Capabilities::network:
ui_->CAT_port_combo_box->clear ();
if (!rig_params_.CAT_network_port_.isEmpty ())
{
ui_->CAT_port_combo_box->setCurrentText (rig_params_.CAT_network_port_); ui_->CAT_port_combo_box->setCurrentText (rig_params_.CAT_network_port_);
}
ui_->CAT_control_group_box->setEnabled (true); ui_->CAT_control_group_box->setEnabled (true);
ui_->CAT_port_label->setText (tr ("Network Server:")); ui_->CAT_port_label->setText (tr ("Network Server:"));
@ -1279,13 +1269,17 @@ void Configuration::impl::accept ()
{ {
case TransceiverFactory::Capabilities::serial: case TransceiverFactory::Capabilities::serial:
temp_rig_params.CAT_serial_port_ = ui_->CAT_port_combo_box->currentText (); temp_rig_params.CAT_serial_port_ = ui_->CAT_port_combo_box->currentText ();
temp_rig_params.CAT_network_port_ = rig_params_.CAT_network_port_;
break; break;
case TransceiverFactory::Capabilities::network: case TransceiverFactory::Capabilities::network:
temp_rig_params.CAT_network_port_ = ui_->CAT_port_combo_box->currentText (); temp_rig_params.CAT_network_port_ = ui_->CAT_port_combo_box->currentText ();
temp_rig_params.CAT_serial_port_ = rig_params_.CAT_serial_port_;
break; break;
default: default:
temp_rig_params.CAT_serial_port_ = rig_params_.CAT_serial_port_;
temp_rig_params.CAT_network_port_ = rig_params_.CAT_network_port_;
break; break;
} }