Added a toggle to disable word suggestions

This commit is contained in:
Jordan Sherer 2018-12-31 15:25:04 -05:00
parent 28e542e414
commit a4cc87d7b4
4 changed files with 34 additions and 12 deletions

View File

@ -645,6 +645,7 @@ private:
bool clear_callsign_;
bool miles_;
bool avoid_allcall_;
bool spellcheck_;
bool quick_call_;
bool disable_TX_on_73_;
int heartbeat_;
@ -777,6 +778,7 @@ bool Configuration::ppfx() const {return m_->ppfx_;}
bool Configuration::clear_callsign () const {return m_->clear_callsign_;}
bool Configuration::miles () const {return m_->miles_;}
bool Configuration::avoid_allcall () const {return m_->avoid_allcall_;}
bool Configuration::spellcheck () const {return m_->spellcheck_;}
bool Configuration::quick_call () const {return m_->quick_call_;}
bool Configuration::disable_TX_on_73 () const {return m_->disable_TX_on_73_;}
int Configuration::heartbeat () const {return m_->heartbeat_;}
@ -1388,6 +1390,7 @@ void Configuration::impl::initialize_models ()
ui_->clear_callsign_check_box->setChecked (clear_callsign_);
ui_->miles_check_box->setChecked (miles_);
ui_->avoid_allcall_checkbox->setChecked(avoid_allcall_);
ui_->spellcheck_check_box->setChecked(spellcheck_);
ui_->quick_call_check_box->setChecked (quick_call_);
ui_->disable_TX_on_73_check_box->setChecked (disable_TX_on_73_);
ui_->heartbeat_spin_box->setValue (heartbeat_);
@ -1699,6 +1702,7 @@ void Configuration::impl::read_settings ()
clear_callsign_ = settings_->value ("ClearCallGrid", false).toBool ();
miles_ = settings_->value ("Miles", false).toBool ();
avoid_allcall_ = settings_->value ("AvoidAllcall", false).toBool ();
spellcheck_ = settings_->value ("Spellcheck", true).toBool();
quick_call_ = settings_->value ("QuickCall", false).toBool ();
disable_TX_on_73_ = settings_->value ("73TxDisable", false).toBool ();
heartbeat_ = settings_->value ("TxBeacon", 30).toInt ();
@ -1835,6 +1839,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("ClearCallGrid", clear_callsign_);
settings_->setValue ("Miles", miles_);
settings_->setValue ("AvoidAllcall", avoid_allcall_);
settings_->setValue ("Spellcheck", spellcheck_);
settings_->setValue ("QuickCall", quick_call_);
settings_->setValue ("73TxDisable", disable_TX_on_73_);
settings_->setValue ("TxBeacon", heartbeat_);
@ -2325,6 +2330,7 @@ void Configuration::impl::accept ()
clear_callsign_ = ui_->clear_callsign_check_box->isChecked ();
miles_ = ui_->miles_check_box->isChecked ();
avoid_allcall_ = ui_->avoid_allcall_checkbox->isChecked();
spellcheck_ = ui_->spellcheck_check_box->isChecked();
quick_call_ = ui_->quick_call_check_box->isChecked ();
disable_TX_on_73_ = ui_->disable_TX_on_73_check_box->isChecked ();
heartbeat_ = ui_->heartbeat_spin_box->value ();

View File

@ -136,6 +136,7 @@ public:
bool clear_callsign () const;
bool miles () const;
bool avoid_allcall () const;
bool spellcheck() const;
bool quick_call () const;
bool disable_TX_on_73 () const;
int heartbeat () const;

View File

@ -295,8 +295,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>654</width>
<height>482</height>
<width>724</width>
<height>511</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_26">
@ -411,6 +411,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="spellcheck_check_box">
<property name="text">
<string>Suggest alternative word choices for more efficient message transmission</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
@ -892,7 +899,7 @@ text message.</string>
<rect>
<x>0</x>
<y>0</y>
<width>264</width>
<width>718</width>
<height>435</height>
</rect>
</property>
@ -1731,8 +1738,8 @@ radio interface behave as expected.</string>
<rect>
<x>0</x>
<y>0</y>
<width>266</width>
<height>329</height>
<width>760</width>
<height>502</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_29">
@ -2044,7 +2051,7 @@ both here.</string>
<rect>
<x>0</x>
<y>0</y>
<width>508</width>
<width>746</width>
<height>525</height>
</rect>
</property>
@ -2098,7 +2105,7 @@ both here.</string>
<bool>true</bool>
</property>
<property name="visible">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="toolTip">
<string>Check this option to force deselect callsign after logging.</string>
@ -2501,8 +2508,8 @@ for assessing propagation and system performance.</string>
<rect>
<x>0</x>
<y>0</y>
<width>487</width>
<height>341</height>
<width>760</width>
<height>502</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_31">
@ -3079,8 +3086,8 @@ QListView::item:hover {
<rect>
<x>0</x>
<y>0</y>
<width>271</width>
<height>195</height>
<width>738</width>
<height>378</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">

View File

@ -7438,6 +7438,10 @@ QString MainWindow::replaceMacros(QString const &text, QMap<QString, QString> va
}
void MainWindow::buildSuggestionsMenu(QMenu *menu, QTextEdit *edit, const QPoint &point){
if(!m_config.spellcheck()){
return;
}
bool found = false;
auto c = edit->cursorForPosition(point);
@ -7448,7 +7452,7 @@ void MainWindow::buildSuggestionsMenu(QMenu *menu, QTextEdit *edit, const QPoint
c.movePosition(QTextCursor::StartOfWord);
c.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
auto word = c.selectedText();
auto word = c.selectedText().trimmed();
if(word.isEmpty()){
return;
}
@ -8723,6 +8727,10 @@ void MainWindow::refreshTextDisplay(){
}
void MainWindow::updateTextWordCheckerDisplay(){
if(!m_config.spellcheck()){
return;
}
JSCChecker::checkRange(ui->extFreeTextMsgEdit, 0, -1);
}