Experimenting with age in the band activity window

This commit is contained in:
Jordan Sherer 2018-07-10 22:32:35 -04:00
parent 74ea603801
commit 1cddbdf91e
3 changed files with 117 additions and 75 deletions

View File

@ -3949,10 +3949,8 @@ void MainWindow::guiUpdate()
displayDialFrequency ();
if(nsec % 15 == 0){
displayActivity();
}
}
displayTransmit();
@ -7628,6 +7626,10 @@ void MainWindow::postDecode (bool is_new, QString const& message)
, QChar {'?'} == decode.mid (has_seconds ? 24 + 21 : 22 + 21, 1)
, m_diskData);
}
if(is_new){
m_rxDirty = true;
}
}
void MainWindow::displayTransmit(){
@ -7644,6 +7646,11 @@ void MainWindow::displayTransmit(){
}
void MainWindow::displayActivity(){
if(!m_rxDirty){
return;
}
m_rxDirty = false;
// RX Activity
int selectedOffset = -1;
auto selectedItems = ui->tableWidgetRXAll->selectedItems();
@ -7669,6 +7676,7 @@ void MainWindow::displayActivity(){
QList<ActivityDetail> items = m_bandActivity[offset];
if(items.length() > 0){
QStringList text;
QString age;
int snr = 0;
foreach(ActivityDetail item, items){
if(item.utcTimestamp.secsTo(now)/60 >= 2){
@ -7682,6 +7690,7 @@ void MainWindow::displayActivity(){
}
text.append(item.text);
snr = item.snr;
age = since(item.utcTimestamp);
}
auto joined = text.join(" ");
@ -7689,12 +7698,25 @@ void MainWindow::displayActivity(){
continue;
}
// TODO: jsherer - maybe parse for callsigns in the text?
// /^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/
// from https://groups.io/g/hamauth/topic/call_sign_pattern_matching/6060598?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,6060598
ui->tableWidgetRXAll->insertRow(ui->tableWidgetRXAll->rowCount());
auto offsetItem = new QTableWidgetItem(QString("%1").arg(offset));
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 0, offsetItem);
auto snrItem = new QTableWidgetItem(QString("%1").arg(snr));
snrItem->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 1, snrItem);
/*
auto ageItem = new QTableWidgetItem(QString("(%1)").arg(age));
ageItem->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 2, ageItem);
*/
// align right if eliding...
int colWidth = ui->tableWidgetRXAll->columnWidth(2);
auto textItem = new QTableWidgetItem(joined);
@ -7709,6 +7731,7 @@ void MainWindow::displayActivity(){
if (text.last().contains(QRegularExpression {"^(CQ|QRZ|DE)\\s"})){
offsetItem->setBackground(QBrush(m_config.color_CQ()));
//ageItem->setBackground(QBrush(m_config.color_CQ()));
snrItem->setBackground(QBrush(m_config.color_CQ()));
textItem->setBackground(QBrush(m_config.color_CQ()));
}
@ -7719,11 +7742,12 @@ void MainWindow::displayActivity(){
);
if (recentlyDirected || (!m_config.my_callsign().isEmpty() && text.last().contains(m_config.my_callsign()))){
offsetItem->setBackground(QBrush(m_config.color_MyCall()));
//ageItem->setBackground(QBrush(m_config.color_MyCall()));
snrItem->setBackground(QBrush(m_config.color_MyCall()));
textItem->setBackground(QBrush(m_config.color_MyCall()));
}
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 2, textItem);
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 2/*3*/, textItem);
if(offset == selectedOffset){
ui->tableWidgetRXAll->selectRow(ui->tableWidgetRXAll->rowCount() - 1);
@ -7731,7 +7755,8 @@ void MainWindow::displayActivity(){
}
}
ui->tableWidgetRXAll->resizeColumnToContents(0);
ui->tableWidgetRXAll->resizeColumnToContents(1); //resizeColumnsToContents();
ui->tableWidgetRXAll->resizeColumnToContents(1);
ui->tableWidgetRXAll->resizeColumnToContents(2);
// Call Activity
QString selectedCall;

View File

@ -660,6 +660,7 @@ private:
QDateTime utcTimestamp;
};
bool m_rxDirty;
int m_txFrameCount;
QQueue<QString> m_txFrameQueue;
QQueue<RXDetail> m_rxFrameQueue;

View File

@ -596,6 +596,14 @@ background-color: #00ff00;
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>40</width>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -650,12 +658,17 @@ background-color: #00ff00;
</property>
</widget>
<widget class="QPushButton" name="monitorTxButton">
<property name="visible">
<bool>false</bool>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>40</width>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -674,6 +687,9 @@ background-color: #00ff00;
<height>30</height>
</size>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
font-family: helvetica;