Fixed #110: duplicate acks weren't being displayed even if they came in minutes apart

This commit is contained in:
Jordan Sherer 2019-02-21 13:11:30 -05:00
parent 5565a7731e
commit 84a3ef6046
2 changed files with 14 additions and 3 deletions

View File

@ -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){

View File

@ -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();
}