mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-03-31 16:38:35 -04:00
Save contest exchange to ADIF log. (Not finished...)
This commit is contained in:
parent
66ef044da0
commit
1170c4054a
@ -180,11 +180,12 @@ int ADIF::getCount() const
|
|||||||
return _data.size();
|
return _data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray ADIF::QSOToADIF(QString const& hisCall, QString const& hisGrid, QString const& mode
|
QByteArray ADIF::QSOToADIF(QString const& hisCall, QString const& hisGrid, QString const& mode,
|
||||||
, QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn
|
QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
|
||||||
, QDateTime const& dateTimeOff, QString const& band, QString const& comments
|
QDateTime const& dateTimeOff, QString const& band, QString const& comments,
|
||||||
, QString const& name, QString const& strDialFreq, QString const& m_myCall
|
QString const& name, QString const& strDialFreq, QString const& m_myCall,
|
||||||
, QString const& m_myGrid, QString const& m_txPower, QString const& operator_call)
|
QString const& m_myGrid, QString const& m_txPower, QString const& operator_call,
|
||||||
|
QString const& xSent, QString const& xRcvd)
|
||||||
{
|
{
|
||||||
QString t;
|
QString t;
|
||||||
t = "<call:" + QString::number(hisCall.length()) + ">" + hisCall;
|
t = "<call:" + QString::number(hisCall.length()) + ">" + hisCall;
|
||||||
@ -198,26 +199,17 @@ QByteArray ADIF::QSOToADIF(QString const& hisCall, QString const& hisGrid, QStri
|
|||||||
t += " <time_off:6>" + dateTimeOff.time().toString("hhmmss");
|
t += " <time_off:6>" + dateTimeOff.time().toString("hhmmss");
|
||||||
t += " <band:" + QString::number(band.length()) + ">" + band;
|
t += " <band:" + QString::number(band.length()) + ">" + band;
|
||||||
t += " <freq:" + QString::number(strDialFreq.length()) + ">" + strDialFreq;
|
t += " <freq:" + QString::number(strDialFreq.length()) + ">" + strDialFreq;
|
||||||
t += " <station_callsign:" + QString::number(m_myCall.length()) + ">" +
|
t += " <station_callsign:" + QString::number(m_myCall.length()) + ">" + m_myCall;
|
||||||
m_myCall;
|
t += " <my_gridsquare:" + QString::number(m_myGrid.length()) + ">" + m_myGrid;
|
||||||
t += " <my_gridsquare:" + QString::number(m_myGrid.length()) + ">" +
|
if(m_txPower!="") t += " <tx_pwr:" + QString::number(m_txPower.length()) + ">" + m_txPower;
|
||||||
m_myGrid;
|
if(comments!="") t += " <comment:" + QString::number(comments.length()) + ">" + comments;
|
||||||
if (m_txPower != "")
|
if(name!="") t += " <name:" + QString::number(name.length()) + ">" + name;
|
||||||
t += " <tx_pwr:" + QString::number(m_txPower.length()) +
|
if(operator_call!="") t+=" <operator:" + QString::number(operator_call.length()) + ">" + operator_call;
|
||||||
">" + m_txPower;
|
if(xSent!="") t += " <STX_STRING:" + QString::number(xSent.length()) + ">" + xSent;
|
||||||
if (comments != "")
|
if(xRcvd!="") t += " <SRX_STRING:" + QString::number(xRcvd.length()) + ">" + xRcvd;
|
||||||
t += " <comment:" + QString::number(comments.length()) +
|
return t.toLatin1();
|
||||||
">" + comments;
|
|
||||||
if (name != "")
|
|
||||||
t += " <name:" + QString::number(name.length()) +
|
|
||||||
">" + name;
|
|
||||||
if (operator_call!="")
|
|
||||||
t+=" <operator:" + QString::number(operator_call.length()) +
|
|
||||||
">" + operator_call;
|
|
||||||
return t.toLatin1 ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// open ADIF file and append the QSO details. Return true on success
|
// open ADIF file and append the QSO details. Return true on success
|
||||||
bool ADIF::addQSOToFile(QByteArray const& ADIF_record)
|
bool ADIF::addQSOToFile(QByteArray const& ADIF_record)
|
||||||
{
|
{
|
||||||
|
@ -33,11 +33,12 @@ class ADIF
|
|||||||
// open ADIF file and append the QSO details. Return true on success
|
// open ADIF file and append the QSO details. Return true on success
|
||||||
bool addQSOToFile(QByteArray const& ADIF_record);
|
bool addQSOToFile(QByteArray const& ADIF_record);
|
||||||
|
|
||||||
QByteArray QSOToADIF(QString const& hisCall, QString const& hisGrid, QString const& mode, QString const& rptSent
|
QByteArray QSOToADIF(QString const& hisCall, QString const& hisGrid, QString const& mode,
|
||||||
, QString const& rptRcvd, QDateTime const& dateTimeOn, QDateTime const& dateTimeOff
|
QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
|
||||||
, QString const& band, QString const& comments, QString const& name
|
QDateTime const& dateTimeOff, QString const& band, QString const& comments,
|
||||||
, QString const& strDialFreq, QString const& m_myCall, QString const& m_myGrid
|
QString const& name, QString const& strDialFreq, QString const& m_myCall,
|
||||||
, QString const& m_txPower, QString const& operator_call);
|
QString const& m_myGrid, QString const& m_txPower, QString const& operator_call,
|
||||||
|
QString const& xSent, QString const& xRcvd);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct QSO
|
struct QSO
|
||||||
|
11
logqso.cpp
11
logqso.cpp
@ -60,9 +60,13 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString
|
|||||||
QDateTime const& dateTimeOn, QDateTime const& dateTimeOff,
|
QDateTime const& dateTimeOn, QDateTime const& dateTimeOff,
|
||||||
Radio::Frequency dialFreq, QString const& myCall, QString const& myGrid,
|
Radio::Frequency dialFreq, QString const& myCall, QString const& myGrid,
|
||||||
bool noSuffix, bool toRTTY, bool dBtoComments, bool bFox,
|
bool noSuffix, bool toRTTY, bool dBtoComments, bool bFox,
|
||||||
bool bAutoLog, QString const& opCall)
|
bool bAutoLog, QString const& opCall, qint32 nContest,
|
||||||
|
QString xSent, QString xRcvd)
|
||||||
{
|
{
|
||||||
if(!isHidden()) return;
|
if(!isHidden()) return;
|
||||||
|
m_nContest=nContest;
|
||||||
|
m_xSent=xSent;
|
||||||
|
m_xRcvd=xRcvd;
|
||||||
ui->call->setText(hisCall);
|
ui->call->setText(hisCall);
|
||||||
ui->grid->setText(hisGrid);
|
ui->grid->setText(hisGrid);
|
||||||
ui->name->setText("");
|
ui->name->setText("");
|
||||||
@ -120,8 +124,9 @@ void LogQSO::accept()
|
|||||||
auto adifilePath = QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log.adi");
|
auto adifilePath = QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log.adi");
|
||||||
adifile.init(adifilePath);
|
adifile.init(adifilePath);
|
||||||
|
|
||||||
QByteArray ADIF {adifile.QSOToADIF (hisCall, hisGrid, mode, rptSent, rptRcvd, m_dateTimeOn, m_dateTimeOff, band
|
QByteArray ADIF {adifile.QSOToADIF (hisCall, hisGrid, mode, rptSent, rptRcvd,
|
||||||
, comments, name, strDialFreq, m_myCall, m_myGrid, m_txPower, operator_call)};
|
m_dateTimeOn, m_dateTimeOff, band, comments, name, strDialFreq, m_myCall,
|
||||||
|
m_myGrid, m_txPower, operator_call, m_xSent, m_xRcvd)};
|
||||||
if (!adifile.addQSOToFile (ADIF))
|
if (!adifile.addQSOToFile (ADIF))
|
||||||
{
|
{
|
||||||
MessageBox::warning_message (this, tr ("Log file error"),
|
MessageBox::warning_message (this, tr ("Log file error"),
|
||||||
|
6
logqso.h
6
logqso.h
@ -34,7 +34,8 @@ public:
|
|||||||
QDateTime const& dateTimeOff,
|
QDateTime const& dateTimeOff,
|
||||||
Radio::Frequency dialFreq, QString const& myCall, QString const& myGrid,
|
Radio::Frequency dialFreq, QString const& myCall, QString const& myGrid,
|
||||||
bool noSuffix, bool toRTTY, bool dBtoComments, bool bFox,
|
bool noSuffix, bool toRTTY, bool dBtoComments, bool bFox,
|
||||||
bool bAutoLog, QString const& opCall);
|
bool bAutoLog, QString const& opCall, qint32 nContest, QString xSent,
|
||||||
|
QString xRcvd);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept();
|
void accept();
|
||||||
@ -62,6 +63,9 @@ private:
|
|||||||
Radio::Frequency m_dialFreq;
|
Radio::Frequency m_dialFreq;
|
||||||
QString m_myCall;
|
QString m_myCall;
|
||||||
QString m_myGrid;
|
QString m_myGrid;
|
||||||
|
QString m_xSent;
|
||||||
|
QString m_xRcvd;
|
||||||
|
qint32 m_nContest;
|
||||||
QDateTime m_dateTimeOn;
|
QDateTime m_dateTimeOn;
|
||||||
QDateTime m_dateTimeOff;
|
QDateTime m_dateTimeOff;
|
||||||
};
|
};
|
||||||
|
@ -5186,23 +5186,35 @@ void MainWindow::on_logQSOButton_clicked() //Log QSO button
|
|||||||
if (dateTimeQSOOff < m_dateTimeQSOOn) dateTimeQSOOff = m_dateTimeQSOOn;
|
if (dateTimeQSOOff < m_dateTimeQSOOn) dateTimeQSOOff = m_dateTimeQSOOn;
|
||||||
QString grid=m_hisGrid;
|
QString grid=m_hisGrid;
|
||||||
if(grid=="....") grid="";
|
if(grid=="....") grid="";
|
||||||
bool bAutoLog=m_config.autoLog() and m_nContest>0;
|
if(m_nContest>NONE and m_nContest<FOX) {
|
||||||
m_logDlg->initLogQSO (m_hisCall, grid, m_modeTx, m_rptSent, m_rptRcvd,
|
|
||||||
m_dateTimeQSOOn, dateTimeQSOOff, m_freqNominal + ui->TxFreqSpinBox->value(),
|
|
||||||
m_config.my_callsign(), m_config.my_grid(), m_noSuffix,
|
|
||||||
m_config.log_as_RTTY(), m_config.report_in_comments(),
|
|
||||||
m_config.bFox(), bAutoLog, m_opCall);
|
|
||||||
if(m_nContest!=NONE) {
|
|
||||||
if(m_nContest==NA_VHF) {
|
if(m_nContest==NA_VHF) {
|
||||||
m_xSent=m_config.my_grid().left(4);
|
m_xSent=m_config.my_grid().left(4);
|
||||||
m_xRcvd=m_hisGrid;
|
m_xRcvd=m_hisGrid;
|
||||||
}
|
}
|
||||||
if(m_nContest!=NONE) {
|
if(m_nContest==EU_VHF) {
|
||||||
int n=ui->sbSerialNumber->value();
|
m_rptSent=m_xSent.split(" ").at(0).left(2);
|
||||||
ui->sbSerialNumber->setValue(n+1);
|
m_rptRcvd=m_xRcvd.split(" ").at(0).left(2);
|
||||||
cabLog(); //Call the Cabrillo contest logger
|
|
||||||
}
|
}
|
||||||
|
if(m_nContest==FIELD_DAY) {
|
||||||
|
m_rptSent=m_xSent.split(" ").at(0);
|
||||||
|
m_rptRcvd=m_xRcvd.split(" ").at(0);
|
||||||
|
}
|
||||||
|
if(m_nContest==RTTY) {
|
||||||
|
m_rptSent=m_xSent.split(" ").at(0);
|
||||||
|
m_rptRcvd=m_xRcvd.split(" ").at(0);
|
||||||
|
}
|
||||||
|
int n=ui->sbSerialNumber->value();
|
||||||
|
ui->sbSerialNumber->setValue(n+1);
|
||||||
|
cabLog(); //Call the Cabrillo contest logger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bAutoLog=m_config.autoLog() and m_nContest>0;
|
||||||
|
m_logDlg->initLogQSO (m_hisCall, grid, m_modeTx, m_rptSent, m_rptRcvd,
|
||||||
|
m_dateTimeQSOOn, dateTimeQSOOff, m_freqNominal +
|
||||||
|
ui->TxFreqSpinBox->value(), m_config.my_callsign(),
|
||||||
|
m_config.my_grid(), m_noSuffix, m_config.log_as_RTTY(),
|
||||||
|
m_config.report_in_comments(), m_config.bFox(),
|
||||||
|
bAutoLog, m_opCall, m_nContest, m_xSent, m_xRcvd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::cabLog()
|
void MainWindow::cabLog()
|
||||||
|
@ -156,5 +156,4 @@ void MessageAveraging::contestAddLog(qint32 nContest, QString logLine)
|
|||||||
int score=m_mult_*m_nLogged_;
|
int score=m_mult_*m_nLogged_;
|
||||||
t.sprintf("Score: %d",score);
|
t.sprintf("Score: %d",score);
|
||||||
ui->lab3->setText(t);
|
ui->lab3->setText(t);
|
||||||
qDebug() << m_nLogged_ << m_mult_ << score;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user