summaryrefslogtreecommitdiff
path: root/logbook/logbook.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
commit69344560ea394c06ca94acac46a2e4c3e8b7b229 (patch)
treeebc98370a697a9bbd6b973a14fa5113c475c6db7 /logbook/logbook.cpp
parent3e9d10a67671d0bd5c7b8c3ca8088f1818322eff (diff)
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
Update upstream source from tag 'upstream/3.2.0_rc1+dfsg'
Update to upstream version '3.2.0~rc1+dfsg' with Debian dir dbff457fd2c3616d5c77b863c7bfb2186ed86047
Diffstat (limited to 'logbook/logbook.cpp')
-rw-r--r--logbook/logbook.cpp119
1 files changed, 24 insertions, 95 deletions
diff --git a/logbook/logbook.cpp b/logbook/logbook.cpp
index e1c0da30..e80930cf 100644
--- a/logbook/logbook.cpp
+++ b/logbook/logbook.cpp
@@ -7,6 +7,7 @@
#include "logbook/AD1CCty.hpp"
#include "models/CabrilloLog.hpp"
#include "models/FoxLog.hpp"
+#include "logbook/AdifQso.hpp"
#include "moc_logbook.cpp"
@@ -32,6 +33,15 @@ void LogBook::match (QString const& call, QString const& mode, QString const& gr
bool& ITUZoneB4,
QString const& band) const
{
+ // Default every flag so callers reading them after an empty call see defined
+ // values: "not worked" for call/grid, and "do not flag" for entity-derived
+ // categories (mirroring the unknown-entity policy below).
+ callB4 = false;
+ gridB4 = false;
+ countryB4 = true;
+ continentB4 = true;
+ CQZoneB4 = true;
+ ITUZoneB4 = true;
if (call.size() > 0)
{
auto const& mode_to_check = (config_ && !config_->highlight_by_mode ()) ? QString {} : mode;
@@ -82,103 +92,22 @@ QByteArray LogBook::QSOToADIF (QString const& hisCall, QString const& hisGrid, Q
QString const& xSent, QString const& xRcvd, QString const& propmode,
QString const& satellite, QString const& satmode, QString const& freqRx)
{
- QString t;
- t = "<call:" + QString::number(hisCall.size()) + ">" + hisCall;
- t += " <gridsquare:" + QString::number(hisGrid.size()) + ">" + hisGrid;
- if (mode != "FT4" && mode != "FST4" && mode != "Q65")
+ Q_ASSERT (config_);
+ auto contest = AdifQso::Contest::None;
+ switch (config_->special_op_id ())
{
- t += " <mode:" + QString::number(mode.size()) + ">" + mode;
+ case Configuration::SpecialOperatingActivity::FIELD_DAY:
+ contest = AdifQso::Contest::FieldDay;
+ break;
+ case Configuration::SpecialOperatingActivity::RTTY:
+ contest = AdifQso::Contest::Rtty;
+ break;
+ default:
+ break;
}
- else
- {
- t += " <mode:4>MFSK <submode:" + QString::number(mode.size()) + ">" + mode;
- }
- t += " <rst_sent:" + QString::number(rptSent.size()) + ">" + rptSent;
- t += " <rst_rcvd:" + QString::number(rptRcvd.size()) + ">" + rptRcvd;
- t += " <qso_date:8>" + dateTimeOn.date().toString("yyyyMMdd");
- t += " <time_on:6>" + dateTimeOn.time().toString("hhmmss");
- t += " <qso_date_off:8>" + dateTimeOff.date().toString("yyyyMMdd");
- t += " <time_off:6>" + dateTimeOff.time().toString("hhmmss");
- t += " <band:" + QString::number(band.size()) + ">" + band;
- t += " <freq:" + QString::number(strDialFreq.size()) + ">" + strDialFreq;
- t += " <station_callsign:" + QString::number(myCall.size()) + ">" + myCall;
- if(myGrid!="") t += " <my_gridsquare:" + QString::number(myGrid.size()) + ">" + myGrid;
- if(txPower!="") t += " <tx_pwr:" + QString::number(txPower.size()) + ">" + txPower;
- if(comments!="") t += " <comment:" + QString::number(comments.size()) + ">" + comments;
- if(name!="") t += " <name:" + QString::number(name.size()) + ">" + name;
- if(operator_call!="") t+=" <operator:" + QString::number(operator_call.size()) + ">" + operator_call;
- if(propmode!="") t += " <prop_mode:" + QString::number(propmode.size()) + ">" + propmode;
- if(satellite!="") t += " <sat_name:" + QString::number(satellite.size()) + ">" + satellite;
- if(satmode!="") t += " <sat_mode:" + QString::number(satmode.size()) + ">" + satmode;
- if(freqRx!="") t += " <freq_rx:" + QString::number(freqRx.size()) + ">" + freqRx;
- if (xSent.size ())
- {
- auto words = xSent.split (' '
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
- , QString::SkipEmptyParts
-#else
- , Qt::SkipEmptyParts
-#endif
- );
- if (words.size () > 1)
- {
- if (words.back ().toUInt ())
- {
- // assume last word is a serial if there are at least
- // two words and if it is positive numeric
- t += " <stx:" + QString::number (words.back ().size ()) + '>' + words.back ();
- }
- else
- {
- if (words.front ().toUInt () && words.front ().size () > 3) // EU VHF contest mode
- {
- auto sn_text = words.front ().mid (2);
- // assume first word is report+serial if there are
- // at least two words and if the first word less the
- // first two characters is a positive numeric
- t += " <stx:" + QString::number (sn_text.size ()) + '>' + sn_text;
- }
- }
- }
- }
- if (xRcvd.size ()) {
- auto words = xRcvd.split (' '
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
- , QString::SkipEmptyParts
-#else
- , Qt::SkipEmptyParts
-#endif
- );
- if (words.size () == 2)
- {
- if (words.at (1).toUInt ())
- {
- t += " <srx:" + QString::number (words.at (1).size ()) + ">" + words.at (1);
- }
- else if (words.at (0).toUInt () && words.at (0).size () > 3) // EU VHF contest exchange
- {
- // strip report and set SRX to serial
- t += " <srx:" + QString::number (words.at (0).mid (2).size ()) + ">" + words.at (0).mid (2);
- }
- else
- {
- if (Configuration::SpecialOperatingActivity::FIELD_DAY == config_->special_op_id ())
- {
- // include DX as an ARRL_SECT value even though it is
- // not in the ADIF spec ARRL_SECT enumeration, done
- // because N1MM does the same
- t += " <contest_id:14>ARRL-FIELD-DAY <SRX_STRING:" + QString::number (xRcvd.size ()) + '>' + xRcvd
- + " <class:" + QString::number (words.at (0).size ()) + '>'
- + words.at (0) + " <arrl_sect:" + QString::number (words.at (1).size ()) + '>' + words.at (1);
- }
- else if (Configuration::SpecialOperatingActivity::RTTY == config_->special_op_id ())
- {
- t += " <state:" + QString::number (words.at (1).size ()) + ">" + words.at (1);
- }
- }
- }
- }
- return t.toLatin1();
+ return AdifQso::to_adif (hisCall, hisGrid, mode, rptSent, rptRcvd, dateTimeOn, dateTimeOff,
+ band, comments, name, strDialFreq, myCall, myGrid, txPower, operator_call,
+ xSent, xRcvd, propmode, satellite, satmode, freqRx, contest);
}
CabrilloLog * LogBook::contest_log ()