From c2408cb752871fcde57240df43bc1d22dad00f66 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 15 Dec 2014 17:04:51 +0000 Subject: [PATCH] Add an interface to program Xlog. This code comes from a patch supplied by Dmitry Budanov (callsign??). I have not tested it beyond seeing that it compiles properly. If anyone has Xlog installed on a Linux machine, please test and let us know if all is well. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4824 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- logbook/adif.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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;