diff --git a/mainwindow.cpp b/mainwindow.cpp index db13d3e..929e742 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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()))) diff --git a/varicode.cpp b/varicode.cpp index 37eca7c..cf1c314 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -103,7 +103,7 @@ QRegularExpression directed_re("^" + optional_cmd_pattern + optional_num_pattern); -QRegularExpression beacon_re(R"(^\s*(?CQCQCQ|CQ QRP|CQ DX|CQ TEST|BEACON)(?:\s(?[A-R]{2}[0-9]{2}))?\b)"); +QRegularExpression beacon_re(R"(^\s*(?CQCQCQ|CQ QRP|CQ DX|CQ TEST|CQ( CQ){0,2}|BEACON)(?:\s(?[A-R]{2}[0-9]{2}))?\b)"); QRegularExpression compound_re("^\\s*[<]" + callsign_pattern + @@ -350,6 +350,9 @@ QMap cqs = { { 1, "CQ DX" }, { 2, "CQ QRP" }, { 3, "CQ TEST" }, + { 4, "CQ"}, + { 5, "CQ CQ"}, + { 6, "CQ CQ CQ"}, }; QMap 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(); diff --git a/varicode.h b/varicode.h index 83b4d8d..e99358c 100644 --- a/varicode.h +++ b/varicode.h @@ -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);