diff --git a/logbook/adif.cpp b/logbook/adif.cpp index fb6b3bcda..a3f3af609 100644 --- a/logbook/adif.cpp +++ b/logbook/adif.cpp @@ -3,6 +3,7 @@ #include #include #include +#include /* W1XT20m14.076DM33JT65-21-14201104220417042441st JT65A QSO. Him: mag loop 20WVK3ACFqf22lb @@ -137,6 +138,29 @@ int ADIF::getCount() bool ADIF::addQSOToFile(const QString hisCall, const QString hisGrid, const QString mode, const QString rptSent, const QString rptRcvd, const QString date, const QString time, const QString band, const QString comments, const QString name, const QString strDialFreq, const QString m_myCall, const QString m_myGrid, const QString m_txPower) { + // open connection to Xlog and try to log QSO + QTcpSocket *xlogSocket = new QTcpSocket(); + xlogSocket->connectToHost("localhost", 7311); + if(xlogSocket->waitForConnected(100)) + { + QDate d = QDate::fromString(date, "yyyyMMdd"); + QString t = "program:WSJT-X\1version:1\1"; + // remove decimal point after month name + t += "date:" + d.toString("dd ") + d.toString("MMM").mid(0,3) + d.toString(" yyyy") + "\1"; + t += "time:" + time + "\1"; + t += "call:" + hisCall + "\1"; + t += "locator:" + hisGrid + "\1"; + t += "mhz:" + strDialFreq + "\1"; + t += "mode:" + mode + "\1"; + t += "tx:" + rptSent + "\1"; + t += "rx:" + rptRcvd + "\1"; + if ( name != "" ) t += "name:" + name + "\1"; + if ( comments != "" ) t += "notes: " + comments + "\1"; + if ( m_txPower != "" ) t += "power: " + m_txPower + "\1"; + xlogSocket->write(t.toLocal8Bit()); + xlogSocket->waitForBytesWritten(100); + xlogSocket->close(); + } QFile f2(_filename); if (!f2.open(QIODevice::Text | QIODevice::Append)) return false;