Implement a QValidator for the Field Day and RTTY exchanges.

This commit is contained in:
Joe Taylor 2018-10-02 10:03:11 -04:00
parent cd8f13b57d
commit 0c9e9aeadc
3 changed files with 34 additions and 8 deletions

View File

@ -457,6 +457,10 @@ private:
Q_SLOT void on_cbx2ToneSpacing_clicked(bool); Q_SLOT void on_cbx2ToneSpacing_clicked(bool);
Q_SLOT void on_cbx4ToneSpacing_clicked(bool); Q_SLOT void on_cbx4ToneSpacing_clicked(bool);
Q_SLOT void on_rbNone_toggled(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 :( // typenames used as arguments must match registered type names :(
Q_SIGNAL void start_transceiver (unsigned seqeunce_number) const; Q_SIGNAL void start_transceiver (unsigned seqeunce_number) const;
@ -2348,6 +2352,20 @@ void Configuration::impl::on_add_macro_line_edit_editingFinished ()
ui_->add_macro_line_edit->setText (ui_->add_macro_line_edit->text ().toUpper ()); 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 */) void Configuration::impl::on_delete_macro_push_button_clicked (bool /* checked */)
{ {
auto selection_model = ui_->macros_list_view->selectionModel (); auto selection_model = ui_->macros_list_view->selectionModel ();
@ -2612,6 +2630,16 @@ void Configuration::impl::on_rbNone_toggled(bool b)
if(!b) ui_->cbGenerate77->setChecked(true); 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) void Configuration::impl::on_cbx2ToneSpacing_clicked(bool b)
{ {
if(b) ui_->cbx4ToneSpacing->setChecked(false); if(b) ui_->cbx4ToneSpacing->setChecked(false);

View File

@ -2805,7 +2805,7 @@ Right click for insert and delete options.</string>
<item> <item>
<layout class="QFormLayout" name="formLayout_17"> <layout class="QFormLayout" name="formLayout_17">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="labRTTY">
<property name="text"> <property name="text">
<string>Exch:</string> <string>Exch:</string>
</property> </property>
@ -2859,7 +2859,7 @@ Right click for insert and delete options.</string>
<item> <item>
<layout class="QFormLayout" name="formLayout_16"> <layout class="QFormLayout" name="formLayout_16">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_14"> <widget class="QLabel" name="labFD">
<property name="text"> <property name="text">
<string>Exch:</string> <string>Exch:</string>
</property> </property>
@ -3106,12 +3106,12 @@ soundcard changes</string>
</connection> </connection>
</connections> </connections>
<buttongroups> <buttongroups>
<buttongroup name="CAT_stop_bits_button_group"/>
<buttongroup name="CAT_data_bits_button_group"/> <buttongroup name="CAT_data_bits_button_group"/>
<buttongroup name="CAT_handshake_button_group"/> <buttongroup name="CAT_handshake_button_group"/>
<buttongroup name="CAT_stop_bits_button_group"/>
<buttongroup name="TX_mode_button_group"/> <buttongroup name="TX_mode_button_group"/>
<buttongroup name="PTT_method_button_group"/>
<buttongroup name="TX_audio_source_button_group"/>
<buttongroup name="split_mode_button_group"/> <buttongroup name="split_mode_button_group"/>
<buttongroup name="TX_audio_source_button_group"/>
<buttongroup name="PTT_method_button_group"/>
</buttongroups> </buttongroups>
</ui> </ui>

View File

@ -60,8 +60,6 @@ auto ExchangeValidator::validate (QString& input, int& length) const -> State
} }
done: done:
qDebug() << input << ok;
if(ok) return Acceptable; if(ok) return Acceptable;
// return Invalid; return Intermediate;
return Acceptable;
} }