Added new CQ parsing to be more intuitive
This commit is contained in:
parent
1817e298b1
commit
4e094b791c
@ -6355,9 +6355,8 @@ QStringList MainWindow::buildFT8MessageFrames(QString const& text){
|
||||
|
||||
bool lineStartsWithBaseCall = (
|
||||
line.startsWith("ALLCALL") ||
|
||||
line.startsWith("CQCQCQ") ||
|
||||
line.startsWith("CQ ") ||
|
||||
line.startsWith("BEACON")
|
||||
line.startsWith("BEACON") ||
|
||||
Varicode::startsWithCQ(line)
|
||||
);
|
||||
|
||||
bool lineStartsWithStandardCall = !calls.isEmpty() && line.startsWith(calls.first());
|
||||
@ -10122,9 +10121,10 @@ void MainWindow::displayBandActivity() {
|
||||
}
|
||||
textItem->setTextAlignment(flag);
|
||||
|
||||
if (text.last().contains(QRegularExpression {
|
||||
"\\b(CQCQCQ|CQ)\\b"
|
||||
})) {
|
||||
if (
|
||||
Varicode::startsWithCQ(text.last()) ||
|
||||
text.last().contains(QRegularExpression {"\\b(CQCQCQ|CQ)\\b"})
|
||||
){
|
||||
offsetItem->setBackground(QBrush(m_config.color_CQ()));
|
||||
ageItem->setBackground(QBrush(m_config.color_CQ()));
|
||||
snrItem->setBackground(QBrush(m_config.color_CQ()));
|
||||
@ -10133,7 +10133,7 @@ void MainWindow::displayBandActivity() {
|
||||
|
||||
bool isDirectedAllCall = false;
|
||||
|
||||
// TODO: jsherer - there's a potential here for a previous allcall o poison the highlight.
|
||||
// TODO: jsherer - there's a potential here for a previous allcall to poison the highlight.
|
||||
if (
|
||||
(isDirectedOffset(offset, &isDirectedAllCall) && !isDirectedAllCall) ||
|
||||
(text.last().contains(Radio::base_callsign(m_config.my_callsign())))
|
||||
|
14
varicode.cpp
14
varicode.cpp
@ -103,7 +103,7 @@ QRegularExpression directed_re("^" +
|
||||
optional_cmd_pattern +
|
||||
optional_num_pattern);
|
||||
|
||||
QRegularExpression beacon_re(R"(^\s*(?<type>CQCQCQ|CQ QRP|CQ DX|CQ TEST|BEACON)(?:\s(?<grid>[A-R]{2}[0-9]{2}))?\b)");
|
||||
QRegularExpression beacon_re(R"(^\s*(?<type>CQCQCQ|CQ QRP|CQ DX|CQ TEST|CQ( CQ){0,2}|BEACON)(?:\s(?<grid>[A-R]{2}[0-9]{2}))?\b)");
|
||||
|
||||
QRegularExpression compound_re("^\\s*[<]" +
|
||||
callsign_pattern +
|
||||
@ -350,6 +350,9 @@ QMap<quint32, QString> cqs = {
|
||||
{ 1, "CQ DX" },
|
||||
{ 2, "CQ QRP" },
|
||||
{ 3, "CQ TEST" },
|
||||
{ 4, "CQ"},
|
||||
{ 5, "CQ CQ"},
|
||||
{ 6, "CQ CQ CQ"},
|
||||
};
|
||||
|
||||
QMap<int, int> dbm2mw = {
|
||||
@ -442,6 +445,15 @@ QString Varicode::cqString(int number){
|
||||
return cqs[number];
|
||||
}
|
||||
|
||||
bool Varicode::startsWithCQ(QString text){
|
||||
foreach(auto cq, cqs.values()){
|
||||
if(text.startsWith(cq)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QString Varicode::formatSNR(int snr){
|
||||
if(snr < -60 || snr > 60){
|
||||
return QString();
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
//Varicode();
|
||||
|
||||
static QString cqString(int number);
|
||||
static bool startsWithCQ(QString text);
|
||||
static QString formatSNR(int snr);
|
||||
static QString formatPWR(int dbm);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user