Updates for Qt v5.14 compaibility

This commit is contained in:
Bill Somerville 2020-05-07 02:56:57 +01:00
parent eb7681c7c5
commit 1403c186d2
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
8 changed files with 77 additions and 45 deletions

View File

@ -187,7 +187,7 @@ QString DecodedText::report() const // returns a string of the SNR field with a
sr = 49; sr = 49;
QString rpt; QString rpt;
rpt.sprintf("%d",abs(sr)); rpt = rpt.asprintf("%d",abs(sr));
if (sr > 9) if (sr > 9)
rpt = "+" + rpt; rpt = "+" + rpt;
else else

View File

@ -35,7 +35,7 @@ namespace
{ {
QString message; QString message;
static char constexpr fmt[] = "Hamlib: %s"; static char constexpr fmt[] = "Hamlib: %s";
message = message.vsprintf (format, ap).trimmed (); message = message.vasprintf (format, ap).trimmed ();
switch (level) switch (level)
{ {

View File

@ -274,10 +274,10 @@ WSPRBandHopping::WSPRBandHopping (QSettings * settings, Configuration const * co
: m_ {settings, configuration, parent_widget} : m_ {settings, configuration, parent_widget}
{ {
// detect changes to the working frequencies model // detect changes to the working frequencies model
m_->WSPR_bands_ = m_->configuration_->frequencies ()->all_bands (m_->configuration_->region (), Modes::WSPR).toList (); m_->WSPR_bands_ = m_->configuration_->frequencies ()->all_bands (m_->configuration_->region (), Modes::WSPR).values ();
connect (m_->configuration_->frequencies (), &QAbstractItemModel::layoutChanged connect (m_->configuration_->frequencies (), &QAbstractItemModel::layoutChanged
, [this] () { , [this] () {
m_->WSPR_bands_ = m_->configuration_->frequencies ()->all_bands (m_->configuration_->region (), Modes::WSPR).toList (); m_->WSPR_bands_ = m_->configuration_->frequencies ()->all_bands (m_->configuration_->region (), Modes::WSPR).values ();
}); });
// load settings // load settings
@ -379,7 +379,11 @@ auto WSPRBandHopping::next_hop (bool tx_enabled) -> Hop
if (frequencies_index < 0) if (frequencies_index < 0)
{ {
// build sets of available rx and tx bands // build sets of available rx and tx bands
#if QT_VERSION < QT_VERSION_CHECK (5, 14, 0)
auto target_rx_bands = m_->WSPR_bands_.toSet (); auto target_rx_bands = m_->WSPR_bands_.toSet ();
#else
QSet<QString> target_rx_bands {m_->WSPR_bands_.begin (), m_->WSPR_bands_.end ()};
#endif
auto target_tx_bands = target_rx_bands; auto target_tx_bands = target_rx_bands;
for (auto i = 0; i < m_->bands_[period_index].size (); ++i) for (auto i = 0; i < m_->bands_[period_index].size (); ++i)
{ {
@ -403,16 +407,23 @@ auto WSPRBandHopping::next_hop (bool tx_enabled) -> Hop
// if we have some bands to permute // if we have some bands to permute
if (target_rx_bands.size () + target_tx_bands.size ()) if (target_rx_bands.size () + target_tx_bands.size ())
{ {
#if QT_VERSION < QT_VERSION_CHECK (5, 14, 0)
auto rx_permutations = m_->rx_permutation_.toSet ();
auto tx_permutations = m_->tx_permutation_.toSet ();
#else
QSet<QString> rx_permutations {m_->rx_permutation_.begin (), m_->rx_permutation_.end ()};
QSet<QString> tx_permutations {m_->tx_permutation_.begin (), m_->tx_permutation_.end ()};
#endif
if (!(m_->rx_permutation_.size () + m_->tx_permutation_.size ()) // all used up if (!(m_->rx_permutation_.size () + m_->tx_permutation_.size ()) // all used up
// or rx list contains a band no longer scheduled // or rx list contains a band no longer scheduled
|| !target_rx_bands.contains (m_->rx_permutation_.toSet ()) || !target_rx_bands.contains (rx_permutations)
// or tx list contains a band no longer scheduled for tx // or tx list contains a band no longer scheduled for tx
|| !target_tx_bands.contains (m_->tx_permutation_.toSet ())) || !target_tx_bands.contains (tx_permutations))
{ {
// build new random permutations // build new random permutations
m_->rx_permutation_ = target_rx_bands.toList (); m_->rx_permutation_ = target_rx_bands.values ();
std::random_shuffle (std::begin (m_->rx_permutation_), std::end (m_->rx_permutation_)); std::random_shuffle (std::begin (m_->rx_permutation_), std::end (m_->rx_permutation_));
m_->tx_permutation_ = target_tx_bands.toList (); m_->tx_permutation_ = target_tx_bands.values ();
std::random_shuffle (std::begin (m_->tx_permutation_), std::end (m_->tx_permutation_)); std::random_shuffle (std::begin (m_->tx_permutation_), std::end (m_->tx_permutation_));
// qDebug () << "New random Rx permutation:" << m_->rx_permutation_ // qDebug () << "New random Rx permutation:" << m_->rx_permutation_
// << "random Tx permutation:" << m_->tx_permutation_; // << "random Tx permutation:" << m_->tx_permutation_;

View File

@ -212,7 +212,7 @@ int ptt(int nport, int ntx, int* iptt, int* nopen)
FILE_ATTRIBUTE_NORMAL,NULL); FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile==INVALID_HANDLE_VALUE) { if(hFile==INVALID_HANDLE_VALUE) {
QString t; QString t;
t.sprintf("Cannot open COM port %d for PTT\n",nport); t = t.asprintf("Cannot open COM port %d for PTT\n",nport);
return 1; return 1;
} }
*nopen=1; *nopen=1;

View File

@ -463,7 +463,7 @@ void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 tx
if(modeTx=="JT65") t1=" # "; if(modeTx=="JT65") t1=" # ";
if(modeTx=="MSK144") t1=" & "; if(modeTx=="MSK144") t1=" & ";
QString t2; QString t2;
t2.sprintf("%4d",txFreq); t2 = t2.asprintf("%4d",txFreq);
QString t; QString t;
if(bFastMode or modeTx=="FT8" or modeTx=="FT4") { if(bFastMode or modeTx=="FT8" or modeTx=="FT4") {
t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \ t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \

View File

@ -155,7 +155,7 @@ void FPlotter::draw() //draw()
int ih=m_UTCdisk/10000; int ih=m_UTCdisk/10000;
int im=m_UTCdisk/100 % 100; int im=m_UTCdisk/100 % 100;
int is=m_UTCdisk % 100; int is=m_UTCdisk % 100;
m_t.sprintf("%2.2d:%2.2d:%2.2d",ih,im,is); m_t = m_t.asprintf("%2.2d:%2.2d:%2.2d",ih,im,is);
} }
int k0=m_jh0; int k0=m_jh0;
@ -168,7 +168,7 @@ void FPlotter::draw() //draw()
int ih=m_UTCdisk/10000; int ih=m_UTCdisk/10000;
int im=m_UTCdisk/100 % 100; int im=m_UTCdisk/100 % 100;
int is=m_UTCdisk % 100; int is=m_UTCdisk % 100;
m_t.sprintf("%2.2d:%2.2d:%2.2d",ih,im,is); m_t = m_t.asprintf("%2.2d:%2.2d:%2.2d",ih,im,is);
} else { } else {
m_t=QDateTime::currentDateTimeUtc().toString("hh:mm:ss"); m_t=QDateTime::currentDateTimeUtc().toString("hh:mm:ss");
} }
@ -243,7 +243,7 @@ void FPlotter::mouseMoveEvent(QMouseEvent *event)
// int y=event->y(); // int y=event->y();
float t=x/m_pixPerSecond; float t=x/m_pixPerSecond;
QString t1; QString t1;
t1.sprintf("%5.2f",t); t1 = t1.asprintf("%5.2f",t);
QRectF rect0(78,85,40,13); //### Should use font metrics ### QRectF rect0(78,85,40,13); //### Should use font metrics ###
painter.fillRect(rect0,Qt::black); painter.fillRect(rect0,Qt::black);
painter.setPen(Qt::yellow); painter.setPen(Qt::yellow);

View File

@ -649,29 +649,50 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
setWindowTitle (program_title ()); setWindowTitle (program_title ());
connect(&proc_jt9, &QProcess::readyReadStandardOutput, this, &MainWindow::readFromStdout); connect(&proc_jt9, &QProcess::readyReadStandardOutput, this, &MainWindow::readFromStdout);
#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
connect(&proc_jt9, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error), connect(&proc_jt9, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
[this] (QProcess::ProcessError error) { [this] (QProcess::ProcessError error) {
subProcessError (&proc_jt9, error); subProcessError (&proc_jt9, error);
}); });
#else
connect(&proc_jt9, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::errorOccurred),
[this] (QProcess::ProcessError error) {
subProcessError (&proc_jt9, error);
});
#endif
connect(&proc_jt9, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished), connect(&proc_jt9, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
[this] (int exitCode, QProcess::ExitStatus status) { [this] (int exitCode, QProcess::ExitStatus status) {
subProcessFailed (&proc_jt9, exitCode, status); subProcessFailed (&proc_jt9, exitCode, status);
}); });
connect(&p1, &QProcess::readyReadStandardOutput, this, &MainWindow::p1ReadFromStdout); connect(&p1, &QProcess::readyReadStandardOutput, this, &MainWindow::p1ReadFromStdout);
#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
connect(&p1, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error), connect(&p1, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
[this] (QProcess::ProcessError error) { [this] (QProcess::ProcessError error) {
subProcessError (&p1, error); subProcessError (&p1, error);
}); });
#else
connect(&p1, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::errorOccurred),
[this] (QProcess::ProcessError error) {
subProcessError (&p1, error);
});
#endif
connect(&p1, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished), connect(&p1, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
[this] (int exitCode, QProcess::ExitStatus status) { [this] (int exitCode, QProcess::ExitStatus status) {
subProcessFailed (&p1, exitCode, status); subProcessFailed (&p1, exitCode, status);
}); });
#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
connect(&p3, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error), connect(&p3, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
[this] (QProcess::ProcessError error) { [this] (QProcess::ProcessError error) {
subProcessError (&p3, error); subProcessError (&p3, error);
}); });
#else
connect(&p3, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::errorOccurred),
[this] (QProcess::ProcessError error) {
subProcessError (&p3, error);
});
#endif
connect(&p3, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished), connect(&p3, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
[this] (int exitCode, QProcess::ExitStatus status) { [this] (int exitCode, QProcess::ExitStatus status) {
subProcessFailed (&p3, exitCode, status); subProcessFailed (&p3, exitCode, status);
@ -795,7 +816,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
float dbm=(10.0*i)/3.0; float dbm=(10.0*i)/3.0;
int ndbm=int(dbm+0.5); int ndbm=int(dbm+0.5);
QString t; QString t;
t.sprintf("%d dBm ",ndbm); t = t.asprintf("%d dBm ",ndbm);
t+=t1[i]; t+=t1[i];
ui->TxPowerComboBox->addItem(t); ui->TxPowerComboBox->addItem(t);
} }
@ -1435,7 +1456,7 @@ void MainWindow::dataSink(qint64 frames)
avecho_(dec_data.d2,&nDop,&nfrit,&nqual,&f1,&xlevel,&sigdb, avecho_(dec_data.d2,&nDop,&nfrit,&nqual,&f1,&xlevel,&sigdb,
&snr,&dfreq,&width); &snr,&dfreq,&width);
QString t; QString t;
t.sprintf("%3d %7.1f %7.1f %7.1f %7.1f %3d",echocom_.nsum,xlevel,sigdb, t = t.asprintf("%3d %7.1f %7.1f %7.1f %7.1f %3d",echocom_.nsum,xlevel,sigdb,
dfreq,width,nqual); dfreq,width,nqual);
t=QDateTime::currentDateTimeUtc().toString("hh:mm:ss ") + t; t=QDateTime::currentDateTimeUtc().toString("hh:mm:ss ") + t;
if (ui) ui->decodedTextBrowser->appendText(t); if (ui) ui->decodedTextBrowser->appendText(t);
@ -1498,12 +1519,12 @@ void MainWindow::dataSink(qint64 frames)
if(m_mode.startsWith ("WSPR")) { if(m_mode.startsWith ("WSPR")) {
QString t2,cmnd,depth_string; QString t2,cmnd,depth_string;
double f0m1500=m_dialFreqRxWSPR/1000000.0; // + 0.000001*(m_BFO - 1500); double f0m1500=m_dialFreqRxWSPR/1000000.0; // + 0.000001*(m_BFO - 1500);
t2.sprintf(" -f %.6f ",f0m1500); t2 = t2.asprintf(" -f %.6f ",f0m1500);
if((m_ndepth&7)==1) depth_string=" -qB "; //2 pass w subtract, no Block detection, no shift jittering if((m_ndepth&7)==1) depth_string=" -qB "; //2 pass w subtract, no Block detection, no shift jittering
if((m_ndepth&7)==2) depth_string=" -C 500 -o 4 "; //3 pass, subtract, Block detection, OSD if((m_ndepth&7)==2) depth_string=" -C 500 -o 4 "; //3 pass, subtract, Block detection, OSD
if((m_ndepth&7)==3) depth_string=" -C 500 -o 4 -d "; //3 pass, subtract, Block detect, OSD, more candidates if((m_ndepth&7)==3) depth_string=" -C 500 -o 4 -d "; //3 pass, subtract, Block detect, OSD, more candidates
QString degrade; QString degrade;
degrade.sprintf("-d %4.1f ",m_config.degrade()); degrade = degrade.asprintf("-d %4.1f ",m_config.degrade());
if(m_diskData) { if(m_diskData) {
cmnd='"' + m_appDir + '"' + "/wsprd " + depth_string + " -a \"" + cmnd='"' + m_appDir + '"' + "/wsprd " + depth_string + " -a \"" +
@ -1631,7 +1652,7 @@ void MainWindow::fastSink(qint64 frames)
&ddir[0],fast_green,fast_s,&fast_jh,&pxmax,&rmsNoGain,&line[0],12,12,512,80); &ddir[0],fast_green,fast_s,&fast_jh,&pxmax,&rmsNoGain,&line[0],12,12,512,80);
float px = fast_green[fast_jh]; float px = fast_green[fast_jh];
QString t; QString t;
t.sprintf(" Rx noise: %5.1f ",px); t = t.asprintf(" Rx noise: %5.1f ",px);
ui->signal_meter_widget->setValue(rmsNoGain,pxmax); // Update thermometer ui->signal_meter_widget->setValue(rmsNoGain,pxmax); // Update thermometer
m_fastGraph->plotSpec(m_diskData,m_UTCdisk); m_fastGraph->plotSpec(m_diskData,m_UTCdisk);
@ -3014,8 +3035,8 @@ void MainWindow::decode() //decode()
double tseq = fmod(double(now.toMSecsSinceEpoch()),1000.0*m_TRperiod)/1000.0; double tseq = fmod(double(now.toMSecsSinceEpoch()),1000.0*m_TRperiod)/1000.0;
if(tseq < 0.5*m_TRperiod) tseq+= m_TRperiod; if(tseq < 0.5*m_TRperiod) tseq+= m_TRperiod;
if(m_ihsym==m_earlyDecode) qDebug() << ""; if(m_ihsym==m_earlyDecode) qDebug() << "";
QString t=""; QString t;
t.sprintf("aa release_jt9 %11.3f %5d %5d %7.3f ",tsec,m_ihsym,m_ihsym,tseq); t = t.asprintf("aa release_jt9 %11.3f %5d %5d %7.3f ",tsec,m_ihsym,m_ihsym,tseq);
qDebug().noquote() << t << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz"); qDebug().noquote() << t << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz");
*/ */
@ -3712,7 +3733,7 @@ void MainWindow::guiUpdate()
if(m_mode.startsWith ("WSPR")) { if(m_mode.startsWith ("WSPR")) {
QString sdBm,msg0,msg1,msg2; QString sdBm,msg0,msg1,msg2;
sdBm.sprintf(" %d",m_dBm); sdBm = sdBm.asprintf(" %d",m_dBm);
m_tx=1-m_tx; m_tx=1-m_tx;
int i2=m_config.my_callsign().indexOf("/"); int i2=m_config.my_callsign().indexOf("/");
if(i2>0 if(i2>0
@ -4056,7 +4077,7 @@ void MainWindow::guiUpdate()
int isec=int(fmod(tsec,m_TRperiod)); int isec=int(fmod(tsec,m_TRperiod));
if(m_TRperiod-int(m_TRperiod)>0.0) { if(m_TRperiod-int(m_TRperiod)>0.0) {
QString progBarLabel; QString progBarLabel;
progBarLabel.sprintf("%d/%3.1f",isec,m_TRperiod); progBarLabel = progBarLabel.asprintf("%d/%3.1f",isec,m_TRperiod);
progressBar.setFormat (progBarLabel); progressBar.setFormat (progBarLabel);
} }
progressBar.setValue(isec); progressBar.setValue(isec);
@ -4106,7 +4127,7 @@ void MainWindow::guiUpdate()
if(m_mode=="MSK144") { if(m_mode=="MSK144") {
int npct=int(100.0*m_fCPUmskrtd/0.298667); int npct=int(100.0*m_fCPUmskrtd/0.298667);
if(npct>90) tx_status_label.setStyleSheet("QLabel{background-color: #ff0000}"); if(npct>90) tx_status_label.setStyleSheet("QLabel{background-color: #ff0000}");
t.sprintf("Receiving %2d%%",npct); t = t.asprintf("Receiving %2d%%",npct);
} }
tx_status_label.setText (t); tx_status_label.setText (t);
} }
@ -5092,7 +5113,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
msgtype("73", ui->tx5->lineEdit()); msgtype("73", ui->tx5->lineEdit());
} else { } else {
int n=rpt.toInt(); int n=rpt.toInt();
rpt.sprintf("%+2.2d",n); rpt = rpt.asprintf("%+2.2d",n);
if(m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4") { if(m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4") {
QString t2,t3; QString t2,t3;
@ -5101,7 +5122,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
int nn=(n+36)/6; int nn=(n+36)/6;
if(nn<2) nn=2; if(nn<2) nn=2;
if(nn>9) nn=9; if(nn>9) nn=9;
rst.sprintf("5%1d9 ",nn); rst = rst.asprintf("5%1d9 ",nn);
rs=rst.mid(0,2); rs=rst.mid(0,2);
t=t0; t=t0;
if(!bMyCall) { if(!bMyCall) {
@ -5119,14 +5140,14 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
sent=rst + m_config.RTTY_Exchange(); sent=rst + m_config.RTTY_Exchange();
QString t1=m_config.RTTY_Exchange(); QString t1=m_config.RTTY_Exchange();
if(t1=="DX" or t1=="#") { if(t1=="DX" or t1=="#") {
t1.sprintf("%4.4d",ui->sbSerialNumber->value()); t1 = t1.asprintf("%4.4d",ui->sbSerialNumber->value());
sent=rst + t1; sent=rst + t1;
} }
} }
if(SpecOp::EU_VHF==m_config.special_op_id()) { if(SpecOp::EU_VHF==m_config.special_op_id()) {
QString a; QString a;
t="<" + t0.split(" ").at(0) + "> <" + t0.split(" ").at(1) + "> "; t="<" + t0.split(" ").at(0) + "> <" + t0.split(" ").at(1) + "> ";
a.sprintf("%4.4d ",ui->sbSerialNumber->value()); a = a.asprintf("%4.4d ",ui->sbSerialNumber->value());
sent=rs + a + m_config.my_grid(); sent=rs + a + m_config.my_grid();
} }
msgtype(t + sent, ui->tx2); msgtype(t + sent, ui->tx2);
@ -5154,7 +5175,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
if(n>=8 and n<=11) n=10; if(n>=8 and n<=11) n=10;
if(n>=12 and n<=14) n=13; if(n>=12 and n<=14) n=13;
if(n>=15) n=16; if(n>=15) n=16;
rpt.sprintf("%+2.2d",n); rpt = rpt.asprintf("%+2.2d",n);
} }
} }
@ -5552,10 +5573,10 @@ void MainWindow::on_dxGridEntry_textChanged (QString const& grid)
int nd=nDkm; int nd=nDkm;
if(m_config.miles()) nd=nDmiles; if(m_config.miles()) nd=nDmiles;
if(m_mode=="MSK144") { if(m_mode=="MSK144") {
if(nHotABetter==0)t.sprintf("Az: %d B: %d El: %d %d",nAz,nHotAz,nEl,nd); if(nHotABetter==0)t = t.asprintf("Az: %d B: %d El: %d %d",nAz,nHotAz,nEl,nd);
if(nHotABetter!=0)t.sprintf("Az: %d A: %d El: %d %d",nAz,nHotAz,nEl,nd); if(nHotABetter!=0)t = t.asprintf("Az: %d A: %d El: %d %d",nAz,nHotAz,nEl,nd);
} else { } else {
t.sprintf("Az: %d %d",nAz,nd); t = t.asprintf("Az: %d %d",nAz,nd);
} }
if(m_config.miles()) t += " mi"; if(m_config.miles()) t += " mi";
if(!m_config.miles()) t += " km"; if(!m_config.miles()) t += " km";
@ -7681,9 +7702,9 @@ void MainWindow::p1ReadFromStdout() //p1readFromStdout
&nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,6,6); &nAz,&nEl,&nDmiles,&nDkm,&nHotAz,&nHotABetter,6,6);
QString t1; QString t1;
if(m_config.miles()) { if(m_config.miles()) {
t1.sprintf("%7d",nDmiles); t1 = t1.asprintf("%7d",nDmiles);
} else { } else {
t1.sprintf("%7d",nDkm); t1 = t1.asprintf("%7d",nDkm);
} }
rxLine += t1; rxLine += t1;
} }
@ -7706,7 +7727,7 @@ QString MainWindow::WSPR_hhmm(int n)
QDateTime t=QDateTime::currentDateTimeUtc().addSecs(n); QDateTime t=QDateTime::currentDateTimeUtc().addSecs(n);
int m=t.toString("hhmm").toInt()/2; int m=t.toString("hhmm").toInt()/2;
QString t1; QString t1;
t1.sprintf("%04d",2*m); t1 = t1.asprintf("%04d",2*m);
return t1; return t1;
} }
@ -7716,12 +7737,12 @@ void MainWindow::WSPR_history(Frequency dialFreq, int ndecodes)
QString t1=t.toString("yyMMdd"); QString t1=t.toString("yyMMdd");
QString t2=WSPR_hhmm(-60); QString t2=WSPR_hhmm(-60);
QString t3; QString t3;
t3.sprintf("%13.6f",0.000001*dialFreq); t3 = t3.asprintf("%13.6f",0.000001*dialFreq);
if(ndecodes<0) { if(ndecodes<0) {
t1=t1 + " " + t2 + t3 + " T"; t1=t1 + " " + t2 + t3 + " T";
} else { } else {
QString t4; QString t4;
t4.sprintf("%4d",ndecodes); t4 = t4.asprintf("%4d",ndecodes);
t1=t1 + " " + t2 + t3 + " R" + t4; t1=t1 + " " + t2 + t3 + " R" + t4;
} }
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("WSPR_history.txt")}; QFile f {m_config.writeable_data_dir ().absoluteFilePath ("WSPR_history.txt")};
@ -8192,7 +8213,7 @@ void MainWindow::on_sbNslots_valueChanged(int n)
{ {
m_Nslots=n; m_Nslots=n;
QString t; QString t;
t.sprintf(" NSlots %d",m_Nslots); t = t.asprintf(" NSlots %d",m_Nslots);
writeFoxQSO(t); writeFoxQSO(t);
} }
@ -8200,7 +8221,7 @@ void MainWindow::on_sbMax_dB_valueChanged(int n)
{ {
m_max_dB=n; m_max_dB=n;
QString t; QString t;
t.sprintf(" Max_dB %d",m_max_dB); t = t.asprintf(" Max_dB %d",m_max_dB);
writeFoxQSO(t); writeFoxQSO(t);
} }
@ -8690,7 +8711,7 @@ void MainWindow::foxGenWaveform(int i,QString fm)
if(fm.mid(0,3)=="CQ ") m_tFoxTxSinceCQ=-1; if(fm.mid(0,3)=="CQ ") m_tFoxTxSinceCQ=-1;
QString txModeArg; QString txModeArg;
txModeArg.sprintf("FT8fox %d",i+1); txModeArg = txModeArg.asprintf("FT8fox %d",i+1);
ui->decodedTextBrowser2->displayTransmittedText(fm.trimmed(), txModeArg, ui->decodedTextBrowser2->displayTransmittedText(fm.trimmed(), txModeArg,
ui->TxFreqSpinBox->value()+60*i,m_bFastMode); ui->TxFreqSpinBox->value()+60*i,m_bFastMode);
foxcom_.i3bit[i]=0; foxcom_.i3bit[i]=0;
@ -8698,14 +8719,14 @@ void MainWindow::foxGenWaveform(int i,QString fm)
strncpy(&foxcom_.cmsg[i][0],fm.toLatin1(),40); //Copy this message into cmsg[i] strncpy(&foxcom_.cmsg[i][0],fm.toLatin1(),40); //Copy this message into cmsg[i]
if(i==0) m_fm1=fm; if(i==0) m_fm1=fm;
QString t; QString t;
t.sprintf(" Tx%d: ",i+1); t = t.asprintf(" Tx%d: ",i+1);
writeFoxQSO(t + fm.trimmed()); writeFoxQSO(t + fm.trimmed());
} }
void MainWindow::writeFoxQSO(QString const& msg) void MainWindow::writeFoxQSO(QString const& msg)
{ {
QString t; QString t;
t.sprintf("%3d%3d%3d",m_houndQueue.count(),m_foxQSOinProgress.count(),m_foxQSO.count()); t = t.asprintf("%3d%3d%3d",m_houndQueue.count(),m_foxQSOinProgress.count(),m_foxQSO.count());
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("FoxQSO.txt")}; QFile f {m_config.writeable_data_dir ().absoluteFilePath ("FoxQSO.txt")};
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
QTextStream out(&f); QTextStream out(&f);
@ -8781,7 +8802,7 @@ void MainWindow::foxTest()
if(line.contains("Tx1:")) { if(line.contains("Tx1:")) {
foxTxSequencer(); foxTxSequencer();
} else { } else {
t.sprintf("%3d %3d %3d %3d %5d ",m_houndQueue.count(), t = t.asprintf("%3d %3d %3d %3d %5d ",m_houndQueue.count(),
m_foxQSOinProgress.count(),m_foxQSO.count(), m_foxQSOinProgress.count(),m_foxQSO.count(),
m_loggedByFox.count(),m_tFoxTx); m_loggedByFox.count(),m_tFoxTx);
sdiag << t << line.mid(37).trimmed() << "\n"; sdiag << t << line.mid(37).trimmed() << "\n";
@ -8812,7 +8833,7 @@ void MainWindow::write_all(QString txRx, QString message)
msg=msg.mid(0,15) + msg.mid(18,-1); msg=msg.mid(0,15) + msg.mid(18,-1);
t.sprintf("%5d",ui->TxFreqSpinBox->value()); t = t.asprintf("%5d",ui->TxFreqSpinBox->value());
if (txRx=="Tx") msg=" 0 0.0" + t + " " + message; if (txRx=="Tx") msg=" 0 0.0" + t + " " + message;
auto time = QDateTime::currentDateTimeUtc (); auto time = QDateTime::currentDateTimeUtc ();
if( txRx=="Rx" ) { if( txRx=="Rx" ) {
@ -8822,7 +8843,7 @@ void MainWindow::write_all(QString txRx, QString message)
} }
time = time.addSecs(-tdec); time = time.addSecs(-tdec);
} }
t.sprintf("%10.3f ",m_freqNominal/1.e6); t = t.asprintf("%10.3f ",m_freqNominal/1.e6);
if (m_diskData) { if (m_diskData) {
if (m_fileDateTime.size()==11) { if (m_fileDateTime.size()==11) {
line=m_fileDateTime + " " + t + txRx + " " + mode_string + msg; line=m_fileDateTime + " " + t + txRx + " " + mode_string + msg;

View File

@ -102,6 +102,6 @@ void SignalMeter::setValue(float value, float valueMax)
m_meter->setValue(int(value)); m_meter->setValue(int(value));
m_meter->set_sigPeak(valueMax); m_meter->set_sigPeak(valueMax);
QString t; QString t;
t.sprintf("%d dB",int(value+0.5)); t = t.asprintf("%d dB",int(value+0.5));
m_reading->setText(t); m_reading->setText(t);
} }