From f743b5b0430707ab3a785e7b6a4a1458612712a7 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 4 Sep 2014 09:59:27 +0000 Subject: [PATCH] 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 --- Configuration.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index b11ddfb8a..3d7b41b66 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -1124,16 +1124,10 @@ void Configuration::impl::set_rig_invariants () { case TransceiverFactory::Capabilities::serial: 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)); - } - } - else - { - ui_->CAT_port_combo_box->setCurrentText (rig_params_.CAT_serial_port_); + ui_->CAT_port_combo_box->setCurrentText (ui_->CAT_port_combo_box->itemText (0)); } ui_->CAT_control_group_box->setEnabled (true); @@ -1142,11 +1136,7 @@ void Configuration::impl::set_rig_invariants () break; 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_port_label->setText (tr ("Network Server:")); @@ -1279,13 +1269,17 @@ void Configuration::impl::accept () { case TransceiverFactory::Capabilities::serial: temp_rig_params.CAT_serial_port_ = ui_->CAT_port_combo_box->currentText (); + temp_rig_params.CAT_network_port_ = rig_params_.CAT_network_port_; break; case TransceiverFactory::Capabilities::network: temp_rig_params.CAT_network_port_ = ui_->CAT_port_combo_box->currentText (); + temp_rig_params.CAT_serial_port_ = rig_params_.CAT_serial_port_; break; default: + temp_rig_params.CAT_serial_port_ = rig_params_.CAT_serial_port_; + temp_rig_params.CAT_network_port_ = rig_params_.CAT_network_port_; break; }