From 393a486ee1d7e308a49f8e0b8c3a4b2f43223248 Mon Sep 17 00:00:00 2001 From: tony mancill Date: Sun, 3 Sep 2023 19:46:43 -0700 Subject: New upstream version 2.7.0~rc2+repack --- Configuration.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 4 deletions(-) (limited to 'Configuration.cpp') diff --git a/Configuration.cpp b/Configuration.cpp index 3a61858d..7c333b45 100755 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -201,6 +201,7 @@ #include "models/DecodeHighlightingModel.hpp" #include "logbook/logbook.h" #include "widgets/LazyFillComboBox.hpp" +#include "Network/FileDownload.hpp" #include "ui_Configuration.h" #include "moc_Configuration.cpp" @@ -564,6 +565,9 @@ private: Q_SLOT void on_add_macro_line_edit_editingFinished (); Q_SLOT void delete_macro (); void delete_selected_macros (QModelIndexList); + void after_CTY_downloaded(); + void set_CTY_DAT_version(QString const& version); + void error_during_CTY_download (QString const& reason); Q_SLOT void on_udp_server_line_edit_textChanged (QString const&); Q_SLOT void on_udp_server_line_edit_editingFinished (); Q_SLOT void on_save_path_select_push_button_clicked (bool); @@ -574,7 +578,9 @@ private: Q_SLOT void handle_transceiver_failure (QString const& reason); Q_SLOT void on_reset_highlighting_to_defaults_push_button_clicked (bool); Q_SLOT void on_rescan_log_push_button_clicked (bool); + Q_SLOT void on_CTY_download_button_clicked (bool); Q_SLOT void on_LotW_CSV_fetch_push_button_clicked (bool); + Q_SLOT void on_cbx2ToneSpacing_clicked(bool); Q_SLOT void on_cbx4ToneSpacing_clicked(bool); Q_SLOT void on_prompt_to_log_check_box_clicked(bool); @@ -746,7 +752,7 @@ private: QAudioDeviceInfo next_audio_output_device_; AudioDevice::Channel audio_output_channel_; AudioDevice::Channel next_audio_output_channel_; - + FileDownload cty_download; friend class Configuration; }; @@ -859,6 +865,11 @@ bool Configuration::highlight_73 () const {return m_->highlight_73_;} bool Configuration::highlight_DXcall () const {return m_->highlight_DXcall_;} bool Configuration::highlight_DXgrid () const {return m_->highlight_DXgrid_;} +void Configuration::set_CTY_DAT_version(QString const& version) +{ + m_->set_CTY_DAT_version(version); +} + void Configuration::set_calibration (CalibrationParams params) { m_->calibration_ = params; @@ -997,6 +1008,15 @@ void Configuration::set_location (QString const& grid_descriptor) m_->dynamic_grid_ = grid_descriptor.trimmed (); } +void Configuration::setSpecial_Q65_Pileup() +{ + m_->bSpecialOp_=true; + m_->ui_->gbSpecialOpActivity->setChecked(m_->bSpecialOp_); + m_->ui_->rbQ65pileup->setChecked(true); + m_->SelectedActivity_ = static_cast (SpecialOperatingActivity::Q65_PILEUP); + m_->write_settings(); +} + void Configuration::setSpecial_Hound() { m_->bSpecialOp_=true; @@ -1019,6 +1039,7 @@ void Configuration::setSpecial_None() { m_->bSpecialOp_=false; m_->ui_->gbSpecialOpActivity->setChecked(m_->bSpecialOp_); + m_->SelectedActivity_ = static_cast (SpecialOperatingActivity::HOUND); // brings backward compatibility to versions without Q65_PILEUP m_->write_settings(); } namespace @@ -1174,8 +1195,13 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network // set up LoTW users CSV file fetching connect (&lotw_users_, &LotWUsers::load_finished, [this] () { - ui_->LotW_CSV_fetch_push_button->setEnabled (true); - }); + ui_->LotW_CSV_fetch_push_button->setEnabled (true); + }); + + connect(&lotw_users_, &LotWUsers::progress, [this] (QString const& msg) { + ui_->LotW_CSV_status_label->setText(msg); + }); + lotw_users_.set_local_file_path (writeable_data_dir_.absoluteFilePath ("lotw-user-activity.csv")); // @@ -1227,6 +1253,7 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network ui_->special_op_activity_button_group->setId (ui_->rbARRL_Digi, static_cast (SpecialOperatingActivity::ARRL_DIGI)); ui_->special_op_activity_button_group->setId (ui_->rbFox, static_cast (SpecialOperatingActivity::FOX)); ui_->special_op_activity_button_group->setId (ui_->rbHound, static_cast (SpecialOperatingActivity::HOUND)); + ui_->special_op_activity_button_group->setId (ui_->rbQ65pileup, static_cast (SpecialOperatingActivity::Q65_PILEUP)); // // setup PTT port combo box drop down content @@ -1542,6 +1569,8 @@ void Configuration::impl::read_settings () Contest_Name_ = settings_->value ("Contest_Name",QString {}).toString (); ui_->Field_Day_Exchange->setText(FD_exchange_); ui_->RTTY_Exchange->setText(RTTY_exchange_); + ui_->Contest_Name->setText(Contest_Name_); + if (next_font_.fromString (settings_->value ("Font", QGuiApplication::font ().toString ()).toString ()) && next_font_ != font_) { @@ -2402,9 +2431,45 @@ void Configuration::impl::on_reset_highlighting_to_defaults_push_button_clicked void Configuration::impl::on_rescan_log_push_button_clicked (bool /*clicked*/) { - if (logbook_) logbook_->rescan (); + if (logbook_) { + logbook_->rescan (); + } } +void Configuration::impl::on_CTY_download_button_clicked (bool /*clicked*/) +{ + ui_->CTY_download_button->setEnabled (false); // disable button until download is complete + QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}; + cty_download.configure(network_manager_, + "http://www.country-files.com/bigcty/cty.dat", + dataPath.absoluteFilePath("cty.dat"), + "WSJT-X CTY Downloader"); + + // set up LoTW users CSV file fetching + connect (&cty_download, &FileDownload::complete, this, &Configuration::impl::after_CTY_downloaded, Qt::UniqueConnection); + connect (&cty_download, &FileDownload::error, this, &Configuration::impl::error_during_CTY_download, Qt::UniqueConnection); + + cty_download.start_download(); +} +void Configuration::impl::set_CTY_DAT_version(QString const& version) +{ + ui_->CTY_file_label->setText(QString{"CTY File Version: %1"}.arg(version)); +} + +void Configuration::impl::error_during_CTY_download (QString const& reason) +{ + MessageBox::warning_message (this, tr ("Error Loading CTY.DAT"), reason); + after_CTY_downloaded(); +} + +void Configuration::impl::after_CTY_downloaded () +{ + ui_->CTY_download_button->setEnabled (true); + if (logbook_) { + logbook_->rescan (); + ui_->CTY_file_label->setText(QString{"CTY File Version: %1"}.arg(logbook_->cty_version())); + } +} void Configuration::impl::on_LotW_CSV_fetch_push_button_clicked (bool /*checked*/) { lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text (), true, true); -- cgit v1.2.3