summaryrefslogtreecommitdiff
path: root/widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2024-09-30 22:36:11 +0200
committerChristoph Berg <myon@debian.org>2024-09-30 22:36:11 +0200
commit4320ce238aae1fe87fc9f379cdd816e9317885fa (patch)
treeb9d97364486fc8b7f79e8e877d5d491bb061740f /widgets/mainwindow.cpp
parentfbaeaa72f63f22bf0b53d634f6809cbdfbb46c9f (diff)
New upstream version 2.7.0~rc7+repackupstream/2.7.0_rc7+repack
Diffstat (limited to 'widgets/mainwindow.cpp')
-rwxr-xr-xwidgets/mainwindow.cpp834
1 files changed, 639 insertions, 195 deletions
diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index f6054855..f756e151 100755
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -58,6 +58,7 @@
#include "echograph.h"
#include "fastplot.h"
#include "fastgraph.h"
+#include "otpgenerator.h"
#include "about.h"
#include "messageaveraging.h"
#include "activeStations.h"
@@ -72,6 +73,7 @@
#include "models/StationList.hpp"
#include "validators/LiveFrequencyValidator.hpp"
#include "Network/MessageClient.hpp"
+#include "Network/FoxVerifier.hpp"
#include "Network/wsprnet.h"
#include "signalmeter.h"
#include "HelpTextWindow.hpp"
@@ -178,7 +180,9 @@ extern "C" {
void foxgen_(bool* bSuperFox, char const * fname, FCL len);
- void sfox_wave_gfsk_(char const * fname, FCL len);
+ void sfox_wave_gfsk_();
+
+ void sftx_sub_(char const * otp_key, FCL len1);
void plotsave_(float swide[], int* m_w , int* m_h1, int* irow);
@@ -194,7 +198,7 @@ extern "C" {
void jpl_setup_(char* fname, FCL len);
}
-
+QList<FoxVerifier *> m_verifications;
int volatile itone[MAX_NUM_SYMBOLS]; //Audio tones for all Tx symbols
int volatile itone0[MAX_NUM_SYMBOLS]; //Dummy array, data not actually used
int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
@@ -222,6 +226,8 @@ bool no_a7_decodes = false;
bool keep_frequency = false;
int m_Nslots0 {1};
int m_TxFreqFox {300};
+bool filtered = false;
+QString m_hisCall0 = "";
QSharedMemory mem_qmap("mem_qmap"); //Memory segment to be shared (optionally) with QMAP
struct {
@@ -241,6 +247,7 @@ namespace
QRegExp message_alphabet {"[- @A-Za-z0-9+./?#<>;$]*"};
// grid exact match excluding RR73
QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
+ QRegularExpression non_r_db_regexp {"\\A[-+]{1}[0-9]{1,2}\\z"};
auto quint32_max = std::numeric_limits<quint32>::max ();
constexpr int N_WIDGETS {38};
constexpr int default_rx_audio_buffer_frames {-1}; // lets Qt decide
@@ -343,7 +350,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
m_widebandDecode {false},
m_dataAvailable {false},
m_decodedText2 {false},
- m_freeText {false},
m_sentFirst73 {false},
m_currentMessageType {-1},
m_lastMessageType {-1},
@@ -697,7 +703,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
// initialize decoded text font and hook up font change signals
// defer initialization until after construction otherwise menu fonts do not get set
- // with 50 ms delay we are on the save side
+ // with 50 ms delay we are on the safe side
QTimer::singleShot (50, this, SLOT (initialize_fonts ()));
connect (&m_config, &Configuration::text_font_changed, [this] (QFont const& font) {
set_application_font (font);
@@ -860,6 +866,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
connect(&m_guiTimer, &QTimer::timeout, this, &MainWindow::guiUpdate);
m_guiTimer.start(100); //### Don't change the 100 ms! ###
+ stopWRTimer.setSingleShot(true);
+ connect(&stopWRTimer, &QTimer::timeout, this, &MainWindow::stopWRTimeout);
+
ptt0Timer.setSingleShot(true);
connect(&ptt0Timer, &QTimer::timeout, this, &MainWindow::stopTx2);
@@ -1037,6 +1046,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
ui->actionAuto_Clear_Avg->setChecked(m_ndepth&128);
m_UTCdisk=-1;
+ m_UTCdiskDateTime=QDateTime{}; // UTCDateTime of file being read from disk.
m_fCPUmskrtd=0.0;
m_bFastDone=false;
m_bAltV=false;
@@ -1076,6 +1086,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
}
m_specOp=m_config.special_op_id();
+
// Starting in FT8 Hound mode needs this initialization
if (m_specOp==SpecOp::HOUND) {
on_ft8Button_clicked();
@@ -1117,9 +1128,9 @@ void MainWindow::not_GA_warning_message ()
MessageBox::critical_message (this,
"This is a pre-release version of WSJT-X " + version (false) + " made\n"
"available for testing purposes. By design it will\n"
- "be nonfunctional after December 31, 2024.");
+ "be nonfunctional after January 15, 2025.");
auto now = QDateTime::currentDateTimeUtc ();
- if (now >= QDateTime {{2024, 12, 31}, {23, 59, 59, 999}, Qt::UTC}) {
+ if (now >= QDateTime {{2025, 1, 15}, {23, 59, 59, 999}, Qt::UTC}) {
Q_EMIT finished ();
}
}
@@ -1167,7 +1178,7 @@ void MainWindow::on_the_minute ()
tx_watchdog (false);
}
update_foxLogWindow_rate(); // update the rate on the window
- if ((!verified && ui->labDXped->isVisible()) or ui->labDXped->text()!="Super Hound")
+ if ((!verified && ui->labDXped->isVisible()) or !ui->labDXped->text().contains("Hound"))
ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
verified = false;
}
@@ -1229,7 +1240,6 @@ void MainWindow::writeSettings()
m_settings->setValue("HoundSort",ui->comboBoxHoundSort->currentIndex());
m_settings->setValue("FoxNlist",ui->sbNlist->value());
m_settings->setValue("FoxNslots",m_Nslots0);
- m_settings->setValue("FoxMaxDB_v2",ui->sbMax_dB->value()); // original key abandoned
m_settings->setValue ("SerialNumber",ui->sbSerialNumber->value ());
m_settings->setValue("FoxTextMsg", m_freeTextMsg0);
m_settings->setValue("WorkDupes", ui->cbWorkDupes->isChecked());
@@ -1344,7 +1354,6 @@ void MainWindow::readSettings()
m_Nslots=m_settings->value("FoxNslots",3).toInt();
m_Nslots0=m_Nslots;
if(!m_config.superFox()) ui->sbNslots->setValue(m_Nslots);
- ui->sbMax_dB->setValue(m_settings->value("FoxMaxDB_v2",70).toInt());
ui->sbSerialNumber->setValue (m_settings->value ("SerialNumber", 1).toInt ());
m_freeTextMsg0=m_settings->value("FoxTextMsg","").toString();
m_freeTextMsg=m_freeTextMsg0;
@@ -1368,6 +1377,9 @@ void MainWindow::readSettings()
ui->sbTR->setValue (m_settings->value ("TRPeriod", 15).toInt());
QTimer::singleShot (50, [=] {blocked = false;});
}
+ if (m_mode=="FT8") {
+ ui->sbFtol->setValue (m_settings->value("Ftol_SF", 50).toInt());
+ }
if (m_mode=="Q65") {
m_nSubMode=m_settings->value("SubMode_Q65",0).toInt();
ui->sbSubmode->setValue(m_nSubMode_Q65);
@@ -1457,7 +1469,10 @@ void MainWindow::readSettings()
if (SpecOp::FOX==m_specOp) {
ui->tabWidget->setCurrentIndex(n);
} else {
- ui->tabWidget->setCurrentIndex(1); // needed for GUI initialisation when SuperFox controls are invisible
+ // We need this to initialize the height of tab 1 correctly
+ ui->pbFreeText->setVisible(false);
+ ui->cbSendMsg->setVisible(false);
+ ui->tabWidget->setCurrentIndex(1);
ui->tabWidget->setCurrentIndex(n);
}
outBufSize=m_settings->value("OutBufSize",4096).toInt();
@@ -1489,10 +1504,10 @@ void MainWindow::readSettings()
m_specOp=m_config.special_op_id();
checkMSK144ContestType();
- if(displayMsgAvg) on_actionMessage_averaging_triggered();
+ if (displayMsgAvg) on_actionMessage_averaging_triggered();
if (displayFoxLog) on_fox_log_action_triggered ();
if (displayContestLog) on_contest_log_action_triggered ();
- if(displayActiveStations) on_actionActiveStations_triggered();
+ if (displayActiveStations) on_actionActiveStations_triggered();
}
void MainWindow::checkMSK144ContestType()
@@ -1937,6 +1952,7 @@ void MainWindow::fastSink(qint64 frames)
{
int k (frames);
bool decodeNow=false;
+ filtered = false;
if(k < m_k0) { //New sequence ?
memcpy(fast_green2,fast_green,4*703); //Copy fast_green[] to fast_green2[]
memcpy(fast_s2,fast_s,4*703*64); //Copy fast_s[] into fast_s2[]
@@ -2067,6 +2083,7 @@ void MainWindow::showStatusMessage(const QString& statusMsg)
void MainWindow::on_actionSettings_triggered() //Setup Dialog
{
+ if (m_mode=="FT8") keep_frequency = true;
// things that might change that we need know about
auto callsign = m_config.my_callsign ();
auto my_grid = m_config.my_grid ();
@@ -2107,7 +2124,7 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
, m_tx_audio_buffer_frames);
}
- displayDialFrequency ();
+ if (!keep_frequency or ui->bandComboBox->currentText()=="oob") displayDialFrequency ();
bool vhf {m_config.enable_VHF_features()};
m_wideGraph->setVHF(vhf);
if (!vhf) ui->sbSubmode->setValue (0);
@@ -2157,6 +2174,9 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
set_mode(m_mode);
configActiveStations();
+ keep_frequency = false;
+ } else {
+ keep_frequency = false;
}
}
@@ -2205,6 +2225,7 @@ void MainWindow::on_actionAbout_triggered() //Display "About"
void MainWindow::on_autoButton_clicked (bool checked)
{
+ stopWRTimer.stop(); // stop a running Tx3 timer
m_auto = checked;
m_maxPoints=-1;
if (checked
@@ -2213,7 +2234,10 @@ void MainWindow::on_autoButton_clicked (bool checked)
m_bAutoReply = false; // ready for next
m_bCallingCQ = true; // allows tail-enders to be picked up
}
- if (!checked) m_bCallingCQ = false;
+ if (!checked) {
+ m_bCallingCQ = false;
+ filtered = false;
+ }
statusUpdate ();
m_bEchoTxOK=false;
if(m_mode=="Echo" and m_auto) {
@@ -2472,8 +2496,9 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
}
break;
case Qt::Key_X:
+
if(e->modifiers() & Qt::AltModifier) {
- foxTest();
+ //foxTest();
return;
}
}
@@ -2481,6 +2506,36 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
QMainWindow::keyPressEvent (e);
}
+void MainWindow::handleVerifyMsg(int status, QDateTime ts, QString callsign, QString code, unsigned int hz, QString const &response)
+{
+ (void)status;
+ (void)code;
+ if (response.length() > 0) {
+ QString msg = FoxVerifier::formatDecodeMessage(ts, callsign, hz, response);
+ if (msg.length() > 0) {
+ // Hound label
+ if ((ui->labDXped->text().contains("Hound") && msg.contains(" verified"))) {
+ verified = true;
+ ui->labDXped->setStyleSheet("QLabel {background-color: #00ff00; color: black;}");
+ }
+ ui->decodedTextBrowser->displayDecodedText(DecodedText{msg}, m_config.my_callsign(), m_mode, m_config.DXCC(),
+ m_logBook, m_currentBand, m_config.ppfx());
+ write_all("Ck",msg);
+ }
+ }
+ LOG_INFO(QString("FoxVerifier response for [%1]: - [%2]").arg(callsign).arg(response).toStdString());
+}
+
+QString MainWindow::userAgent() {
+ // see User-Agent format definition https://www.rfc-editor.org/rfc/rfc9110#name-user-agent
+ //
+ QString platform = "(" + QSysInfo::prettyProductName()+"; "+QSysInfo::productType() + " " + QSysInfo::productVersion() + "; " +
+ QSysInfo::currentCpuArchitecture() + "; " +
+ QString("rv:%1").arg(QSysInfo::kernelVersion()) + ")";
+ QString userAgent = QString{"WSJT-X/" + version() + "_" + m_revision}.simplified() + " " +platform;
+ return userAgent;
+ }
+
void MainWindow::bumpFqso(int n) //bumpFqso()
{
int i;
@@ -2551,6 +2606,11 @@ void MainWindow::displayDialFrequency ()
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency));
}
+ void MainWindow::stopWRTimeout()
+ {
+ auto_tx_mode(false);
+ }
+
void MainWindow::statusChanged()
{
if (m_specOp==SpecOp::Q65_PILEUP && m_mode != "Q65") on_actionQ65_triggered();
@@ -2609,14 +2669,23 @@ void MainWindow::statusChanged()
}
}
}
- if (SpecOp::FOX==m_specOp && m_config.superFox()) {
- ui->sbNslots->setVisible(false);
+ if (SpecOp::FOX==m_specOp) {
ui->pbFreeText->setVisible(true);
ui->cbSendMsg->setVisible(true);
- if(ui->cbSendMsg->isChecked()) {
- ui->sbNslots->setValue(2);
+ ui->txb6->click();
+ if (m_config.superFox()) {
+ ui->sbNslots->setVisible(true);
+ m_XIT=0;
+ if(ui->cbSendMsg->isChecked()) {
+ ui->sbNslots->setValue(2);
+ m_Nslots=2;
+ } else {
+ ui->sbNslots->setValue(5);
+ m_Nslots=5;
+ }
} else {
- ui->sbNslots->setValue(5);
+ ui->sbNslots->setVisible(true);
+ ui->sbNslots->setValue(m_Nslots0);
}
} else {
ui->sbNslots->setVisible(true);
@@ -2625,6 +2694,10 @@ void MainWindow::statusChanged()
ui->sbNslots->setValue(m_Nslots0);
}
if (SpecOp::HOUND==m_specOp) ui->cbRxAll->setVisible(!m_config.superFox());
+ if ((SpecOp::HOUND!=m_specOp && SpecOp::FOX!=m_specOp) or !m_config.superFox()) {
+ m_wideGraph->setSuperFox(false);
+ m_wideGraph->setSuperHound(false);
+ }
}
bool MainWindow::eventFilter (QObject * object, QEvent * event)
@@ -2814,6 +2887,8 @@ void MainWindow::on_stopButton_clicked() //stopButton
MessageBox::information_message (this, tr ("Reference spectrum saved"));
m_bRefSpec=false;
}
+ stopWRTimer.stop(); // stop a running Tx3 timer
+ filtered = false;
}
void MainWindow::on_actionRelease_Notes_triggered ()
@@ -3103,9 +3178,15 @@ void MainWindow::on_actionActiveStations_triggered()
m_ActiveStationsWidget->activateWindow();
configActiveStations();
connect(m_ActiveStationsWidget.data(), SIGNAL(callSandP(int)),this,SLOT(callSandP2(int)));
+ // connect up another signal to handle clicks in the Activity window when in Fox mode
+ connect(m_ActiveStationsWidget.data(), SIGNAL(queueActiveWindowHound(QString)),this,SLOT(queueActiveWindowHound2(QString)),static_cast<Qt::ConnectionType>(Qt::UniqueConnection));
+
connect(m_ActiveStationsWidget.data(), SIGNAL(activeStationsDisplay()),this,SLOT(ARRL_Digi_Display()));
m_ActiveStationsWidget->setScore(m_score);
if(m_mode=="Q65") m_ActiveStationsWidget->setRate(m_score);
+ QString as_mode = m_mode;
+ if(m_mode=="FT8" && SpecOp::FOX==m_specOp) as_mode="Fox Mode"; // TODO - active stations for hound mode?
+ m_ActiveStationsWidget->setupUi(as_mode);
}
void MainWindow::on_actionOpen_triggered() //Open File
@@ -3134,6 +3215,11 @@ void MainWindow::read_wav_file (QString const& fname)
int i1=fname.indexOf(".wav");
m_nutc0=m_UTCdisk;
m_UTCdisk=fname.mid(i0+1,i1-i0-1).toInt();
+ if (i0 > 6) {
+ m_UTCdiskDateTime = QDateTime::fromString("20" + fname.mid(i0 - 6, 13) + "Z", "yyyyMMdd_hhmmsst").toUTC();
+ } else
+ m_UTCdiskDateTime = QDateTime{};
+
m_wav_future_watcher.setFuture (QtConcurrent::run ([this, fname] {
auto basename = fname.mid (fname.lastIndexOf ('/') + 1);
auto pos = fname.indexOf (".wav", 0, Qt::CaseInsensitive);
@@ -3369,6 +3455,12 @@ void MainWindow::on_actionSpecial_mouse_commands_triggered()
</td>
</tr>
<tr>
+ <td align="right">H Button:</td>
+ <td><b>Click</b> to toggle FT8 Hound Mode On/Off.<br/>
+ <b>Right-click</b> to activate or deactivate SuperFox mode.
+ </td>
+ </tr>
+ <tr>
<td align="right">Q65 Button:</td>
<td><b>Click</b> to switch to Q65 Mode.<br/>
<b>Right-click</b> to switch to Q65 Pileup Mode.
@@ -3497,10 +3589,6 @@ void MainWindow::decode() //decode()
if(dec_data.params.b_superfox and dec_data.params.b_even_seq and m_ihsym<50) return;
dec_data.params.ntol=ui->sbFtol->value ();
- if(!m_config.enable_VHF_features()) {
- dec_data.params.ntol=20;
- dec_data.params.naggressive=0;
- }
if(m_mode=="FST4") {
dec_data.params.ntol=ui->sbFtol->value();
if(m_config.single_decode()) {
@@ -3865,6 +3953,12 @@ void MainWindow::ARRL_Digi_Display()
readWidebandDecodes();
return;
}
+ if (m_mode == "Fox Mode") { // ARRL_Digi_Display can be shown for other modes
+ if (m_ActiveStationsWidget != NULL) {
+ m_ActiveStationsWidget->setClickOK(true);
+ }
+ return;
+ }
QMutableMapIterator<QString,RecentCall> icall(m_recentCall);
QString deCall,deGrid;
int age=0;
@@ -3935,10 +4029,60 @@ void MainWindow::ARRL_Digi_Display()
t += (t1 + list[k] + "\n");
if(i>=maxRecent) break;
}
- if(m_ActiveStationsWidget!=NULL) m_ActiveStationsWidget->displayRecentStations(m_mode,t);
+ bool is_fox_mode = (m_mode=="FT8" && m_specOp == SpecOp::FOX);
+ if(m_ActiveStationsWidget!=NULL && !is_fox_mode) m_ActiveStationsWidget->displayRecentStations(m_mode,t);
m_ActiveStationsWidget->setClickOK(true);
}
+void MainWindow::queueActiveWindowHound2(QString line) {
+ // Active Window shows what's going on outside of current F/H display rules (calling below 1000Hz e.g.)
+ // TODO should we allow calling a station that's calling another station, not us?
+ if (m_mode == "FT8" and m_specOp == SpecOp::FOX) {
+ // process the line to get the callsign
+ QStringList w = line.split(' ', SkipEmptyParts);
+ // make sure our call is the first in the list, or the station is CQing (not a directed CQ)
+ if ( (w.size() > 7) &&
+ (w[5] == m_config.my_callsign() || w[5] == "<"+m_config.my_callsign()+">" || w[5]=="CQ") &&
+ ( w[7].contains(grid_regexp) || w[7].contains(non_r_db_regexp) )){
+ QString caller = w[6];
+ QString grid = "";
+ QString db = w[1];
+ int db_i = w[1].toInt();
+ db = (db_i >=0 ? "+":"") + QStringLiteral("%1").arg(db_i, (db_i >=0 ? 2:3), 10, QLatin1Char('0')); // +00, -01 etc.
+ // houndcall rpt grid
+ if (w[7].contains(grid_regexp)) grid = w[7];
+ if (w[7].contains(non_r_db_regexp)) {
+ LOG_INFO(QString("ActiveStations Window click: %1 called with signal report %2").arg(caller).arg(w[7]));
+ }
+ if (caller.length() > 2) {
+ // make sure it's not already in the queue
+ for ( QString hs : m_houndQueue) {
+ if (hs.startsWith(caller)) {
+ //LOG_INFO(QString("ActiveStations Window click: %1 already in queue. Skipping").arg(hs));
+ return;
+ }
+ }
+ // make sure caller is not in fox queue either
+ if(m_foxQSOinProgress.contains(caller)) {
+ //LOG_INFO(QString("ActiveStations Window click: %1 already in progress. Skipping").arg(caller));
+ return;
+ }
+
+ QString caller_rpt = (caller+" ").mid(0,12)+db;
+ if (m_houndQueue.count() < MAX_HOUNDS_IN_QUEUE) {
+ // add it to the queue
+ m_houndQueue.enqueue(caller_rpt + " " + grid);
+ refreshHoundQueueDisplay();
+ // TODO: remove from active stations window too?
+ }
+ removeHoundFromCallingList(caller);
+ }
+ } else {
+ LOG_INFO(QString("ActiveStations Window click: skipping %1").arg(line));
+ }
+ }
+}
+
void MainWindow::callSandP2(int n)
{
bool bCtrl = (n<0);
@@ -4035,12 +4179,21 @@ void MainWindow::activeWorked(QString call, QString band)
void MainWindow::readFromStdout() //readFromStdout
{
bool bDisplayPoints = false;
+ filtered = false;
+ QString all_decodes;
if(m_ActiveStationsWidget!=NULL) {
bDisplayPoints=(m_mode=="FT4" or m_mode=="FT8") and
(m_specOp==SpecOp::ARRL_DIGI or m_ActiveStationsWidget->isVisible());
}
while(proc_jt9.canReadLine()) {
auto line_read = proc_jt9.readLine ();
+ if (m_mode == "FT8" and m_specOp == SpecOp::FOX and m_ActiveStationsWidget != NULL) { // see if we should add this to ActiveStations window
+ QString the_line = QString(line_read);
+ if (!m_ActiveStationsWidget->wantedOnly() ||
+ (the_line.contains(" " + m_config.my_callsign() + " ") ||
+ the_line.contains(" <" + m_config.my_callsign() + "> ")))
+ all_decodes.append(line_read);
+ }
if (auto p = std::strpbrk (line_read.constData (), "\n\r")) {
// truncate before line ending chars
line_read = line_read.left (p - line_read.constData ());
@@ -4119,11 +4272,15 @@ void MainWindow::readFromStdout() //readFromStdout
}
if(navg>=2) bAvgMsg=true;
}
- write_all("Rx",line_read.trimmed());
+ write_all("Rx", line_read.trimmed());
int ntime=6;
if(m_TRperiod>=60) ntime=4;
if (line_read.left(ntime) != m_tBlankLine && QString::fromUtf8(line_read.constData()).left(4).contains(QRegularExpression {"\\d\\d\\d\\d"})) {
ui->decodedTextBrowser->new_period ();
+ if (m_specOp == SpecOp::FOX and m_ActiveStationsWidget != NULL) { // clear the ActiveStations window
+ m_ActiveStationsWidget->clearStations();
+ m_ActiveStationsWidget->displayRecentStations("Fox Mode", "");
+ }
if (m_config.insert_blank ()
&& SpecOp::FOX != m_specOp) {
QString band;
@@ -4169,64 +4326,133 @@ void MainWindow::readFromStdout() //readFromStdout
m_bDisplayedOnce=true;
}
} else {
- DecodedText decodedtext1=decodedtext0;
- if((m_mode=="FT4" or m_mode=="FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) {
- ARRL_Digi_Update(decodedtext1);
- }
- if (ui->labDXped->text()=="Super Hound" && decodedtext0.mid(3,18).contains(" verified")) {
- verified = true;
- ui->labDXped->setStyleSheet("QLabel {background-color: #00ff00; color: black;}");
- } else {
- if (decodedtext0.mid(4,2).contains("00") or decodedtext0.mid(4,2).contains("30")) verified = false;
+
+#ifdef FOX_OTP
+ // remove verifications that are done
+ QMutableListIterator < FoxVerifier * > it(m_verifications);
+ while (it.hasNext()) {
+ if (it.next()->finished()) {
+ it.remove();
+ }
}
- if ((!verified && ui->labDXped->isVisible()) or ui->labDXped->text()!="Super Hound")
- ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
- ui->decodedTextBrowser->displayDecodedText (decodedtext1, m_config.my_callsign (), m_mode, m_config.DXCC (),
- m_logBook, m_currentBandPeriod, m_config.ppfx (),
- ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(),
- haveFSpread, fSpread, bDisplayPoints, m_points);
- if((m_mode=="FT4" or m_mode=="FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) {
- QString deCall,deGrid;
- decodedtext.deCallAndGrid(/*out*/deCall,deGrid);
- bool bWorkedOnBand=(ui->decodedTextBrowser->CQPriority()!="New Call on Band") and ui->decodedTextBrowser->CQPriority()!="";
- if(bWorkedOnBand) activeWorked(deCall,m_currentBand);
+#endif
+ DecodedText decodedtext1 = decodedtext0;
+ if ((m_mode == "FT4" or m_mode == "FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) {
+ ARRL_Digi_Update(decodedtext1);
}
- if (m_config.highlight_DXcall () && (m_hisCall!="") && ((decodedtext.string().contains(QRegularExpression {"(\\w+) " + m_hisCall}))
- || (decodedtext.string().contains(QRegularExpression {"(\\w+) <" + m_hisCall +">"}))
- || (decodedtext.string().contains(QRegularExpression {"<(\\w+)> " + m_hisCall}))
- || (decodedtext.string().contains(QRegularExpression {"<...> " + m_hisCall})))) {
- ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true); // highlight dxCallEntry
- QTimer::singleShot (500, [=] { // repeated highlighting to override JTAlert
- ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);
- });
- QTimer::singleShot (1000, [=] { // repeated highlighting to override JTAlert
- ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);
- });
- QTimer::singleShot (2500, [=] { // repeated highlighting to override JTAlert
- ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255,0,0), QColor(255,255,255), true);
- });
- }
- if (m_config.highlight_DXgrid () && (m_hisGrid!="") && (decodedtext.string().contains(m_hisGrid))) {
- ui->decodedTextBrowser->highlight_callsign(m_hisGrid, QColor(0,0,255), QColor(255,255,255), true); // highlight dxGridEntry
+#ifdef FOX_OTP
+ if ((SpecOp::HOUND == m_specOp) &&
+ ((m_config.superFox() && (decodedtext0.mid(24, 8) == "$VERIFY$")) || // $VERIFY$ K8R 920749
+ (decodedtext0.mid(24,-1).contains(QRegularExpression{"^[A-Z0-9]{2,6}\\.[0-9]{6}"})))) // K8R.920749
+ {
+ // two cases:
+ // QString test_return = QString{"203630 -12 0.1 775 ~ K8R.920749"};
+ // $VERIFY$ foxcall otp
+ // QString test_return = QString{"203630 -12 0.1 775 ~ $VERIFY$ K8R 920749"};
+ QStringList lineparts;
+ QString callsign, otp;
+ unsigned int hz;
+ lineparts = decodedtext0.string().split(' ', SkipEmptyParts);
+ if (lineparts.length() <= 6) {
+ QStringList otp_parts;
+ // split K8.V920749 into K8R and 920749
+ otp_parts = lineparts[5].split('.', SkipEmptyParts);
+ callsign = otp_parts[0];
+ otp = otp_parts[1];
+ hz = lineparts[3].toInt();
+ if (!m_config.ShowOTP()) filtered = true;
+ } else
+ {
+ // split $VERIFY$ K8R 920749 into K8R and 920749
+ callsign = lineparts[6];
+ otp = lineparts[7];
+ hz = 750; // SF is 750
+ if (!m_config.ShowOTP()) filtered = true;
+ }
+ QDateTime verifyDateTime;
+ if (m_diskData) {
+ verifyDateTime = m_UTCdiskDateTime; // get the date set from reading the wav file
+ } else {
+ verifyDateTime = QDateTime(QDateTime::currentDateTimeUtc().date(),
+ QTime::fromString(lineparts[0], "hhmmss"));
+ }
+ FoxVerifier *fv = new FoxVerifier(MainWindow::userAgent(),
+ &m_network_manager,
+ m_config.OTPUrl(),
+ callsign, // foxcall
+ verifyDateTime,
+ otp,
+ hz); // freq
+ connect(fv, &FoxVerifier::verifyComplete, this, &MainWindow::handleVerifyMsg);
+ m_verifications << fv;
}
+#endif
+ {
+ if (ui->labDXped->text().contains("Hound") && decodedtext0.mid(3,18).contains(" verified")) {
+ verified = true;
+ write_all("Vf",decodedtext0.string());
+ ui->labDXped->setStyleSheet("QLabel {background-color: #00ff00; color: black;}");
+ } else {
+#ifndef FOX_OTP
+ if (m_specOp==SpecOp::HOUND && m_config.superFox() && (decodedtext0.mid(4,2).contains("00") or decodedtext0.mid(4,2).contains("30"))) verified = false;
+#endif
+ }
+ if ((!verified && ui->labDXped->isVisible()) or !ui->labDXped->text().contains("Hound"))
+ ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
+ if (!filtered) {
+ ui->decodedTextBrowser->displayDecodedText(decodedtext1, m_config.my_callsign(), m_mode, m_config.DXCC(),
+ m_logBook, m_currentBandPeriod, m_config.ppfx(),
+ ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(),
+ haveFSpread, fSpread, bDisplayPoints, m_points);
+ }
+ if ((m_mode == "FT4" or m_mode == "FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) {
+ QString deCall, deGrid;
+ decodedtext.deCallAndGrid(/*out*/deCall, deGrid);
+ bool bWorkedOnBand = (ui->decodedTextBrowser->CQPriority() != "New Call on Band") and
+ ui->decodedTextBrowser->CQPriority() != "";
+ if (bWorkedOnBand) activeWorked(deCall, m_currentBand);
+ }
- if(m_bBestSPArmed && m_mode=="FT4" && CALLING == m_QSOProgress) {
- QString messagePriority=ui->decodedTextBrowser->CQPriority();
- if(messagePriority!="") {
- if(messagePriority=="New Call on Band"
- and m_BestCQpriority!="New Call on Band"
- and m_BestCQpriority!="New Multiplier") {
- m_BestCQpriority="New Call on Band";
- m_bDoubleClicked = true;
- processMessage(decodedtext0);
- }
- if(messagePriority=="New DXCC"
- and m_BestCQpriority!="New DXCC"
- and m_BestCQpriority!="New Multiplier") {
- m_BestCQpriority="New DXCC";
- m_bDoubleClicked = true;
- processMessage(decodedtext0);
+ if (m_config.highlight_DXcall() && (m_hisCall != "") &&
+ ((decodedtext.string().contains(QRegularExpression{"(\\w+) " + m_hisCall}))
+ || (decodedtext.string().contains(QRegularExpression{"(\\w+) <" + m_hisCall + ">"}))
+ || (decodedtext.string().contains(QRegularExpression{"<(\\w+)> " + m_hisCall}))
+ || (decodedtext.string().contains(QRegularExpression{"<...> " + m_hisCall})))) {
+ ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255, 0, 0), QColor(255, 255, 255),
+ true); // highlight dxCallEntry
+ QTimer::singleShot(500, [=] { // repeated highlighting to override JTAlert
+ ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255, 0, 0), QColor(255, 255, 255), true);
+ });
+ QTimer::singleShot(1000, [=] { // repeated highlighting to override JTAlert
+ ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255, 0, 0), QColor(255, 255, 255), true);
+ });
+ QTimer::singleShot(2500, [=] { // repeated highlighting to override JTAlert
+ ui->decodedTextBrowser->highlight_callsign(m_hisCall, QColor(255, 0, 0), QColor(255, 255, 255), true);
+ });
+ }
+ if (m_config.highlight_DXgrid() && (m_hisGrid != "") && (decodedtext.string().contains(m_hisGrid))) {
+ ui->decodedTextBrowser->highlight_callsign(m_hisGrid, QColor(0, 0, 255), QColor(255, 255, 255),
+ true); // highlight dxGridEntry
+ }
+
+ if (m_bBestSPArmed && m_mode == "FT4" && CALLING == m_QSOProgress) {
+ QString messagePriority = ui->decodedTextBrowser->CQPriority();
+ if (messagePriority != "") {
+ if (messagePriority == "New Call on Band"
+ and m_BestCQpriority != "New Call on Band"
+ and m_BestCQpriority != "New Multiplier") {
+ m_BestCQpriority = "New Call on Band";
+ m_bDoubleClicked = true;
+ processMessage(decodedtext0);
+ }
+ if (messagePriority == "New DXCC"
+ and m_BestCQpriority != "New DXCC"
+ and m_BestCQpriority != "New Multiplier") {
+ m_BestCQpriority = "New DXCC";
+ m_bDoubleClicked = true;
+ processMessage(decodedtext0);
+ }
}
}
}
@@ -4378,6 +4604,7 @@ void MainWindow::readFromStdout() //readFromStdout
m_nFoxFreq=decodedtext.string().mid(16,4).toInt();
hound_reply ();
} else {
+ if (SpecOp::HOUND==m_specOp && (text.mid(4,2).contains("15") or text.mid(4,2).contains("45"))) return; // ignore stations calling in the wrong time slot
if (text.contains(" " + m_config.my_callsign() + " " + m_hisCall) && !text.contains("73 ")) processMessage(decodedtext0); // needed for MSHV multistream messages
}
}
@@ -4439,6 +4666,9 @@ void MainWindow::readFromStdout() //readFromStdout
}
}
}
+ if (m_mode == "FT8" and m_specOp == SpecOp::FOX and m_ActiveStationsWidget != NULL) {
+ m_ActiveStationsWidget->addLine(all_decodes);
+ }
}
//
@@ -4488,12 +4718,13 @@ void MainWindow::auto_sequence (DecodedText const& message, unsigned start_toler
}
if (m_auto
&& (m_QSOProgress==REPLYING or (!ui->tx1->isEnabled () and m_QSOProgress==REPORT))
- && qAbs (ui->TxFreqSpinBox->value () - df) <= int (stop_tolerance)
+ && !m_config.superFox() && (SpecOp::HOUND != m_specOp) && qAbs (ui->TxFreqSpinBox->value () - df) <= int (stop_tolerance) //
&& message_words.at (2) != "DE"
&& !message_words.at (2).contains (QRegularExpression {"(^(CQ|QRZ))|" + m_baseCall})
&& message_words.at (3).contains (Radio::base_callsign (ui->dxCallEntry->text ()))) {
// auto stop to avoid accidental QRM
ui->stopTxButton->click (); // halt any transmission
+ LOG_INFO("STOPPED!");
} else if (m_auto // transmit allowed
&& ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked () // auto-sequencing allowed
&& ((!m_bCallingCQ // not calling CQ/QRZ
@@ -4652,7 +4883,7 @@ void MainWindow::guiUpdate()
m_bTxTime = (t2p >= tx1) and (t2p < tx2);
if(m_mode=="Echo") m_bTxTime = m_bTxTime and m_bEchoTxOK;
if(m_mode=="FT8" and ui->tx5->currentText().contains("/B ")) {
- //FT8 beacon transmissiion from Tx5 only at top of a UTC minute
+ //FT8 beacon transmission from Tx5 only at top of a UTC minute
double t4p=fmod(tsec,4*m_TRperiod);
if(t4p >= 30.0) m_bTxTime=false;
}
@@ -4731,7 +4962,7 @@ void MainWindow::guiUpdate()
ui->TxFreqSpinBox->setValue(750); //SuperFox transmits at 750 Hz
} else {
if (ui->TxFreqSpinBox->value() > 900) {
- ui->TxFreqSpinBox->setValue(300);
+ ui->TxFreqSpinBox->setValue(500);
}
}
}
@@ -4889,7 +5120,10 @@ void MainWindow::guiUpdate()
foxcom_.bSendMsg=ui->cbSendMsg->isChecked();
memcpy(foxcom_.textMsg, m_freeTextMsg.leftJustified(26,' ').toLatin1(),26);
foxgen_(&bSuperFox, fname.constData(), (FCL)fname.size());
- if(bSuperFox) sfox_tx();
+ if(bSuperFox) {
+ writeFoxTxMsgs();
+ sfox_tx();
+ }
}
}
}
@@ -5183,10 +5417,13 @@ void MainWindow::guiUpdate()
if(nsec != m_sec0) {
// qDebug() << "AAA" << nsec%60 << ui->cbWorkDupes->isChecked();
-// qint64 n64 = QDateTime::currentSecsSinceEpoch();
-// n64=n64/30;
-// n64=n64*30;
-// qDebug() << "bb" << m_config.FoxKey() << nsec%60 << dec_data.params.nutc << n64 << n64%60;
+ // prevent tuning on top of a SuperFox message
+ if (SpecOp::HOUND==m_specOp && m_config.superFox() && m_tune) {
+ QDateTime now = QDateTime::currentDateTimeUtc();
+ int s = now.time().toString("ss").toInt();
+ if ((s >= 0 && s < 15) || (s >= 30 && s < 45)) ui->tuneButton->click ();
+ }
+
if(m_mode=="FST4") chk_FST4_freq_range();
m_currentBand=m_config.bands()->find(m_freqNominal);
if( SpecOp::HOUND == m_specOp ) {
@@ -5593,6 +5830,7 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
cursor=ui->decodedTextBrowser2->textCursor();
}
DecodedText message {cursor.block().text().trimmed().left(61).remove("TU; ")};
+ if(SpecOp::HOUND==m_specOp && (message.string().mid(4,2).contains("15") or message.string().mid(4,2).contains("45"))) return; // ignore stations calling in the wrong time slot
if(message.string().contains(";") && message.string().contains("<")) {
QVector<qint32> Freq = {1840000,3573000,7074000,10136000,14074000,18100000,21074000,24915000,28074000,50313000,70154000,3575000,7047500,10140000,14080000,18104000,21140000,24919000,28180000,50318000};
for(int i=0; i<Freq.length()-1; i++) {
@@ -5625,6 +5863,7 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
return;
}
m_bDoubleClicked = true;
+ m_hisCall0 = m_hisCall;
processMessage (message, modifiers);
}
@@ -6246,6 +6485,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
m_gen_message_is_cq = false;
return;
}
+ m_hisCall0 = hisCall;
auto const& my_callsign = m_config.my_callsign ();
auto is_compound = my_callsign != m_baseCall;
auto is_type_one = !is77BitMode () && is_compound && shortList (my_callsign);
@@ -6492,6 +6732,8 @@ void MainWindow::clearDX ()
if (m_mode=="FT8" and SpecOp::HOUND == m_specOp) {
m_ntx=1;
ui->txrb1->setChecked(true);
+ m_hisCall = "";
+ m_hisCall0 = "";
} else {
m_ntx=6;
ui->txrb6->setChecked(true);
@@ -6685,6 +6927,10 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
void MainWindow::on_tx1_editingFinished() //tx1 edited
{
+ if (SpecOp::HOUND==m_specOp && m_config.superFox() && !m_bDoubleClicked) {
+ clearDX();
+ return;
+ }
QString t=ui->tx1->text();
msgtype(t, ui->tx1);
}
@@ -6697,6 +6943,10 @@ void MainWindow::on_tx2_editingFinished() //tx2 edited
void MainWindow::on_tx3_editingFinished() //tx3 edited
{
+ if (SpecOp::HOUND==m_specOp && m_config.superFox() && !m_bDoubleClicked) {
+ clearDX();
+ return;
+ }
QString t=ui->tx3->text();
msgtype(t, ui->tx3);
}
@@ -6743,18 +6993,23 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
on_actionJT9_triggered();
ui->jt65Button->clearFocus();
}
- if(ui->ft8Button->hasFocus() && (event->button() & Qt::RightButton)) { // toggle SuperFox mode
+ if(ui->houndButton->hasFocus() && (event->button() & Qt::RightButton)) { // toggle SuperFox mode
keep_frequency = true;
m_config.toggle_SF();
QTimer::singleShot (250, [=] {keep_frequency = false;});
on_actionFT8_triggered();
- ui->ft8Button->clearFocus();
+ ui->houndButton->clearFocus();
ui->labDXped->setStyleSheet("QLabel {background-color: red; color: white;}");
}
}
void MainWindow::on_dxCallEntry_textChanged (QString const& call)
{
+ if (SpecOp::HOUND==m_specOp && m_config.superFox() && !(m_bDoubleClicked or (m_hisCall0 != ""
+ && (call.left(6).contains(m_hisCall0) or call.right(6).contains(m_hisCall0))))) {
+ clearDX();
+ return;
+ }
set_dateTimeQSO (-1); // reset the QSO start time when DXCall changes
m_hisCall = call;
ui->dxGridEntry->clear();
@@ -6881,6 +7136,8 @@ void MainWindow::on_logQSOButton_clicked() //Log QSO button
m_dateTimeQSOOn, dateTimeQSOOff, m_freqNominal +
ui->TxFreqSpinBox->value(), m_noSuffix, m_xSent, m_xRcvd);
m_inQSOwith="";
+ stopWRTimer.stop(); // stop a running Tx3 timer
+ filtered = false;
}
void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid
@@ -6932,7 +7189,7 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call,
refreshPileupList();
}
m_ActiveStationsWidget->setRate(m_score);
- } else {
+ } else if (m_specOp==SpecOp::ARRL_DIGI) {
QString band=m_config.bands()->find(dial_freq);
activeWorked(call,band);
int points=m_activeCall[call].points;
@@ -7198,7 +7455,6 @@ void MainWindow::on_actionFT8_triggered()
QTimer::singleShot (50, [=] {
if(m_specOp!=SpecOp::FOX) ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt());
if(m_specOp==SpecOp::FOX && !m_config.superFox()) ui->TxFreqSpinBox->setValue(m_TxFreqFox);
- ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt());
on_sbSubmode_valueChanged(ui->sbSubmode->value());
});
m_mode="FT8";
@@ -7217,6 +7473,7 @@ void MainWindow::on_actionFT8_triggered()
VHF_features_enabled(bVHF);
ui->cbAutoSeq->setChecked(true);
m_TRperiod=15.0;
+ ui->sbFtol->setValue (m_settings->value ("Ftol_SF", 50).toInt()); // restore last used Ftol parameter
m_fastGraph->hide();
m_wideGraph->show();
ui->rh_decodes_headings_label->setText(" UTC dB DT Freq " + tr ("Message"));
@@ -7226,7 +7483,7 @@ void MainWindow::on_actionFT8_triggered()
ui->rh_decodes_title_label->setText(tr ("Rx Frequency"));
if(SpecOp::FOX==m_specOp) {
ui->lh_decodes_title_label->setText(tr ("Stations calling DXpedition %1").arg (m_config.my_callsign()));
- ui->lh_decodes_headings_label->setText( "Call Grid dB Freq Dist Age Continent");
+ ui->lh_decodes_headings_label->setText( "Call Grid dB Freq Dist Age Cont Score");
} else {
ui->lh_decodes_title_label->setText(tr ("Band Activity"));
ui->lh_decodes_headings_label->setText( " UTC dB DT Freq " + tr ("Message"));
@@ -7249,19 +7506,23 @@ void MainWindow::on_actionFT8_triggered()
ui->cbHoldTxFreq->setChecked(true);
ui->cbAutoSeq->setEnabled(false);
ui->tabWidget->setCurrentIndex(1);
+ m_wideGraph->setSuperFox(false);
if(m_config.superFox()) {
ui->TxFreqSpinBox->setValue(750); //SuperFox transmits at 750 Hz
+ m_wideGraph->setSuperFox(true);
} else {
- ui->TxFreqSpinBox->setValue(300);
+ ui->TxFreqSpinBox->setValue(500);
}
// 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11101000010011100001000000000010000000"));
+ displayWidgets(nWidgets("11101000010011100001000000000011000000"));
+ ui->cbRxAll->setText(tr("Show Already Worked"));
if(m_config.superFox()) {
ui->labDXped->setText(tr ("Super Fox"));
} else {
ui->labDXped->setText(tr ("Fox"));
}
on_fox_log_action_triggered();
+ if (m_ActiveStationsWidget) m_ActiveStationsWidget->setClickOK(true); // allow clicks
}
if(SpecOp::HOUND == m_specOp) {
ui->houndButton->setChecked(true);
@@ -7270,14 +7531,25 @@ void MainWindow::on_actionFT8_triggered()
ui->cbAutoSeq->setEnabled(false);
ui->tabWidget->setCurrentIndex(0);
ui->cbHoldTxFreq->setChecked(true);
- // 01234567890123456789012345678901234567
- displayWidgets(nWidgets("11101000010011000001000000000011000000"));
+ m_wideGraph->setSuperHound(false);
if(m_config.superFox()) {
+ // 01234567890123456789012345678901234567
+ displayWidgets(nWidgets("11111000010011000001000000000011000000"));
ui->labDXped->setText(tr ("Super Hound"));
ui->cbRxAll->setEnabled(false);
+ m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value());
+ m_wideGraph->setTol(ui->sbFtol->value());
+ m_wideGraph->setSuperHound(true);
+ clearDX();
+ if(ui->RxFreqSpinBox->value() < 700 or ui->RxFreqSpinBox->value() > 800)
+ ui->RxFreqSpinBox->setValue(750);
} else {
+ // 01234567890123456789012345678901234567
+ displayWidgets(nWidgets("11101000010011000001000000000011000000"));
ui->labDXped->setText(tr ("Hound"));
ui->cbRxAll->setEnabled(true);
+ m_wideGraph->setSuperHound(false);
+ ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt());
}
ui->txrb1->setChecked(true);
ui->txrb2->setEnabled(false);
@@ -7288,11 +7560,13 @@ void MainWindow::on_actionFT8_triggered()
ui->txb4->setEnabled(false);
ui->txb5->setEnabled(false);
ui->txb6->setEnabled(false);
+ if (m_ActiveStationsWidget) m_ActiveStationsWidget->setClickOK(false);
} else {
switch_mode (Modes::FT8);
}
if(m_specOp != SpecOp::HOUND) {
ui->houndButton->setChecked(false);
+ m_wideGraph->setSuperHound(false);
}
m_specOp=m_config.special_op_id();
@@ -7898,7 +8172,8 @@ void MainWindow::on_RxFreqSpinBox_valueChanged(int n)
if (m_mode == "FreqCal") {
setRig ();
}
- if (m_mode != "MSK144" && m_mode != "FST4W" && m_mode != "WSPR" && m_mode != "Echo" && m_mode != "FreqCal") {
+ if (m_mode != "MSK144" && m_mode != "FST4W" && m_mode != "WSPR" && m_mode != "Echo" && m_mode != "FreqCal"
+ && !(SpecOp::HOUND == m_specOp && m_config.superFox())) {
QTimer::singleShot (200, [=] {m_settings->setValue("RxFreq_old",ui->RxFreqSpinBox->value());});
}
statusUpdate ();
@@ -8179,6 +8454,16 @@ void MainWindow::on_rptSpinBox_valueChanged(int n)
void MainWindow::on_tuneButton_clicked (bool checked)
{
+ // prevent tuning on top of a SuperFox message
+ if (SpecOp::HOUND==m_specOp && m_config.superFox() && !m_tune) {
+ QDateTime now = QDateTime::currentDateTimeUtc();
+ int s = now.time().toString("ss").toInt();
+ if ((s >= 0 && s < 15) || (s >= 30 && s < 45)) {
+ ui->tuneButton->setChecked (false);
+ return;
+ }
+ }
+ stopWRTimer.stop(); // stop a running Tx3 timer
static bool lastChecked = false;
if (lastChecked == checked) return;
lastChecked = checked;
@@ -8239,6 +8524,8 @@ void MainWindow::on_stopTxButton_clicked() //Stop Tx
m_bCallingCQ = false;
m_bAutoReply = false; // ready for next
m_maxPoints=-1;
+ stopWRTimer.stop(); // stop a running Tx3 timer
+ filtered = false;
}
void MainWindow::rigOpen ()
@@ -8315,6 +8602,15 @@ void MainWindow::setXIT(int n, Frequency base)
void MainWindow::setFreq4(int rxFreq, int txFreq)
{
if (m_mode=="ECHO") return; // we do not adjust rx/tx for echo mode -- always 1500Hz
+
+ if(m_mode=="FT8" and m_config.superFox() and (m_specOp == SpecOp::HOUND) and
+ (qAbs(rxFreq-750)>200)) {
+// SuperHound should normally keep RxFreq close to 750 Hz
+ if(MessageBox::No == MessageBox::query_message (this,
+ tr ("Please confirm setting RxFreq to %1 Hz.\nSuperFox should be at 750 Hz.").arg
+ (QString::number(rxFreq)))) return;
+ }
+
if (ui->RxFreqSpinBox->isEnabled ()) ui->RxFreqSpinBox->setValue(rxFreq);
if(m_mode=="WSPR" or m_mode=="FST4W") {
ui->WSPRfreqSpinBox->setValue(txFreq);
@@ -8765,6 +9061,7 @@ void MainWindow::on_sbFtol_valueChanged(int value)
statusUpdate ();
// save last used parameters
QTimer::singleShot (200, [=] {
+ if (m_mode=="FT8") m_settings->setValue ("Ftol_SF", ui->sbFtol->value());
if (m_mode=="Q65") m_settings->setValue ("Ftol_Q65", ui->sbFtol->value());
if (m_mode=="MSK144") m_settings->setValue ("Ftol_MSK144", ui->sbFtol->value());
if (m_mode=="JT65") m_settings->setValue ("Ftol_JT65", ui->sbFtol->value ());
@@ -8940,10 +9237,14 @@ void MainWindow::on_cbFast9_clicked(bool b)
void MainWindow::on_cbSendMsg_toggled(bool b)
{
+ if (!(m_config.superFox() && m_specOp==SpecOp::FOX))
+ return; // don't do anything with slot values unless SuperFox mode
if(b) {
ui->sbNslots->setValue(2);
+ m_Nslots=2;
} else {
ui->sbNslots->setValue(5);
+ m_Nslots=5;
}
}
@@ -9104,6 +9405,7 @@ void MainWindow::replayDecodes ()
void MainWindow::postDecode (bool is_new, QString const& message)
{
+ if (message.contains("$VERIFY$")) return; // Don't send SuperFox OTP messages to messageClient
auto const& decode = message.trimmed ();
auto const& parts = decode.left (22).split (' ', SkipEmptyParts);
if (parts.size () >= 5)
@@ -9909,12 +10211,13 @@ void MainWindow::readWidebandDecodes()
void MainWindow::hound_reply ()
{
if (!m_tune) {
- //Select TX3, set TxFreq to FoxFreq, and Force Auto ON.
+ // Select Tx3, set TxFreq to FoxFreq, and Force Auto ON.
ui->txrb3->setChecked (true);
m_nSentFoxRrpt = 1;
ui->rptSpinBox->setValue(m_rptSent.toInt());
if (!m_auto) auto_tx_mode(true);
if (!m_config.superFox()) ui->TxFreqSpinBox->setValue (m_nFoxFreq);
+ stopWRTimer.start(int(11000.0*m_TRperiod)); // Tx3 timeout when in Hound mode
}
}
@@ -9925,22 +10228,15 @@ void MainWindow::on_sbNlist_valueChanged(int n)
void MainWindow::on_sbNslots_valueChanged(int n)
{
- m_Nslots=n;
if(m_specOp!=SpecOp::FOX) return;
+ if(m_config.superFox()) return; // Don't allow setting m_Nslots manually in SF mode
+ m_Nslots=n;
QString t;
t = t.asprintf(" NSlots %d",m_Nslots);
writeFoxQSO(t);
if(!m_config.superFox()) m_Nslots0=n;
}
-void MainWindow::on_sbMax_dB_valueChanged(int n)
-{
- m_max_dB=n;
- if(m_specOp!=SpecOp::FOX) return;
- QString t;
- t = t.asprintf(" Max_dB %d",m_max_dB);
- writeFoxQSO(t);
-}
void MainWindow::FoxReset(QString reason="")
{
QFile f(m_config.temp_dir().absoluteFilePath("houndcallers.txt"));
@@ -9970,8 +10266,13 @@ void MainWindow::on_pbFoxReset_clicked()
void MainWindow::on_pbFreeText_clicked()
{
bool ok;
- m_freeTextMsg = QInputDialog::getText (this, tr("Free Text Message"),
- tr("Message:"), QLineEdit::Normal, m_freeTextMsg0, &ok).left(26);
+ if(m_config.superFox()) {
+ m_freeTextMsg = QInputDialog::getText (this, tr("Free Text Message"),
+ tr("Message:"), QLineEdit::Normal, m_freeTextMsg0, &ok).left(26);
+ } else {
+ m_freeTextMsg = QInputDialog::getText (this, tr("Free Text Message"),
+ tr("Message:"), QLineEdit::Normal, m_freeTextMsg0, &ok).left(13);
+ }
if(ok) {
m_freeTextMsg=m_freeTextMsg.toUpper();
m_freeTextMsg0=m_freeTextMsg;
@@ -9982,6 +10283,26 @@ void MainWindow::on_comboBoxHoundSort_activated(int index)
{
if(index!=-99) houndCallers(); //Silence compiler warning
}
+#ifdef FOX_OTP
+QString MainWindow::foxOTPcode()
+{
+ QString code;
+ if (!m_config.OTPSeed().isEmpty())
+ {
+
+ OTPGenerator totp;
+ QDateTime dateTime = dateTime.currentDateTime();
+ code = totp.generateTOTP(m_config.OTPSeed(), dateTime, 6);
+ LOG_INFO(QString("foxOTPcode: code is %1").arg(code));
+ } else
+ {
+ code = "000000";
+ showStatusMessage(tr("TOTP: No seed entered in fox configuration to generate verification code."));
+ LOG_INFO(QString("foxOTPcode: No seed entered in fox configuration to generate verification code."));
+ }
+ return code;
+}
+#endif
//------------------------------------------------------------------------------
QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
@@ -9995,15 +10316,21 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
* 2: Grid
* 3: SNR (reverse order)
* 4: Distance (reverse order)
+ * 5: Age (reverse order)
+ * 6: Continent
+ * 7: User defined (reverse order)
+ *
*/
QMap<QString,QString> map;
QStringList lines,lines2;
QString msg,houndCall,t1;
QString ABC{"ABCDEFGHIJKLMNOPQRSTUVWXYZ _"};
+ QList<int> reverse_sorted{3,4,5,6};
+ QString Continents{" AF AN AS EU NA OC SA UN "}; // matches what we get from AD1C's country list
QList<int> list;
int i,j,k,n,nlines;
- bool bReverse=(isort >= 3);
+ bool bReverse = reverse_sorted.contains(isort);
isort=qAbs(isort);
// Save only the most recent transmission from each caller.
@@ -10012,7 +10339,7 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
for(i=0; i<nlines; i++) {
msg=lines.at(i); //key = callsign
if(msg.mid(13,1)==" ") msg=msg.mid(0,13) + "...." + msg.mid(17);
- houndCall=msg.split(" ").at(0); //value = "call grid snr freq dist age"
+ houndCall=msg.split(" ").at(0); //value = "call grid snr freq dist age continent user-defined
map[houndCall]=msg;
}
@@ -10020,16 +10347,47 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
t="";
for(auto a: map.keys()) {
t1=map[a].split(" ",SkipEmptyParts).at(2);
+ // add the user-defined value to the end of the line. Example:
+ // JJ0NCC PM97 15 2724 7580 2 AS 67
+ // PY7ZZ HI21 -13 1673 10549 1 SA -
+
+ QString annotated_value_s{" - "}; // default
+ qint32 annotated_value = 0;
+
+ if (m_annotated_callsigns.contains(a)) {
+ annotated_value = m_annotated_callsigns.value(a);
+ annotated_value_s = QString::number(annotated_value);
+ }
+
+ map[a] += QString(" %1").arg(annotated_value_s, 8);
int nsnr=t1.toInt(); // get snr
if(nsnr <= max_dB) { // keep only if snr in specified range
if(isort==1) t += map[a] + "\n";
- if(isort==3 or isort==4) {
- i=2; // sort Hound calls by snr
- if(isort==4) i=4; // sort Hound calls by distance
+ if (isort==3 or isort==4 or isort==5) { // numeric ones: snr, distance, age
+ if (isort==3)
+ i=2; // sort Hound calls by snr
+ else
+ i=isort; // part of the line that we want
t1=map[a].split(" ",SkipEmptyParts).at(i);
- n=1000*(t1.toInt()+100) + j; // pack (snr or dist) and index j into n
+ int isort_value = t1.toInt();
+ if (isort==5) { // sort by age ascending
+ isort_value = (100 < isort_value ? 100 : 100-isort_value);
+ }
+ n=1000*(isort_value+100) + j; // pack (snr or dist or age) and index j into n
list.insert(j,n); // add n to list at [j]
}
+ if (isort == 6) { // sort by continent
+ i = 6;
+ QStringList parts = map[a].split(" ", SkipEmptyParts);
+ if (parts.size() <= i + 1) {
+ n = j;
+ } else {
+ QString cont = map[a].split(" ", SkipEmptyParts).at(i);
+ int cont_n = Continents.indexOf(" " + cont + " ");
+ n = 1000 + 1000 * cont_n + j; // index may return -1, so add 1000 to make it positive
+ }
+ list.insert(j, n);
+ }
if(isort==2) { // sort Hound calls by grid
t1=map[a].split(" ",SkipEmptyParts).at(1);
@@ -10041,6 +10399,11 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
list.insert(j,n); // add n to list at [j]
}
+ if(isort==7) { // annotated value provided by external app
+ n = 1000 + 1000 * std::max((qint32) 0, annotated_value) + j;
+ list.insert(j, n);
+ }
+
lines2.insert(j,map[a]); // add map[a] to lines2 at [j]
j++;
}
@@ -10089,6 +10452,17 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
return m_houndCallers;
}
+void MainWindow::removeHoundFromCallingList(QString callsign)
+{
+ QString text = m_houndCallers;
+ QRegularExpression re = QRegularExpression("^" + callsign + "[^\\n]+\\n", QRegularExpression::MultilineOption);
+ text.remove(re);
+ if (text != m_houndCallers) {
+ m_nSortedHounds--;
+ m_houndCallers = text;
+ ui->decodedTextBrowser->setHighlightedHoundText(m_houndCallers);
+ }
+}
//------------------------------------------------------------------------------
void MainWindow::selectHound(QString line, bool bTopQueue)
{
@@ -10097,7 +10471,7 @@ void MainWindow::selectHound(QString line, bool bTopQueue)
* The line may be selected by double-clicking; alternatively, hitting
* <Enter> is equivalent to double-clicking on the top-most line.
*/
- if(line.length()==0) return;
+ if(line.simplified().isEmpty()) return;
if(line.length() < 6) return;
QString houndCall=line.split(" ",SkipEmptyParts).at(0);
@@ -10109,28 +10483,28 @@ void MainWindow::selectHound(QString line, bool bTopQueue)
m_houndCallers=m_houndCallers.remove(line+"\n"); // Remove t from sorted Hound list
m_nSortedHounds--;
- ui->decodedTextBrowser->setText(m_houndCallers); // Populate left window with Hound callers
+ ui->decodedTextBrowser->setHighlightedHoundText(m_houndCallers); // Populate left window with Hound callers
QString t1=houndCall + " ";
QString t2=rpt;
QString t1_with_grid;
if(rpt.mid(0,1) != "-" and rpt.mid(0,1) != "+") t2="+" + rpt;
if(t2.length()==2) t2=t2.mid(0,1) + "0" + t2.mid(1,1);
t1=t1.mid(0,12) + t2;
- ui->houndQueueTextBrowser->displayHoundToBeCalled(t1, bTopQueue); // Add hound call and rpt to tb4
+ // display the callers, highlighting calls if necessary
+ ui->houndQueueTextBrowser->insertText(bTopQueue ? t1 + "\n" : t1, QColor{}, QColor{}, houndCall, "", bTopQueue ? QTextCursor::Start : QTextCursor::End);
t1_with_grid=t1 + " " + houndGrid; // Append the grid
-
- if (bTopQueue)
- {
- m_houndQueue.prepend(t1_with_grid); // Put this hound into the queue at the top
- }
- else
- {
- m_houndQueue.enqueue(t1_with_grid); // Put this hound into the queue
- }
+ if (bTopQueue) {
+ m_houndQueue.prepend(t1_with_grid); // Put this hound into the queue at the top
+ } else {
+ m_houndQueue.enqueue(t1_with_grid); // Put this hound into the queue
+ }
writeFoxQSO(" Sel: " + t1_with_grid);
QTextCursor cursor = ui->houndQueueTextBrowser->textCursor();
cursor.setPosition(0); // Scroll to top of list
ui->houndQueueTextBrowser->setTextCursor(cursor);
+ cursor = ui->decodedTextBrowser->textCursor();
+ cursor.setPosition(0); // Highlighting happens in the forward direction
+ ui->decodedTextBrowser->setTextCursor(cursor);
}
//------------------------------------------------------------------------------
@@ -10184,10 +10558,15 @@ void MainWindow::houndCallers()
if(ui->cbWorkDupes->isChecked()) {
if(m_loggedByFox[houndCall].contains(m_lastBand)
and !decoded.contains(paddedHoundCall)) continue; // don't display old messages again of stations already logged
- } else {
- if(m_loggedByFox[houndCall].contains(m_lastBand)) continue; // already logged on this band
}
- if(m_foxQSO.contains(houndCall)) continue; // still in the QSO map
+ if(m_foxQSOinProgress.contains(houndCall) || m_foxQSO.contains(houndCall))
+ {
+ continue;
+ } // still in the QSO map, or was (very) recently worked
+
+ if(m_foxQSO.contains(houndCall) && !ui->cbRxAll->isChecked()) {
+ continue;
+ } // already worked
auto const& entity = m_logBook.countries ()->lookup (houndCall);
auto const& continent = AD1CCty::continent (entity.continent);
@@ -10214,8 +10593,11 @@ void MainWindow::houndCallers()
if(t.length()>30) {
m_isort=ui->comboBoxHoundSort->currentIndex();
QString t1=sortHoundCalls(t,m_isort,m_max_dB);
- ui->decodedTextBrowser->setText(t1);
+ ui->decodedTextBrowser->setHighlightedHoundText(t1);
}
+ QTextCursor cursor = ui->decodedTextBrowser->textCursor();
+ cursor.setPosition(0); // Set scroll at top, in preparation for highlighting messages
+ ui->decodedTextBrowser->setTextCursor(cursor);
f.close();
}
}
@@ -10242,6 +10624,7 @@ void MainWindow::foxRxSequencer(QString msg, QString houndCall, QString rptRcvd)
}
}
}
+
void MainWindow::updateFoxQSOsInProgressDisplay()
{
@@ -10252,7 +10635,7 @@ void MainWindow::updateFoxQSOsInProgressDisplay()
QString hc = m_foxQSOinProgress.at(i);
QString status = m_foxQSO[hc].ncall > m_maxStrikes ? QString(" (rx) ") : QString(" ");
QString str = (hc + " ").left(13) + QString::number(m_foxQSO[hc].ncall) + status;
- ui->foxTxListTextBrowser->displayHoundToBeCalled(str);
+ ui->foxTxListTextBrowser->insertText(str, QColor{}, QColor{}, hc, "", QTextCursor::End);
}
}
@@ -10272,11 +10655,15 @@ void MainWindow::foxTxSequencer()
QString hc,hc1,hc2; //Hound calls
QString t,rpt;
qint32 islot=0;
+ qint32 ncalls_sent=0;
qint32 n1,n2,n3;
+ int nMaxRemainingSlots=0;
+ static unsigned int m_tFoxTxSinceOTP=99;
+ m_tFoxTxSinceOTP++;
m_tFoxTx++; //Increment Fox Tx cycle counter
- //Is it time for a stand-alone CQ?
+ // Is it time for a stand-alone CQ?
if(m_tFoxTxSinceCQ >= m_foxCQtime and ui->cbMoreCQs->isChecked()) {
fm=ui->comboBoxCQ->currentText() + " " + m_config.my_callsign();
if(!fm.contains("/")) {
@@ -10289,15 +10676,36 @@ void MainWindow::foxTxSequencer()
foxGenWaveform(islot-1,fm);
goto Transmit;
}
+
+ // Maybe send out the freetext message?
+ if (!m_config.superFox() && ui->cbSendMsg->isChecked() && (islot < m_Nslots)) {
+ fm = m_freeTextMsg;
+ islot++;
+ foxGenWaveform(islot - 1, fm);
+ }
+
+#ifdef FOX_OTP
+ // Send OTP message maybe for regular fox mode
+ if (!m_config.superFox() && m_config.OTPEnabled() && (islot < m_Nslots) && (m_tFoxTxSinceOTP >= m_config.OTPinterval()))
+ {
+ // truncated callsign + OTP code (to be under 13 character limit of free text)
+ QString trunc_call=m_config.my_callsign().left(6).split("/").at(0); // truncate callsign to 6 characters
+ fm = trunc_call + "." + foxOTPcode(); // N5J-> N5J.123456, W1AW/7 -> W1AW.123456, 4U1IARU -> 4U1IAR.123456
+ m_tFoxTxSinceOTP = 0; //Remember when we sent a Tx5
+ islot++;
+ foxGenWaveform(islot - 1, fm);
+ }
+#endif
+
//Compile list1: up to NSLots Hound calls to be sent RR73
for(QString hc: m_foxQSO.keys()) { //Check all Hound calls: First priority
if(m_foxQSO[hc].tFoxRrpt<0) continue;
if(m_foxQSO[hc].tFoxRrpt - m_foxQSO[hc].tFoxTxRR73 > 3) {
//Has been a long time since we sent RR73
+ if(list1.size()>=(m_Nslots - islot)) goto list1Done;
list1 << hc; //Add to list1
m_foxQSO[hc].tFoxTxRR73 = m_tFoxTx; //Time RR73 is sent
m_foxQSO[hc].nRR73++; //Increment RR73 counter
- if(list1.size()==m_Nslots) goto list1Done;
}
}
@@ -10305,10 +10713,10 @@ void MainWindow::foxTxSequencer()
if(m_foxQSO[hc].tFoxRrpt<0) continue;
if(m_foxQSO[hc].tFoxTxRR73 < 0) {
//Have not yet sent RR73
+ if(list1.size()>=(m_Nslots - islot)) goto list1Done;
list1 << hc; //Add to list1
m_foxQSO[hc].tFoxTxRR73 = m_tFoxTx; //Time RR73 is sent
m_foxQSO[hc].nRR73++; //Increment RR73 counter
- if(list1.size()==m_Nslots) goto list1Done;
}
}
@@ -10316,27 +10724,35 @@ void MainWindow::foxTxSequencer()
if(m_foxQSO[hc].tFoxRrpt<0) continue;
if(m_foxQSO[hc].tFoxTxRR73 <= m_foxQSO[hc].tFoxRrpt) {
//We received R+rpt more recently than we sent RR73
+ if(list1.size()>=(m_Nslots - islot)) goto list1Done;
list1 << hc; //Add to list1
m_foxQSO[hc].tFoxTxRR73 = m_tFoxTx; //Time RR73 is sent
m_foxQSO[hc].nRR73++; //Increment RR73 counter
- if(list1.size()==m_Nslots) goto list1Done;
}
}
list1Done:
//Compile list2: Up to Nslots Hound calls to be sent a report.
+// For Superfox, up to 5 RR73, but only 4 callsigns with reports. m_NSlots should be 5 for SF.
+ nMaxRemainingSlots = (m_config.superFox()) ? m_Nslots - 1 : m_Nslots;
+ if(m_config.superFox() and ui->cbSendMsg->isChecked()) nMaxRemainingSlots=4;
for(int i=0; i<m_foxQSOinProgress.count(); i++) {
//First do those for QSOs in progress
hc=m_foxQSOinProgress.at(i);
if((m_foxQSO[hc].tFoxRrpt < 0) and (m_foxQSO[hc].ncall < m_maxStrikes)) {
//Sent him a report and have not received R+rpt: call him again
+ if(list2.size()>=(nMaxRemainingSlots - islot)) goto list2Done;
list2 << hc; //Add to list2
- if(list2.size()==m_Nslots) goto list2Done;
+ if(list2.size() == nMaxRemainingSlots) goto list2Done;
}
}
while(!m_houndQueue.isEmpty()) {
//Start QSO with a new Hound
+ if (list2.size() == (nMaxRemainingSlots - islot))
+ {
+ break;
+ }
t=m_houndQueue.dequeue(); //Fetch new hound from queue
int i0=t.indexOf(" ");
hc=t.mid(0,i0); //hound call
@@ -10350,12 +10766,7 @@ list1Done:
m_foxQSO[hc].rcvd = -99; //Have not received R+rpt
m_foxQSO[hc].tFoxRrpt = -1; //Have not received R+rpt
m_foxQSO[hc].tFoxTxRR73 = -1; //Have not sent RR73
- rm_tb4(hc); //Remove this Hound from tb4
-
- if(list2.size()==m_Nslots) {
- break;
- }
-
+ refreshHoundQueueDisplay();
}
list2Done:
@@ -10364,7 +10775,6 @@ list2Done:
n2=list2.size();
n3=qMax(n1,n2);
if(n3>m_Nslots) n3=m_Nslots;
-
for(int i=0; i<n3; i++) {
hc1="";
fm="";
@@ -10416,12 +10826,13 @@ list2Done:
fm = Radio::base_callsign(hc2) + " " + m_baseCall + " " + m_foxQSO[hc2].sent; //Standard FT8 message
}
islot++;
+ ncalls_sent++;
foxGenWaveform(islot-1,fm); //Generate tx waveform
}
if(islot < m_Nslots) {
//At least one slot is still open
- if(islot==0 or ((m_tFoxTx-m_tFoxTx0>=4) and ui->cbMoreCQs->isChecked())) {
+ if(ncalls_sent==0 or ((m_tFoxTx-m_tFoxTx0>=4) and ui->cbMoreCQs->isChecked())) {
//Roughly every 4th Tx sequence, put a CQ message in an otherwise empty slot
fm=ui->comboBoxCQ->currentText() + " " + m_config.my_callsign();
if(!fm.contains("/")) {
@@ -10443,12 +10854,13 @@ Transmit:
bool bSuperFox=m_config.superFox();
foxcom_.bMoreCQs=ui->cbMoreCQs->isChecked();
foxcom_.bSendMsg=ui->cbSendMsg->isChecked();
-// qDebug() << "cc" << foxcom_.bMoreCQs << foxcom_.bSendMsg << foxcom_.nslots
-// << m_Nslots << m_freeTextMsg0;
::memcpy(foxcom_.textMsg, m_freeTextMsg0.leftJustified(26,' ').toLatin1(),26);
auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_1.dat")).toLocal8Bit()};
foxgen_(&bSuperFox, fname.constData(), (FCL)fname.size());
- if(bSuperFox) sfox_tx();
+ if(bSuperFox) {
+ writeFoxTxMsgs();
+ sfox_tx();
+ }
m_tFoxTxSinceCQ++;
for(QString hc: m_foxQSO.keys()) { //Check for strikeout or timeout
@@ -10480,24 +10892,13 @@ void MainWindow::update_foxLogWindow_rate()
}
}
-void MainWindow::rm_tb4(QString houndCall)
+void MainWindow::refreshHoundQueueDisplay()
{
- if(houndCall=="") return;
- QString t="";
- QString tb4=ui->houndQueueTextBrowser->toPlainText();
- QStringList list=tb4.split("\n");
- int n=list.size();
- int j=0;
- for (int i=0; i<n; i++) {
- if(j>0) t += "\n";
- QString line=list.at(i);
- if(!line.contains(houndCall + " ")) {
- j++;
- t += line;
- }
+ ui->houndQueueTextBrowser->clear();
+ for (QString line: m_houndQueue) {
+ auto hc = line.mid(0, 12).trimmed();
+ ui->houndQueueTextBrowser->insertText(line, QColor{}, QColor{}, hc, "", QTextCursor::End);
}
- t.replace("\n\n","\n");
- ui->houndQueueTextBrowser->setText(t);
}
void MainWindow::doubleClickOnFoxQueue(Qt::KeyboardModifiers modifiers)
@@ -10521,14 +10922,9 @@ void MainWindow::doubleClickOnFoxQueue(Qt::KeyboardModifiers modifiers)
}
}
m_houndQueue.prepend(houndLine);
- ui->houndQueueTextBrowser->clear();
- for (QString line: m_houndQueue)
- {
- ui->houndQueueTextBrowser->displayHoundToBeCalled(line.mid(0,16), false);
- }
+ refreshHoundQueueDisplay();
} else
{
- rm_tb4(houndCall);
writeFoxQSO(" Del: " + houndCall);
QQueue <QString> tmpQueue;
while (!m_houndQueue.isEmpty())
@@ -10538,6 +10934,7 @@ void MainWindow::doubleClickOnFoxQueue(Qt::KeyboardModifiers modifiers)
if (hc != houndCall) tmpQueue.enqueue(t);
}
m_houndQueue.swap(tmpQueue);
+ refreshHoundQueueDisplay();
}
}
@@ -10559,7 +10956,7 @@ void MainWindow::doubleClickOnFoxInProgress(Qt::KeyboardModifiers modifiers)
void MainWindow::foxQueueTopCallCommand()
{
m_decodedText2 = true;
- if(SpecOp::FOX==m_specOp && m_decodedText2 && m_houndQueue.count() < 10)
+ if(SpecOp::FOX==m_specOp && m_decodedText2 && m_houndQueue.count() < MAX_HOUNDS_IN_QUEUE)
{
QTextCursor cursor = ui->decodedTextBrowser->textCursor();
@@ -10581,12 +10978,17 @@ void MainWindow::foxGenWaveform(int i,QString fm)
QString txModeArg;
txModeArg = txModeArg.asprintf("FT8fox %d",i+1);
int nfreq=ui->TxFreqSpinBox->value()+60*i;
- if(m_config.superFox()) nfreq=750;
+
+ if(m_config.superFox() && SpecOp::FOX==m_specOp) {
+ nfreq=750;
+ if(i==0 && ui->cbSendMsg->isChecked()) {
+ ui->decodedTextBrowser2->displayTransmittedText(m_freeTextMsg0, txModeArg,
+ nfreq,m_bFastMode,m_TRperiod,m_config.superFox());
+ }
+ }
+
ui->decodedTextBrowser2->displayTransmittedText(fm.trimmed(), txModeArg,
nfreq,m_bFastMode,m_TRperiod,m_config.superFox());
- if (SpecOp::FOX==m_specOp && m_config.superFox() && ui->cbSendMsg->isChecked())
- ui->decodedTextBrowser2->displayTransmittedText(m_freeTextMsg0, txModeArg,
- nfreq,m_bFastMode,m_TRperiod,m_config.superFox());
foxcom_.i3bit[i]=0;
if(fm.indexOf("<")>0) foxcom_.i3bit[i]=1;
strncpy(&foxcom_.cmsg[i][0],fm.toLatin1(),40); //Copy this message into cmsg[i]
@@ -10596,7 +10998,24 @@ void MainWindow::foxGenWaveform(int i,QString fm)
writeFoxQSO(t + fm.trimmed());
}
-void MainWindow::writeFoxQSO(QString const& msg)
+void MainWindow::writeFoxTxMsgs() {
+ // references extern struct foxcom_
+ QString t;
+ for (int i = 0; i < 5; i++) {
+ t = QString::fromLatin1(foxcom_.cmsg[i]).left(40);
+ if (t.length() > 0) {
+ write_all("Tx", t);
+ }
+ }
+ t = QString::fromLatin1(foxcom_.textMsg).left(38);
+ if (foxcom_.bSendMsg) {
+ write_all("Tx", "-Free Text- "+t);
+ }
+ if (foxcom_.bMoreCQs) {
+ write_all("Tx", "-MoreCQs- ");
+ }
+}
+ void MainWindow::writeFoxQSO(QString const& msg)
{
QString t;
t = t.asprintf("%3d%3d%3d",m_houndQueue.count(),m_foxQSOinProgress.count(),m_foxQSO.count());
@@ -10687,7 +11106,7 @@ void MainWindow::foxTest()
hc1=line.mid(i0+6);
int i1=hc1.indexOf(" ");
hc1=hc1.mid(0,i1);
- rm_tb4(hc1);
+
writeFoxQSO(" Del: " + hc1);
QQueue<QString> tmpQueue;
while(!m_houndQueue.isEmpty()) {
@@ -10696,6 +11115,7 @@ void MainWindow::foxTest()
if(hc != hc1) tmpQueue.enqueue(t);
}
m_houndQueue.swap(tmpQueue);
+ refreshHoundQueueDisplay();
}
if(line.contains("Rx:")) {
msg=line.mid(37+6);
@@ -10768,7 +11188,7 @@ void MainWindow::write_all(QString txRx, QString message)
t = t.asprintf("%5d",ui->TxFreqSpinBox->value());
if (txRx=="Tx") msg=" 0 0.0" + t + " " + message;
auto time = QDateTime::currentDateTimeUtc ();
- if( txRx=="Rx" && !m_bFastMode ) time=m_dateTimeSeqStart;
+ if( (txRx=="Rx" || txRx=="Ck") && !m_bFastMode ) time=m_dateTimeSeqStart;
if (txRx=="Rx") {
t = t.asprintf("%10.3f ",m_freqNominalPeriod/1.e6); // prevent writing of wrong frequencies
@@ -10872,11 +11292,17 @@ void MainWindow::set_mode (QString const& mode)
void MainWindow::configActiveStations()
{
- if(m_ActiveStationsWidget!=NULL and (m_mode=="Q65" or m_mode=="FT4" or m_mode=="FT8")) {
- if(m_specOp==SpecOp::Q65_PILEUP) {
- m_ActiveStationsWidget->displayRecentStations("Q65-pileup","");
+ if (m_ActiveStationsWidget != NULL and (m_mode == "Q65" or m_mode == "FT4" or m_mode == "FT8")) {
+ if (m_specOp == SpecOp::Q65_PILEUP) {
+ m_ActiveStationsWidget->displayRecentStations("Q65-pileup", "");
} else {
- m_ActiveStationsWidget->displayRecentStations(m_mode,"");
+ if (m_specOp == SpecOp::FOX)
+ if (m_config.superFox())
+ m_ActiveStationsWidget->displayRecentStations("SuperFox Mode", "");
+ else
+ m_ActiveStationsWidget->displayRecentStations("Fox Mode", "");
+ else
+ m_ActiveStationsWidget->displayRecentStations(m_mode, "");
}
}
}
@@ -11008,7 +11434,7 @@ void MainWindow::on_houndButton_clicked (bool checked)
void MainWindow::on_ft8Button_clicked()
{
- if (m_specOp==SpecOp::HOUND) {
+ if (m_specOp==SpecOp::HOUND or m_specOp==SpecOp::FOX) {
m_config.setSpecial_None();
m_specOp=m_config.special_op_id();
}
@@ -11039,16 +11465,34 @@ void MainWindow::on_jt65Button_clicked()
on_actionJT65_triggered();
}
-void MainWindow::sfox_tx()
-{
- auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_1.dat")).toLocal8Bit()};
- QStringList args{fname};
- args.append(m_config.my_callsign());
- args.append(m_config.FoxKey());
-// qDebug() << "aa" << QDir::toNativeSeparators(m_appDir)+QDir::separator()+"sftx";
-// qDebug() << "bb" << args;
- p2.start(QDir::toNativeSeparators(m_appDir)+QDir::separator()+"sftx", args);
- p2.waitForFinished();
- auto fname2 {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_2.dat")).toLocal8Bit()};
- sfox_wave_gfsk_(fname2.constData(), (FCL)fname2.size());
+void MainWindow::sfox_tx() {
+ auto fname{QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox_1.dat")).toLocal8Bit()};
+ QString ckey{"OTP:000000"};
+ LOG_INFO(QString("sfox_tx: OTP code is %1").arg(foxOTPcode()));
+#ifdef FOX_OTP
+ qint32 otp_key = 0;
+ if (m_config.OTPEnabled())
+ {
+ LOG_INFO(QString("TOTP: Generating OTP key with %1").arg(m_config.OTPSeed()));
+ if (m_config.OTPSeed().length() == 16) {
+ QString output=foxOTPcode();
+ if (6 == output.length())
+ {
+ otp_key = QString(output).toInt();
+ LOG_INFO(QString("TOTP SF: %1 [%2]").arg(output).arg(otp_key).toStdString());
+ } else
+ {
+ otp_key = 0;
+ LOG_INFO(QString("TOTP SF: Incorrect length"));
+ }
+ ckey=(QString("OTP:%1").arg(otp_key));
+ } else
+ {
+ showStatusMessage (tr ("TOTP SF: seed not long enough."));
+ LOG_INFO(QString("TOTP SF: seed not long enough"));
+ }
+ }
+#endif
+ sftx_sub_(ckey.toLatin1().constData(), (FCL)ckey.size());
+ sfox_wave_gfsk_();
}