From dac6a2cc260229ecc6395d5fd348645b8ab82266 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sun, 2 Dec 2018 00:51:41 +0000 Subject: [PATCH] More relaxed validation for FD exchange and fix up to uppercase --- Configuration.cpp | 25 +++- Configuration.ui | 291 ++++++++++++++++++++++------------------------ 2 files changed, 161 insertions(+), 155 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index 244d885a2..c0c9a982f 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -210,6 +210,7 @@ namespace |DX # anyone else ) )", QRegularExpression::CaseInsensitiveOption | QRegularExpression::ExtendedPatternSyntaxOption}; + QRegularExpression field_day_exchange_re { R"( ( @@ -217,7 +218,7 @@ namespace |[0-2]\d |3[0-2] ) - [A-F]\ # class and space + [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 @@ -488,6 +489,8 @@ private: 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; @@ -1011,8 +1014,8 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network ui_->callsign_line_edit->setValidator (new CallsignValidator {this}); ui_->grid_line_edit->setValidator (new MaidenheadLocatorValidator {this}); ui_->add_macro_line_edit->setValidator (new QRegularExpressionValidator {message_alphabet, this}); - ui_->Field_Day_Exchange->setValidator(new QRegularExpressionValidator {field_day_exchange_re}); - ui_->RTTY_Exchange->setValidator(new QRegularExpressionValidator {RTTY_roundup_exchange_re}); + 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::max ()); @@ -2507,6 +2510,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 ()) diff --git a/Configuration.ui b/Configuration.ui index f52eeb2be..4ec35f7ef 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -2456,7 +2456,140 @@ Right click for insert and delete options. false - + + + + + <html><head/><body><p>FT8 DXpedition mode: Hound operator calling the DX.</p></body></html> + + + Hound + + + true + + + special_op_activity_button_group + + + + + + + + 0 + 0 + + + + <html><head/><body><p>North American VHF/UHF/Microwave contests and others in which a 4-character grid locator is the required exchange.</p></body></html> + + + NA VHF Contest + + + special_op_activity_button_group + + + + + + + <html><head/><body><p>FT8 DXpedition mode: Fox (DXpedition) operator.</p></body></html> + + + Fox + + + false + + + special_op_activity_button_group + + + + + + + + 0 + 0 + + + + <html><head/><body><p>European VHF+ contests requiring a signal report, serial number, and 6-character locator.</p></body></html> + + + EU VHF Contest + + + special_op_activity_button_group + + + + + + + + + <html><head/><body><p>ARRL RTTY Roundup and similar contests. Exchange is US state, Canadian province, or &quot;DX&quot;.</p></body></html> + + + ARRL RTTY Roundup + + + special_op_activity_button_group + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + RTTY RU Exch: + + + RTTY_Exchange + + + + + + + + 70 + 0 + + + + <html><head/><body><p>ARRL RTTY Roundup and similar contests. Exchange is US state, Canadian province, or &quot;DX&quot;.</p></body></html> + + + NJ + + + Qt::AlignCenter + + + + + + + @@ -2503,7 +2636,7 @@ Right click for insert and delete options. - Exch: + FD Exch: Field_Day_Exchange @@ -2533,152 +2666,6 @@ Right click for insert and delete options. - - - - - - <html><head/><body><p>ARRL RTTY Roundup and similar contests. Exchange is US state, Canadian province, or &quot;DX&quot;.</p></body></html> - - - ARRL RTTY Roundup - - - special_op_activity_button_group - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Exch: - - - RTTY_Exchange - - - - - - - - 70 - 0 - - - - <html><head/><body><p>ARRL RTTY Roundup and similar contests. Exchange is US state, Canadian province, or &quot;DX&quot;.</p></body></html> - - - NJ - - - Qt::AlignCenter - - - - - - - - - - - <html><head/><body><p>FT8 DXpedition mode: Fox (DXpedition) operator.</p></body></html> - - - Fox - - - false - - - special_op_activity_button_group - - - - - - - - 0 - 0 - - - - <html><head/><body><p>European VHF+ contests requiring a signal report, serial number, and 6-character locator.</p></body></html> - - - EU VHF Contest - - - special_op_activity_button_group - - - - - - - - 0 - 0 - - - - <html><head/><body><p>North American VHF/UHF/Microwave contests and others in which a 4-character grid locator is the required exchange.</p></body></html> - - - NA VHF Contest - - - special_op_activity_button_group - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>FT8 DXpedition mode: Hound operator calling the DX.</p></body></html> - - - Hound - - - true - - - special_op_activity_button_group - - - @@ -3031,13 +3018,13 @@ Right click for insert and delete options. - - - + - + + +