From 84a3ef604604d109c711117938d884b3f86fab71 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Thu, 21 Feb 2019 13:11:30 -0500 Subject: [PATCH] Fixed #110: duplicate acks weren't being displayed even if they came in minutes apart --- mainwindow.cpp | 16 ++++++++++++++-- varicode.cpp | 1 - 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index fe18390..73b9766 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1747,6 +1747,14 @@ void MainWindow::initializeDummyData(){ displayTextForFreq("J1Y: KN4CRD SNR -05 \u2301 ", 42, DriftingDateTime::currentDateTimeUtc().addSecs(-300), false, true, true); displayTextForFreq("HELLO BRAVE NEW WORLD \u2301 ", 42, DriftingDateTime::currentDateTimeUtc().addSecs(-300), false, true, true); + auto now = DriftingDateTime::currentDateTimeUtc(); + displayTextForFreq("KN4CRD: JY1 ACK -12 \u2301 ", 780, now, false, true, true); + displayTextForFreq("KN4CRD: JY1 ACK -12 \u2301 ", 780, now, false, true, true); // should be hidden (duplicate) + displayTextForFreq("OH8STN: JY1 ACK -12 \u2301 ", 780, now, false, true, true); + + displayTextForFreq("KN4CRD: JY1 ACK -10 \u2301 ", 800, now, false, true, true); + displayTextForFreq("KN4CRD: JY1 ACK -12 \u2301 ", 780, now.addSecs(120), false, true, true); + displayActivity(true); } @@ -5768,8 +5776,12 @@ int MainWindow::writeMessageTextToUI(QDateTime date, QString text, int freq, boo // fixup duplicate acks auto tc = c.document()->find(text); if(!tc.isNull() && tc.selectedText() == text && text.contains(" ACK ")){ - qDebug() << "found" << tc.selectedText() << "so not displaying..."; - return tc.blockNumber(); + tc.select(QTextCursor::BlockUnderCursor); + + if(tc.selectedText().trimmed().startsWith(date.time().toString())){ + qDebug() << "found" << tc.selectedText() << "so not displaying..."; + return tc.blockNumber(); + } } if(found && !bold){ diff --git a/varicode.cpp b/varicode.cpp index a7b237d..cb771a2 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -1169,7 +1169,6 @@ bool Varicode::isValidCallsign(const QString &callsign, bool *pIsCompound){ auto match = QRegularExpression(base_callsign_pattern).match(callsign); if(match.hasMatch() && (match.capturedLength() == callsign.length())){ if(pIsCompound) *pIsCompound = false; - qDebug() << "match" << match.capturedTexts(); return callsign.length() > 2 && QRegularExpression("[0-9][A-Z]|[A-Z][0-9]").match(callsign).hasMatch(); }