diff --git a/mainwindow.cpp b/mainwindow.cpp index a97303331..200120a3c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -204,7 +204,7 @@ MainWindow::MainWindow(QWidget *parent) : // Create "m_worked", a dictionary of all calls in wsjtx.log QFile f("wsjtx.log"); - f.open(QIODevice::ReadOnly); + f.open(QIODevice::ReadOnly | QIODevice::Text); QTextStream in(&f); QString line,t,callsign; for(int i=0; i<99999; i++) { @@ -614,12 +614,12 @@ void MainWindow::dialFreqChanged2(double f) void MainWindow::statusChanged() { QFile f("wsjtx_status.txt"); - if(!f.open(QFile::WriteOnly)) { + if(!f.open(QFile::WriteOnly | QIODevice::Text)) { msgBox("Cannot open file \"wsjtx_status.txt\"."); return; } QTextStream out(&f); - out << m_dialFreq << ";" << m_mode << ";" << m_hisCall << "\r\n"; + out << m_dialFreq << ";" << m_mode << ";" << m_hisCall << endl; f.close(); } @@ -1020,11 +1020,12 @@ void MainWindow::readFromStdout() //readFromStdout if(m_RxLog & 1) { out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm") << endl; + m_RxLog=0; } - out << t << endl; + int n=t.length(); + out << t.mid(0,n-2) << endl; f.close(); - int n=t.length(); QString bg="white"; if(t.indexOf(" CQ ")>0) bg="#66ff66"; //Light green if(t.indexOf(" "+m_myCall+" ")>0) bg="#ff6666"; //Light red @@ -1034,7 +1035,7 @@ void MainWindow::readFromStdout() //readFromStdout QString msg=t.mid(34,22); bool b=stdmsg_(msg.toAscii().constData()); QStringList w=msg.split(" ",QString::SkipEmptyParts); - if(b and w[1]==m_myCall) { + if(b and w[0]==m_myCall) { QString tt=w[2]; int i1; bool ok; @@ -1050,6 +1051,7 @@ void MainWindow::readFromStdout() //readFromStdout } } } + if(m_pskReporterInit and b and !m_diskData) { // if(m_pskReporterInit and b) { int i1=msg.indexOf(" "); @@ -1196,8 +1198,8 @@ void MainWindow::guiUpdate() QFile f("ALL.TXT"); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); QTextStream out(&f); - out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm") - << " Tx message: " << t << endl; + out << QDateTime::currentDateTimeUtc().toString("hhmm") + << " Transmitted: " << t << endl; f.close(); } QStringList w=t.split(" ",QString::SkipEmptyParts); @@ -1702,43 +1704,40 @@ void MainWindow::on_logQSOButton_clicked() //Log QSO button { double dialFreq=g_pWideGraph->dialFreq(); QDateTime t = QDateTime::currentDateTimeUtc(); + QString date=t.toString("yyyyMMdd"); QFile f("wsjtx.log"); - if(!f.open(QFile::Append)) { + if(!f.open(QIODevice::Text | QIODevice::Append)) { msgBox("Cannot open file \"wsjtx.log\"."); } else { QString logEntry=t.date().toString("yyyy-MMM-dd,") + t.time().toString("hh:mm,") + m_hisCall + "," + m_hisGrid + "," + QString::number(dialFreq) + "," + m_mode + "," + - m_rptSent + "," + m_rptRcvd; QTextStream out(&f); + m_rptSent + "," + m_rptRcvd; + QTextStream out(&f); // out << logEntry << "\r\n"; out << logEntry << endl; f.close(); } QFile f2("wsjtx_log.adi"); - if(!f2.open(QFile::Append)) { + if(!f2.open(QIODevice::Text | QIODevice::Append)) { msgBox("Cannot open file \"wsjtx_log.adi\"."); } else { QTextStream out(&f2); if(f2.size()==0) out << "WSJT-X ADIF Export" << endl; -/* -K1ABCFN42JT65-15 --1713551357 -5JimK1JTFN20 -*/ + QString t; t="" + m_hisCall; - t+="" + m_hisGrid; - t+="" + m_mode; - t+="" + m_rptSent; - t+="" + m_rptRcvd; - t+=""; - t+="" + m_qsoStart; - t+="" + m_qsoStop; - t+="" + m_myCall; - t+="" + m_myGrid; -// t.date.toString("yyyymmdd"); + t+= "" + m_hisGrid; + t+= "" + m_mode; + t+= "" + m_rptSent; + t+= "" + m_rptRcvd; + t+= ""; + t+= "" + m_qsoStart; + t+= "" + m_qsoStop; + t+= "" + m_myCall; + t+= "" + m_myGrid; out << t << endl; f2.close(); }