Fixed allcall and groupcall counts to respect aging

This commit is contained in:
Jordan Sherer 2018-10-18 10:51:53 -04:00
parent 8bba574963
commit 8529ef0982

View File

@ -5053,10 +5053,15 @@ void MainWindow::clearActivity(){
void MainWindow::createAllcallTableRow(QTableWidget *table, bool selected){ void MainWindow::createAllcallTableRow(QTableWidget *table, bool selected){
table->insertRow(table->rowCount()); table->insertRow(table->rowCount());
int count = 0;
auto now = DriftingDateTime::currentDateTimeUtc();
int callsignAging = m_config.callsign_aging();
if(ui->selcalButton->isChecked()){ if(ui->selcalButton->isChecked()){
int freq = currentFreqOffset(); int freq = currentFreqOffset();
int count = 0;
foreach(auto cd, m_callActivity.values()){ foreach(auto cd, m_callActivity.values()){
if (callsignAging && cd.utcTimestamp.secsTo(now) / 60 >= callsignAging) {
continue;
}
if(abs(freq - cd.freq) <= NEAR_THRESHOLD_GROUPCALL){ if(abs(freq - cd.freq) <= NEAR_THRESHOLD_GROUPCALL){
count++; count++;
} }
@ -5067,7 +5072,12 @@ void MainWindow::createAllcallTableRow(QTableWidget *table, bool selected){
table->setSpan(table->rowCount() - 1, 0, 1, table->columnCount()); table->setSpan(table->rowCount() - 1, 0, 1, table->columnCount());
} else { } else {
int count = m_callActivity.count(); foreach(auto cd, m_callActivity.values()){
if (callsignAging && cd.utcTimestamp.secsTo(now) / 60 >= callsignAging) {
continue;
}
count++;
}
auto item = new QTableWidgetItem(count == 0 ? QString("ALLCALL") : QString("ALLCALL (%1)").arg(count)); auto item = new QTableWidgetItem(count == 0 ? QString("ALLCALL") : QString("ALLCALL (%1)").arg(count));
item->setData(Qt::UserRole, QVariant("ALLCALL")); item->setData(Qt::UserRole, QVariant("ALLCALL"));
table->setItem(table->rowCount() - 1, 0, item); table->setItem(table->rowCount() - 1, 0, item);
@ -9549,8 +9559,13 @@ void MainWindow::networkMessage(Message const &message)
// RX.GET_TEXT // RX.GET_TEXT
if(type == "RX.GET_CALL_ACTIVITY"){ if(type == "RX.GET_CALL_ACTIVITY"){
auto now = DriftingDateTime::currentDateTimeUtc();
int callsignAging = m_config.callsign_aging();
QMap<QString, QVariant> calls; QMap<QString, QVariant> calls;
foreach(auto cd, m_callActivity.values()){ foreach(auto cd, m_callActivity.values()){
if (callsignAging && cd.utcTimestamp.secsTo(now) / 60 >= callsignAging) {
continue;
}
QMap<QString, QVariant> detail; QMap<QString, QVariant> detail;
detail["SNR"] = QVariant(cd.snr); detail["SNR"] = QVariant(cd.snr);
detail["GRID"] = QVariant(cd.grid); detail["GRID"] = QVariant(cd.grid);