From 0451d10b2514688b471d6a1ee50e30ef289b8fc3 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 2 Oct 2018 10:03:11 -0400 Subject: [PATCH] Implement a QValidator for the Field Day and RTTY exchanges. --- Configuration.cpp | 28 ++++++++++++++++++++++++++++ Configuration.ui | 10 +++++----- ExchangeValidator.cpp | 4 +--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index fe5139c5b..e9f5a997d 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -461,6 +461,10 @@ private: Q_SLOT void on_cbx2ToneSpacing_clicked(bool); Q_SLOT void on_cbx4ToneSpacing_clicked(bool); Q_SLOT void on_rbNone_toggled(bool); + Q_SLOT void on_rbFieldDay_toggled(); + Q_SLOT void on_rbRTTYroundup_toggled(); + Q_SLOT void on_FieldDay_Exchange_textChanged(); + Q_SLOT void on_RTTY_Exchange_textChanged(); // typenames used as arguments must match registered type names :( Q_SIGNAL void start_transceiver (unsigned seqeunce_number) const; @@ -2358,6 +2362,20 @@ void Configuration::impl::on_add_macro_line_edit_editingFinished () ui_->add_macro_line_edit->setText (ui_->add_macro_line_edit->text ().toUpper ()); } +void Configuration::impl::on_FieldDay_Exchange_textChanged() +{ + bool b=ui_->FieldDay_Exchange->hasAcceptableInput() or !ui_->rbFieldDay->isChecked(); + if(b) ui_->FieldDay_Exchange->setStyleSheet("color: black"); + if(!b) ui_->FieldDay_Exchange->setStyleSheet("color: red"); +} + +void Configuration::impl::on_RTTY_Exchange_textChanged() +{ + bool b=ui_->RTTY_Exchange->hasAcceptableInput() or !ui_->rbRTTYroundup->isChecked(); + if(b) ui_->RTTY_Exchange->setStyleSheet("color: black"); + if(!b) ui_->RTTY_Exchange->setStyleSheet("color: red"); +} + void Configuration::impl::on_delete_macro_push_button_clicked (bool /* checked */) { auto selection_model = ui_->macros_list_view->selectionModel (); @@ -2622,6 +2640,16 @@ void Configuration::impl::on_rbNone_toggled(bool b) if(!b) ui_->cbGenerate77->setChecked(true); } +void Configuration::impl::on_rbFieldDay_toggled() +{ + on_FieldDay_Exchange_textChanged(); +} + +void Configuration::impl::on_rbRTTYroundup_toggled() +{ + on_RTTY_Exchange_textChanged(); +} + void Configuration::impl::on_cbx2ToneSpacing_clicked(bool b) { if(b) ui_->cbx4ToneSpacing->setChecked(false); diff --git a/Configuration.ui b/Configuration.ui index 34366a1a0..47cd2147c 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -2805,7 +2805,7 @@ Right click for insert and delete options. - + Exch: @@ -2859,7 +2859,7 @@ Right click for insert and delete options. - + Exch: @@ -3106,12 +3106,12 @@ soundcard changes - + - - + + diff --git a/ExchangeValidator.cpp b/ExchangeValidator.cpp index e825d00ca..92c77e6aa 100644 --- a/ExchangeValidator.cpp +++ b/ExchangeValidator.cpp @@ -60,8 +60,6 @@ auto ExchangeValidator::validate (QString& input, int& length) const -> State } done: - qDebug() << input << ok; if(ok) return Acceptable; -// return Invalid; - return Acceptable; + return Intermediate; }