summaryrefslogtreecommitdiff
path: root/Configuration.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
commite0737c56c1e384e05064a0c6e1ac46979371041b (patch)
treea0123d694a2d36c43dabdf0a3907392fce11d457 /Configuration.cpp
parentb4aebf2d137b892f53503b13785ecae900062ff7 (diff)
New upstream version 2.0.0+repackupstream/2.0.0+repack
Diffstat (limited to 'Configuration.cpp')
-rw-r--r--Configuration.cpp445
1 files changed, 280 insertions, 165 deletions
diff --git a/Configuration.cpp b/Configuration.cpp
index a2d618d6..cb0566c1 100644
--- a/Configuration.cpp
+++ b/Configuration.cpp
@@ -150,14 +150,14 @@
#include <QStringList>
#include <QStringListModel>
#include <QLineEdit>
-#include <QRegExpValidator>
+#include <QRegularExpression>
+#include <QRegularExpressionValidator>
#include <QIntValidator>
#include <QThread>
#include <QTimer>
#include <QStandardPaths>
#include <QFont>
#include <QFontDialog>
-#include <QColorDialog>
#include <QSerialPortInfo>
#include <QScopedPointer>
#include <QDebug>
@@ -166,20 +166,23 @@
#include "qt_helpers.hpp"
#include "MetaDataRegistry.hpp"
#include "SettingsGroup.hpp"
-#include "FrequencyLineEdit.hpp"
-#include "CandidateKeyFilter.hpp"
-#include "ForeignKeyDelegate.hpp"
+#include "widgets/FrequencyLineEdit.hpp"
+#include "item_delegates/CandidateKeyFilter.hpp"
+#include "item_delegates/ForeignKeyDelegate.hpp"
#include "TransceiverFactory.hpp"
#include "Transceiver.hpp"
-#include "Bands.hpp"
-#include "IARURegions.hpp"
-#include "Modes.hpp"
-#include "FrequencyList.hpp"
-#include "StationList.hpp"
+#include "models/Bands.hpp"
+#include "models/IARURegions.hpp"
+#include "models/Modes.hpp"
+#include "models/FrequencyList.hpp"
+#include "models/StationList.hpp"
#include "NetworkServerLookup.hpp"
-#include "MessageBox.hpp"
-#include "MaidenheadLocatorValidator.hpp"
-#include "CallsignValidator.hpp"
+#include "widgets/MessageBox.hpp"
+#include "validators/MaidenheadLocatorValidator.hpp"
+#include "validators/CallsignValidator.hpp"
+#include "LotWUsers.hpp"
+#include "models/DecodeHighlightingModel.hpp"
+#include "logbook/logbook.h"
#include "ui_Configuration.h"
#include "moc_Configuration.cpp"
@@ -193,7 +196,44 @@ namespace
int const combo_box_item_disabled (0);
// QRegExp message_alphabet {"[- A-Za-z0-9+./?]*"};
- QRegExp message_alphabet {"[- @A-Za-z0-9+./?#<>]*"};
+ QRegularExpression message_alphabet {"[- @A-Za-z0-9+./?#<>]*"};
+ QRegularExpression RTTY_roundup_exchange_re {
+ R"(
+ (
+ AL|AZ|AR|CA|CO|CT|DE|FL|GA # 48 contiguous states
+ |ID|IL|IN|IA|KS|KY|LA|ME|MD
+ |MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ
+ |NM|NY|NC|ND|OH|OK|OR|PA|RI|SC
+ |SD|TN|TX|UT|VT|VA|WA|WV|WI|WY
+ |NB|NS|QC|ON|MB|SK|AB|BC|NWT|NF # VE provinces
+ |LB|NU|YT|PEI
+ |DC # District of Columbia
+ |DX # anyone else
+ )
+ )", QRegularExpression::CaseInsensitiveOption | QRegularExpression::ExtendedPatternSyntaxOption};
+
+ QRegularExpression field_day_exchange_re {
+ R"(
+ (
+ [1-9] # # transmitters (1 to 32 inc.)
+ |[0-2]\d
+ |3[0-2]
+ )
+ [A-F]\ * # class and optional space
+ (
+ AB|AK|AL|AR|AZ|BC|CO|CT|DE|EB # ARRL/RAC section
+ |EMA|ENY|EPA|EWA|GA|GTA|IA|ID
+ |IL|IN|KS|KY|LA|LAX|MAR|MB|MDC
+ |ME|MI|MN|MO|MS|MT|NC|ND|NE|NFL
+ |NH|NL|NLI|NM|NNJ|NNY|NT|NTX|NV
+ |OH|OK|ONE|ONN|ONS|OR|ORG|PAC
+ |PR|QC|RI|SB|SC|SCV|SD|SDG|SF
+ |SFL|SJV|SK|SNJ|STX|SV|TN|UT|VA
+ |VI|VT|WCF|WI|WMA|WNY|WPA|WTX
+ |WV|WWA|WY
+ |DX # anyone else
+ )
+ )", QRegularExpression::CaseInsensitiveOption | QRegularExpression::ExtendedPatternSyntaxOption};
// Magic numbers for file validation
constexpr quint32 qrg_magic {0xadbccbdb};
@@ -339,7 +379,7 @@ public:
{
auto editor = new QLineEdit {parent};
editor->setFrame (false);
- editor->setValidator (new QRegExpValidator {message_alphabet, editor});
+ editor->setValidator (new QRegularExpressionValidator {message_alphabet, editor});
return editor;
}
};
@@ -354,8 +394,12 @@ public:
using FrequencyDelta = Radio::FrequencyDelta;
using port_type = Configuration::port_type;
- explicit impl (Configuration * self, QDir const& temp_directory,
- QSettings * settings, QWidget * parent);
+ explicit impl (Configuration * self
+ , QNetworkAccessManager * network_manager
+ , QDir const& temp_directory
+ , QSettings * settings
+ , LogBook * logbook
+ , QWidget * parent);
~impl ();
bool have_rig ();
@@ -439,15 +483,15 @@ private:
Q_SLOT void on_calibration_slope_ppm_spin_box_valueChanged (double);
Q_SLOT void handle_transceiver_update (TransceiverState const&, unsigned sequence_number);
Q_SLOT void handle_transceiver_failure (QString const& reason);
- Q_SLOT void on_pbCQmsg_clicked();
- Q_SLOT void on_pbMyCall_clicked();
- Q_SLOT void on_pbTxMsg_clicked();
- Q_SLOT void on_pbNewDXCC_clicked();
- Q_SLOT void on_pbNewCall_clicked();
- Q_SLOT void on_cbFox_clicked (bool);
- Q_SLOT void on_cbHound_clicked (bool);
+ 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_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);
+ Q_SLOT void on_cbAutoLog_clicked(bool);
+ Q_SLOT void on_Field_Day_Exchange_textEdited (QString const&);
+ Q_SLOT void on_RTTY_Exchange_textEdited (QString const&);
// typenames used as arguments must match registered type names :(
Q_SIGNAL void start_transceiver (unsigned seqeunce_number) const;
@@ -463,7 +507,9 @@ private:
QScopedPointer<Ui::configuration_dialog> ui_;
+ QNetworkAccessManager * network_manager_;
QSettings * settings_;
+ LogBook * logbook_;
QDir doc_dir_;
QDir data_dir_;
@@ -480,6 +526,8 @@ private:
QFont decoded_text_font_;
QFont next_decoded_text_font_;
+ LotWUsers lotw_users_;
+
bool restart_sound_input_device_;
bool restart_sound_output_device_;
@@ -508,10 +556,15 @@ private:
QAction * reset_frequencies_action_;
FrequencyDialog * frequency_dialog_;
- QAction * station_delete_action_;
- QAction * station_insert_action_;
+ QAction station_delete_action_;
+ QAction station_insert_action_;
StationDialog * station_dialog_;
+ DecodeHighlightingModel decode_highlighing_model_;
+ DecodeHighlightingModel next_decode_highlighing_model_;
+ bool highlight_by_mode_;
+ int LotW_days_since_upload_;
+
TransceiverFactory::ParameterPack rig_params_;
TransceiverFactory::ParameterPack saved_rig_params_;
TransceiverFactory::Capabilities::PortType last_port_type_;
@@ -529,16 +582,9 @@ private:
// configuration fields that we publish
QString my_callsign_;
QString my_grid_;
- QColor color_CQ_;
- QColor next_color_CQ_;
- QColor color_MyCall_;
- QColor next_color_MyCall_;
- QColor color_TxMsg_;
- QColor next_color_TxMsg_;
- QColor color_DXCC_;
- QColor next_color_DXCC_;
- QColor color_NewCall_;
- QColor next_color_NewCall_;
+ QString FD_exchange_;
+ QString RTTY_exchange_;
+
qint32 id_interval_;
qint32 ntrials_;
qint32 aggressive_;
@@ -553,6 +599,7 @@ private:
bool log_as_RTTY_;
bool report_in_comments_;
bool prompt_to_log_;
+ bool autoLog_;
bool insert_blank_;
bool DXCC_;
bool ppfx_;
@@ -566,21 +613,17 @@ private:
bool decode_at_52s_;
bool single_decode_;
bool twoPass_;
- bool bFox_;
- bool bHound_;
+ bool bSpecialOp_;
+ int SelectedActivity_;
bool x2ToneSpacing_;
bool x4ToneSpacing_;
bool use_dynamic_grid_;
QString opCall_;
QString udp_server_name_;
port_type udp_server_port_;
-// QString n1mm_server_name () const;
QString n1mm_server_name_;
port_type n1mm_server_port_;
bool broadcast_to_n1mm_;
-// port_type n1mm_server_port () const;
-// bool valid_n1mm_info () const;
-// bool broadcast_to_n1mm() const;
bool accept_udp_requests_;
bool udpWindowToFront_;
bool udpWindowRestore_;
@@ -602,9 +645,9 @@ private:
// delegate to implementation class
-Configuration::Configuration (QDir const& temp_directory,
- QSettings * settings, QWidget * parent)
- : m_ {this, temp_directory, settings, parent}
+Configuration::Configuration (QNetworkAccessManager * network_manager, QDir const& temp_directory,
+ QSettings * settings, LogBook * logbook, QWidget * parent)
+ : m_ {this, network_manager, temp_directory, settings, logbook, parent}
{
}
@@ -629,11 +672,6 @@ bool Configuration::restart_audio_input () const {return m_->restart_sound_input
bool Configuration::restart_audio_output () const {return m_->restart_sound_output_device_;}
auto Configuration::type_2_msg_gen () const -> Type2MsgGen {return m_->type_2_msg_gen_;}
QString Configuration::my_callsign () const {return m_->my_callsign_;}
-QColor Configuration::color_CQ () const {return m_->color_CQ_;}
-QColor Configuration::color_MyCall () const {return m_->color_MyCall_;}
-QColor Configuration::color_TxMsg () const {return m_->color_TxMsg_;}
-QColor Configuration::color_DXCC () const {return m_->color_DXCC_;}
-QColor Configuration::color_NewCall () const {return m_->color_NewCall_;}
QFont Configuration::text_font () const {return m_->font_;}
QFont Configuration::decoded_text_font () const {return m_->decoded_text_font_;}
qint32 Configuration::id_interval () const {return m_->id_interval_;}
@@ -654,6 +692,7 @@ bool Configuration::monitor_last_used () const {return m_->rig_is_dummy_ || m_->
bool Configuration::log_as_RTTY () const {return m_->log_as_RTTY_;}
bool Configuration::report_in_comments () const {return m_->report_in_comments_;}
bool Configuration::prompt_to_log () const {return m_->prompt_to_log_;}
+bool Configuration::autoLog() const {return m_->autoLog_;}
bool Configuration::insert_blank () const {return m_->insert_blank_;}
bool Configuration::DXCC () const {return m_->DXCC_;}
bool Configuration::ppfx() const {return m_->ppfx_;}
@@ -667,8 +706,6 @@ bool Configuration::enable_VHF_features () const {return m_->enable_VHF_features
bool Configuration::decode_at_52s () const {return m_->decode_at_52s_;}
bool Configuration::single_decode () const {return m_->single_decode_;}
bool Configuration::twoPass() const {return m_->twoPass_;}
-bool Configuration::bFox() const {return m_->bFox_;}
-bool Configuration::bHound() const {return m_->bHound_;}
bool Configuration::x2ToneSpacing() const {return m_->x2ToneSpacing_;}
bool Configuration::x4ToneSpacing() const {return m_->x4ToneSpacing_;}
bool Configuration::split_mode () const {return m_->split_mode ();}
@@ -695,6 +732,9 @@ QDir Configuration::azel_directory () const {return m_->azel_directory_;}
QString Configuration::rig_name () const {return m_->rig_params_.rig_name;}
bool Configuration::pwrBandTxMemory () const {return m_->pwrBandTxMemory_;}
bool Configuration::pwrBandTuneMemory () const {return m_->pwrBandTuneMemory_;}
+LotWUsers const& Configuration::lotw_users () const {return m_->lotw_users_;}
+DecodeHighlightingModel const& Configuration::decode_highlighting () const {return m_->decode_highlighing_model_;}
+bool Configuration::highlight_by_mode () const {return m_->highlight_by_mode_;}
void Configuration::set_calibration (CalibrationParams params)
{
@@ -807,6 +847,30 @@ QString Configuration::my_grid() const
return the_grid;
}
+QString Configuration::Field_Day_Exchange() const
+{
+ return m_->FD_exchange_;
+}
+
+void Configuration::setEU_VHF_Contest()
+{
+ m_->bSpecialOp_=true;
+ m_->ui_->gbSpecialOpActivity->setChecked(m_->bSpecialOp_);
+ m_->ui_->rbEU_VHF_Contest->setChecked(true);
+ m_->SelectedActivity_ = static_cast<int> (SpecialOperatingActivity::EU_VHF);
+ m_->write_settings();
+}
+
+QString Configuration::RTTY_Exchange() const
+{
+ return m_->RTTY_exchange_;
+}
+
+auto Configuration::special_op_id () const -> SpecialOperatingActivity
+{
+ return m_->bSpecialOp_ ? static_cast<SpecialOperatingActivity> (m_->SelectedActivity_) : SpecialOperatingActivity::NONE;
+}
+
void Configuration::set_location (QString const& grid_descriptor)
{
// change the dynamic grid
@@ -848,17 +912,21 @@ namespace
}
}
-Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
- QSettings * settings, QWidget * parent)
+Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network_manager
+ , QDir const& temp_directory, QSettings * settings, LogBook * logbook
+ , QWidget * parent)
: QDialog {parent}
, self_ {self}
, transceiver_thread_ {nullptr}
, ui_ {new Ui::configuration_dialog}
+ , network_manager_ {network_manager}
, settings_ {settings}
+ , logbook_ {logbook}
, doc_dir_ {doc_path ()}
, data_dir_ {data_path ()}
, temp_dir_ {temp_directory}
, writeable_data_dir_ {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}
+ , lotw_users_ {network_manager_}
, restart_sound_input_device_ {false}
, restart_sound_output_device_ {false}
, frequencies_ {&bands_}
@@ -868,7 +936,11 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
, current_offset_ {0}
, current_tx_offset_ {0}
, frequency_dialog_ {new FrequencyDialog {&regions_, &modes_, this}}
+ , station_delete_action_ {tr ("&Delete"), nullptr}
+ , station_insert_action_ {tr ("&Insert ..."), nullptr}
, station_dialog_ {new StationDialog {&next_stations_, &bands_, this}}
+ , highlight_by_mode_ {false}
+ , LotW_days_since_upload_ {0}
, last_port_type_ {TransceiverFactory::Capabilities::none}
, rig_is_dummy_ {false}
, rig_active_ {false}
@@ -883,17 +955,8 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
, default_audio_output_device_selected_ {false}
{
ui_->setupUi (this);
-// ui_->groupBox_6->setVisible(false); //### Temporary ??? ###
{
- // Find a suitable data file location
- if (!writeable_data_dir_.mkpath ("."))
- {
- MessageBox::critical_message (this, tr ("Failed to create data directory"),
- tr ("path: \"%1\"").arg (writeable_data_dir_.absolutePath ()));
- throw std::runtime_error {"Failed to create data directory"};
- }
-
// Make sure the default save directory exists
QString save_dir {"save"};
default_save_directory_ = writeable_data_dir_;
@@ -939,12 +1002,21 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
// this must be done after the default paths above are set
read_settings ();
+ // conditionally load LotW users data
+ ui_->LotW_CSV_fetch_push_button->setEnabled (false);
+ connect (&lotw_users_, &LotWUsers::load_finished, [this] () {
+ ui_->LotW_CSV_fetch_push_button->setEnabled (true);
+ });
+ lotw_users_.set_local_file_path (writeable_data_dir_.absoluteFilePath ("lotw-user-activity.csv"));
+ lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text ());
+
//
// validation
- //
ui_->callsign_line_edit->setValidator (new CallsignValidator {this});
ui_->grid_line_edit->setValidator (new MaidenheadLocatorValidator {this});
- ui_->add_macro_line_edit->setValidator (new QRegExpValidator {message_alphabet, this});
+ ui_->add_macro_line_edit->setValidator (new QRegularExpressionValidator {message_alphabet, this});
+ ui_->Field_Day_Exchange->setValidator (new QRegularExpressionValidator {field_day_exchange_re, this});
+ ui_->RTTY_Exchange->setValidator (new QRegularExpressionValidator {RTTY_roundup_exchange_re, this});
ui_->udp_server_port_spin_box->setMinimum (1);
ui_->udp_server_port_spin_box->setMaximum (std::numeric_limits<port_type>::max ());
@@ -984,6 +1056,13 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
ui_->split_mode_button_group->setId (ui_->split_rig_radio_button, TransceiverFactory::split_mode_rig);
ui_->split_mode_button_group->setId (ui_->split_emulate_radio_button, TransceiverFactory::split_mode_emulate);
+ ui_->special_op_activity_button_group->setId (ui_->rbNA_VHF_Contest, static_cast<int> (SpecialOperatingActivity::NA_VHF));
+ ui_->special_op_activity_button_group->setId (ui_->rbEU_VHF_Contest, static_cast<int> (SpecialOperatingActivity::EU_VHF));
+ ui_->special_op_activity_button_group->setId (ui_->rbField_Day, static_cast<int> (SpecialOperatingActivity::FIELD_DAY));
+ ui_->special_op_activity_button_group->setId (ui_->rbRTTY_Roundup, static_cast<int> (SpecialOperatingActivity::RTTY));
+ ui_->special_op_activity_button_group->setId (ui_->rbFox, static_cast<int> (SpecialOperatingActivity::FOX));
+ ui_->special_op_activity_button_group->setId (ui_->rbHound, static_cast<int> (SpecialOperatingActivity::HOUND));
+
//
// setup PTT port combo box drop down content
//
@@ -1022,6 +1101,8 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
frequencies_.sort (FrequencyList_v2::frequency_column);
ui_->frequencies_table_view->setModel (&next_frequencies_);
+ ui_->frequencies_table_view->horizontalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
+ ui_->frequencies_table_view->verticalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
ui_->frequencies_table_view->sortByColumn (FrequencyList_v2::frequency_column, Qt::AscendingOrder);
ui_->frequencies_table_view->setColumnHidden (FrequencyList_v2::frequency_mhz_column, true);
@@ -1057,29 +1138,32 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
ui_->frequencies_table_view->insertAction (nullptr, reset_frequencies_action_);
connect (reset_frequencies_action_, &QAction::triggered, this, &Configuration::impl::reset_frequencies);
-
//
// setup stations table model & view
//
stations_.sort (StationList::band_column);
-
ui_->stations_table_view->setModel (&next_stations_);
+ ui_->stations_table_view->horizontalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
+ ui_->stations_table_view->verticalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
ui_->stations_table_view->sortByColumn (StationList::band_column, Qt::AscendingOrder);
- // delegates
+ // stations delegates
auto stations_item_delegate = new QStyledItemDelegate {this};
stations_item_delegate->setItemEditorFactory (item_editor_factory ());
ui_->stations_table_view->setItemDelegate (stations_item_delegate);
ui_->stations_table_view->setItemDelegateForColumn (StationList::band_column, new ForeignKeyDelegate {&bands_, &next_stations_, 0, StationList::band_column, this});
- // actions
- station_delete_action_ = new QAction {tr ("&Delete"), ui_->stations_table_view};
- ui_->stations_table_view->insertAction (nullptr, station_delete_action_);
- connect (station_delete_action_, &QAction::triggered, this, &Configuration::impl::delete_stations);
+ // stations actions
+ ui_->stations_table_view->addAction (&station_delete_action_);
+ connect (&station_delete_action_, &QAction::triggered, this, &Configuration::impl::delete_stations);
+
+ ui_->stations_table_view->addAction (&station_insert_action_);
+ connect (&station_insert_action_, &QAction::triggered, this, &Configuration::impl::insert_station);
- station_insert_action_ = new QAction {tr ("&Insert ..."), ui_->stations_table_view};
- ui_->stations_table_view->insertAction (nullptr, station_insert_action_);
- connect (station_insert_action_, &QAction::triggered, this, &Configuration::impl::insert_station);
+ //
+ // colours and highlighting setup
+ //
+ ui_->highlighting_list_view->setModel (&next_decode_highlighing_model_);
//
// load combo boxes with audio setup choices
@@ -1123,12 +1207,7 @@ void Configuration::impl::initialize_models ()
ui_->callsign_line_edit->setText (my_callsign_);
ui_->grid_line_edit->setText (my_grid_);
ui_->use_dynamic_grid->setChecked(use_dynamic_grid_);
- ui_->labCQ->setStyleSheet(QString("background: %1").arg(color_CQ_.name()));
- ui_->labMyCall->setStyleSheet(QString("background: %1").arg(color_MyCall_.name()));
- ui_->labTx->setStyleSheet(QString("background: %1").arg(color_TxMsg_.name()));
- ui_->labDXCC->setStyleSheet(QString("background: %1").arg(color_DXCC_.name()));
- ui_->labNewCall->setStyleSheet(QString("background: %1").arg(color_NewCall_.name()));
- ui_->CW_id_interval_spin_box->setValue (id_interval_);
+ ui_->CW_id_interval_spin_box->setValue (id_interval_);
ui_->sbNtrials->setValue (ntrials_);
ui_->sbTxDelay->setValue (txDelay_);
ui_->sbAggressive->setValue (aggressive_);
@@ -1145,6 +1224,7 @@ void Configuration::impl::initialize_models ()
ui_->log_as_RTTY_check_box->setChecked (log_as_RTTY_);
ui_->report_in_comments_check_box->setChecked (report_in_comments_);
ui_->prompt_to_log_check_box->setChecked (prompt_to_log_);
+ ui_->cbAutoLog->setChecked(autoLog_);
ui_->insert_blank_check_box->setChecked (insert_blank_);
ui_->DXCC_check_box->setChecked (DXCC_);
ui_->ppfx_check_box->setChecked (ppfx_);
@@ -1158,8 +1238,8 @@ void Configuration::impl::initialize_models ()
ui_->decode_at_52s_check_box->setChecked(decode_at_52s_);
ui_->single_decode_check_box->setChecked(single_decode_);
ui_->cbTwoPass->setChecked(twoPass_);
- ui_->cbFox->setChecked(bFox_);
- ui_->cbHound->setChecked(bHound_);
+ ui_->gbSpecialOpActivity->setChecked(bSpecialOp_);
+ ui_->special_op_activity_button_group->button (SelectedActivity_)->setChecked (true);
ui_->cbx2ToneSpacing->setChecked(x2ToneSpacing_);
ui_->cbx4ToneSpacing->setChecked(x4ToneSpacing_);
ui_->type_2_msg_gen_combo_box->setCurrentIndex (type_2_msg_gen_);
@@ -1220,6 +1300,10 @@ void Configuration::impl::initialize_models ()
next_frequencies_.frequency_list (frequencies_.frequency_list ());
next_stations_.station_list (stations_.station_list ());
+ next_decode_highlighing_model_.items (decode_highlighing_model_.items ());
+ ui_->highlight_by_mode_check_box->setChecked (highlight_by_mode_);
+ ui_->LotW_days_since_upload_spin_box->setValue (LotW_days_since_upload_);
+
set_rig_invariants ();
}
@@ -1239,12 +1323,10 @@ void Configuration::impl::read_settings ()
my_callsign_ = settings_->value ("MyCall", QString {}).toString ();
my_grid_ = settings_->value ("MyGrid", QString {}).toString ();
- next_color_CQ_ = color_CQ_ = settings_->value("colorCQ","#66ff66").toString();
- next_color_MyCall_ = color_MyCall_ = settings_->value("colorMyCall","#ff6666").toString();
- next_color_TxMsg_ = color_TxMsg_ = settings_->value("colorTxMsg","#ffff00").toString();
- next_color_DXCC_ = color_DXCC_ = settings_->value("colorDXCC","#ff00ff").toString();
- next_color_NewCall_ = color_NewCall_ = settings_->value("colorNewCall","#ffaaff").toString();
-
+ FD_exchange_ = settings_->value ("Field_Day_Exchange",QString {}).toString ();
+ RTTY_exchange_ = settings_->value ("RTTY_Exchange",QString {}).toString ();
+ ui_->Field_Day_Exchange->setText(FD_exchange_);
+ ui_->RTTY_Exchange->setText(RTTY_exchange_);
if (next_font_.fromString (settings_->value ("Font", QGuiApplication::font ().toString ()).toString ())
&& next_font_ != font_)
{
@@ -1259,6 +1341,8 @@ void Configuration::impl::read_settings ()
&& next_decoded_text_font_ != decoded_text_font_)
{
decoded_text_font_ = next_decoded_text_font_;
+ next_decode_highlighing_model_.set_font (decoded_text_font_);
+ ui_->highlighting_list_view->reset ();
Q_EMIT self_->decoded_text_font_changed (decoded_text_font_);
}
else
@@ -1362,6 +1446,13 @@ void Configuration::impl::read_settings ()
stations_.station_list (settings_->value ("stations").value<StationList::Stations> ());
+ auto highlight_items = settings_->value ("DecodeHighlighting", QVariant::fromValue (DecodeHighlightingModel::default_items ())).value<DecodeHighlightingModel::HighlightItems> ();
+ if (!highlight_items.size ()) highlight_items = DecodeHighlightingModel::default_items ();
+ decode_highlighing_model_.items (highlight_items);
+ highlight_by_mode_ = settings_->value("HighlightByMode", false).toBool ();
+ LotW_days_since_upload_ = settings_->value ("LotWDaysSinceLastUpload", 365).toInt ();
+ lotw_users_.set_age_constraint (LotW_days_since_upload_);
+
log_as_RTTY_ = settings_->value ("toRTTY", false).toBool ();
report_in_comments_ = settings_->value("dBtoComments", false).toBool ();
rig_params_.rig_name = settings_->value ("Rig", TransceiverFactory::basic_transceiver_name_).toString ();
@@ -1382,6 +1473,7 @@ void Configuration::impl::read_settings ()
rig_params_.ptt_port = settings_->value ("PTTport").toString ();
data_mode_ = settings_->value ("DataMode", QVariant::fromValue (data_mode_none)).value<Configuration::DataMode> ();
prompt_to_log_ = settings_->value ("PromptToLog", false).toBool ();
+ autoLog_ = settings_->value ("AutoLog", false).toBool ();
insert_blank_ = settings_->value ("InsertBlank", false).toBool ();
DXCC_ = settings_->value ("DXCCEntity", false).toBool ();
ppfx_ = settings_->value ("PrincipalPrefix", false).toBool ();
@@ -1395,8 +1487,8 @@ void Configuration::impl::read_settings ()
decode_at_52s_ = settings_->value("Decode52",false).toBool ();
single_decode_ = settings_->value("SingleDecode",false).toBool ();
twoPass_ = settings_->value("TwoPass",true).toBool ();
- bFox_ = settings_->value("Fox",false).toBool ();
- bHound_ = settings_->value("Hound",false).toBool ();
+ bSpecialOp_ = settings_->value("SpecialOpActivity",false).toBool ();
+ SelectedActivity_ = settings_->value("SelectedActivity",1).toInt ();
x2ToneSpacing_ = settings_->value("x2ToneSpacing",false).toBool ();
x4ToneSpacing_ = settings_->value("x4ToneSpacing",false).toBool ();
rig_params_.poll_interval = settings_->value ("Polling", 0).toInt ();
@@ -1422,11 +1514,8 @@ void Configuration::impl::write_settings ()
settings_->setValue ("MyCall", my_callsign_);
settings_->setValue ("MyGrid", my_grid_);
- settings_->setValue("colorCQ",color_CQ_);
- settings_->setValue("colorMyCall",color_MyCall_);
- settings_->setValue("colorTxMsg",color_TxMsg_);
- settings_->setValue("colorDXCC",color_DXCC_);
- settings_->setValue("colorNewCall",color_NewCall_);
+ settings_->setValue ("Field_Day_Exchange", FD_exchange_);
+ settings_->setValue ("RTTY_Exchange", RTTY_exchange_);
settings_->setValue ("Font", font_.toString ());
settings_->setValue ("DecodedTextFont", decoded_text_font_.toString ());
settings_->setValue ("IDint", id_interval_);
@@ -1468,6 +1557,9 @@ void Configuration::impl::write_settings ()
settings_->setValue ("Macros", macros_.stringList ());
settings_->setValue ("FrequenciesForRegionModes", QVariant::fromValue (frequencies_.frequency_list ()));
settings_->setValue ("stations", QVariant::fromValue (stations_.station_list ()));
+ settings_->setValue ("DecodeHighlighting", QVariant::fromValue (decode_highlighing_model_.items ()));
+ settings_->setValue ("HighlightByMode", highlight_by_mode_);
+ settings_->setValue ("LotWDaysSinceLastUpload", LotW_days_since_upload_);
settings_->setValue ("toRTTY", log_as_RTTY_);
settings_->setValue ("dBtoComments", report_in_comments_);
settings_->setValue ("Rig", rig_params_.rig_name);
@@ -1480,6 +1572,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("CATHandshake", QVariant::fromValue (rig_params_.handshake));
settings_->setValue ("DataMode", QVariant::fromValue (data_mode_));
settings_->setValue ("PromptToLog", prompt_to_log_);
+ settings_->setValue ("AutoLog", autoLog_);
settings_->setValue ("InsertBlank", insert_blank_);
settings_->setValue ("DXCCEntity", DXCC_);
settings_->setValue ("PrincipalPrefix", ppfx_);
@@ -1500,8 +1593,8 @@ void Configuration::impl::write_settings ()
settings_->setValue ("Decode52", decode_at_52s_);
settings_->setValue ("SingleDecode", single_decode_);
settings_->setValue ("TwoPass", twoPass_);
- settings_->setValue ("Fox", bFox_);
- settings_->setValue ("Hound", bHound_);
+ settings_->setValue ("SelectedActivity", SelectedActivity_);
+ settings_->setValue ("SpecialOpActivity", bSpecialOp_);
settings_->setValue ("x2ToneSpacing", x2ToneSpacing_);
settings_->setValue ("x4ToneSpacing", x4ToneSpacing_);
settings_->setValue ("OpCall", opCall_);
@@ -1680,6 +1773,42 @@ bool Configuration::impl::validate ()
return false;
}
+ if (ui_->rbField_Day-> isChecked () &&
+ !ui_->Field_Day_Exchange->hasAcceptableInput ())
+ {
+ for (auto * parent = ui_->Field_Day_Exchange->parentWidget (); parent; parent = parent->parentWidget ())
+ {
+ auto index = ui_->configuration_tabs->indexOf (parent);
+ if (index != -1)
+ {
+ ui_->configuration_tabs->setCurrentIndex (index);
+ break;
+ }
+ }
+ ui_->Field_Day_Exchange->setFocus ();
+ MessageBox::critical_message (this, tr ("Invalid Contest Exchange")
+ , tr ("You must input a valid ARRL Field Day exchange"));
+ return false;
+ }
+
+ if (ui_->rbRTTY_Roundup-> isChecked () &&
+ !ui_->RTTY_Exchange->hasAcceptableInput ())
+ {
+ for (auto * parent = ui_->RTTY_Exchange->parentWidget (); parent; parent = parent->parentWidget ())
+ {
+ auto index = ui_->configuration_tabs->indexOf (parent);
+ if (index != -1)
+ {
+ ui_->configuration_tabs->setCurrentIndex (index);
+ break;
+ }
+ }
+ ui_->RTTY_Exchange->setFocus ();
+ MessageBox::critical_message (this, tr ("Invalid Contest Exchange")
+ , tr ("You must input a valid ARRL RTTY Roundup exchange"));
+ return false;
+ }
+
return true;
}
@@ -1783,15 +1912,11 @@ void Configuration::impl::accept ()
if (next_decoded_text_font_ != decoded_text_font_)
{
decoded_text_font_ = next_decoded_text_font_;
+ next_decode_highlighing_model_.set_font (decoded_text_font_);
+ ui_->highlighting_list_view->reset ();
Q_EMIT self_->decoded_text_font_changed (decoded_text_font_);
}
- color_CQ_ = next_color_CQ_;
- color_MyCall_ = next_color_MyCall_;
- color_TxMsg_ = next_color_TxMsg_;
- color_DXCC_ = next_color_DXCC_;
- color_NewCall_ = next_color_NewCall_;
-
rig_params_ = temp_rig_params; // now we can go live with the rig
// related configuration parameters
rig_is_dummy_ = TransceiverFactory::basic_transceiver_name_ == rig_params_.rig_name;
@@ -1872,6 +1997,8 @@ void Configuration::impl::accept ()
my_callsign_ = ui_->callsign_line_edit->text ();
my_grid_ = ui_->grid_line_edit->text ();
+ FD_exchange_= ui_->Field_Day_Exchange->text ().toUpper ();
+ RTTY_exchange_= ui_->RTTY_Exchange->text ().toUpper ();
spot_to_psk_reporter_ = ui_->psk_reporter_check_box->isChecked ();
id_interval_ = ui_->CW_id_interval_spin_box->value ();
ntrials_ = ui_->sbNtrials->value ();
@@ -1887,6 +2014,7 @@ void Configuration::impl::accept ()
log_as_RTTY_ = ui_->log_as_RTTY_check_box->isChecked ();
report_in_comments_ = ui_->report_in_comments_check_box->isChecked ();
prompt_to_log_ = ui_->prompt_to_log_check_box->isChecked ();
+ autoLog_ = ui_->cbAutoLog->isChecked();
insert_blank_ = ui_->insert_blank_check_box->isChecked ();
DXCC_ = ui_->DXCC_check_box->isChecked ();
ppfx_ = ui_->ppfx_check_box->isChecked ();
@@ -1903,8 +2031,8 @@ void Configuration::impl::accept ()
decode_at_52s_ = ui_->decode_at_52s_check_box->isChecked ();
single_decode_ = ui_->single_decode_check_box->isChecked ();
twoPass_ = ui_->cbTwoPass->isChecked ();
- bFox_ = ui_->cbFox->isChecked ();
- bHound_ = ui_->cbHound->isChecked ();
+ bSpecialOp_ = ui_->gbSpecialOpActivity->isChecked ();
+ SelectedActivity_ = ui_->special_op_activity_button_group->checkedId();
x2ToneSpacing_ = ui_->cbx2ToneSpacing->isChecked ();
x4ToneSpacing_ = ui_->cbx4ToneSpacing->isChecked ();
calibration_.intercept = ui_->calibration_intercept_spin_box->value ();
@@ -1927,10 +2055,8 @@ void Configuration::impl::accept ()
}
accept_udp_requests_ = ui_->accept_udp_requests_check_box->isChecked ();
- auto new_n1mm_server = ui_->n1mm_server_name_line_edit->text ();
- n1mm_server_name_ = new_n1mm_server;
- auto new_n1mm_port = ui_->n1mm_server_port_spin_box->value ();
- n1mm_server_port_ = new_n1mm_port;
+ n1mm_server_name_ = ui_->n1mm_server_name_line_edit->text ();
+ n1mm_server_port_ = ui_->n1mm_server_port_spin_box->value ();
broadcast_to_n1mm_ = ui_->enable_n1mm_broadcast_check_box->isChecked ();
udpWindowToFront_ = ui_->udpWindowToFront->isChecked ();
@@ -1951,10 +2077,19 @@ void Configuration::impl::accept ()
if (stations_.station_list () != next_stations_.station_list ())
{
- stations_.station_list(next_stations_.station_list ());
+ stations_.station_list (next_stations_.station_list ());
stations_.sort (StationList::band_column);
}
+ if (decode_highlighing_model_.items () != next_decode_highlighing_model_.items ())
+ {
+ decode_highlighing_model_.items (next_decode_highlighing_model_.items ());
+ Q_EMIT self_->decode_highlighting_changed (decode_highlighing_model_);
+ }
+ highlight_by_mode_ = ui_->highlight_by_mode_check_box->isChecked ();
+ LotW_days_since_upload_ = ui_->LotW_days_since_upload_spin_box->value ();
+ lotw_users_.set_age_constraint (LotW_days_since_upload_);
+
if (ui_->use_dynamic_grid->isChecked() && !use_dynamic_grid_ )
{
// turning on so clear it so only the next location update gets used
@@ -1993,63 +2128,32 @@ void Configuration::impl::on_font_push_button_clicked ()
next_font_ = QFontDialog::getFont (0, next_font_, this);
}
-void Configuration::impl::on_pbCQmsg_clicked()
-{
- auto new_color = QColorDialog::getColor(next_color_CQ_, this, "CQ Messages Color");
- if (new_color.isValid ())
- {
- next_color_CQ_ = new_color;
- ui_->labCQ->setStyleSheet(QString("background: %1").arg(next_color_CQ_.name()));
- }
-}
-
-void Configuration::impl::on_pbMyCall_clicked()
-{
- auto new_color = QColorDialog::getColor(next_color_MyCall_, this, "My Call Messages Color");
- if (new_color.isValid ())
- {
- next_color_MyCall_ = new_color;
- ui_->labMyCall->setStyleSheet(QString("background: %1").arg(next_color_MyCall_.name()));
- }
-}
-
-void Configuration::impl::on_pbTxMsg_clicked()
+void Configuration::impl::on_reset_highlighting_to_defaults_push_button_clicked (bool /*checked*/)
{
- auto new_color = QColorDialog::getColor(next_color_TxMsg_, this, "Tx Messages Color");
- if (new_color.isValid ())
+ if (MessageBox::Yes == MessageBox::query_message (this
+ , tr ("Reset Decode Highlighting")
+ , tr ("Reset all decode highlighting and priorities to default values")))
{
- next_color_TxMsg_ = new_color;
- ui_->labTx->setStyleSheet(QString("background: %1").arg(next_color_TxMsg_.name()));
+ next_decode_highlighing_model_.items (DecodeHighlightingModel::default_items ());
}
}
-void Configuration::impl::on_pbNewDXCC_clicked()
+void Configuration::impl::on_rescan_log_push_button_clicked (bool /*clicked*/)
{
- auto new_color = QColorDialog::getColor(next_color_DXCC_, this, "New DXCC Messages Color");
- if (new_color.isValid ())
- {
- next_color_DXCC_ = new_color;
- ui_->labDXCC->setStyleSheet(QString("background: %1").arg(next_color_DXCC_.name()));
- }
+ if (logbook_) logbook_->rescan ();
}
-void Configuration::impl::on_pbNewCall_clicked()
+void Configuration::impl::on_LotW_CSV_fetch_push_button_clicked (bool /*checked*/)
{
- auto new_color = QColorDialog::getColor(next_color_NewCall_, this, "New Call Messages Color");
- if (new_color.isValid ())
- {
- next_color_NewCall_ = new_color;
- ui_->labNewCall->setStyleSheet(QString("background: %1").arg(next_color_NewCall_.name()));
- }
+ lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text (), true);
+ ui_->LotW_CSV_fetch_push_button->setEnabled (false);
}
void Configuration::impl::on_decoded_text_font_push_button_clicked ()
{
next_decoded_text_font_ = QFontDialog::getFont (0, decoded_text_font_ , this
, tr ("WSJT-X Decoded Text Font Chooser")
-#if QT_VERSION >= 0x050201
, QFontDialog::MonospacedFonts
-#endif
);
}
@@ -2192,10 +2296,10 @@ void Configuration::impl::delete_selected_macros (QModelIndexList selected_rows)
{
// sort in reverse row order so that we can delete without changing
// indices underneath us
- qSort (selected_rows.begin (), selected_rows.end (), [] (QModelIndex const& lhs, QModelIndex const& rhs)
- {
- return rhs.row () < lhs.row (); // reverse row ordering
- });
+ std::sort (selected_rows.begin (), selected_rows.end (), [] (QModelIndex const& lhs, QModelIndex const& rhs)
+ {
+ return rhs.row () < lhs.row (); // reverse row ordering
+ });
// now delete them
Q_FOREACH (auto index, selected_rows)
@@ -2389,14 +2493,14 @@ void Configuration::impl::on_calibration_slope_ppm_spin_box_valueChanged (double
rig_active_ = false; // force reset
}
-void Configuration::impl::on_cbFox_clicked (bool checked)
+void Configuration::impl::on_prompt_to_log_check_box_clicked(bool checked)
{
- if (checked) ui_->cbHound->setChecked (false);
+ if(checked) ui_->cbAutoLog->setChecked(false);
}
-void Configuration::impl::on_cbHound_clicked (bool checked)
+void Configuration::impl::on_cbAutoLog_clicked(bool checked)
{
- if (checked) ui_->cbFox->setChecked (false);
+ if(checked) ui_->prompt_to_log_check_box->setChecked(false);
}
void Configuration::impl::on_cbx2ToneSpacing_clicked(bool b)
@@ -2409,6 +2513,22 @@ void Configuration::impl::on_cbx4ToneSpacing_clicked(bool b)
if(b) ui_->cbx2ToneSpacing->setChecked(false);
}
+void Configuration::impl::on_Field_Day_Exchange_textEdited (QString const& exchange)
+{
+ auto text = exchange.simplified ().toUpper ();
+ auto class_pos = text.indexOf (QRegularExpression {R"([A-H])"});
+ if (class_pos >= 0 && text.size () >= class_pos + 2 && text.at (class_pos + 1) != QChar {' '})
+ {
+ text.insert (class_pos + 1, QChar {' '});
+ }
+ ui_->Field_Day_Exchange->setText (text);
+}
+
+void Configuration::impl::on_RTTY_Exchange_textEdited (QString const& exchange)
+{
+ ui_->RTTY_Exchange->setText (exchange.toUpper ());
+}
+
bool Configuration::impl::have_rig ()
{
if (!open_rig ())
@@ -2809,11 +2929,6 @@ auto Configuration::impl::remove_calibration (Frequency f) const -> Frequency
/ (1. + calibration_.slope_ppm / 1.e6));
}
-#if !defined (QT_NO_DEBUG_STREAM)
-ENUM_QDEBUG_OPS_IMPL (Configuration, DataMode);
-ENUM_QDEBUG_OPS_IMPL (Configuration, Type2MsgGen);
-#endif
-
ENUM_QDATASTREAM_OPS_IMPL (Configuration, DataMode);
ENUM_QDATASTREAM_OPS_IMPL (Configuration, Type2MsgGen);