From 43bebfbad6e7ba026bd3d55720c7d9e12a7ef8ef Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 8 Aug 2022 23:08:17 +0200 Subject: New upstream version 2.6.0~rc2+repack --- widgets/mainwindow.cpp | 877 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 695 insertions(+), 182 deletions(-) (limited to 'widgets/mainwindow.cpp') diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index ecb5e860..8099aa7f 100755 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -60,6 +60,7 @@ #include "fastgraph.h" #include "about.h" #include "messageaveraging.h" +#include "activeStations.h" #include "colorhighlighting.h" #include "widegraph.h" #include "sleep.h" @@ -90,6 +91,8 @@ #include "ui_mainwindow.h" #include "moc_mainwindow.cpp" +#define FCL fortran_charlen_t + extern "C" { //----------------------------------------------------- C and Fortran routines void symspec_(struct dec_data *, int* k, double* trperiod, int* nsps, int* ingain, @@ -133,8 +136,7 @@ extern "C" { void genmsk_128_90_(char* msg, int* ichk, char* msgsent, int itone[], int* itype, fortran_charlen_t, fortran_charlen_t); - void gen65_(char* msg, int* ichk, char* msgsent, int itone[], - int* itext, fortran_charlen_t, fortran_charlen_t); + void gen65(char* msg, int* ichk, char msgsent[], int itone[], int* itext); void genq65_(char* msg, int* ichk, char* msgsent, int itone[], int* i3, int* n3, fortran_charlen_t, fortran_charlen_t); @@ -147,13 +149,11 @@ extern "C" { void morse_(char* msg, int* icw, int* ncw, fortran_charlen_t); - int ptt_(int nport, int ntx, int* iptt, int* nopen); - void wspr_downsample_(short int d2[], int* k); int savec2_(char const * fname, int* TR_seconds, double* dial_freq, fortran_charlen_t); - void avecho_( short id2[], int* dop, int* nfrit, int* nqual, float* f1, + void avecho_( short id2[], int* dop, int* nfrit, int* nauto, int* nqual, float* f1, float* level, float* sigdb, float* snr, float* dfreq, float* width); @@ -170,8 +170,6 @@ extern "C" { void freqcal_(short d2[], int* k, int* nkhz,int* noffset, int* ntol, char line[], fortran_charlen_t); - void fix_contest_msg_(char* MyGrid, char* msg, fortran_charlen_t, fortran_charlen_t); - void calibrate_(char const * data_dir, int* iz, double* a, double* b, double* rms, double* sigmaa, double* sigmab, int* irc, fortran_charlen_t); @@ -179,13 +177,11 @@ extern "C" { void plotsave_(float swide[], int* m_w , int* m_h1, int* irow); - void chkcall_(char* w, char* basc_call, bool cok, int len1, int len2); - - void get_ft4msg_(int* idecode, char* line, int len); - void chk_samples_(int* m_ihsym,int* k, int* m_hsymStop); - void save_dxbase_(char* dxbase, int len); + void save_dxbase_(char* dxbase, FCL len); + + void indexx_(float arr[], int* n, int indx[]); } int volatile itone[MAX_NUM_SYMBOLS]; //Audio tones for all Tx symbols @@ -209,6 +205,8 @@ QVector g_ColorTbl; using SpecOp = Configuration::SpecialOperatingActivity; +bool m_displayBand = false; + namespace { Radio::Frequency constexpr default_frequency {14076000}; @@ -276,6 +274,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_msErase {0}, m_secBandChanged {0}, m_freqNominal {0}, + m_freqNominalPeriod {0}, m_freqTxNominal {0}, m_reverse_Doppler {"1" == env.value ("WSJT_REVERSE_DOPPLER", "0")}, m_tRemaining {0.}, @@ -295,6 +294,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_secID {0}, m_idleMinutes {0}, m_nSubMode {0}, + m_nSubMode_Q65 {0}, + m_nSubMode_JT65 {0}, + m_nSubMode_JT4 {0}, m_nclearave {1}, m_nWSPRdecodes {0}, m_k0 {9999999}, @@ -604,6 +606,12 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, ui->actionSave_decoded->setActionGroup(saveGroup); ui->actionSave_all->setActionGroup(saveGroup); + QActionGroup* alltxtGroup = new QActionGroup(this); + ui->actionDon_t_split_ALL_TXT->setActionGroup(alltxtGroup); + ui->actionSplit_ALL_TXT_yearly->setActionGroup(alltxtGroup); + ui->actionSplit_ALL_TXT_monthly->setActionGroup(alltxtGroup); + ui->actionDisable_writing_of_ALL_TXT->setActionGroup(alltxtGroup); + QActionGroup* DepthGroup = new QActionGroup(this); ui->actionQuickDecode->setActionGroup(DepthGroup); ui->actionMediumDecode->setActionGroup(DepthGroup); @@ -743,6 +751,24 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, } }); + // ensure a balanced layout of the mode buttons + qreal pointSize = m_config.text_font().pointSizeF(); + if (pointSize < 11) { + ui->houndButton->setMaximumWidth(40); + ui->ft8Button->setMaximumWidth(40); + ui->ft4Button->setMaximumWidth(40); + ui->msk144Button->setMaximumWidth(40); + ui->q65Button->setMaximumWidth(40); + ui->jt65Button->setMaximumWidth(40); + } else { + ui->houndButton->setMinimumWidth(50); + ui->ft8Button->setMinimumWidth(50); + ui->ft4Button->setMinimumWidth(50); + ui->msk144Button->setMinimumWidth(50); + ui->q65Button->setMinimumWidth(50); + ui->jt65Button->setMinimumWidth(50); + } + // hook up save WAV file exit handling connect (&m_saveWAVWatcher, &QFutureWatcher::finished, [this] { // extract the promise from the future @@ -852,6 +878,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, auto dBm = int ((10. * i / 3.) + .5); ui->TxPowerComboBox->addItem (QString {"%1 dBm %2"}.arg (dBm).arg (power[i]), dBm); } + ui->respondComboBox->addItem("CQ: None"); + ui->respondComboBox->addItem("CQ: First"); + ui->respondComboBox->addItem("CQ: Max Dist"); m_dateTimeRcvdRR73=QDateTime::currentDateTimeUtc(); m_dateTimeSentTx3=QDateTime::currentDateTimeUtc(); @@ -954,7 +983,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, ui->txFirstCheckBox->setChecked(m_txFirst); morse_(const_cast (m_config.my_callsign ().toLatin1().constData()), - const_cast (icw), &m_ncw, m_config.my_callsign ().length()); + const_cast (icw), &m_ncw, (FCL)m_config.my_callsign().length()); on_actionWide_Waterfall_triggered(); ui->cbShMsgs->setChecked(m_bShMsgs); ui->cbSWL->setChecked(m_bSWL); @@ -1026,14 +1055,14 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, 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 Nov 30, 2021."); - // auto now = QDateTime::currentDateTimeUtc (); - // if (now >= QDateTime {{2021, 11, 30}, {23, 59, 59, 999}, Qt::UTC}) { - // Q_EMIT finished (); - // } + MessageBox::critical_message (this, + "This is a pre-release version of WSJT-X 2.6.0 made\n" + "available for testing purposes. By design it will\n" + "be nonfunctional after Nov 30, 2022."); + auto now = QDateTime::currentDateTimeUtc (); + if (now >= QDateTime {{2022, 11, 30}, {23, 59, 59, 999}, Qt::UTC}) { + Q_EMIT finished (); + } } void MainWindow::initialize_fonts () @@ -1123,7 +1152,8 @@ void MainWindow::writeSettings() m_settings->setValue ("MsgAvgDisplayed", m_msgAvgWidget && m_msgAvgWidget->isVisible ()); m_settings->setValue ("FoxLogDisplayed", m_foxLogWindow && m_foxLogWindow->isVisible ()); m_settings->setValue ("ContestLogDisplayed", m_contestLogWindow && m_contestLogWindow->isVisible ()); - m_settings->setValue("CallFirst",ui->cbFirst->isChecked()); + m_settings->setValue ("ActiveStationsDisplayed", m_ActiveStationsWidget && m_ActiveStationsWidget->isVisible ()); + m_settings->setValue("RespondCQ",ui->respondComboBox->currentIndex()); m_settings->setValue("HoundSort",ui->comboBoxHoundSort->currentIndex()); m_settings->setValue("FoxNlist",ui->sbNlist->value()); m_settings->setValue("FoxNslots",ui->sbNslots->value()); @@ -1144,7 +1174,7 @@ void MainWindow::writeSettings() m_settings->setValue("FST4W_FTol",ui->sbFST4W_FTol->value()); m_settings->setValue("FST4_FLow",ui->sbF_Low->value()); m_settings->setValue("FST4_FHigh",ui->sbF_High->value()); - m_settings->setValue("SubMode",ui->sbSubmode->value()); +// m_settings->setValue("SubMode",ui->sbSubmode->value()); m_settings->setValue("DTtol",m_DTtol); m_settings->setValue("Ftol", ui->sbFtol->value ()); m_settings->setValue("MinSync",m_minSync); @@ -1166,7 +1196,7 @@ void MainWindow::writeSettings() m_settings->setValue("UploadSpots",m_uploadWSPRSpots); m_settings->setValue("NoOwnCall",ui->cbNoOwnCall->isChecked()); m_settings->setValue ("BandHopping", ui->band_hopping_group_box->isChecked ()); - m_settings->setValue ("TRPeriod", ui->sbTR->value ()); +// m_settings->setValue ("TRPeriod", ui->sbTR->value ()); m_settings->setValue ("MaxDrift", ui->sbMaxDrift->value()); m_settings->setValue ("TRPeriod_FST4W", ui->sbTR_FST4W->value ()); m_settings->setValue("FastMode",m_bFastMode); @@ -1179,6 +1209,7 @@ void MainWindow::writeSettings() m_settings->setValue ("AutoClearAvg", ui->actionAuto_Clear_Avg->isChecked ()); m_settings->setValue("SplitterState",ui->decodes_splitter->saveState()); m_settings->setValue("Blanker",ui->sbNB->value()); + m_settings->setValue("Score",m_score); { QList coeffs; // suitable for QSettings @@ -1188,6 +1219,10 @@ void MainWindow::writeSettings() } m_settings->setValue ("PhaseEqualizationCoefficients", QVariant {coeffs}); } + m_settings->setValue ("actionDontSplitALLTXT", ui->actionDon_t_split_ALL_TXT->isChecked() ); + m_settings->setValue ("splitAllTxtYearly", ui->actionSplit_ALL_TXT_yearly->isChecked() ); + m_settings->setValue ("splitAllTxtMonthly", ui->actionSplit_ALL_TXT_monthly->isChecked() ); + m_settings->setValue ("disableWritingOfAllTxt", ui->actionDisable_writing_of_ALL_TXT->isChecked() ); m_settings->endGroup(); } @@ -1195,7 +1230,7 @@ void MainWindow::writeSettings() void MainWindow::readSettings() { ui->cbAutoSeq->setVisible(false); - ui->cbFirst->setVisible(false); + ui->respondComboBox->setVisible(false); m_settings->beginGroup("MainWindow"); std::array the_geometries; the_geometries[0] = m_settings->value ("geometry", saveGeometry ()).toByteArray (); @@ -1217,7 +1252,8 @@ void MainWindow::readSettings() auto displayMsgAvg = m_settings->value ("MsgAvgDisplayed", false).toBool (); auto displayFoxLog = m_settings->value ("FoxLogDisplayed", false).toBool (); auto displayContestLog = m_settings->value ("ContestLogDisplayed", false).toBool (); - ui->cbFirst->setChecked(m_settings->value("CallFirst",true).toBool()); + bool displayActiveStations = m_settings->value ("ActiveStationsDisplayed", false).toBool (); + ui->respondComboBox->setCurrentIndex(m_settings->value("RespondCQ",0).toInt()); ui->comboBoxHoundSort->setCurrentIndex(m_settings->value("HoundSort",3).toInt()); ui->sbNlist->setValue(m_settings->value("FoxNlist",12).toInt()); m_Nslots=m_settings->value("FoxNslots",5).toInt(); @@ -1230,6 +1266,10 @@ void MainWindow::readSettings() ui->actionAstronomical_data->setChecked (displayAstro); m_settings->beginGroup("Common"); + ui->actionDon_t_split_ALL_TXT->setChecked(m_settings->value("actionDontSplitALLTXT", true).toBool()); + ui->actionSplit_ALL_TXT_yearly->setChecked(m_settings->value("splitAllTxtYearly", false).toBool()); + ui->actionSplit_ALL_TXT_monthly->setChecked(m_settings->value("splitAllTxtMonthly", false).toBool()); + ui->actionDisable_writing_of_ALL_TXT->setChecked(m_settings->value("disableWritingOfAllTxt", false).toBool()); m_mode=m_settings->value("Mode","JT9").toString(); ui->actionNone->setChecked(m_settings->value("SaveNone",true).toBool()); ui->actionSave_decoded->setChecked(m_settings->value("SaveDecoded",false).toBool()); @@ -1240,8 +1280,14 @@ void MainWindow::readSettings() ui->sbFST4W_RxFreq->setValue(m_settings->value("FST4W_RxFreq",1500).toInt()); ui->sbF_Low->setValue(m_settings->value("FST4_FLow",600).toInt()); ui->sbF_High->setValue(m_settings->value("FST4_FHigh",1400).toInt()); - m_nSubMode=m_settings->value("SubMode",0).toInt(); - ui->sbSubmode->setValue(m_nSubMode); +// m_nSubMode=m_settings->value("SubMode",0).toInt(); + if (m_mode=="Q65") m_nSubMode=m_settings->value("SubMode_Q65",0).toInt(); + if (m_mode=="JT65") m_nSubMode=m_settings->value("SubMode_JT65",0).toInt(); + if (m_mode=="JT4") m_nSubMode=m_settings->value("SubMode_JT4",0).toInt(); +// ui->sbSubmode->setValue(m_nSubMode); + if (m_mode=="Q65") ui->sbSubmode->setValue(m_nSubMode_Q65); + if (m_mode=="JT65") ui->sbSubmode->setValue(m_nSubMode_JT65); + if (m_mode=="JT4") ui->sbSubmode->setValue(m_nSubMode_JT4); ui->sbFtol->setValue (m_settings->value("Ftol", 50).toInt()); ui->sbFST4W_FTol->setValue(m_settings->value("FST4W_FTol",100).toInt()); m_minSync=m_settings->value("MinSync",0).toInt(); @@ -1252,7 +1298,10 @@ void MainWindow::readSettings() m_bSWL=m_settings->value("SWL",false).toBool(); m_bFast9=m_settings->value("Fast9",false).toBool(); m_bFastMode=m_settings->value("FastMode",false).toBool(); - ui->sbTR->setValue (m_settings->value ("TRPeriod", 15).toInt()); +// ui->sbTR->setValue (m_settings->value ("TRPeriod", 15).toInt()); + if (m_mode=="Q65") ui->sbTR->setValue (m_settings->value ("TRPeriod_Q65", 30).toInt()); + if (m_mode=="MSK144") ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144", 15).toInt()); + if (m_mode=="FST4") ui->sbTR->setValue (m_settings->value ("TRPeriod_FST4", 60).toInt()); ui->sbMaxDrift->setValue (m_settings->value ("MaxDrift",0).toInt()); ui->sbTR_FST4W->setValue (m_settings->value ("TRPeriod_FST4W", 15).toInt()); m_lastMonitoredFrequency = m_settings->value ("DialFreq", @@ -1267,6 +1316,7 @@ void MainWindow::readSettings() ui->RoundRobin->setCurrentText(m_settings->value("RoundRobin",tr("Random")).toString()); m_dBm=m_settings->value("dBm",37).toInt(); m_send_RR73=m_settings->value("RR73",false).toBool(); + m_score=m_settings->value("Score",0).toInt(); if(m_send_RR73) { m_send_RR73=false; on_txrb4_doubleClicked(); @@ -1306,13 +1356,17 @@ void MainWindow::readSettings() // use these initialisation settings to tune the audio o/p buffer // size and audio thread priority m_settings->beginGroup ("Tune"); - m_audioThreadPriority = static_cast (m_settings->value ("Audio/ThreadPriority", QThread::HighPriority).toInt () % 8); + m_audioThreadPriority = static_cast (m_settings->value ("Audio/ThreadPriority", QThread::TimeCriticalPriority).toInt () % 8); m_settings->endGroup (); checkMSK144ContestType(); 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(); +// QFile f {m_config.writeable_data_dir ().absoluteFilePath ("activeCalls.txt")}; + } } void MainWindow::checkMSK144ContestType() @@ -1369,6 +1423,10 @@ void MainWindow::setDecodedTextFont (QFont const& font) } if (m_contestLogWindow) { m_contestLogWindow->set_log_view_font (font); + m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso()); + } + if(m_ActiveStationsWidget != NULL) { + m_ActiveStationsWidget->changeFont(font); } updateGeometry (); } @@ -1440,7 +1498,7 @@ void MainWindow::dataSink(qint64 frames) m_bUseRef=m_wideGraph->useRef(); if(!m_diskData) { refspectrum_(&dec_data.d2[k-m_nsps/2],&m_bClearRefSpec,&m_bRefSpec, - &m_bUseRef, fname.constData (), fname.size ()); + &m_bUseRef, fname.constData (), (FCL)fname.size ()); } m_bClearRefSpec=false; @@ -1480,11 +1538,11 @@ void MainWindow::dataSink(qint64 frames) int RxFreq=ui->RxFreqSpinBox->value (); int nkhz=(m_freqNominal+RxFreq)/1000; int ftol = ui->sbFtol->value (); - freqcal_(&dec_data.d2[0],&k,&nkhz,&RxFreq,&ftol,&line[0],80); + freqcal_(&dec_data.d2[0], &k, &nkhz, &RxFreq, &ftol, &line[0], (FCL)80); QString t=QString::fromLatin1(line); DecodedText decodedtext {t}; - ui->decodedTextBrowser->displayDecodedText (decodedtext, m_config.my_callsign (), m_mode, m_config.DXCC (), - m_logBook, m_currentBand, m_config.ppfx ()); + ui->decodedTextBrowser->displayDecodedText (decodedtext, m_config.my_callsign(), + m_mode, m_config.DXCC(), m_logBook, m_currentBand, m_config.ppfx()); if (ui->measure_check_box->isChecked ()) { // Append results text to file "fmt.all". QFile f {m_config.writeable_data_dir ().absoluteFilePath ("fmt.all")}; @@ -1529,8 +1587,10 @@ void MainWindow::dataSink(qint64 frames) } if(bCallDecoder) { if(m_mode=="Echo") { - float snr=0; + float dBerr=0.0; int nfrit=0; + int nauto=0; + if(m_auto) nauto=1; int nqual=0; float f1=1500.0; float xlevel=0.0; @@ -1539,11 +1599,11 @@ void MainWindow::dataSink(qint64 frames) float width=0.0; echocom_.nclearave=m_nclearave; int nDop=0; - avecho_(dec_data.d2,&nDop,&nfrit,&nqual,&f1,&xlevel,&sigdb, - &snr,&dfreq,&width); + avecho_(dec_data.d2,&nDop,&nfrit,&nauto,&nqual,&f1,&xlevel,&sigdb, + &dBerr,&dfreq,&width); QString t; - t = t.asprintf("%3d %7.1f %7.1f %7.1f %7.1f %3d",echocom_.nsum,xlevel,sigdb, - dfreq,width,nqual); + t = t.asprintf("%3d %7.1f %7.1f %7.1f %7.1f %7.1f %3d",echocom_.nsum,xlevel,sigdb, + dBerr,dfreq,width,nqual); t=QDateTime::currentDateTimeUtc().toString("hh:mm:ss ") + t; if (ui) ui->decodedTextBrowser->appendText(t); if(m_echoGraph->isVisible()) m_echoGraph->plotSpec(); @@ -1593,13 +1653,13 @@ void MainWindow::dataSink(qint64 frames) // idea to pass pointer to be processed in another thread m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file, this, m_fnameWE, &dec_data.d2[0], samples, m_config.my_callsign(), - m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, m_hisGrid))); + m_config.my_grid(), m_mode, m_nSubMode, m_freqNominalPeriod, m_hisCall, m_hisGrid))); if (m_mode=="WSPR") { auto c2name {(m_fnameWE + ".c2").toLocal8Bit ()}; int nsec=120; int nbfo=1500; double f0m1500=m_freqNominal/1000000.0 + nbfo - 1500; - int err = savec2_(c2name.constData (),&nsec,&f0m1500, c2name.size ()); + int err = savec2_(c2name.constData (),&nsec,&f0m1500, (FCL)c2name.size()); if (err!=0) MessageBox::warning_message (this, tr ("Error saving c2 file"), c2name); } } @@ -1720,9 +1780,10 @@ void MainWindow::fastSink(qint64 frames) float rmsNoGain = 0; int ftol = ui->sbFtol->value (); hspec_(dec_data.d2,&k,&nutc0,&nTRpDepth,&RxFreq,&ftol,&bmsk144, - &m_bTrain,m_phaseEqCoefficients.constData(),&m_inGain,&dec_data.params.mycall[0], - &dec_data.params.hiscall[0],&bshmsg,&bswl, - data_dir.constData (),fast_green,fast_s,&fast_jh,&pxmax,&rmsNoGain,&line[0],12,12,data_dir.size (),80); + &m_bTrain,m_phaseEqCoefficients.constData(),&m_inGain,&dec_data.params.mycall[0], + &dec_data.params.hiscall[0],&bshmsg,&bswl, + data_dir.constData (),fast_green,fast_s,&fast_jh,&pxmax,&rmsNoGain,&line[0],(FCL)12, + (FCL)12,(FCL)data_dir.size (),(FCL)80); float px = fast_green[fast_jh]; QString t; t = t.asprintf(" Rx noise: %5.1f ",px); @@ -1824,7 +1885,7 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog m_baseCall = Radio::base_callsign (m_config.my_callsign ()); ui->tx1->setEnabled (elide_tx1_not_allowed () || ui->tx1->isEnabled ()); morse_(const_cast (m_config.my_callsign ().toLatin1().constData()), - const_cast (icw), &m_ncw, m_config.my_callsign ().length()); + const_cast (icw), &m_ncw, (FCL)m_config.my_callsign().length()); } if (m_config.my_callsign () != callsign || m_config.my_grid () != my_grid) { statusUpdate (); @@ -1944,14 +2005,12 @@ void MainWindow::on_actionAbout_triggered() //Display "About" void MainWindow::on_autoButton_clicked (bool checked) { m_auto = checked; + m_maxPoints=-1; if (checked - && ui->cbFirst->isVisible () && ui->cbFirst->isChecked() + && ui->respondComboBox->isVisible () && ui->respondComboBox->currentText() != "CQ: None" && CALLING == m_QSOProgress) { m_bAutoReply = false; // ready for next - m_bCallingCQ = true; // allows tail-enders to be picked up - ui->cbFirst->setStyleSheet ("QCheckBox{color:red}"); - } else { - ui->cbFirst->setStyleSheet(""); + m_bCallingCQ = true; // allows tail-enders to be picked up } if (!checked) m_bCallingCQ = false; statusUpdate (); @@ -2014,9 +2073,10 @@ void MainWindow::keyPressEvent (QKeyEvent * e) } return; case Qt::Key_C: - if(m_mode=="FT4" && e->modifiers() & Qt::AltModifier) { - bool b=ui->cbFirst->isChecked(); - ui->cbFirst->setChecked(!b); + if(e->modifiers() & Qt::AltModifier) { + int n=ui->respondComboBox->currentIndex()+1; + if(n>2) n=0; + ui->respondComboBox->setCurrentIndex(n); } return; case Qt::Key_D: @@ -2077,8 +2137,9 @@ void MainWindow::keyPressEvent (QKeyEvent * e) } case Qt::Key_F6: if(bAltF1F6) { - bool b=ui->cbFirst->isChecked(); - ui->cbFirst->setChecked(!b); + int n=ui->respondComboBox->currentIndex()+1; + if(n>2) n=0; + ui->respondComboBox->setCurrentIndex(n); } else { if(e->modifiers() & Qt::ShiftModifier) { on_actionDecode_remaining_files_in_directory_triggered(); @@ -2234,6 +2295,13 @@ void MainWindow::displayDialFrequency () m_wideGraph->setRxBand (band_name); m_lastBand = band_name; band_changed(dial_frequency); + // prevent wrong frequencies for all.txt, PSK Reporter and highlighting for late decodes after band changes + m_displayBand = false; + QTimer::singleShot ((int(600.0*m_TRperiod)), [=] { + m_freqNominalPeriod = m_freqNominal; + m_currentBandPeriod = m_currentBand; + m_displayBand = true; + }); } // search working frequencies for one we are within 10kHz of (1 Mhz @@ -2537,7 +2605,7 @@ void MainWindow::on_actionSolve_FreqCal_triggered() auto data_dir {QDir::toNativeSeparators(m_config.writeable_data_dir().absolutePath()).toLocal8Bit ()}; int iz,irc; double a,b,rms,sigmaa,sigmab; - calibrate_(data_dir.constData (),&iz,&a,&b,&rms,&sigmaa,&sigmab,&irc,data_dir.size ()); + calibrate_(data_dir.constData(), &iz, &a, &b, &rms, &sigmaa, &sigmab, &irc, (FCL)data_dir.size()); QString t2; if(irc==-1) t2="Cannot open " + data_dir + "/fmt.all"; if(irc==-2) t2="Cannot open " + data_dir + "/fcal2.out"; @@ -2582,10 +2650,11 @@ void MainWindow::on_actionCopyright_Notice_triggered() "\"The algorithms, source code, look-and-feel of WSJT-X and related " "programs, and protocol specifications for the modes FSK441, FST4, FT8, " "JT4, JT6M, JT9, JT65, JTMS, QRA64, Q65, MSK144 are Copyright (C) " - "2001-2021 by one or more of the following authors: Joseph Taylor, " + "2001-2022 by one or more of the following authors: Joseph Taylor, " "K1JT; Bill Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, " "IV3NWV; Greg Beam, KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; " - "Philip Karn, KA9Q; and other members of the WSJT Development Group.\""); + "Philip Karn, KA9Q; Chester Fennell, KG4IYS; Uwe Risse, DG2YCB; " + "and other members of the WSJT Development Group.\""); MessageBox::warning_message(this, message); } @@ -2710,6 +2779,9 @@ void MainWindow::on_contest_log_action_triggered() m_contestLogWindow->showNormal (); m_contestLogWindow->raise (); m_contestLogWindow->activateWindow (); + // connect signal from m_logBook.contest_log to m_contestLogWindow + connect(m_logBook.contest_log(), &CabrilloLog::qso_count_changed, m_contestLogWindow.data (), &CabrilloLogWindow::set_nQSO); + m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso()); } void MainWindow::on_actionColors_triggered() @@ -2737,6 +2809,22 @@ void MainWindow::on_actionMessage_averaging_triggered() m_msgAvgWidget->activateWindow(); } +void MainWindow::on_actionActiveStations_triggered() +{ + if(m_ActiveStationsWidget == NULL) { + m_ActiveStationsWidget.reset (new ActiveStations {m_settings, m_config.decoded_text_font ()}); + + // Connect signals from Message Averaging window + connect (this, &MainWindow::finished, m_ActiveStationsWidget.data (), &ActiveStations::close); + } + m_ActiveStationsWidget->showNormal(); + m_ActiveStationsWidget->raise(); + m_ActiveStationsWidget->activateWindow(); + connect(m_ActiveStationsWidget.data(), SIGNAL(callSandP(int)),this,SLOT(callSandP2(int))); + connect(m_ActiveStationsWidget.data(), SIGNAL(activeStationsDisplay()),this,SLOT(ARRL_Digi_Display())); + m_ActiveStationsWidget->setScore(m_score); +} + void MainWindow::on_actionOpen_triggered() //Open File { monitor (false); @@ -2949,10 +3037,10 @@ void MainWindow::on_actionKeyboard_shortcuts_triggered() Alt+H Halt Tx Ctrl+L Lookup callsign in database, generate standard messages Alt+M Monitor - Alt+N Enable Tx + Alt+N Toggle "Enable Tx" Ctrl+O Open a .wav file Alt+O Change operator - Alt+Q Log QSO + Alt+Q Open "Log QSO" window Ctrl+R Set Tx4 message to RRR (not in FT4) Alt+R Set Tx4 message to RR73 Alt+S Stop monitoring @@ -3032,10 +3120,14 @@ void MainWindow::freezeDecode(int n) //freezeDecode() void MainWindow::on_ClrAvgButton_clicked() { m_nclearave=1; - if(m_msgAvgWidget != NULL) { - if(m_msgAvgWidget->isVisible()) m_msgAvgWidget->displayAvg(""); + if(m_mode=="Echo") { + echocom_.nsum=0; + } else { + if(m_msgAvgWidget != NULL) { + if(m_msgAvgWidget->isVisible()) m_msgAvgWidget->displayAvg(""); + } + if(m_mode=="Q65") ndecodes_label.setText("0 0"); } - if(m_mode=="Q65") ndecodes_label.setText("0 0"); } void MainWindow::msgAvgDecode2() @@ -3211,9 +3303,9 @@ void MainWindow::decode() //decode() narg[13]=-1; narg[14]=m_config.aggressive(); memcpy(d2b,dec_data.d2,2*360000); - watcher3.setFuture (QtConcurrent::run (std::bind (fast_decode_,&d2b[0], - &narg[0],&m_TRperiod,&m_msg[0][0], - dec_data.params.mycall,dec_data.params.hiscall,8000,12,12))); + watcher3.setFuture (QtConcurrent::run (std::bind (fast_decode_, &d2b[0], + &narg[0],&m_TRperiod, &m_msg[0][0], dec_data.params.mycall, + dec_data.params.hiscall, (FCL)8000, (FCL)12, (FCL)12))); } else { mem_jt9->lock (); memcpy(to, from, qMin(mem_jt9->size(), size)); @@ -3222,6 +3314,8 @@ void MainWindow::decode() //decode() decodeBusy(true); } } + if((m_mode=="FT4" or (m_mode=="FT8" and m_ihsym==41) or m_diskData) and + m_ActiveStationsWidget != NULL) m_ActiveStationsWidget->erase(); } void::MainWindow::fast_decode_done() @@ -3240,7 +3334,7 @@ void::MainWindow::fast_decode_done() DecodedText decodedtext {message.replace (QChar::LineFeed, "")}; if(!m_bFastDone) { ui->decodedTextBrowser->displayDecodedText (decodedtext, m_config.my_callsign (), m_mode, m_config.DXCC (), - m_logBook, m_currentBand, m_config.ppfx ()); + m_logBook, m_currentBandPeriod, m_config.ppfx ()); } t=message.mid(10,5).toFloat(); @@ -3302,15 +3396,11 @@ void MainWindow::decodeDone () mswait = 1000.0 * ( 1.6 * m_TRperiod - tdone ); } m_bDecoded=m_nDecodes>0; -// qDebug() << "aa 3316" << m_saveDecoded << m_saveAll << m_bDecoded << m_nDecodes -// << m_TRperiod << tdone << mswait; if(!m_diskData and !m_saveAll) { if(m_saveDecoded and (m_nDecodes==0)) { -// qDebug() << "bb 3319" << mswait; killFileTimer.start(mswait); //Kill at 3/4 period } } - if(m_mode!="FT8" or dec_data.params.nzhsym==50) m_nDecodes=0; dec_data.params.nagain=0; dec_data.params.ndiskdat=0; @@ -3327,16 +3417,200 @@ void MainWindow::decodeDone () MessageBox::information_message(this, tr("No more files to open.")); m_bNoMoreFiles=false; } + + if((m_mode=="FT4" or m_mode=="FT8") + and m_latestDecodeTime>=0 and m_ActiveStationsWidget!=NULL) { + if(!m_diskData and (m_nDecodes==0)) { + m_latestDecodeTime = (QDateTime::currentMSecsSinceEpoch()/1000) % 86400; + m_latestDecodeTime = int(m_latestDecodeTime/m_TRperiod); + m_latestDecodeTime = int(m_latestDecodeTime*m_TRperiod); + } + ARRL_Digi_Display(); // Update the ARRL_DIGI display + } + if(m_mode!="FT8" or dec_data.params.nzhsym==50) m_nDecodes=0; +} + +void MainWindow::ARRL_Digi_Update(DecodedText dt) +{ + // Extract information relevant for the ARRL Digi contest + QString deCall; + QString deGrid; + dt.deCallAndGrid(/*out*/deCall,deGrid); + ActiveCall ac; + RecentCall rc; + + if(deGrid.contains(grid_regexp)) { + if(!m_activeCall.contains(deCall) or deGrid!=m_activeCall.value(deCall).grid4) { + // Transmitting station's call is not already in QMap "m_activeCall", or grid has changed. + // Insert the call, grid, and associated fixed data into the list. + + double utch=0.0; + int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; + azdist_(const_cast (m_config.my_grid().left(4).toLatin1().constData()), + const_cast (deGrid.left(4).toLatin1().constData()),&utch, + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6); + int points=nDkm/500; + if(nDkm > 500*points) points += 1; + points += 1; + ac.grid4=deGrid; + ac.bands="......."; + ac.az=nAz; + ac.points=points; + m_activeCall[deCall]=ac; + } + } + + m_points=-1; + if(m_activeCall.contains(deCall)) { + +// Don't display stations we already worked on this band. + QString band=m_config.bands()->find(m_freqNominal); + if(band=="160m" and m_activeCall[deCall].bands.indexOf("a")>=0) {m_recentCall.remove(deCall); return;} + if(band=="80m" and m_activeCall[deCall].bands.indexOf("b")>=0) {m_recentCall.remove(deCall); return;} + if(band=="40m" and m_activeCall[deCall].bands.indexOf("c")>=0) {m_recentCall.remove(deCall); return;} + if(band=="20m" and m_activeCall[deCall].bands.indexOf("d")>=0) {m_recentCall.remove(deCall); return;} + if(band=="15m" and m_activeCall[deCall].bands.indexOf("e")>=0) {m_recentCall.remove(deCall); return;} + if(band=="10m" and m_activeCall[deCall].bands.indexOf("f")>=0) {m_recentCall.remove(deCall); return;} + if(band=="6m" and m_activeCall[deCall].bands.indexOf("g")>=0) {m_recentCall.remove(deCall); return;} + + // Update the variable data for this deCall + rc.dialFreq=m_freqNominal; + rc.audioFreq=dt.frequencyOffset(); + rc.snr=dt.snr(); + m_latestDecodeTime=dt.timeInSeconds(); + rc.txEven = (m_latestDecodeTime % int(2*m_TRperiod)) > 0; + rc.ready2call=false; + bool bCQ=dt.messageWords()[0].left(3)=="CQ "; + if(bCQ or deGrid=="RR73" or deGrid=="73") rc.ready2call=true; + rc.decodeTime=m_latestDecodeTime; + m_recentCall[deCall]=rc; + m_points=m_activeCall.value(deCall).points; + } + updateRate(); +} + +void MainWindow::ARRL_Digi_Display() +{ + QMutableMapIterator icall(m_recentCall); + QString deCall,deGrid; + int age=0; + int i=0; + int maxAge=m_ActiveStationsWidget->maxAge(); + int points=0; + int maxPoints=0; + int indx[1000]; + float pts[1000]; + QStringList list; + + while (icall.hasNext()) { + icall.next(); + deCall=icall.key(); + age=int((m_latestDecodeTime - icall.value().decodeTime)/m_TRperiod + 0.5); + if(age<0) age=age + int(86400/m_TRperiod); + int itx=1; + if(icall.value().txEven) itx=0; + int snr=icall.value().snr; + int freq=icall.value().audioFreq; + if(age>maxAge) { + icall.remove(); + } else { + bool bReady=false; + if(age==0 and m_recentCall.value(deCall).ready2call) bReady=true; + + QString bands=m_activeCall[deCall].bands; + bool bWorkedOnBand=false; + if(m_currentBand=="160m" and bands.mid(0,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="80m" and bands.mid(1,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="40m" and bands.mid(2,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="20m" and bands.mid(3,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="15m" and bands.mid(4,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="10m" and bands.mid(5,1)!=".") bWorkedOnBand=true; + if(m_currentBand=="6m" and bands.mid(6,1)!=".") bWorkedOnBand=true; + + if((bReady or !m_ActiveStationsWidget->readyOnly()) and !bWorkedOnBand) { + i++; + int az=m_activeCall[deCall].az; + deGrid=m_activeCall[deCall].grid4; + points=m_activeCall[deCall].points; + if(points>maxPoints) maxPoints=points; + float x=float(age)/(maxAge+1); + if(x>1.0) x=0; + pts[i-1]=points - x; + QString t1; + if(!bReady) t1 = t1.asprintf(" %3d %+2.2d %4d %1d %2d %4d",az,snr,freq,itx,age,points); + if(bReady) t1 = t1.asprintf(" %3d %+2.2d %4d %1d %2d*%4d",az,snr,freq,itx,age,points); +// t1 = (deCall + " ").left(6) + " " + m_activeCall[deCall].grid4 + t1 + " " + bands; + t1 = (deCall + " ").left(6) + " " + m_activeCall[deCall].grid4 + t1; + list.append(t1); + } + } + } + if(i==0) return; + int jz=i; + m_ActiveStationsWidget->setClickOK(false); + int maxRecent=qMin(i,m_ActiveStationsWidget->maxRecent()); + indexx_(pts,&jz,indx); + QString t; + i=0; + for(int j=jz-1; j>=0; j--) { + int k=indx[j]-1; + m_ready2call[i]=list[k]; + i++; + QString t1=QString::number(i) + ". "; + if(i<10) t1=" " + t1; + t += (t1 + list[k] + "\n"); + if(i>=maxRecent) break; + } + if(m_ActiveStationsWidget!=NULL) m_ActiveStationsWidget->displayRecentStations(t); + m_ActiveStationsWidget->setClickOK(true); +} + +void MainWindow::callSandP2(int n) +{ + if(m_ready2call[n]=="") return; + QStringList w=m_ready2call[n].split(' ', SkipEmptyParts); + m_deCall=w[0]; + m_deGrid=w[1]; + m_bDoubleClicked=true; //### needed? + ui->dxCallEntry->setText(m_deCall); + ui->dxGridEntry->setText(m_deGrid); + genStdMsgs(w[3]); //### real SNR would be better here? + ui->RxFreqSpinBox->setValue(w[4].toInt()); + setTxMsg(1); + m_txFirst = (w[5]=="0"); + ui->txFirstCheckBox->setChecked(m_txFirst); + if (!ui->autoButton->isChecked()) ui->autoButton->click(); // Enable Tx + if(m_transmitting) m_restart=true; +} + +void MainWindow::activeWorked(QString call, QString band) +{ + QString bands=m_activeCall[call].bands; + QByteArray ba=bands.toLatin1(); + if(band=="160m") ba[0]='a'; + if(band=="80m") ba[1]='b'; + if(band=="40m") ba[2]='c'; + if(band=="20m") ba[3]='d'; + if(band=="15m") ba[4]='e'; + if(band=="10m") ba[5]='f'; + if(band=="6m") ba[6]='g'; + m_activeCall[call].bands=QString::fromLatin1(ba); } void MainWindow::readFromStdout() //readFromStdout { + bool bDisplayPoints = false; + if(m_ActiveStationsWidget!=NULL) { + bDisplayPoints=(m_mode=="FT4" or m_mode=="FT8") and + (m_config.special_op_id()==SpecOp::ARRL_DIGI or m_ActiveStationsWidget->isVisible()); + } while(proc_jt9.canReadLine()) { auto line_read = proc_jt9.readLine (); if (auto p = std::strpbrk (line_read.constData (), "\n\r")) { // truncate before line ending chars line_read = line_read.left (p - line_read.constData ()); } + if(bDisplayPoints) line_read=line_read.replace("a7"," "); bool haveFSpread {false}; float fSpread {0.}; if (m_mode.startsWith ("FST4")) @@ -3412,7 +3686,8 @@ void MainWindow::readFromStdout() //readFromStdout if (m_config.insert_blank () && SpecOp::FOX != m_config.special_op_id()) { QString band; - if((QDateTime::currentMSecsSinceEpoch() / 1000 - m_secBandChanged) > 4*int(m_TRperiod)/4) { + if(((QDateTime::currentMSecsSinceEpoch() / 1000 - m_secBandChanged) > 4*int(m_TRperiod)/4) + or m_displayBand) { band = ' ' + m_config.bands ()->find (m_freqNominal); } ui->decodedTextBrowser->insertLineSpacer (band.rightJustified (40, '-')); @@ -3452,10 +3727,37 @@ void MainWindow::readFromStdout() //readFromStdout } } else { DecodedText decodedtext1=decodedtext0; + if((m_mode=="FT4" or m_mode=="FT8") and bDisplayPoints and decodedtext1.isStandardMessage()) { + ARRL_Digi_Update(decodedtext1); + } ui->decodedTextBrowser->displayDecodedText (decodedtext1, m_config.my_callsign (), m_mode, m_config.DXCC (), - m_logBook, m_currentBand, m_config.ppfx (), + m_logBook, m_currentBandPeriod, m_config.ppfx (), ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(), - haveFSpread, fSpread); + 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_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})))) { + 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(); @@ -3476,7 +3778,6 @@ void MainWindow::readFromStdout() //readFromStdout } } } - } } @@ -3491,29 +3792,71 @@ void MainWindow::readFromStdout() //readFromStdout if (parts.size() > 6) { auto for_us = parts[5].contains (m_baseCall) || ("DE" == parts[5] && qAbs (ui->RxFreqSpinBox->value () - audioFreq) <= ftol); - if(m_baseCall == m_config.my_callsign()) - { - if (m_baseCall != parts[5]) - { - for_us=false; - } + if(m_baseCall == m_config.my_callsign()) { + if (m_baseCall != parts[5]) for_us=false; + } else { + if (m_config.my_callsign () != parts[5]) { +// Same base call as ours but different prefix or suffix. Rare but can happen with +// multi-station special events. + for_us = false; } - else - { - if (m_config.my_callsign () != parts[5]) - { - for_us = false; // same base call as ours but - // different prefix or suffix, rare - // but can happen with multi station - // special events + } + if(m_bCallingCQ && !m_bAutoReply && for_us && SpecOp::FOX > m_config.special_op_id()) { + bool bProcessMsgNormally=ui->respondComboBox->currentText()=="CQ: First" or + (ui->respondComboBox->currentText()=="CQ: Max Dist" and m_ActiveStationsWidget==NULL) or + (m_ActiveStationsWidget!=NULL and !m_ActiveStationsWidget->isVisible()); + QString t=decodedtext.messageWords()[4]; + if(t.contains("R+") or t.contains("R-") or t=="R" or t=="RRR" or t=="RR73") bProcessMsgNormally=true; + if(bProcessMsgNormally) { + m_bDoubleClicked=true; + m_bAutoReply = true; + processMessage (decodedtext); + } + + if(!bProcessMsgNormally and m_ActiveStationsWidget and ui->respondComboBox->currentText()=="CQ: Max Dist") { + QString deCall; + QString deGrid; + decodedtext.deCallAndGrid(/*out*/deCall,deGrid); + if(deGrid.contains(grid_regexp) or + (deGrid.contains("+") or deGrid.contains("-"))) { + int points=0; + if(m_activeCall.contains(deCall)) { + points=m_activeCall[deCall].points; + deGrid=m_activeCall[deCall].grid4; + } else if(deGrid.contains(grid_regexp)) { + double utch=0.0; + int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; + azdist_(const_cast ((m_config.my_grid () + " ").left (6).toLatin1 ().constData ()), + const_cast ((deGrid + " ").left(6).toLatin1 ().constData ()),&utch, + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6); + points=nDkm/500; + if(nDkm > 500*points) points += 1; + points += 1; + } + if(points>m_maxPoints) { + m_maxPoints=points; + m_deCall=deCall; + m_bDoubleClicked=true; + ui->dxCallEntry->setText(deCall); + int m_ntx=2; + bool bContest=m_config.special_op_id()==SpecOp::NA_VHF or m_config.special_op_id()==SpecOp::ARRL_DIGI; + if(bContest) m_ntx=3; + if(deGrid.contains(grid_regexp)) { + m_deGrid=deGrid; + ui->dxGridEntry->setText(deGrid); + } else { + m_ntx=3; + } + if(m_ntx==2) m_QSOProgress = REPORT; + if(m_ntx==3) m_QSOProgress = ROGER_REPORT; + genStdMsgs(QString::number(decodedtext.snr())); + ui->RxFreqSpinBox->setValue(decodedtext.frequencyOffset()); + setTxMsg(m_ntx); + m_currentMessageType=m_ntx; } + } } - if(m_bCallingCQ && !m_bAutoReply && for_us && ui->cbFirst->isChecked() and - SpecOp::FOX > m_config.special_op_id()) { - m_bDoubleClicked=true; - m_bAutoReply = true; - if(SpecOp::FOX != m_config.special_op_id()) processMessage (decodedtext); - ui->cbFirst->setStyleSheet(""); + } if(SpecOp::FOX==m_config.special_op_id() and decodedtext.string().contains(" DE ")) for_us=true; //Hound with compound callsign if(SpecOp::FOX==m_config.special_op_id() and for_us and (audioFreq<1000)) bDisplayRight=true; @@ -3529,7 +3872,7 @@ void MainWindow::readFromStdout() //readFromStdout // or contains MyCall if(!m_bBestSPArmed or m_mode!="FT4") { ui->decodedTextBrowser2->displayDecodedText (decodedtext0, m_config.my_callsign (), m_mode, m_config.DXCC (), - m_logBook, m_currentBand, m_config.ppfx ()); + m_logBook, m_currentBand, m_config.ppfx (), false, false, 0.0, bDisplayPoints, m_points); } m_QSOText = decodedtext.string ().trimmed (); } @@ -3709,7 +4052,8 @@ void MainWindow::auto_sequence (DecodedText const& message, unsigned start_toler void MainWindow::pskPost (DecodedText const& decodedtext) { - if (m_diskData || !m_config.spot_to_psk_reporter() || decodedtext.isLowConfidence ()) return; + if (m_diskData || !m_config.spot_to_psk_reporter() || decodedtext.isLowConfidence () + || (decodedtext.string().contains(m_baseCall) && decodedtext.string().contains(m_config.my_grid().left(4)))) return; // prevent self-spotting when running multiple instances QString msgmode=m_mode; QString deCall; @@ -3720,7 +4064,7 @@ void MainWindow::pskPost (DecodedText const& decodedtext) audioFrequency=decodedtext.string().mid(16,4).toInt(); } int snr = decodedtext.snr(); - Frequency frequency = m_freqNominal + audioFrequency; + Frequency frequency = m_freqNominalPeriod + audioFrequency; // prevent spotting wrong band if(grid.contains (grid_regexp)) { // qDebug() << "To PSKreporter:" << deCall << grid << frequency << msgmode << snr; if (!m_psk_Reporter.addRemoteStation (deCall, grid, frequency, msgmode, snr)) @@ -3732,7 +4076,6 @@ void MainWindow::pskPost (DecodedText const& decodedtext) void MainWindow::killFile () { -// qDebug() << "cc 3725" << m_saveDecoded << m_saveAll << m_bDecoded << m_nDecodes << m_fnameWE; if (m_fnameWE.size () && !(m_saveAll || (m_saveDecoded && m_bDecoded))) { QFile f1 {m_fnameWE + ".wav"}; if(f1.exists()) f1.remove(); @@ -4019,18 +4362,18 @@ void MainWindow::guiUpdate() if(m_QSOProgress==REPORT || m_QSOProgress==ROGER_REPORT) m_bSentReport=true; if(m_bSentReport and (m_QSOProgressROGER_REPORT)) m_bSentReport=false; if(m_mode=="JT4") gen4_(message, &ichk , msgsent, const_cast (itone), - &m_currentMessageType, 22, 22); + &m_currentMessageType, (FCL)22, (FCL)22); if(m_mode=="JT9") gen9_(message, &ichk, msgsent, const_cast (itone), - &m_currentMessageType, 22, 22); - if(m_mode=="JT65") gen65_(message, &ichk, msgsent, const_cast (itone), - &m_currentMessageType, 22, 22); + &m_currentMessageType, (FCL)22, (FCL)22); + if(m_mode=="JT65") gen65(message, &ichk, msgsent, const_cast (itone), + &m_currentMessageType); if(m_mode=="WSPR") genwspr_(message, msgsent, const_cast (itone), - 22, 22); + (FCL)22, (FCL)22); if(m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4" or m_mode=="FST4" or m_mode=="FST4W" || "Q65" == m_mode) { if(m_mode=="MSK144") { genmsk_128_90_(message, &ichk, msgsent, const_cast (itone), - &m_currentMessageType, 37, 37); + &m_currentMessageType, (FCL)37, (FCL)37); if(m_restart) { int nsym=144; if(itone[40]==-40) nsym=40; @@ -4046,7 +4389,7 @@ void MainWindow::guiUpdate() int n3=0; char ft8msgbits[77]; genft8_(message, &i3, &n3, msgsent, const_cast (ft8msgbits), - const_cast (itone), 37, 37); + const_cast (itone), (FCL)37, (FCL)37); int nsym=79; int nsps=4*1920; float fsample=48000.0; @@ -4073,7 +4416,7 @@ void MainWindow::guiUpdate() int ichk=0; char ft4msgbits[77]; genft4_(message, &ichk, msgsent, const_cast (ft4msgbits), - const_cast(itone), 37, 37); + const_cast(itone), (FCL)37, (FCL)37); int nsym=103; int nsps=4*576; float fsample=48000.0; @@ -4095,7 +4438,7 @@ void MainWindow::guiUpdate() ba2msg(ba,message); } genfst4_(message,&ichk,msgsent,const_cast (fst4msgbits), - const_cast(itone), &iwspr, 37, 37); + const_cast(itone), &iwspr, (FCL)37, (FCL)37); int hmod=1; if(m_config.x2ToneSpacing()) hmod=2; if(m_config.x4ToneSpacing()) hmod=4; @@ -4122,7 +4465,7 @@ void MainWindow::guiUpdate() if(m_mode=="Q65") { int i3=-1; int n3=-1; - genq65_(message,&ichk,msgsent,const_cast(itone),&i3,&n3,37,37); + genq65_(message, &ichk,msgsent, const_cast(itone), &i3, &n3, (FCL)37, (FCL)37); int nsps=1800; if(m_TRperiod==30) nsps=3600; if(m_TRperiod==60) nsps=7200; @@ -4165,13 +4508,7 @@ void MainWindow::guiUpdate() } m_bCallingCQ = 6 == m_ntx || m_currentMessage.contains (QRegularExpression {"^(CQ|QRZ) "}); - if(m_mode=="FT8" or m_mode=="FT4") { - if(m_bCallingCQ && ui->cbFirst->isVisible () && ui->cbFirst->isChecked ()) { - ui->cbFirst->setStyleSheet("QCheckBox{color:red}"); - } else { - ui->cbFirst->setStyleSheet(""); - } - } + m_maxPoints=-1; if (m_tune) { m_currentMessage = "TUNE"; @@ -4213,7 +4550,8 @@ void MainWindow::guiUpdate() } } - bool b=("FT8"==m_mode or "FT4"==m_mode or "Q65"==m_mode) and ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked (); + bool b=("FT8"==m_mode or "FT4"==m_mode or "Q65"==m_mode) and ui->cbAutoSeq->isVisible () + && ui->cbAutoSeq->isEnabled () && ui->cbAutoSeq->isChecked (); if(is_73 and (m_config.disable_TX_on_73() or b)) { m_nextCall=""; //### Temporary: disable use of "TU;" messages; if(m_nextCall!="") { @@ -4326,7 +4664,8 @@ void MainWindow::guiUpdate() (SpecOp::NA_VHF==m_config.special_op_id() or SpecOp::FIELD_DAY==m_config.special_op_id() or SpecOp::RTTY==m_config.special_op_id() or - SpecOp::WW_DIGI==m_config.special_op_id()) ) { + SpecOp::WW_DIGI==m_config.special_op_id() or + SpecOp::ARRL_DIGI==m_config.special_op_id()) ) { //We're in a contest-like mode other than EU_VHF: start QSO with Tx2. ui->tx1->setEnabled(false); ui->txb1->setEnabled(false); @@ -4460,9 +4799,10 @@ void MainWindow::startTx2() t=ui->tx6->text(); if(t.mid(0,1)=="#") snr=t.mid(1,5).toDouble(); if(snr>0.0 or snr < -50.0) snr=99.0; - if((m_ntx==6 or m_ntx==7) and m_config.force_call_1st()) { + if((m_ntx==6 or m_ntx==7) and m_config.force_call_1st() and + ui->respondComboBox->currentIndex()==0) { ui->cbAutoSeq->setChecked(true); - ui->cbFirst->setChecked(true); + ui->respondComboBox->setCurrentIndex(1); } transmit (snr); ui->signal_meter_widget->setValue(0,0); @@ -4859,7 +5199,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie } QString firstcall = message.call(); - if(firstcall.length()==5 and firstcall.mid(0,3)=="CQ ") firstcall="CQ"; + if(firstcall.length()>=4 and firstcall.mid(0,3)=="CQ ") firstcall="CQ"; if(!m_bFastMode and (!m_config.enable_VHF_features() or m_mode=="FT8")) { // Don't change Tx freq if in a fast mode, or VHF features enabled; also not if a // station is calling me, unless CTRL or SHIFT is held down. @@ -4943,7 +5283,9 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie && (message_words.at(3).contains(qso_partner_base_call) or m_bDoubleClicked or bEU_VHF_w2 or (m_QSOProgress==CALLING))) { if(message_words.at(4).contains(grid_regexp) and SpecOp::EU_VHF!=m_config.special_op_id()) { - if((SpecOp::NA_VHF==m_config.special_op_id() or SpecOp::WW_DIGI==m_config.special_op_id()) and bContestOK){ + if((SpecOp::NA_VHF==m_config.special_op_id() or SpecOp::WW_DIGI==m_config.special_op_id() or + SpecOp::ARRL_DIGI==m_config.special_op_id() ) + and bContestOK) { setTxMsg(3); m_QSOProgress=ROGER_REPORT; } else { @@ -5010,9 +5352,13 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie ui->tx3->setText(t); m_bTUmsg=true; } else { - if (m_QSOProgress > CALLING && m_QSOProgress < SIGNOFF - && SpecOp::NONE < m_config.special_op_id () && SpecOp::FOX > m_config.special_op_id () - && ("RR73" == word_3 || 73 == word_3_as_number)) + +// The following test was to skip sending 73 after receiving RR73, in a contest mode. +// I'm disabling it so thet we always send 73 after receiving RR73. +// if (m_QSOProgress > CALLING && m_QSOProgress < SIGNOFF +// && SpecOp::NONE < m_config.special_op_id () && SpecOp::FOX > m_config.special_op_id () +// && ("RR73" == word_3 || 73 == word_3_as_number)) + if (false) // Always Send 73 after receiving RRR or RR73, even in contest mode. { if (m_config.prompt_to_log() || m_config.autoLog()) { logQSOTimer.start(0); @@ -5191,6 +5537,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie } // if we get here then we are reacting to the message if (m_bAutoReply) m_bCallingCQ = CALLING == m_QSOProgress; + m_maxPoints=-1; if (ui->RxFreqSpinBox->isEnabled () and m_mode != "MSK144" and !shift) { ui->RxFreqSpinBox->setValue (frequency); //Set Rx freq } @@ -5316,6 +5663,7 @@ void MainWindow::genCQMsg () if(SpecOp::FIELD_DAY == m_config.special_op_id()) m_cqStr="FD"; if(SpecOp::RTTY == m_config.special_op_id()) m_cqStr="RU"; if(SpecOp::WW_DIGI == m_config.special_op_id()) m_cqStr="WW"; + if(SpecOp::ARRL_DIGI == m_config.special_op_id()) m_cqStr="TEST"; if( tlist.at(1)==my_callsign ) { t="CQ " + m_cqStr + " " + tlist.at(1) + " " + tlist.at(2); } else { @@ -5374,7 +5722,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional) auto is_type_one = !is77BitMode () && is_compound && shortList (my_callsign); auto const& my_grid = m_config.my_grid ().left (4); auto const& hisBase = Radio::base_callsign (hisCall); - save_dxbase_(const_cast ((hisBase + " ").left (6).toLatin1().constData()),6); + save_dxbase_(const_cast ((hisBase + " ").left(6).toLatin1().constData()), (FCL)6); auto eme_short_codes = m_config.enable_VHF_features () && ui->cbShMsgs->isChecked () && m_mode == "JT65"; @@ -5425,6 +5773,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional) } if(SpecOp::NA_VHF==m_config.special_op_id()) sent=my_grid; if(SpecOp::WW_DIGI==m_config.special_op_id()) sent=my_grid; + if(SpecOp::ARRL_DIGI==m_config.special_op_id()) sent=my_grid; if(SpecOp::FIELD_DAY==m_config.special_op_id()) sent=m_config.Field_Day_Exchange(); if(SpecOp::RTTY==m_config.special_op_id()) { sent=rst + m_config.RTTY_Exchange(); @@ -5761,7 +6110,7 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype() QByteArray s=t.toUpper().toLocal8Bit(); ba2msg(s,message); int ichk=1,itype=0; - gen65_(message,&ichk,msgsent,const_cast(itone0),&itype,22,22); + gen65(message, &ichk,msgsent, const_cast(itone0), &itype); msgsent[22]=0; bool text=false; bool shortMsg=false; @@ -5859,7 +6208,7 @@ void MainWindow::on_dxCallEntry_textChanged (QString const& call) void MainWindow::on_dxCallEntry_editingFinished() { auto const& dxBase = Radio::base_callsign (m_hisCall); - save_dxbase_(const_cast ((dxBase + " ").left (6).toLatin1().constData()),6); + save_dxbase_(const_cast ((dxBase + " ").left (6).toLatin1().constData()), (FCL)6); } @@ -5880,7 +6229,7 @@ void MainWindow::on_dxGridEntry_textChanged (QString const& grid) int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; azdist_(const_cast ((m_config.my_grid () + " ").left (6).toLatin1().constData()), const_cast ((m_hisGrid + " ").left (6).toLatin1().constData()),&utch, - &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,6,6); + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6); QString t; int nd=nDkm; if(m_config.miles()) nd=nDmiles; @@ -5960,6 +6309,10 @@ void MainWindow::on_logQSOButton_clicked() //Log QSO button m_xSent=m_config.my_grid().left(4); m_xRcvd=m_hisGrid; break; + case SpecOp::ARRL_DIGI: + m_xSent=m_config.my_grid().left(4); + m_xRcvd=m_hisGrid; + break; default: break; } @@ -6010,8 +6363,40 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call, ui->sbSerialNumber->setValue(ui->sbSerialNumber->value() + 1); } + if(m_ActiveStationsWidget!=NULL) { + QString band=m_config.bands()->find(dial_freq); + activeWorked(call,band); + int points=m_activeCall[call].points; + m_score += points; + ARRL_logged al; + al.time=QDateTime::currentDateTimeUtc(); + al.band=band; + al.points=points; + m_arrl_log.append(al); + updateRate(); + } + m_xSent.clear (); m_xRcvd.clear (); + +} + +void MainWindow::updateRate() +{ + int iz=m_arrl_log.size(); + int rate=0; + int nbc=0; + double hrDiff; + + for(int i=iz-1; i>=0; i--) { + hrDiff = m_arrl_log[i].time.msecsTo(QDateTime::currentDateTimeUtc())/3600000.0; + if(hrDiff > 1.0) break; + rate += m_arrl_log[i].points; + if(isetRate(rate); + m_ActiveStationsWidget->setScore(m_score); + m_ActiveStationsWidget->setBandChanges(nbc); } qint64 MainWindow::nWidgets(QString t) @@ -6067,8 +6452,7 @@ void MainWindow::displayWidgets(qint64 n) if(i==24) ui->actionEnable_AP_FT8->setVisible (b); if(i==25) ui->actionEnable_AP_JT65->setVisible (b); if(i==26) ui->actionEnable_AP_DXcall->setVisible (b); - if(i==27) ui->cbFirst->setVisible(b); - // if(i==28) ui->labNextCall->setVisible(b); + if(i==27) ui->respondComboBox->setVisible(b); if(i==29) ui->measure_check_box->setVisible(b); if(i==30) ui->labDXped->setVisible(b); if(i==31) ui->cbRxAll->setVisible(b); @@ -6101,7 +6485,11 @@ void MainWindow::displayWidgets(qint64 n) void MainWindow::on_actionFST4_triggered() { - m_mode="FST4"; + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + }); m_mode="FST4"; ui->actionFST4->setChecked(true); m_bFast9=false; @@ -6135,7 +6523,8 @@ void MainWindow::on_actionFST4_triggered() switch_mode (Modes::FST4); m_wideGraph->setMode(m_mode); ui->sbTR->values ({15, 30, 60, 120, 300, 900, 1800}); - on_sbTR_valueChanged (ui->sbTR->value()); + ui->sbTR->setValue (m_settings->value ("TRPeriod_FST4", 60).toInt()); // remember sbTR settings by mode + QTimer::singleShot (50, [=] {on_sbTR_valueChanged (ui->sbTR->value());}); statusChanged(); m_bOK_to_chk=true; chk_FST4_freq_range(); @@ -6173,6 +6562,11 @@ void MainWindow::on_actionFST4W_triggered() void MainWindow::on_actionFT4_triggered() { + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + }); m_mode="FT4"; m_TRperiod=7.5; bool bVHF=m_config.enable_VHF_features(); @@ -6216,12 +6610,16 @@ void MainWindow::on_actionFT4_triggered() void MainWindow::on_actionFT8_triggered() { + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + }); m_mode="FT8"; bool bVHF=m_config.enable_VHF_features(); m_bFast9=false; m_bFastMode=false; WSPR_config(false); - switch_mode (Modes::FT8); m_nsps=6912; m_FFTSize = m_nsps / 2; Q_EMIT FFTSize (m_FFTSize); @@ -6272,6 +6670,8 @@ void MainWindow::on_actionFT8_triggered() on_fox_log_action_triggered(); } if(SpecOp::HOUND == m_config.special_op_id()) { + ui->houndButton->setChecked(true); + ui->houndButton->setStyleSheet("background-color: #ff0000;"); ui->txFirstCheckBox->setChecked(false); ui->txFirstCheckBox->setEnabled(false); ui->cbAutoSeq->setEnabled(false); @@ -6289,15 +6689,23 @@ void MainWindow::on_actionFT8_triggered() ui->txb4->setEnabled(false); ui->txb5->setEnabled(false); ui->txb6->setEnabled(false); + } else { + switch_mode (Modes::FT8); + } + + if(m_config.special_op_id() != SpecOp::HOUND) { + ui->houndButton->setChecked(false); + ui->houndButton->setStyleSheet(""); } if (SpecOp::NONE < m_config.special_op_id () && SpecOp::FOX > m_config.special_op_id ()) { QString t0=""; - if(SpecOp::NA_VHF==m_config.special_op_id()) t0+="NA VHF"; - if(SpecOp::EU_VHF==m_config.special_op_id()) t0+="EU VHF"; - if(SpecOp::FIELD_DAY==m_config.special_op_id()) t0+="Field Day"; - if(SpecOp::RTTY==m_config.special_op_id()) t0+="RTTY"; - if(SpecOp::WW_DIGI==m_config.special_op_id()) t0+="WW_DIGI"; + if(SpecOp::NA_VHF==m_config.special_op_id()) t0="NA VHF"; + if(SpecOp::EU_VHF==m_config.special_op_id()) t0="EU VHF"; + if(SpecOp::FIELD_DAY==m_config.special_op_id()) t0="Field Day"; + if(SpecOp::RTTY==m_config.special_op_id()) t0="RTTY"; + if(SpecOp::WW_DIGI==m_config.special_op_id()) t0="WW_DIGI"; + if(SpecOp::ARRL_DIGI==m_config.special_op_id()) t0="ARRL_DIGI"; if(t0=="") { ui->labDXped->setVisible(false); } else { @@ -6320,6 +6728,10 @@ void MainWindow::on_actionFT8_triggered() void MainWindow::on_actionJT4_triggered() { + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + }); m_mode="JT4"; bool bVHF=m_config.enable_VHF_features(); WSPR_config(false); @@ -6346,7 +6758,10 @@ void MainWindow::on_actionJT4_triggered() ui->lh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); ui->rh_decodes_headings_label->setText("UTC dB DT Freq " + tr ("Message")); if(bVHF) { - ui->sbSubmode->setValue(m_nSubMode); +// ui->sbSubmode->setValue(m_nSubMode); + QTimer::singleShot (50, [=] {m_nSubMode=m_settings->value("SubMode_JT4",0).toInt();}); + QTimer::singleShot (75, [=] {ui->sbSubmode->setValue(m_settings->value("SubMode_JT4",0).toInt());}); + QTimer::singleShot (100, [=] {on_sbSubmode_valueChanged(m_nSubMode);}); } else { ui->sbSubmode->setValue(0); } @@ -6362,6 +6777,7 @@ void MainWindow::on_actionJT4_triggered() void MainWindow::on_actionJT9_triggered() { + QTimer::singleShot (50, [=] {on_sbSubmode_valueChanged(ui->sbSubmode->value());}); m_mode="JT9"; bool bVHF=m_config.enable_VHF_features(); m_bFast9=ui->cbFast9->isChecked(); @@ -6421,6 +6837,10 @@ void MainWindow::on_actionJT9_triggered() void MainWindow::on_actionJT65_triggered() { + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + }); on_actionJT9_triggered(); m_mode="JT65"; bool bVHF=m_config.enable_VHF_features(); @@ -6447,8 +6867,11 @@ void MainWindow::on_actionJT65_triggered() m_bFast9=false; ui->sbSubmode->setMaximum(2); if(bVHF) { - ui->sbSubmode->setValue(m_nSubMode); - ui->lh_decodes_title_label->setText(tr ("Single-Period Decodes")); +// ui->sbSubmode->setValue(m_nSubMode); + QTimer::singleShot (50, [=] {m_nSubMode=m_settings->value("SubMode_JT65",0).toInt();}); + QTimer::singleShot (75, [=] {ui->sbSubmode->setValue(m_settings->value("SubMode_JT65",0).toInt());}); + QTimer::singleShot (100, [=] {on_sbSubmode_valueChanged(m_nSubMode);}); + ui->lh_decodes_title_label->setText(tr ("Single-Period Decodes")); ui->rh_decodes_title_label->setText(tr ("Average Decodes")); } else { ui->sbSubmode->setValue(0); @@ -6471,6 +6894,10 @@ void MainWindow::on_actionJT65_triggered() void MainWindow::on_actionQ65_triggered() { + QTimer::singleShot (50, [=] { + ui->TxFreqSpinBox->setValue(m_settings->value("TxFreq_old",1500).toInt()); + ui->RxFreqSpinBox->setValue(m_settings->value("RxFreq_old",1500).toInt()); + }); m_mode="Q65"; ui->actionQ65->setChecked(true); switch_mode(Modes::Q65); @@ -6483,8 +6910,12 @@ void MainWindow::on_actionQ65_triggered() Q_EMIT FFTSize(m_FFTSize); m_hsymStop=49; ui->sbTR->values ({15, 30, 60, 120, 300}); - on_sbTR_valueChanged (ui->sbTR->value()); - ui->sbSubmode->setValue(m_nSubMode); + ui->sbTR->setValue (m_settings->value ("TRPeriod_Q65", 30).toInt()); // remember sbTR settings by mode + QTimer::singleShot (50, [=] {on_sbTR_valueChanged (ui->sbTR->value());}); +// ui->sbSubmode->setValue(m_nSubMode); + QTimer::singleShot (50, [=] {m_nSubMode=m_settings->value("SubMode_Q65",0).toInt();}); + QTimer::singleShot (75, [=] {ui->sbSubmode->setValue(m_settings->value("SubMode_Q65",0).toInt());}); + QTimer::singleShot (100, [=] {on_sbSubmode_valueChanged(m_nSubMode);}); QString fname {QDir::toNativeSeparators(m_config.temp_dir().absoluteFilePath ("red.dat"))}; m_wideGraph->setRedFile(fname); m_wideGraph->setMode(m_mode); @@ -6507,8 +6938,9 @@ void MainWindow::on_actionQ65_triggered() if(SpecOp::NA_VHF==m_config.special_op_id()) t0="NA VHF"; if(SpecOp::EU_VHF==m_config.special_op_id()) t0="EU VHF"; if(SpecOp::FIELD_DAY==m_config.special_op_id()) t0="Field Day"; - if(SpecOp::RTTY==m_config.special_op_id()) t0+="RTTY"; - if(SpecOp::WW_DIGI==m_config.special_op_id()) t0+="WW_DIGI"; + if(SpecOp::RTTY==m_config.special_op_id()) t0="RTTY"; + if(SpecOp::WW_DIGI==m_config.special_op_id()) t0="WW_DIGI"; + if(SpecOp::ARRL_DIGI==m_config.special_op_id()) t0="ARRL_DIGI"; if(t0=="") { ui->labDXped->setVisible(false); } else { @@ -6553,7 +6985,11 @@ void MainWindow::on_actionMSK144_triggered() m_bFastMode=true; m_bFast9=false; ui->sbTR->values ({5, 10, 15, 30}); - on_sbTR_valueChanged (ui->sbTR->value()); + ui->sbTR->setValue (m_settings->value ("TRPeriod_MSK144", 15).toInt()); // remember sbTR settings by mode + QTimer::singleShot (50, [=] { + on_sbTR_valueChanged (ui->sbTR->value()); + on_sbSubmode_valueChanged(ui->sbSubmode->value()); + }); m_wideGraph->hide(); m_fastGraph->showNormal(); ui->TxFreqSpinBox->setValue(1500); @@ -6580,8 +7016,8 @@ void MainWindow::on_actionMSK144_triggered() statusChanged(); QString t0=""; - if(SpecOp::NA_VHF==m_config.special_op_id()) t0+="NA VHF"; - if(SpecOp::EU_VHF==m_config.special_op_id()) t0+="EU VHF"; + if(SpecOp::NA_VHF==m_config.special_op_id()) t0="NA VHF"; + if(SpecOp::EU_VHF==m_config.special_op_id()) t0="EU VHF"; if(t0=="") { ui->labDXped->setVisible(false); } else { @@ -6645,9 +7081,9 @@ void MainWindow::on_actionEcho_triggered() m_bFastMode=false; m_bFast9=false; WSPR_config(true); - ui->lh_decodes_headings_label->setText(" UTC N Level Sig DF Width Q"); + ui->lh_decodes_headings_label->setText(" UTC N Level SNR dBerr DF Width Q"); // 01234567890123456789012345678901234567 - displayWidgets(nWidgets("00000000000000000000001000000000000000")); + displayWidgets(nWidgets("00000000000000000010001000000000000000")); fast_config(false); statusChanged(); } @@ -6715,7 +7151,7 @@ void MainWindow::WSPR_config(bool b) ui->rh_decodes_widget->setVisible(!b); ui->controls_stack_widget->setCurrentIndex (b && m_mode != "Echo" ? 1 : 0); ui->QSO_controls_widget->setVisible (!b); - ui->DX_controls_widget->setVisible (!b); + ui->DX_controls_widget->setVisible (!b or (m_mode=="Echo")); ui->WSPR_controls_widget->setVisible (b); ui->lh_decodes_title_label->setVisible(!b and ui->cbMenus->isChecked()); ui->logQSOButton->setVisible(!b); @@ -6773,7 +7209,9 @@ void MainWindow::on_TxFreqSpinBox_valueChanged(int n) ui->TxFreqSpinBox->setStyleSheet(""); } } - + if (m_mode != "MSK144" && m_mode != "FST4W" && m_mode != "WSPR" && m_mode != "Echo" && m_mode != "FreqCal") { + QTimer::singleShot (200, [=] {m_settings->setValue("TxFreq_old",ui->TxFreqSpinBox->value());}); + } statusUpdate (); } @@ -6783,6 +7221,9 @@ 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") { + QTimer::singleShot (200, [=] {m_settings->setValue("RxFreq_old",ui->RxFreqSpinBox->value());}); + } statusUpdate (); } @@ -6877,6 +7318,9 @@ void MainWindow::on_reset_cabrillo_log_action_triggered () { if(m_config.RTTY_Exchange()!="SCC") ui->sbSerialNumber->setValue(1); m_logBook.contest_log ()->reset (); + m_activeCall.clear(); //Erase the QMap of active calls + m_score=0; + m_ActiveStationsWidget->setScore(0); } } @@ -7034,6 +7478,7 @@ void MainWindow::on_rptSpinBox_valueChanged(int n) void MainWindow::on_tuneButton_clicked (bool checked) { + if (!m_config.Tune_watchdog_disabled ()) tuneATU_Timer.start (90000); // tune watchdog (90s) static bool lastChecked = false; if (lastChecked == checked) return; lastChecked = checked; @@ -7093,7 +7538,7 @@ void MainWindow::on_stopTxButton_clicked() //Stop Tx m_btxok=false; m_bCallingCQ = false; m_bAutoReply = false; // ready for next - ui->cbFirst->setStyleSheet (""); + m_maxPoints=-1; } void MainWindow::rigOpen () @@ -7240,6 +7685,12 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const& if (m_lastDialFreq != m_freqNominal && (m_mode != "MSK144" || !(ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked()))) { + + if(m_lastDialFreq != m_freqNominal and m_ActiveStationsWidget != NULL) { + m_recentCall.clear(); + m_ActiveStationsWidget->erase(); + } + m_lastDialFreq = m_freqNominal; m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000; pskSetLocal (); @@ -7331,6 +7782,12 @@ void MainWindow::transmit (double snr) true, false, snr, m_TRperiod); } + if((m_mode=="FT4" or m_mode=="FT8") and m_maxPoints>0 and SpecOp::ARRL_DIGI==m_config.special_op_id()) { + ui->dxCallEntry->setText(m_deCall); + ui->dxGridEntry->setText(m_deGrid); + genStdMsgs("-10"); + } + if (m_mode == "FT8") { // toneSpacing=12000.0/1920.0; toneSpacing=-3; @@ -7655,7 +8112,16 @@ void MainWindow::on_sbTR_valueChanged(int value) m_wideGraph->setPeriod (value, m_nsps); progressBar.setMaximum (value); } - if(m_mode=="FST4") chk_FST4_freq_range(); + if (m_mode=="Q65") { + QTimer::singleShot (200, [=] {m_settings->setValue ("TRPeriod_Q65", ui->sbTR->value ());}); + } + if (m_mode=="MSK144") { + QTimer::singleShot (200, [=] {m_settings->setValue ("TRPeriod_MSK144", ui->sbTR->value ());}); + } + if (m_mode=="FST4") { + chk_FST4_freq_range(); + QTimer::singleShot (200, [=] {m_settings->setValue ("TRPeriod_FST4", ui->sbTR->value ());}); + } // if(m_transmitting) on_stopTxButton_clicked(); //### Is this needed or desirable? ### on_sbSubmode_valueChanged(ui->sbSubmode->value()); statusUpdate (); @@ -7711,6 +8177,10 @@ void MainWindow::on_sbSubmode_valueChanged(int n) if(m_bFast9) ui->TxFreqSpinBox->setValue(700); } if(m_transmitting and m_bFast9 and m_nSubMode>=4) transmit (99.0); + if (m_mode !="Q65") ui->TxFreqSpinBox->setStyleSheet(""); + if (m_mode=="Q65") {QTimer::singleShot (200, [=] {m_settings->setValue("SubMode_Q65",ui->sbSubmode->value());});} + if (m_mode=="JT65") {QTimer::singleShot (200, [=] {m_settings->setValue("SubMode_JT65",ui->sbSubmode->value());});} + if (m_mode=="JT4") {QTimer::singleShot (200, [=] {m_settings->setValue("SubMode_JT4",ui->sbSubmode->value());});} statusUpdate (); } @@ -7814,7 +8284,7 @@ void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 de showNormal (); raise (); } - if (text.contains (QRegularExpression {R"(^(CQ |CQDX |QRZ ))"})) { + if ((text.contains (QRegularExpression {R"(^(CQ |CQDX |QRZ ))"})) || (ui->cbHoldTxFreq->isChecked ())) { // a message we are willing to accept and auto reply to m_bDoubleClicked = true; } @@ -7956,8 +8426,7 @@ void MainWindow::p1ReadFromStdout() //p1readFromStdout } m_nWSPRdecodes=0; ui->DecodeButton->setChecked (false); - if (m_uploadWSPRSpots - && m_config.is_transceiver_online ()) { // need working rig control + if(m_uploadWSPRSpots && m_config.is_transceiver_online()) { // need working rig control #if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0) uploadTimer.start(QRandomGenerator::global ()->bounded (0, 20000)); // Upload delay #else @@ -7972,7 +8441,6 @@ void MainWindow::p1ReadFromStdout() //p1readFromStdout m_decoderBusy = false; statusUpdate (); } else { - int n=t.length(); t=t.mid(0,n-2) + " "; t.remove(QRegExp("\\s+$")); @@ -8010,7 +8478,7 @@ void MainWindow::p1ReadFromStdout() //p1readFromStdout int nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter; azdist_(const_cast ((m_config.my_grid () + " ").left (6).toLatin1 ().constData ()), const_cast ((grid + " ").left (6).toLatin1 ().constData ()),&utch, - &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,6,6); + &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,(FCL)6,(FCL)6); QString t1; if(m_config.miles()) { t1 = t1.asprintf("%7d",nDmiles); @@ -8530,21 +8998,9 @@ void MainWindow::on_cbCQonly_toggled(bool) decodeBusy(true); } -void MainWindow::on_cbFirst_toggled(bool b) -{ - if (b) { - if (m_auto && CALLING == m_QSOProgress) { - ui->cbFirst->setStyleSheet ("QCheckBox{color:red}"); - } - } else { - ui->cbFirst->setStyleSheet (""); - } -} - void MainWindow::on_cbAutoSeq_toggled(bool b) { - if(!b) ui->cbFirst->setChecked(false); - ui->cbFirst->setVisible((m_mode=="FT8" or m_mode=="FT4" or m_mode=="FST4" + ui->respondComboBox->setVisible((m_mode=="FT8" or m_mode=="FT4" or m_mode=="FST4" or m_mode=="Q65") and b); } @@ -9221,6 +9677,7 @@ void MainWindow::foxTest() void MainWindow::write_all(QString txRx, QString message) { + if (!(ui->actionDisable_writing_of_ALL_TXT->isChecked())) { QString line; QString t; QString msg; @@ -9249,7 +9706,7 @@ void MainWindow::write_all(QString txRx, QString message) auto time = QDateTime::currentDateTimeUtc (); if( txRx=="Rx" && !m_bFastMode ) time=m_dateTimeSeqStart; - t = t.asprintf("%10.3f ",m_freqNominal/1.e6); + t = t.asprintf("%10.3f ",m_freqNominalPeriod/1.e6); // prevent writing of wrong frequencies if (m_diskData) { if (m_fileDateTime.size()==11) { line=m_fileDateTime + " " + t + txRx + " " + mode_string + msg; @@ -9261,6 +9718,8 @@ void MainWindow::write_all(QString txRx, QString message) } QString file_name="ALL.TXT"; + if (ui->actionSplit_ALL_TXT_yearly->isChecked()) file_name=(time.toString("yyyy") + "-" + "ALL.TXT"); + if (ui->actionSplit_ALL_TXT_monthly->isChecked()) file_name=(time.toString("yyyy-MM") + "-" + "ALL.TXT"); if (m_mode=="WSPR") file_name="ALL_WSPR.TXT"; QFile f{m_config.writeable_data_dir().absoluteFilePath(file_name)}; if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { @@ -9279,24 +9738,26 @@ void MainWindow::write_all(QString txRx, QString message) QTimer::singleShot (0, [=] { // don't block guiUpdate MessageBox::warning_message(this, tr ("Log File Error"), message2); }); } + } } void MainWindow::chkFT4() { if(m_mode!="FT4") return; ui->cbAutoSeq->setEnabled(true); - ui->cbFirst->setVisible(true); - ui->cbFirst->setEnabled(true); + ui->respondComboBox->setVisible(true); + ui->respondComboBox->setEnabled(true); ui->labDXped->setVisible(m_config.special_op_id()!=SpecOp::NONE); - ui->cbFirst->setVisible(ui->cbAutoSeq->isChecked()); + ui->respondComboBox->setVisible(ui->cbAutoSeq->isChecked()); if (SpecOp::NONE < m_config.special_op_id () && SpecOp::FOX > m_config.special_op_id ()) { QString t0=""; - if(SpecOp::NA_VHF==m_config.special_op_id()) t0+="NA VHF"; - if(SpecOp::EU_VHF==m_config.special_op_id()) t0+="EU VHF"; - if(SpecOp::FIELD_DAY==m_config.special_op_id()) t0+="Field Day"; - if(SpecOp::RTTY==m_config.special_op_id()) t0+="RTTY"; - if(SpecOp::WW_DIGI==m_config.special_op_id()) t0+="WW_DIGI"; + if(SpecOp::NA_VHF==m_config.special_op_id()) t0="NA VHF"; + if(SpecOp::EU_VHF==m_config.special_op_id()) t0="EU VHF"; + if(SpecOp::FIELD_DAY==m_config.special_op_id()) t0="Field Day"; + if(SpecOp::RTTY==m_config.special_op_id()) t0="RTTY"; + if(SpecOp::WW_DIGI==m_config.special_op_id()) t0="WW_DIGI"; + if(SpecOp::ARRL_DIGI==m_config.special_op_id()) t0="ARRL_DIGI"; if(t0=="") { ui->labDXped->setVisible(false); } else { @@ -9443,3 +9904,55 @@ QString MainWindow::WSPR_message() } return msg2; } + +void MainWindow::on_houndButton_clicked (bool checked) +{ + if (checked) { + ui->houndButton->setStyleSheet("background-color: #ff0000;"); + m_config.setSpecial_Hound(); + } else { + ui->houndButton->setStyleSheet(""); + m_config.setSpecial_None(); + } + on_actionFT8_triggered(); +} + +void MainWindow::on_ft8Button_clicked() +{ + ui->houndButton->setChecked(false); + ui->houndButton->setStyleSheet(""); + if(m_config.special_op_id()==SpecOp::HOUND) m_config.setSpecial_None(); + on_actionFT8_triggered(); +} + +void MainWindow::on_ft4Button_clicked() +{ + ui->houndButton->setChecked(false); + ui->houndButton->setStyleSheet(""); + if(m_config.special_op_id()==SpecOp::HOUND) m_config.setSpecial_None(); + on_actionFT4_triggered(); +} + +void MainWindow::on_msk144Button_clicked() +{ + ui->houndButton->setChecked(false); + ui->houndButton->setStyleSheet(""); + if(m_config.special_op_id()==SpecOp::HOUND) m_config.setSpecial_None(); + on_actionMSK144_triggered(); +} + +void MainWindow::on_q65Button_clicked() +{ + ui->houndButton->setChecked(false); + ui->houndButton->setStyleSheet(""); + if(m_config.special_op_id()==SpecOp::HOUND) m_config.setSpecial_None(); + on_actionQ65_triggered(); +} + +void MainWindow::on_jt65Button_clicked() +{ + ui->houndButton->setChecked(false); + ui->houndButton->setStyleSheet(""); + if(m_config.special_op_id()==SpecOp::HOUND) m_config.setSpecial_None(); + on_actionJT65_triggered(); +} -- cgit v1.2.3