From 0a07f6058ac41328abe8c44635458a30f60c038b Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 7 Dec 2017 15:38:48 +0000 Subject: [PATCH] More work on Fox-mode code. Another intermediate commit -- much still TBD. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8293 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 81 +++++++++++++++++++++++++------------------------- mainwindow.h | 2 ++ mainwindow.ui | 5 +--- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index bf6e00369..863f8a841 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -912,7 +912,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, Q_EMIT finished (); } - if(!ui->cbMenus->isChecked()) { ui->cbMenus->setChecked(true); ui->cbMenus->setChecked(false); @@ -1157,11 +1156,8 @@ void MainWindow::setDecodedTextFont (QFont const& font) { ui->decodedTextBrowser->setContentFont (font); ui->decodedTextBrowser2->setContentFont (font); - ui->textBrowser3->setContentFont(font); ui->textBrowser4->setContentFont(font); - ui->textBrowser3->displayFoxToBeCalled(" ","#ffffff"); ui->textBrowser4->displayFoxToBeCalled(" ","#ffffff"); - ui->textBrowser3->setText(""); ui->textBrowser4->setText(""); auto style_sheet = "QLabel {" + font_as_stylesheet (font) + '}'; ui->decodedTextLabel->setStyleSheet (ui->decodedTextLabel->styleSheet () + style_sheet); @@ -7021,7 +7017,6 @@ void MainWindow::on_sbMax_dB_valueChanged(int n) void MainWindow::on_pbFoxReset_clicked() { - ui->textBrowser3->setText(""); ui->textBrowser4->setText(""); for(int i=0; i map; QStringList lines,lines2; QString msg,houndCall,t1; @@ -7059,8 +7056,8 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB) lines = t.split("\n"); nlines=lines.length()-1; for(i=0; itextBrowser3->toPlainText().indexOf(houndCall) >= 0) return; if(ui->textBrowser4->toPlainText().indexOf(houndCall) >= 0) return; + for(int i=0; itextBrowser4->displayFoxToBeCalled(t1,"#ffffff"); // Add hound call and rpt to queue + QTextCursor cursor = ui->textBrowser4->textCursor(); + cursor.setPosition(0); + ui->textBrowser4->setTextCursor(cursor); } //------------------------------------------------------------------------------ @@ -7190,8 +7192,7 @@ void MainWindow::houndCallers() line=s.readLine(); houndCall=line.mid(0,6); paddedHoundCall=houndCall + " "; - if(!ui->textBrowser3->toPlainText().contains(paddedHoundCall) and - !ui->textBrowser4->toPlainText().contains(paddedHoundCall)) { + if(!ui->textBrowser4->toPlainText().contains(paddedHoundCall)) { QString countryName,continent; bool callWorkedBefore,countryWorkedBefore; m_logBook.match(/*in*/houndCall,/*out*/countryName,callWorkedBefore,countryWorkedBefore); @@ -7214,42 +7215,42 @@ void MainWindow::houndCallers() void MainWindow::foxRxSequencer(QString houndCall, QString houndGrid) { /* Called from "readFromStdOut()" to process decoded messages of the form - * "myCall houndCall R+rpt". If houndCall matches a callsign in one of - * our active QSO slots, we prepare to send "houndCall RR73" to that caller. - * If no suitable message appears for slot i, we queue its message to be - * repeated. + * "myCall houndCall R+rpt". + * + * If houndCall matches a callsign in one of our active QSO slots, we + * prepare to send "houndCall RR73" to that caller. If no suitable + * message appears for slot i, we queue its message to be repeated. */ - ui->textBrowser3->setText(""); for(int i=0; itextBrowser3->displayFoxToBeCalled(m_foxMsgToBeSent[i],"#ffffff"); } - qDebug() << " "; } void MainWindow::foxTxSequencer() { /* Called from guiUpdate at the point where an FT8 Fox-mode transmission - * is to be started. Here we determine what the Tx message(s) will be, - * and then call foxgen() to generate the corresponding waveform. + * is to be started. + * + * Determine what the Tx message(s) will be for each active slot, call + * foxgen() to generate and accumulate the corresponding waveform. */ - QString allQSOtext=""; - QString nextTxMessages=ui->textBrowser3->toPlainText(); -// int islots=nextTxMessages.split("\n").size() - 1; + for(int i=0; i0) m_foxMsgToBeSent[i]=m_foxMsgToBeSent[i].mid(i1+2); + QString fm=m_foxMsgToBeSent[i]; //Fox message to be transmitted in this slot if(fm=="") { if(!m_houndQueue.isEmpty()) { QString t=m_houndQueue.dequeue(); - m_houndCall[i]=t.mid(0,6); + m_houndCall[i]=t.mid(0,6).trimmed(); QString rpt=t.mid(7,3); fm= m_houndCall[i] + " " + m_config.my_callsign() + " " + rpt; QString tb4=ui->textBrowser4->toPlainText(); @@ -7262,45 +7263,45 @@ void MainWindow::foxTxSequencer() } if(fm.contains(" RR73")) { - qDebug() << "Logged:" << i << fm << m_houndCall[i] << m_houndRptSent[i] << m_houndRptRcvd[i]; + qDebug() << "Logged:" << i << m_houndCall[i] << m_houndRptSent[i] << m_houndRptRcvd[i]; if(!m_houndQueue.isEmpty()) { QString t=m_houndQueue.dequeue(); //Fetch next hound call - m_houndCall[i]=t.mid(0,6); + m_houndCall[i]=t.mid(0,6).trimmed(); QString rpt=t.mid(7,3); fm=fm.mid(0,7) + "RR73; " + m_houndCall[i] + " <" + m_config.my_callsign() + "> " + rpt; - QString tb4=ui->textBrowser4->toPlainText(); //Remove popped call from tb4 tb4=tb4.remove(t+"\n"); ui->textBrowser4->setText(tb4); - - //In case we might need to send a repeat: - m_foxMsgToBeSent[i]=m_houndCall[i] + " " + m_config.my_callsign() + " " + rpt; - } else { fm=m_houndCall[i] + " " + m_config.my_callsign() + " RR73"; - qDebug() << "a2" << i << fm; } } fm += " "; fm=fm.mid(0,32); + if(m_houndCall[i]!=m_houndCall0[i]) { + m_nFoxMsgTimes[i]=0; + } + m_houndCall0[i]=m_houndCall[i]; + m_nFoxMsgTimes[i]++; +// ### Send a flag with m_nFoxMsgTimes[i] to tb2 ### ui->decodedTextBrowser2->displayTransmittedText(fm, m_modeTx, 300+60*i,m_config.color_TxMsg(),m_bFastMode); foxcom_.i3bit[i]=0; if(fm.indexOf("<")>0) foxcom_.i3bit[i]=1; strncpy(&foxcom_.cmsg[i][0], fm.toLatin1(),32); //Copy this message into cmsg[i] m_foxMsgSent[i]=fm.trimmed(); //What was actually sent - qDebug() << "Tx:" << i << foxcom_.i3bit[i] << m_foxMsgSent[i] << m_foxMsgToBeSent[i]; +// qDebug() << "Tx:" << i << foxcom_.i3bit[i] << m_foxMsgSent[i] << m_nFoxMsgTimes[i]; + i1=fm.indexOf(";"); + if(i1>0) fm=fm.mid(i1+2); + m_foxMsgToBeSent[i]=fm; - int i1=qMax(fm.indexOf("+"),fm.indexOf("-")); + i1=qMax(fm.indexOf("+"),fm.indexOf("-")); if(i1>6) { m_houndRptSent[i]=fm.mid(i1,3); //Active hound call for slot i } - allQSOtext += (fm + "\n"); } - qDebug() << " "; - ui->textBrowser3->setText(allQSOtext); foxcom_.nslots=m_Nslots; foxgen_(); } diff --git a/mainwindow.h b/mainwindow.h index 4586617d3..30677533b 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -420,6 +420,7 @@ private: qint32 m_nHoundsCalling=0; qint32 m_Nsig=12; qint32 m_Nslots=5; + qint32 m_nFoxMsgTimes[5]={0,0,0,0,0}; bool m_btxok; //True if OK to transmit bool m_diskData; @@ -559,6 +560,7 @@ private: QString m_opCall; QString m_houndCallers; //Sorted list of Hound callers QString m_houndCall[5]; + QString m_houndCall0[5]; QString m_houndGrid[5]; QString m_houndRptSent[5]; QString m_houndRptRcvd[5]; diff --git a/mainwindow.ui b/mainwindow.ui index c11d7f259..bb81c2d49 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -1049,7 +1049,7 @@ QLabel[oob="true"] { QTabWidget::Triangular - 2 + 0 @@ -1623,9 +1623,6 @@ list. The list can be maintained in Settings (F2). 3 - - -