From 06b97466198c07ceb3ee6a340a2a467f7e2a34f7 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 20 Jul 2020 18:27:29 +0100 Subject: [PATCH] Make fSpread printing compatible with QSOs --- widgets/displaytext.cpp | 8 +++++++- widgets/displaytext.h | 3 ++- widgets/mainwindow.cpp | 23 ++++++++++++++--------- widgets/mainwindow.h | 1 - 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp index 5d8136a01..75807c959 100644 --- a/widgets/displaytext.cpp +++ b/widgets/displaytext.cpp @@ -387,7 +387,8 @@ QString DisplayText::appendWorkedB4 (QString message, QString call, QString cons void DisplayText::displayDecodedText(DecodedText const& decodedText, QString const& myCall, QString const& mode, bool displayDXCCEntity, LogBook const& logBook, - QString const& currentBand, bool ppfx, bool bCQonly) + QString const& currentBand, bool ppfx, bool bCQonly, + bool haveFSpread, float fSpread) { m_bPrincipalPrefix=ppfx; QColor bg; @@ -421,6 +422,11 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"}; if(!dxGrid.contains(grid_regexp)) dxGrid=""; message = message.left (message.indexOf (QChar::Nbsp)); // strip appended info + if (haveFSpread) + { + message += QString {37 - message.size (), QChar {' '}}; + message += QChar::Nbsp + QString {"%1"}.arg (fSpread, 5, 'f', fSpread < 0.95 ? 3 : 2); + } m_CQPriority=""; if (CQcall) { diff --git a/widgets/displaytext.h b/widgets/displaytext.h index d4adc3d2c..fbbfa5656 100644 --- a/widgets/displaytext.h +++ b/widgets/displaytext.h @@ -30,7 +30,8 @@ public: void insertLineSpacer(QString const&); void displayDecodedText(DecodedText const& decodedText, QString const& myCall, QString const& mode, bool displayDXCCEntity, LogBook const& logBook, - QString const& currentBand=QString {}, bool ppfx=false, bool bCQonly=false); + QString const& currentBand=QString {}, bool ppfx=false, bool bCQonly=false, + bool haveFSpread = false, float fSpread = 0.); void displayTransmittedText(QString text, QString modeTx, qint32 txFreq, bool bFastMode, double TRperiod); void displayQSY(QString text); void displayFoxToBeCalled(QString t, QColor bg = QColor {}, QColor fg = QColor {}); diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 9c1825f27..35869b2c5 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -3145,12 +3145,21 @@ void MainWindow::readFromStdout() //readFromStdout { while(proc_jt9.canReadLine()) { auto line_read = proc_jt9.readLine (); - m_fSpread=line_read.mid(64,6).toFloat(); - line_read=line_read.left(64); if (auto p = std::strpbrk (line_read.constData (), "\n\r")) { // truncate before line ending chars line_read = line_read.left (p - line_read.constData ()); } + bool haveFSpread {false}; + float fSpread {0.}; + if (m_mode.startsWith ("FST240")) + { + auto text = line_read.mid (64, 6).trimmed (); + if (text.size ()) + { + fSpread = text.toFloat (&haveFSpread); + line_read = line_read.left (64); + } + } if(m_mode!="FT8" and m_mode!="FT4") { //Pad 22-char msg to at least 37 chars line_read = line_read.left(44) + " " + line_read.mid(44); @@ -3232,14 +3241,10 @@ void MainWindow::readFromStdout() //readFromStdout } } else { DecodedText decodedtext1=decodedtext0; - if(m_mode.startsWith("FST240") and m_fSpread>0.0) { - QString t=decodedtext0.string(); - DecodedText dt2 {QString {"%1%2%3"}.arg (t.left (46)).arg (m_fSpread, 5, 'f', m_fSpread < 0.95 ? 2 : 3).arg (t.mid(50)).trimmed ()}; - decodedtext1=dt2; - } ui->decodedTextBrowser->displayDecodedText(decodedtext1,m_baseCall,m_mode,m_config.DXCC(), - m_logBook,m_currentBand,m_config.ppfx(), - (ui->cbCQonly->isVisible() and ui->cbCQonly->isChecked())); + m_logBook,m_currentBand,m_config.ppfx(), + ui->cbCQonly->isVisible() && ui->cbCQonly->isChecked(), + haveFSpread, fSpread); if(m_bBestSPArmed and m_mode=="FT4") { QString messagePriority=ui->decodedTextBrowser->CQPriority(); diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 630935ac8..8170de842 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -419,7 +419,6 @@ private: float m_t0Pick; float m_t1Pick; float m_fCPUmskrtd; - float m_fSpread; qint32 m_waterfallAvg; qint32 m_ntx;