From 04bdf8574aab4d509f8007298e0acd98eb172930 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Thu, 5 Jul 2018 15:21:47 -0400 Subject: [PATCH] Cache calls for easier display --- mainwindow.cpp | 22 +++++++-- mainwindow.h | 3 ++ mainwindow.ui | 127 +++++++++++++++++++++++++++---------------------- 3 files changed, 92 insertions(+), 60 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index f02dd6d..6679f3a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3021,7 +3021,6 @@ void MainWindow::readFromStdout() //readFromStdout d.timestamp = QDateTime::currentDateTimeUtc().toMSecsSinceEpoch(); d.snr = decodedtext.snr(); m_bandActivity[offset].append(d); - while(m_bandActivity[offset].count() > 10){ m_bandActivity[offset].removeFirst(); } @@ -3068,6 +3067,10 @@ void MainWindow::readFromStdout() //readFromStdout if(abs(audioFreq - m_wideGraph->rxFreq()) <= 10) bDisplayRight=true; } + if(!bDisplayRight){ + bDisplayRight = m_rxDirectedCache.contains(audioFreq/10*10); + } + if (bDisplayRight) { // This msg is within 10 hertz of our tuned frequency, or a JT4 or JT65 avg, // or contains MyCall @@ -3083,12 +3086,15 @@ void MainWindow::readFromStdout() //readFromStdout m_QSOText = decodedtext.string ().trimmed (); // TODO: jsherer - parse decode... - //logRxTxMessageText(decodedtext.messageWords().first().trimmed(), false); RXDetail d; d.freq = audioFreq; d.text = decodedtext.messageWords().first(); d.timestamp = QDateTime::currentDateTimeUtc().toSecsSinceEpoch(); m_rxFrameQueue.append(d); + + if(d.text.contains(m_config.my_callsign())){ + m_rxDirectedCache.insert(audioFreq/10*10, new QDateTime(QDateTime::currentDateTimeUtc()), 25); + } } if(m_mode=="FT8" and m_config.bHound()) { @@ -6364,6 +6370,10 @@ void MainWindow::on_cqMacroButton_clicked(){ addMessageText(text); } +void MainWindow::on_deMacroButton_clicked(){ + addMessageText(m_config.my_callsign()); +} + void MainWindow::on_replyMacroButton_clicked(){ auto items = ui->tableWidgetCalls->selectedItems(); if(!items.isEmpty()){ @@ -6407,6 +6417,12 @@ void MainWindow::on_macrosMacroButton_clicked(){ QAction *action = menu->addAction(macro); connect(action, &QAction::triggered, this, [this, macro](){ addMessageText(macro); }); } + menu->addSeparator(); + auto action = new QAction(QIcon::fromTheme("edit-edit"), "Edit"); + menu->addAction(action); + connect(action, &QAction::triggered, this, &MainWindow::on_actionSettings_triggered); + + ui->macrosMacroButton->setMenu(menu); ui->macrosMacroButton->showMenu(); } @@ -7409,7 +7425,7 @@ void MainWindow::postDecode (bool is_new, QString const& message) textItem->setBackground(QBrush(m_config.color_CQ())); } - if (text.last().contains(m_config.my_callsign())){ + if (text.last().contains(m_config.my_callsign()) || m_rxDirectedCache.contains(offset/10*10)){ offsetItem->setBackground(QBrush(m_config.color_MyCall())); snrItem->setBackground(QBrush(m_config.color_MyCall())); textItem->setBackground(QBrush(m_config.color_MyCall())); diff --git a/mainwindow.h b/mainwindow.h index 5b6a791..151f115 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -231,6 +231,7 @@ private slots: void on_rbFreeText_clicked(bool checked); void on_clearAction_triggered(QObject * sender); void on_cqMacroButton_clicked(); + void on_deMacroButton_clicked(); void on_replyMacroButton_clicked(); void on_snrMacroButton_clicked(); void on_macrosMacroButton_clicked(); @@ -651,6 +652,8 @@ private: int m_txFrameCount; QQueue m_txFrameQueue; QQueue m_rxFrameQueue; + QCache m_rxDirectedCache; // freq -> last directed rx + QCache m_rxCallCache; // call -> last freq seen QMap m_rxFrameBlockNumbers; // freq -> block QMap> m_bandActivity; // freq -> [(text, last timestamp), ...] QMap m_callActivity; // call -> (last freq, last timestamp) diff --git a/mainwindow.ui b/mainwindow.ui index 2f2c840..68eb7cf 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -60,7 +60,7 @@ 0 - 120 + 140 @@ -966,7 +966,7 @@ QTextEdit[readOnly="true"] { - + @@ -979,62 +979,7 @@ QTextEdit[readOnly="true"] { - - - - - 0 - 30 - - - - SNR - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - 0 - 30 - - - - Halt - - - - - - - - 0 - 30 - - - - Macros - - - - false @@ -1061,6 +1006,74 @@ background:yellow; + + + + + 0 + 30 + + + + Macros + + + + + + + + 0 + 30 + + + + Halt + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + 0 + 30 + + + + SNR + + + + + + + + 0 + 30 + + + + DE + + +