mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 12:23:37 -05:00
Use regex to decide how the GUI formats the Tx messages for subsequent packing by packjt77. Ensure that C4XMAS is properly flagged as a non-standard callsign.
This commit is contained in:
parent
fb39de196e
commit
c8853cb90c
@ -4777,29 +4777,17 @@ void MainWindow::abortQSO()
|
|||||||
ui->txrb6->setChecked(true);
|
ui->txrb6->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::stdCall(QString w)
|
bool MainWindow::stdCall(QString const& w)
|
||||||
{
|
{
|
||||||
int n=w.trimmed().length();
|
static QRegularExpression standard_call_re {
|
||||||
//Treat /P and /R as special cases: strip them off for this test.
|
R"(
|
||||||
if(w.mid(n-2,2)=="/P") w=w.left(n-2);
|
^\s* # optional leading spaces
|
||||||
if(w.mid(n-2,2)=="/R") w=w.left(n-2);
|
( [A-Z]{0,2} | [A-Z][0-9] | [0-9][A-Z] ) # part 1
|
||||||
n=w.trimmed().length();
|
( [0-9][A-Z]{0,3} ) # part 2
|
||||||
if(n>6) return false; //Callsigns longer than 6 chars are nonstandard
|
(/R | /P)? # optional suffix
|
||||||
w=w.toUpper();
|
\s*$ # optional trailing spaces
|
||||||
int i1=99; // index of first letter
|
)", QRegularExpression::CaseInsensitiveOption | QRegularExpression::ExtendedPatternSyntaxOption};
|
||||||
int i2=-1; // index of last digit
|
return standard_call_re.match (w).hasMatch ();
|
||||||
for(int i=0; i<n; i++) {
|
|
||||||
QString c=w.mid(i,1);
|
|
||||||
if(i1==99 and (c>="A" and c<="Z")) i1=i;
|
|
||||||
if(c>="0" and c<="9") i2=i;
|
|
||||||
}
|
|
||||||
if(i1!=0 and i1!=1) return false; //One of the first two characters must be a letter
|
|
||||||
if(i2>2) return false; //No digits allowed after the 3rd character
|
|
||||||
for(int i=i2+1; i<n; i++) {
|
|
||||||
QString c=w.mid(i,1);
|
|
||||||
if(c<"A" or c>"Z") return false; //Anything after final digit must be a letter
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::genStdMsgs(QString rpt, bool unconditional)
|
void MainWindow::genStdMsgs(QString rpt, bool unconditional)
|
||||||
|
@ -305,7 +305,7 @@ private slots:
|
|||||||
void not_GA_warning_message ();
|
void not_GA_warning_message ();
|
||||||
void checkMSK144ContestType();
|
void checkMSK144ContestType();
|
||||||
int setTxMsg(int n);
|
int setTxMsg(int n);
|
||||||
bool stdCall(QString w);
|
bool stdCall(QString const& w);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,
|
Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,
|
||||||
|
Loading…
Reference in New Issue
Block a user