From a5b2eeab5d6eba45d1e8fa688c7de1243534a03a Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Fri, 21 Sep 2018 22:41:20 -0400 Subject: [PATCH] Started basic selcal functionality --- mainwindow.cpp | 42 ++-- mainwindow.h | 1 + mainwindow.ui | 599 +++++++++++++++++++++++++++++-------------------- 3 files changed, 375 insertions(+), 267 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 1473225..cff1ca9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1678,6 +1678,7 @@ void MainWindow::writeSettings() m_settings->setValue("TextVerticalSplitter", ui->textVerticalSplitter->saveState()); m_settings->setValue("ShowTimeDrift", ui->driftSyncFrame->isVisible()); m_settings->setValue("TimeDrift", ui->driftSpinBox->value()); + m_settings->setValue("SelCal", ui->selcalButton->isChecked()); m_settings->endGroup(); @@ -1783,6 +1784,7 @@ void MainWindow::readSettings() } ui->driftSyncFrame->setVisible(m_settings->value("ShowTimeDrift", false).toBool()); ui->driftSpinBox->setValue(m_settings->value("TimeDrift", 0).toInt()); + ui->selcalButton->setChecked(m_settings->value("SelCal", false).toBool()); m_settings->endGroup(); @@ -3695,6 +3697,7 @@ void MainWindow::readFromStdout() //readFromStdout m_messageBuffer[d.freq/10*10].msgs.append(d); } + m_rxActivityQueue.append(d); m_bandActivity[offset].append(d); while(m_bandActivity[offset].count() > 10){ @@ -9183,7 +9186,7 @@ void MainWindow::updateButtonDisplay(){ if(isTransmitting){ int count = m_txFrameCount; int sent = count - m_txFrameQueue.count(); - ui->startTxButton->setText(QString("Sending (%1/%2)").arg(sent).arg(count)); + ui->startTxButton->setText(m_tune ? "Tuning" : QString("Sending (%1/%2)").arg(sent).arg(count)); } } @@ -9254,7 +9257,7 @@ void MainWindow::markOffsetRecent(int offset){ bool MainWindow::isDirectedOffset(int offset, bool *pIsAllCall){ bool isDirected = ( m_rxDirectedCache.contains(offset/10*10) && - m_rxDirectedCache[offset/10*10]->date.secsTo(DriftingDateTime::currentDateTimeUtc()) < 300 + m_rxDirectedCache[offset/10*10]->date.secsTo(DriftingDateTime::currentDateTimeUtc()) < 120 ); if(isDirected){ @@ -9271,6 +9274,11 @@ void MainWindow::markOffsetDirected(int offset, bool isAllCall){ m_rxDirectedCache.insert(offset/10*10+10, d2, 10); } +void MainWindow::clearOffsetDirected(int offset){ + m_rxDirectedCache.remove(offset/10*10); + m_rxDirectedCache.remove(offset/10*10+10); +} + bool MainWindow::isMyCallIncluded(const QString &text){ QString myCall = Radio::base_callsign(m_config.my_callsign()); @@ -9316,12 +9324,6 @@ void MainWindow::processRxActivity() { while (!m_rxActivityQueue.isEmpty()) { ActivityDetail d = m_rxActivityQueue.dequeue(); - // if this is a compound message or it's a directed message needing a compound call, skip. - // these messages will be displayed when the compound calls come through -#if 0 - if(d.isCompound || (d.isDirected && d.text.contains("<....>"))){ -#endif - // if this is a _partial_ directed message, skip until the complete call comes through. if(d.isDirected && d.text.contains("<....>")){ continue; @@ -9347,19 +9349,6 @@ void MainWindow::processRxActivity() { shouldDisplay = shouldDisplay || !isDirectedAllCall; } - // TODO: jsherer - develop a better way to determine if we can display this band activity... -#if 0 - if(isRecentOffset(freq) || isAllCallIncluded(d.text)){ - m_rxRecentCache.insert(freq, new QDateTime(DriftingDateTime::currentDateTimeUtc()), 25); - shouldDisplay = true; - } - - if(isDirectedOffset(freq) || isMyCallIncluded(d.text)){ - m_rxDirectedCache.insert(freq, new QDateTime(DriftingDateTime::currentDateTimeUtc()), 25); - shouldDisplay = true; - } -#endif - if(!shouldDisplay){ continue; } @@ -9379,6 +9368,10 @@ void MainWindow::processRxActivity() { // log it to the display! displayTextForFreq(d.text, d.freq, d.utcTimestamp, false, isFirst, isLast); + if(isLast){ + clearOffsetDirected(d.freq); + } + if(isLast && !d.isBuffered){ // buffered commands need the rxFrameBlockNumbers cache so it can fixup its display // all other "last" data frames can clear the rxFrameBlockNumbers cache so the next message will be on a new line. @@ -9601,9 +9594,14 @@ void MainWindow::processCommandActivity() { cd.utcTimestamp = d.utcTimestamp; logCallActivity(cd, true); + bool toMe = d.to == m_config.my_callsign().trimmed() || d.to == Radio::base_callsign(m_config.my_callsign()).trimmed(); // we're only responding to allcall and our callsign at this point, so we'll end after logging the callsigns we've heard - if (!isAllCall && d.to != m_config.my_callsign().trimmed() && d.to != Radio::base_callsign(m_config.my_callsign()).trimmed()) { + if (!isAllCall && !toMe) { + continue; + } + + if (isAllCall && ui->selcalButton->isChecked()) { continue; } diff --git a/mainwindow.h b/mainwindow.h index e934761..220ad4f 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -883,6 +883,7 @@ private: void markOffsetRecent(int offset); bool isDirectedOffset(int offset, bool *pIsAllCall); void markOffsetDirected(int offset, bool isAllCall); + void clearOffsetDirected(int offset); void processActivity(bool force=false); void processRxActivity(); void processCompoundActivity(); diff --git a/mainwindow.ui b/mainwindow.ui index b6ca287..24bea17 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,10 +6,16 @@ 0 0 - 960 - 563 + 872 + 566 + + + 0 + 0 + + FT8Call @@ -105,6 +111,9 @@ 16777215 + + QFrame { background:black; } + QFrame::NoFrame @@ -278,6 +287,22 @@ QPushButton[oob="true"] { + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + @@ -419,6 +444,22 @@ color : white; + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + @@ -440,22 +481,64 @@ color : white; QFrame::Plain - - 18 - - - 6 - - - 18 - - - 6 - - - 18 - - + + + + true + + + + 0 + 0 + + + + + 75 + 30 + + + + + 0 + 30 + + + + <html><head/><body><p>Insert a new entry into the log</p></body></html> + + + QPushButton { +font-family: helvetica; +font-weight: bold; +background-color: lightgray; +color: black; +border-style: solid; +border-radius:2px; +border-width:0px; +border-color: gray; +font-size:90%; +min-width:75px; +min-height:30px; +/*max-width:60px;*/ +max-height:30px; +} +QPushButton[state="error"] { +background-color: red; +} +QPushButton[state="warning"] { +background-color: orange; +} +QPushButton[state="ok"] { +background-color: #00ff00; +} + + + LOG + + + + Qt::Vertical @@ -468,17 +551,175 @@ color : white; - - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + true + + + + 0 + 0 + + - 60 + 75 30 - 60 + 0 + 30 + + + + <html><head/><body><p>Enable or disable the automatic beacon</p></body></html> + + + QPushButton { +font-family: helvetica; +font-weight: bold; +background-color: lightgray; +color: black; +border-style: solid; +border-radius:2px; +border-width:0px; +border-color: gray; +font-size:90%; +min-width:75px; +min-height:30px; +/*max-width:60px;*/ +max-height:30px; +} +QPushButton[state="error"] { +background-color: red; +} +QPushButton[state="warning"] { +background-color: orange; +} +QPushButton[state="ok"] { +background-color: #00ff00; +} +QPushButton:checked { +background-color: #6699ff; +} + + + BCN + + + true + + + + + + + true + + + + 0 + 0 + + + + + 75 + 30 + + + + + 0 + 30 + + + + <html><head/><body><p>Enable or disable selective calling (i.e., only directed messages to you will be displayed)</p></body></html> + + + QPushButton { +font-family: helvetica; +font-weight: bold; +background-color: lightgray; +color: black; +border-style: solid; +border-radius:2px; +border-width:0px; +border-color: gray; +font-size:90%; +min-width:75px; +min-height:30px; +/*max-width:60px;*/ +max-height:30px; +} +QPushButton[state="error"] { +background-color: red; +} +QPushButton[state="warning"] { +background-color: orange; +} +QPushButton[state="ok"] { +background-color: #00ff00; +} +QPushButton:checked { +background-color: #6699ff; +} + + + SELCAL + + + true + + + + + + + + 0 + 0 + + + + + 75 + 30 + + + + + 0 30 @@ -490,25 +731,25 @@ color : white; 0 0 - 60 + 75 30 - + 0 0 - 60 + 75 30 - 60 + 0 30 @@ -526,9 +767,9 @@ border-radius:2px; border-width:0px; border-color: gray; font-size:90%; -min-width:60px; +min-width:75px; min-height:30px; -max-width:60px; +/*max-width:60px;*/ max-height:30px; } QPushButton[state="error"] { @@ -559,25 +800,25 @@ background-color: #00ff00; 0 0 - 60 + 75 30 - + 0 0 - 60 + 75 30 - 60 + 0 30 @@ -594,9 +835,9 @@ border-radius:2px; border-width:0px; border-color: gray; font-size:90%; -min-width:60px; +min-width:75px; min-height:30px; -max-width:60px; +/*max-width:60px;*/ max-height:30px; background-color: yellow; } @@ -611,103 +852,26 @@ background-color: yellow; - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - true - - - - 0 - 0 - - - - - 60 - 30 - - - - - 60 - 30 - - - - <html><head/><body><p>Transmit a tuning tone</p></body></html> - - - QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:60px; -min-height:30px; -max-width:60px; -max-height:30px; - -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: yellow; -} - - - TUNE - - - true - - - - + true - + 0 0 - 60 + 75 30 - 60 + 0 30 @@ -725,9 +889,9 @@ border-radius:2px; border-width:0px; border-color: gray; font-size:90%; -min-width:60px; +min-width:75px; min-height:30px; -max-width:60px; +/*max-width:60px;*/ max-height:30px; } QPushButton[state="error"] { @@ -757,20 +921,20 @@ background-color: #6699ff; true - + 0 0 - 60 + 75 30 - 60 + 0 30 @@ -788,9 +952,9 @@ border-radius:2px; border-width:0px; border-color: gray; font-size:90%; -min-width:60px; +min-width:75px; min-height:30px; -max-width:60px; +/*max-width:60px;*/ max-height:30px; } QPushButton[state="error"] { @@ -814,126 +978,6 @@ background-color: #00ff00; - - - - true - - - - 0 - 0 - - - - - 60 - 30 - - - - - 60 - 30 - - - - <html><head/><body><p>Enable or disable the automatic beacon</p></body></html> - - - QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:60px; -min-height:30px; -max-width:60px; -max-height:30px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #6699ff; -} - - - BCN - - - true - - - - - - - true - - - - 0 - 0 - - - - - 60 - 30 - - - - - 60 - 30 - - - - <html><head/><body><p>Insert a new entry into the log</p></body></html> - - - QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:60px; -min-height:30px; -max-width:60px; -max-height:30px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} - - - LOG - - - @@ -1662,7 +1706,7 @@ background-color: #00ff00; 0 - 50 + 30 @@ -1687,7 +1731,7 @@ background-color: #00ff00; - + 1 0 @@ -1752,6 +1796,71 @@ background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #2ecc71, stop:1 #00FF + + + + true + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 16777215 + + + + <html><head/><body><p>Transmit a tuning tone</p></body></html> + + + QPushButton { +/* +font-family: helvetica; +font-weight: bold; +background-color: lightgray; +color: black; +border-style: solid; +border-radius:2px; +border-width:0px; +border-color: gray; +font-size:90%; +min-width:75px; +min-height:30px; +/*max-width:60px;*/ +max-height:30px; +*/ +} +QPushButton[state="error"] { +background-color: red; +} +QPushButton[state="warning"] { +background-color: orange; +} +QPushButton[state="ok"] { +background-color: #00ff00; +} +QPushButton:checked { +background-color: yellow; +} + + + Tune + + + true + + + @@ -4406,7 +4515,7 @@ list. The list can be maintained in Settings (F2). 0 0 - 960 + 872 22