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,9 +3949,7 @@ void MainWindow::guiUpdate()
displayDialFrequency (); displayDialFrequency ();
if(nsec % 15 == 0){ displayActivity();
displayActivity();
}
} }
displayTransmit(); displayTransmit();
@ -7618,7 +7616,7 @@ void MainWindow::postDecode (bool is_new, QString const& message)
auto const& decode = message.trimmed (); auto const& decode = message.trimmed ();
auto const& parts = decode.left (22).split (' ', QString::SkipEmptyParts); auto const& parts = decode.left (22).split (' ', QString::SkipEmptyParts);
if (parts.size () >= 5) if (parts.size () >= 5)
{ {
auto has_seconds = parts[0].size () > 4; auto has_seconds = parts[0].size () > 4;
m_messageClient->decode (is_new m_messageClient->decode (is_new
, QTime::fromString (parts[0], has_seconds ? "hhmmss" : "hhmm") , QTime::fromString (parts[0], has_seconds ? "hhmmss" : "hhmm")
@ -7627,7 +7625,11 @@ void MainWindow::postDecode (bool is_new, QString const& message)
, decode.mid (has_seconds ? 24 : 22, 21) , decode.mid (has_seconds ? 24 : 22, 21)
, QChar {'?'} == decode.mid (has_seconds ? 24 + 21 : 22 + 21, 1) , QChar {'?'} == decode.mid (has_seconds ? 24 + 21 : 22 + 21, 1)
, m_diskData); , m_diskData);
} }
if(is_new){
m_rxDirty = true;
}
} }
void MainWindow::displayTransmit(){ void MainWindow::displayTransmit(){
@ -7644,6 +7646,11 @@ void MainWindow::displayTransmit(){
} }
void MainWindow::displayActivity(){ void MainWindow::displayActivity(){
if(!m_rxDirty){
return;
}
m_rxDirty = false;
// RX Activity // RX Activity
int selectedOffset = -1; int selectedOffset = -1;
auto selectedItems = ui->tableWidgetRXAll->selectedItems(); auto selectedItems = ui->tableWidgetRXAll->selectedItems();
@ -7669,6 +7676,7 @@ void MainWindow::displayActivity(){
QList<ActivityDetail> items = m_bandActivity[offset]; QList<ActivityDetail> items = m_bandActivity[offset];
if(items.length() > 0){ if(items.length() > 0){
QStringList text; QStringList text;
QString age;
int snr = 0; int snr = 0;
foreach(ActivityDetail item, items){ foreach(ActivityDetail item, items){
if(item.utcTimestamp.secsTo(now)/60 >= 2){ if(item.utcTimestamp.secsTo(now)/60 >= 2){
@ -7682,6 +7690,7 @@ void MainWindow::displayActivity(){
} }
text.append(item.text); text.append(item.text);
snr = item.snr; snr = item.snr;
age = since(item.utcTimestamp);
} }
auto joined = text.join(" "); auto joined = text.join(" ");
@ -7689,12 +7698,25 @@ void MainWindow::displayActivity(){
continue; 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()); ui->tableWidgetRXAll->insertRow(ui->tableWidgetRXAll->rowCount());
auto offsetItem = new QTableWidgetItem(QString("%1").arg(offset)); auto offsetItem = new QTableWidgetItem(QString("%1").arg(offset));
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 0, offsetItem); ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 0, offsetItem);
auto snrItem = new QTableWidgetItem(QString("%1").arg(snr)); auto snrItem = new QTableWidgetItem(QString("%1").arg(snr));
snrItem->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
ui->tableWidgetRXAll->setItem(ui->tableWidgetRXAll->rowCount() - 1, 1, snrItem); 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... // align right if eliding...
int colWidth = ui->tableWidgetRXAll->columnWidth(2); int colWidth = ui->tableWidgetRXAll->columnWidth(2);
auto textItem = new QTableWidgetItem(joined); auto textItem = new QTableWidgetItem(joined);
@ -7709,6 +7731,7 @@ void MainWindow::displayActivity(){
if (text.last().contains(QRegularExpression {"^(CQ|QRZ|DE)\\s"})){ if (text.last().contains(QRegularExpression {"^(CQ|QRZ|DE)\\s"})){
offsetItem->setBackground(QBrush(m_config.color_CQ())); offsetItem->setBackground(QBrush(m_config.color_CQ()));
//ageItem->setBackground(QBrush(m_config.color_CQ()));
snrItem->setBackground(QBrush(m_config.color_CQ())); snrItem->setBackground(QBrush(m_config.color_CQ()));
textItem->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()))){ if (recentlyDirected || (!m_config.my_callsign().isEmpty() && text.last().contains(m_config.my_callsign()))){
offsetItem->setBackground(QBrush(m_config.color_MyCall())); offsetItem->setBackground(QBrush(m_config.color_MyCall()));
//ageItem->setBackground(QBrush(m_config.color_MyCall()));
snrItem->setBackground(QBrush(m_config.color_MyCall())); snrItem->setBackground(QBrush(m_config.color_MyCall()));
textItem->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){ if(offset == selectedOffset){
ui->tableWidgetRXAll->selectRow(ui->tableWidgetRXAll->rowCount() - 1); ui->tableWidgetRXAll->selectRow(ui->tableWidgetRXAll->rowCount() - 1);
@ -7731,7 +7755,8 @@ void MainWindow::displayActivity(){
} }
} }
ui->tableWidgetRXAll->resizeColumnToContents(0); ui->tableWidgetRXAll->resizeColumnToContents(0);
ui->tableWidgetRXAll->resizeColumnToContents(1); //resizeColumnsToContents(); ui->tableWidgetRXAll->resizeColumnToContents(1);
ui->tableWidgetRXAll->resizeColumnToContents(2);
// Call Activity // Call Activity
QString selectedCall; QString selectedCall;

View File

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

View File

@ -591,31 +591,39 @@ background-color: #00ff00;
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QWidget" name="monitorContainer" native="true"> <widget class="QWidget" name="monitorContainer" native="true">
<widget class="QPushButton" name="monitorButton"> <widget class="QPushButton" name="monitorButton">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy"> <property name="geometry">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <rect>
<horstretch>0</horstretch> <x>0</x>
<verstretch>0</verstretch> <y>0</y>
</sizepolicy> <width>40</width>
</property> <height>30</height>
<property name="minimumSize"> </rect>
<size> </property>
<width>40</width> <property name="sizePolicy">
<height>30</height> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
</size> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
<property name="maximumSize"> </sizepolicy>
<size> </property>
<width>40</width> <property name="minimumSize">
<height>30</height> <size>
</size> <width>40</width>
</property> <height>30</height>
<property name="styleSheet"> </size>
<string notr="true">QPushButton { </property>
<property name="maximumSize">
<size>
<width>40</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
font-family: helvetica; font-family: helvetica;
font-size: 9pt; font-size: 9pt;
font-weight: bold; font-weight: bold;
@ -641,41 +649,49 @@ background-color: #00ff00;
QPushButton:checked { QPushButton:checked {
background-color: #00ff00; background-color: #00ff00;
}</string> }</string>
</property> </property>
<property name="text"> <property name="text">
<string>RX</string> <string>RX</string>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="monitorTxButton"> <widget class="QPushButton" name="monitorTxButton">
<property name="visible"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="enabled"> <property name="geometry">
<bool>true</bool> <rect>
</property> <x>0</x>
<property name="sizePolicy"> <y>0</y>
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <width>40</width>
<horstretch>0</horstretch> <height>30</height>
<verstretch>0</verstretch> </rect>
</sizepolicy> </property>
</property> <property name="sizePolicy">
<property name="minimumSize"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<size> <horstretch>0</horstretch>
<width>40</width> <verstretch>0</verstretch>
<height>30</height> </sizepolicy>
</size> </property>
</property> <property name="minimumSize">
<property name="maximumSize"> <size>
<size> <width>40</width>
<width>40</width> <height>30</height>
<height>30</height> </size>
</size> </property>
</property> <property name="maximumSize">
<property name="styleSheet"> <size>
<string notr="true">QPushButton { <width>40</width>
<height>30</height>
</size>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
font-family: helvetica; font-family: helvetica;
font-size: 9pt; font-size: 9pt;
font-weight: bold; font-weight: bold;
@ -690,15 +706,15 @@ max-width:40px;;
background-color: yellow; background-color: yellow;
} }
</string> </string>
</property> </property>
<property name="text"> <property name="text">
<string>TX</string> <string>TX</string>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget>
</widget> </widget>
</widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QPushButton" name="tuneButton"> <widget class="QPushButton" name="tuneButton">