summaryrefslogtreecommitdiff
path: root/Decoder
diff options
context:
space:
mode:
authortony mancill <tmancill@debian.org>2021-12-21 21:48:16 -0800
committertony mancill <tmancill@debian.org>2021-12-21 21:48:16 -0800
commit941d45887769621879b83292f167142951977d69 (patch)
treea0e7371b6341198254882feb2bbcfb0a86fe66c8 /Decoder
parente05d4def60e25e7fed87ff67ce5a97df24fc945b (diff)
New upstream version 2.5.3+repack
Diffstat (limited to 'Decoder')
-rw-r--r--Decoder/decodedtext.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/Decoder/decodedtext.cpp b/Decoder/decodedtext.cpp
index 8f7f9573..e65d34bd 100644
--- a/Decoder/decodedtext.cpp
+++ b/Decoder/decodedtext.cpp
@@ -13,25 +13,32 @@ namespace
{
QRegularExpression tokens_re {R"(
^
- (?:(?<dual>[A-Z0-9/]+)\sRR73;\s)?
+ (?:(?<dual>[A-Z0-9/]+)\sRR73;\s)? # dual reply DXpedition message
(?:
(?<word1>
(?:CQ|DE|QRZ)
(?:\s?DX|\s
- (?:[A-Z]{1,4}|\d{3})
+ (?:[A-Z]{1,4}|\d{3}) # directional CQ
)
- | [A-Z0-9/]+
- |\.{3}
+ | [A-Z0-9/]+ # DX call
+ |\.{3} # unknown hash code
)\s
)
(?:
- (?<word2>[A-Z0-9/]+)
+ (?<word2>[A-Z0-9/]+) # DE call
(?:\s
- (?<word3>[-+A-Z0-9]+)
+ (?<word3>[-+A-Z0-9]+) # report
(?:\s
(?<word4>
- (?:OOO | (?!RR73)[A-R]{2}[0-9]{2})
+ (?:
+ OOO # EME
+ | (?!RR73)[A-R]{2}[0-9]{2} # grid square (not RR73)
+ | 5[0-9]{5} # EU VHF Contest report & serial
+ )
)
+ (?:\s
+ (?<word5>[A-R]{2}[0-9]{2}[A-X]{2}) # EU VHF Contest grid locator
+ )?
)?
)?
)?
@@ -48,13 +55,13 @@ DecodedText::DecodedText (QString const& the_string)
, is_standard_ {false}
{
// discard appended AP info
- clean_string_.replace (QRegularExpression {R"(^(.*?)(?:\?\s)?(?:a|q)[0-9].*$)"}, "\\1");
+ clean_string_.replace (QRegularExpression {R"(^(.*?)(?:\?\s)?[aq][0-9].*$)"}, "\\1");
// qDebug () << "DecodedText: the_string:" << the_string << "Nbsp pos:" << the_string.indexOf (QChar::Nbsp);
if (message_.length() >= 1)
{
- message0_ = message_.left(36);
- message_ = message_.left(36).remove (QRegularExpression {"[<>]"});
+ message0_ = message_.left(37);
+ message_ = message_.left(37).remove (QRegularExpression {"[<>]"});
int i1 = message_.indexOf ('\r');
if (i1 > 0)
{
@@ -85,13 +92,13 @@ QStringList DecodedText::messageWords () const
// extract up to the first four message words
QString t=message_;
if(t.left(4)=="TU; ") t=message_.mid(4,-1);
- auto res = tokens_re.match(t).capturedTexts();
- qDebug () << "captured texts:" << res;
- return res;
+ return tokens_re.match(t).capturedTexts();
}
// simple word split for free text messages
auto words = message_.split (' ', SkipEmptyParts);
- // add whole message as item 0 to mimic RE capture list
+ // add whole message and two empty strings as item 0 & 1 to mimic RE
+ // capture list
+ words.prepend (QString {});
words.prepend (message_);
return words;
}
@@ -121,7 +128,7 @@ bool DecodedText::isTX() const
bool DecodedText::isLowConfidence () const
{
- return QChar {'?'} == string_.mid (padding_ + column_qsoText + 21, 1);
+ return QChar {'?'} == string_.mid (padding_ + column_qsoText + 36, 1);
}
int DecodedText::frequencyOffset() const