Add validation to message entry fields.

All message  entry fields on the  mainscreen and in the  macro editing
facilities are now restricted to valid characters in the JT65/JT9 free
text message alphabet.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4362 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville
2014-09-25 11:36:01 +00:00
parent fbc744e066
commit cb27e2c4b0
3 changed files with 42 additions and 5 deletions
+12 -1
View File
@@ -7,7 +7,8 @@
#include <QThread>
#include <QLineEdit>
#include <QRegularExpression>
#include <QRegExpValidator>
#include <QRegExp>
#include <QDebug>
#include <QtConcurrent/QtConcurrentRun>
@@ -42,6 +43,7 @@ wchar_t buffer[256];
namespace
{
Radio::Frequency constexpr default_frequency {14076000};
QRegExp message_alphabet {"[- A-Za-z0-9+./?]*"};
}
class BandAndFrequencyItemDelegate final
@@ -239,6 +241,15 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
connect (&m_config, &Configuration::transceiver_update, this, &MainWindow::handle_transceiver_update);
connect (&m_config, &Configuration::transceiver_failure, this, &MainWindow::handle_transceiver_failure);
// set up message text validators
ui->tx1->setValidator (new QRegExpValidator {message_alphabet, this});
ui->tx2->setValidator (new QRegExpValidator {message_alphabet, this});
ui->tx3->setValidator (new QRegExpValidator {message_alphabet, this});
ui->tx4->setValidator (new QRegExpValidator {message_alphabet, this});
ui->tx5->setValidator (new QRegExpValidator {message_alphabet, this});
ui->tx6->setValidator (new QRegExpValidator {message_alphabet, this});
ui->freeTextMsg->setValidator (new QRegExpValidator {message_alphabet, this});
// Free text macros model to widget hook up.
ui->tx5->setModel (m_config.macros ());
connect (ui->tx5->lineEdit ()