Only attempt to fetch LoTW users at start up if highlighting enabled

This commit is contained in:
Bill Somerville 2020-11-16 17:10:33 +00:00
parent b98746ffc9
commit dc4f824f43
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
1 changed files with 13 additions and 3 deletions

View File

@ -1076,9 +1076,6 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
});
lotw_users_.set_local_file_path (writeable_data_dir_.absoluteFilePath ("lotw-user-activity.csv"));
// load the dictionary if it exists, fetch and load if it doesn't
lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text ());
//
// validation
//
@ -1239,6 +1236,19 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
audio_output_device_ = next_audio_output_device_;
audio_output_channel_ = next_audio_output_channel_;
bool fetch_if_needed {false};
for (auto const& item : decode_highlighing_model_.items ())
{
if (DecodeHighlightingModel::Highlight::LotW == item.type_)
{
fetch_if_needed = item.enabled_;
break;
}
}
// load the LoTW users dictionary if it exists, fetch and load if it
// doesn't and we need it
lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text (), fetch_if_needed);
transceiver_thread_ = new QThread {this};
transceiver_thread_->start ();
}