From 3718f8d3aa5ef09ed68d4f24428bfc92ff914494 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 29 Aug 2018 14:38:18 -0400 Subject: [PATCH] Fix several color highlighting anomalies. --- displaytext.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/displaytext.cpp b/displaytext.cpp index 899750ff1..3e5b9ccaf 100644 --- a/displaytext.cpp +++ b/displaytext.cpp @@ -165,7 +165,6 @@ QString DisplayText::appendWorkedB4(QString message, QString const& callsign, QS bool gridB4; bool gridB4onBand; - if(call.length()==2) { int i0=message.indexOf("CQ "+call); call=message.mid(i0+6,-1); @@ -175,9 +174,14 @@ QString DisplayText::appendWorkedB4(QString message, QString const& callsign, QS if(call.length()<3) return message; if(!call.contains(QRegExp("[0-9]|[A-Z]"))) return message; - logBook.match(/*in*/call,grid,/*out*/countryName,callWorkedBefore,countryWorkedBefore,gridB4); - logBook.match(/*in*/call,grid,/*out*/countryName,callB4onBand,countryB4onBand,gridB4onBand, - /*in*/ currentBand); + if(grid=="") { + gridB4=true; + gridB4onBand=true; + } else { + logBook.match(/*in*/call,grid,/*out*/countryName,callWorkedBefore,countryWorkedBefore,gridB4); + logBook.match(/*in*/call,grid,/*out*/countryName,callB4onBand,countryB4onBand,gridB4onBand, + /*in*/ currentBand); + } message = message.trimmed (); QString appendage{""}; @@ -269,12 +273,14 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con bg = m_color_CQ; } if(bCQonly and !CQcall) return; - if (myCall != "" and ( - decodedText.indexOf (" " + myCall + " ") >= 0 - or decodedText.indexOf (" " + myCall + "/") >= 0 - or decodedText.indexOf ("/" + myCall + " ") >= 0 - or decodedText.indexOf ("<" + myCall + " ") >= 0 - or decodedText.indexOf (" " + myCall + ">") >= 0)) { + if (myCall != "" and (decodedText.indexOf (" " + myCall + " ") >= 0 + or decodedText.indexOf (" " + myCall + "/") >= 0 + or decodedText.indexOf ("<" + myCall + "/") >= 0 + or decodedText.indexOf ("/" + myCall + " ") >= 0 + or decodedText.indexOf ("/" + myCall + ">") >= 0 + or decodedText.indexOf ("<" + myCall + " ") >= 0 + or decodedText.indexOf ("<" + myCall + ">") >= 0 + or decodedText.indexOf (" " + myCall + ">") >= 0)) { bg = m_color_MyCall; } auto message = decodedText.string(); @@ -367,7 +373,8 @@ namespace } } -void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg, QColor const& fg, bool last_only) +void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg, + QColor const& fg, bool last_only) { QTextCharFormat old_format {currentCharFormat ()}; QTextCursor cursor {document ()};