From a4cc87d7b4c2cb0124c40b73cbd87ccb8fb979ea Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Mon, 31 Dec 2018 15:25:04 -0500 Subject: [PATCH] Added a toggle to disable word suggestions --- Configuration.cpp | 6 ++++++ Configuration.hpp | 1 + Configuration.ui | 29 ++++++++++++++++++----------- mainwindow.cpp | 10 +++++++++- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index 88a6735..711be43 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -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 (); diff --git a/Configuration.hpp b/Configuration.hpp index cd03a78..f62cd20 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -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; diff --git a/Configuration.ui b/Configuration.ui index 2ff3c5b..2731b5d 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -295,8 +295,8 @@ 0 0 - 654 - 482 + 724 + 511 @@ -411,6 +411,13 @@ + + + + Suggest alternative word choices for more efficient message transmission + + + @@ -892,7 +899,7 @@ text message. 0 0 - 264 + 718 435 @@ -1731,8 +1738,8 @@ radio interface behave as expected. 0 0 - 266 - 329 + 760 + 502 @@ -2044,7 +2051,7 @@ both here. 0 0 - 508 + 746 525 @@ -2098,7 +2105,7 @@ both here. true - true + false Check this option to force deselect callsign after logging. @@ -2501,8 +2508,8 @@ for assessing propagation and system performance. 0 0 - 487 - 341 + 760 + 502 @@ -3079,8 +3086,8 @@ QListView::item:hover { 0 0 - 271 - 195 + 738 + 378 diff --git a/mainwindow.cpp b/mainwindow.cpp index 5a20cdd..59a66dc 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -7438,6 +7438,10 @@ QString MainWindow::replaceMacros(QString const &text, QMap 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); }