summaryrefslogtreecommitdiff
path: root/logbook
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
commit059831534c7e884f0a607ed86b582fd00d821731 (patch)
tree76bcb67a78f8aa2654fd34c2ad801a62136b0170 /logbook
parentd83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff)
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to 'logbook')
-rw-r--r--logbook/AD1CCty.cpp50
-rw-r--r--logbook/AD1CCty.hpp1
-rw-r--r--logbook/AdifQso.cpp143
-rw-r--r--logbook/AdifQso.hpp29
-rw-r--r--logbook/WorkedBefore.cpp88
-rw-r--r--logbook/WorkedBefore.hpp2
-rw-r--r--logbook/WorkedBeforeLoadState.hpp70
-rw-r--r--logbook/logbook.cpp119
-rw-r--r--logbook/logbook.pri13
9 files changed, 370 insertions, 145 deletions
diff --git a/logbook/AD1CCty.cpp b/logbook/AD1CCty.cpp
index e4b2fd84..d63b1dff 100644
--- a/logbook/AD1CCty.cpp
+++ b/logbook/AD1CCty.cpp
@@ -10,7 +10,6 @@
#include <boost/lambda/lambda.hpp>
#include <boost/lexical_cast.hpp>
#include <QString>
-#include <QStandardPaths>
#include <QDir>
#include <QFile>
#include <QTextStream>
@@ -21,6 +20,7 @@
#include "Radio.hpp"
#include "pimpl_impl.hpp"
#include "Logger.hpp"
+#include "qt_helpers.hpp"
#include "moc_AD1CCty.cpp"
@@ -39,6 +39,7 @@ struct entity
explicit entity (int id
, QString const& name
+ , QString const& abbreviated_name
, bool WAE_only
, int CQ_zone
, int ITU_zone
@@ -49,6 +50,7 @@ struct entity
, QString const& primary_prefix)
: id_ {id}
, name_ {name}
+ , abbreviated_name_ {abbreviated_name}
, WAE_only_ {WAE_only}
, CQ_zone_ {CQ_zone}
, ITU_zone_ {ITU_zone}
@@ -62,6 +64,7 @@ struct entity
int id_;
QString name_;
+ QString abbreviated_name_;
bool WAE_only_; // DARC WAE only, not valid for ARRL awards
int CQ_zone_;
int ITU_zone_;
@@ -86,6 +89,7 @@ QDebug operator << (QDebug dbg, entity const& e)
dbg.nospace () << "entity("
<< e.id_ << ", "
<< e.name_ << ", "
+ << e.abbreviated_name_ << ", "
<< e.WAE_only_ << ", "
<< e.CQ_zone_ << ", "
<< e.ITU_zone_ << ", "
@@ -173,6 +177,30 @@ public:
: configuration_ {configuration}
{
}
+ QString abbreviated_entity_name (QString const& name) const
+ {
+ auto result = name;
+ result.replace ("Islands", "Is.");
+ result.replace ("Island", "Is.");
+ result.replace ("North ", "N. ");
+ result.replace ("Northern ", "N. ");
+ result.replace ("South ", "S. ");
+ result.replace ("East ", "E. ");
+ result.replace ("Eastern ", "E. ");
+ result.replace ("West ", "W. ");
+ result.replace ("Western ", "W. ");
+ result.replace ("Central ", "C. ");
+ result.replace (" and ", " & ");
+ result.replace ("Republic", "Rep.");
+ result.replace ("United States of America", "U.S.A.");
+ result.replace ("United States", "U.S.A.");
+ result.replace ("Fed. Rep. of ", "");
+ result.replace ("French ", "Fr.");
+ result.replace ("Asiatic", "AS");
+ result.replace ("European", "EU");
+ result.replace ("African", "AF");
+ return result;
+ }
QString get_cty_path(const Configuration *configuration);
void load_cty(QFile &file);
@@ -203,6 +231,7 @@ public:
result.CQ_zone = e.CQ_zone_;
result.ITU_zone = e.ITU_zone_;
result.entity_name = e.name_;
+ result.abbreviated_entity_name = e.abbreviated_name_;
result.WAE_only = e.WAE_only_;
result.latitude = e.lat_;
result.longtitude = e.long_;
@@ -333,11 +362,8 @@ char const * AD1CCty::continent (Continent c)
QString AD1CCty::impl::get_cty_path(Configuration const * configuration)
{
- QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
- auto path = dataPath.exists (file_name)
- ? dataPath.absoluteFilePath (file_name) // user override
- : configuration->data_dir ().absoluteFilePath (file_name); // or original
- return path;
+ return writable_override_or_installed_file_path (configuration->writeable_data_dir (),
+ configuration->data_dir (), file_name);
}
void AD1CCty::impl::load_cty(QFile &file)
@@ -369,7 +395,7 @@ void AD1CCty::impl::load_cty(QFile &file)
WAE_only = true;
}
bool ok1, ok2, ok3, ok4, ok5;
- entities_.emplace(++entity_id, entity_parts[0].trimmed(), WAE_only, entity_parts[1].trimmed().toInt(&ok1),
+ entities_.emplace(++entity_id, entity_parts[0].trimmed(), abbreviated_entity_name(entity_parts[0].trimmed()),WAE_only, entity_parts[1].trimmed().toInt(&ok1),
entity_parts[2].trimmed().toInt(&ok2), continent(entity_parts[3].trimmed()),
entity_parts[4].trimmed().toFloat(&ok3), entity_parts[5].trimmed().toFloat(&ok4),
static_cast<int> (entity_parts[6].trimmed().toFloat(&ok5) * 60 * 60), primary_prefix);
@@ -423,14 +449,10 @@ AD1CCty::AD1CCty (Configuration const * configuration)
}
}
- QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
- m_->path_ = dataPath.exists (file_name)
- ? dataPath.absoluteFilePath (file_name) // user override
- : configuration->data_dir ().absoluteFilePath (file_name); // or original
+ m_->path_ = m_->impl::get_cty_path (configuration);
- QString path = dataPath.exists (grid_file_name)
- ? dataPath.absoluteFilePath (grid_file_name) // user override
- : configuration->data_dir ().absoluteFilePath (grid_file_name); // or original in the resources FS
+ QString path = writable_override_or_installed_file_path (configuration->writeable_data_dir (),
+ configuration->data_dir (), grid_file_name);
QFile file1 {path};
diff --git a/logbook/AD1CCty.hpp b/logbook/AD1CCty.hpp
index 1f031b99..4afb7d9b 100644
--- a/logbook/AD1CCty.hpp
+++ b/logbook/AD1CCty.hpp
@@ -34,6 +34,7 @@ public:
int CQ_zone;
int ITU_zone;
QString entity_name;
+ QString abbreviated_entity_name;
bool WAE_only;
float latitude;
float longtitude;
diff --git a/logbook/AdifQso.cpp b/logbook/AdifQso.cpp
new file mode 100644
index 00000000..c85a869e
--- /dev/null
+++ b/logbook/AdifQso.cpp
@@ -0,0 +1,143 @@
+#include "logbook/AdifQso.hpp"
+
+#include <QDateTime>
+#include <QStringList>
+
+QByteArray AdifQso::to_adif (QString const& hisCall, QString const& hisGrid, QString const& mode,
+ QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
+ QDateTime const& dateTimeOff, QString const& band, QString const& comments,
+ QString const& name, QString const& strDialFreq, QString const& myCall,
+ QString const& myGrid, QString const& txPower, QString const& operator_call,
+ QString const& xSent, QString const& xRcvd, QString const& propmode,
+ QString const& satellite, QString const& satmode, QString const& freqRx,
+ Contest contest)
+{
+ QString t;
+
+ auto to_adi_text = [] (QString value)
+ {
+ for (auto& ch : value)
+ {
+ if (ch == QChar {'<'} || ch == QChar {'>'})
+ {
+ ch = QChar {};
+ }
+ else if (ch < QChar {' '} || ch > QChar {'~'})
+ {
+ ch = QChar {'?'};
+ }
+ }
+ return value.remove (QChar {});
+ };
+
+ auto append_field = [&t, &to_adi_text] (QString const& fieldName, QString const& value)
+ {
+ auto const adiValue = to_adi_text (value);
+ if (!t.isEmpty ()) t += ' ';
+ t += '<' + fieldName + ':' + QString::number (adiValue.size ()) + '>' + adiValue;
+ };
+ // Optional fields are omitted entirely when empty.
+ auto append_optional = [&] (QString const& fieldName, QString const& value)
+ {
+ if (value.size ()) append_field (fieldName, value);
+ };
+ append_field ("call", hisCall);
+ append_field ("gridsquare", hisGrid); // emitted even when empty for consistency
+ if (mode != "FT4" && mode != "FST4" && mode != "Q65")
+ {
+ append_field ("mode", mode);
+ }
+ else
+ {
+ append_field ("mode", "MFSK");
+ append_field ("submode", mode);
+ }
+ append_field ("rst_sent", rptSent);
+ append_field ("rst_rcvd", rptRcvd);
+ append_field ("qso_date", dateTimeOn.date ().toString ("yyyyMMdd"));
+ append_field ("time_on", dateTimeOn.time ().toString ("hhmmss"));
+ append_field ("qso_date_off", dateTimeOff.date ().toString ("yyyyMMdd"));
+ append_field ("time_off", dateTimeOff.time ().toString ("hhmmss"));
+ append_field ("band", band);
+ append_field ("freq", strDialFreq);
+ append_field ("station_callsign", myCall);
+ append_optional ("my_gridsquare", myGrid);
+ append_optional ("tx_pwr", txPower);
+ append_optional ("comment", comments);
+ append_optional ("name", name);
+ append_optional ("operator", operator_call);
+ append_optional ("prop_mode", propmode);
+ append_optional ("sat_name", satellite);
+ append_optional ("sat_mode", satmode);
+ append_optional ("freq_rx", 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)
+ {
+ // Supported contest exchanges are either two tokens, or EU VHF's
+ // report+serial token followed by a locator.
+ if (words.size () == 2 && words.back ().toUInt ())
+ {
+ append_field ("stx", words.back ()); // last word is a positive serial
+ }
+ else if (words.size () == 2 && words.front ().toUInt () && words.front ().size () > 3) // EU VHF contest mode
+ {
+ append_field ("stx", words.front ().mid (2)); // first word is report+serial
+ }
+ else
+ {
+ // non-serial exchange (e.g. Field Day class+section) kept verbatim
+ append_field ("STX_STRING", xSent);
+ }
+ }
+ }
+ 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 () > 1)
+ {
+ // Supported contest exchanges are either two tokens, or EU VHF's
+ // report+serial token followed by a locator.
+ if (words.size () == 2 && words.back ().toUInt ())
+ {
+ append_field ("srx", words.back ()); // last word is a positive serial
+ }
+ else if (words.size () == 2 && words.front ().toUInt () && words.front ().size () > 3) // EU VHF contest exchange
+ {
+ append_field ("srx", words.front ().mid (2)); // strip report, keep serial
+ }
+ else if (words.size () == 2 && Contest::FieldDay == contest)
+ {
+ // 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
+ append_field ("contest_id", "ARRL-FIELD-DAY");
+ append_field ("SRX_STRING", xRcvd);
+ append_field ("class", words.front ());
+ append_field ("arrl_sect", words.back ());
+ }
+ else if (words.size () == 2 && Contest::Rtty == contest)
+ {
+ append_field ("state", words.back ());
+ }
+ else
+ {
+ // non-serial exchange with no special handling kept verbatim
+ append_field ("SRX_STRING", xRcvd);
+ }
+ }
+ }
+ return t.toLatin1 ();
+}
diff --git a/logbook/AdifQso.hpp b/logbook/AdifQso.hpp
new file mode 100644
index 00000000..8868b2b7
--- /dev/null
+++ b/logbook/AdifQso.hpp
@@ -0,0 +1,29 @@
+#ifndef WSJTX_LOGBOOK_ADIFQSO_HPP
+#define WSJTX_LOGBOOK_ADIFQSO_HPP
+
+#include <QByteArray>
+#include <QString>
+
+class QDateTime;
+
+namespace AdifQso
+{
+ //! Contest-exchange handling required by the ADIF formatter.
+ enum class Contest { None, FieldDay, Rtty };
+
+ //! Format a single QSO as an ADIF (.adi) record.
+ //!
+ //! The returned record has no <eor> terminator; callers append their own.
+ //! Values are converted to printable ADI text and stripped of '<'/'>'
+ //! before field lengths are calculated.
+ QByteArray to_adif (QString const& hisCall, QString const& hisGrid, QString const& mode,
+ QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
+ QDateTime const& dateTimeOff, QString const& band, QString const& comments,
+ QString const& name, QString const& strDialFreq, QString const& myCall,
+ QString const& myGrid, QString const& txPower, QString const& operator_call,
+ QString const& xSent, QString const& xRcvd, QString const& propmode,
+ QString const& satellite, QString const& satmode, QString const& freqRx,
+ Contest contest);
+}
+
+#endif // WSJTX_LOGBOOK_ADIFQSO_HPP
diff --git a/logbook/WorkedBefore.cpp b/logbook/WorkedBefore.cpp
index 7255ee4a..c2570f0b 100644
--- a/logbook/WorkedBefore.cpp
+++ b/logbook/WorkedBefore.cpp
@@ -15,16 +15,18 @@
#include <QChar>
#include <QString>
#include <QByteArray>
-#include <QStandardPaths>
#include <QDir>
#include <QFileInfo>
#include <QFile>
#include <QTextStream>
#include <QDateTime>
+#include <QPointer>
#include "Configuration.hpp"
+#include "PerformanceTrace.hpp"
#include "revision_utils.hpp"
#include "Logger.hpp"
#include "qt_helpers.hpp"
+#include "WorkedBeforeLoadState.hpp"
#include "pimpl_impl.hpp"
#include "moc_WorkedBefore.cpp"
@@ -279,8 +281,10 @@ namespace
return QString {};
}
- worked_before_database_type loader (QString const& path, AD1CCty const * prefixes)
+ worked_before_database_type loader (QString const& path, AD1CCty const * prefixes,
+ PerformanceTrace::RunId run)
{
+ PerformanceTrace::Phase parse {run, "logbook.parse"};
worked_before_database_type worked;
QFile inputFile {path};
if (inputFile.exists ())
@@ -359,6 +363,7 @@ namespace
throw LoaderException (std::runtime_error {QCoreApplication::translate ("WorkedBefore", "Error opening ADIF log file for read: %0").arg (inputFile.errorString ()).toLocal8Bit ()});
}
}
+ parse.finish (QString {"unique_entries=%1"}.arg (worked.size ()));
return worked;
}
}
@@ -367,50 +372,82 @@ class WorkedBefore::impl final
{
public:
impl (Configuration const * configuration)
- : configuration_ {configuration}
- , path_ {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath (logFileName)}
+ : construction_trace_ {"logbook.construct"}
+ , configuration_ {configuration}
+ , path_ {writable_file_path (configuration->writeable_data_dir (), logFileName)}
, prefixes_ {configuration}
{
+ construction_trace_.finish ();
}
- void reload ()
+ void start_loader ()
{
- prefixes_.reload (configuration_);
- async_loader_ = QtConcurrent::run (loader, path_, &prefixes_);
+ loader_run_ = PerformanceTrace::current_run ();
+ {
+ PerformanceTrace::Phase prefixes_reload {loader_run_, "logbook.prefixes_reload"};
+ prefixes_.reload (configuration_);
+ }
+ PerformanceTrace::milestone (loader_run_, "logbook.load_started");
+ async_loader_ = QtConcurrent::run (loader, path_, &prefixes_, loader_run_);
loader_watcher_.setFuture (async_loader_);
}
+ void reload ()
+ {
+ if (WorkedBeforeLoadState::ReloadResult::Start == load_state_.request_reload ())
+ {
+ start_loader ();
+ }
+ }
+
+ PerformanceTrace::Phase construction_trace_;
Configuration const * configuration_;
QString path_;
AD1CCty prefixes_;
QFutureWatcher<worked_before_database_type> loader_watcher_;
QFuture<worked_before_database_type> async_loader_;
worked_before_database_type worked_;
+ WorkedBeforeLoadState load_state_;
+ PerformanceTrace::RunId loader_run_ {0};
};
WorkedBefore::WorkedBefore (Configuration const * configuration)
: m_ {configuration}
{
Q_ASSERT (configuration);
- connect (&m_->loader_watcher_, &QFutureWatcher<worked_before_database_type>::finished, [this] () {
- QString error;
- size_t n {0};
- try
- {
- m_->worked_ = m_->loader_watcher_.result ();
- n = m_->worked_.size ();
- }
- catch (LoaderException const& e)
- {
- error = e.error ();
- }
- QString cty_ver = m_->prefixes_.version();
- LOG_DEBUG(QString{"WorkedBefore::reload: CTY.DAT version %1"}.arg (cty_ver));
- Q_EMIT finished_loading (n, cty_ver, error);
- });
+ connect (&m_->loader_watcher_, &QFutureWatcher<worked_before_database_type>::finished,
+ this, &WorkedBefore::handle_loader_finished);
reload ();
}
+void WorkedBefore::handle_loader_finished ()
+{
+ m_->load_state_.begin_completion ();
+ QString error;
+ size_t n {0};
+ try
+ {
+ m_->worked_ = m_->loader_watcher_.result ();
+ n = m_->worked_.size ();
+ }
+ catch (LoaderException const& e)
+ {
+ error = e.error ();
+ }
+ QString cty_ver = m_->prefixes_.version();
+ LOG_DEBUG(QString{"WorkedBefore::reload: CTY.DAT version %1"}.arg (cty_ver));
+ QPointer<WorkedBefore> guard {this};
+ Q_EMIT finished_loading (n, cty_ver, error);
+ if (!guard)
+ {
+ return;
+ }
+ if (WorkedBeforeLoadState::CompletionResult::Restart == m_->load_state_.finish_completion ())
+ {
+ m_->start_loader ();
+ }
+}
+
QString WorkedBefore::cty_version () const
{
return m_->prefixes_.version ();
@@ -423,6 +460,8 @@ void WorkedBefore::reload ()
WorkedBefore::~WorkedBefore ()
{
+ PerformanceTrace::Phase shutdown_wait {"logbook.shutdown_wait"};
+ m_->async_loader_.waitForFinished ();
}
QString const& WorkedBefore::path () const
@@ -445,8 +484,11 @@ bool WorkedBefore::add (QString const& call
{
auto const& entity = m_->prefixes_.lookup (call);
QFile file {m_->path_};
+ ensure_parent_directory (file.fileName ());
if (!file.open(QIODevice::Text | QIODevice::Append))
{
+ LOG_ERROR ("Error opening ADIF log file for append: " << file.fileName ()
+ << " - " << file.errorString ());
return false;
}
else
diff --git a/logbook/WorkedBefore.hpp b/logbook/WorkedBefore.hpp
index 0be9d783..ae9cb443 100644
--- a/logbook/WorkedBefore.hpp
+++ b/logbook/WorkedBefore.hpp
@@ -41,6 +41,8 @@ public:
Q_SIGNAL void finished_loading (int worked_before_record_count, QString const, QString const& error) const;
private:
+ Q_SLOT void handle_loader_finished ();
+
class impl;
pimpl<impl> m_;
};
diff --git a/logbook/WorkedBeforeLoadState.hpp b/logbook/WorkedBeforeLoadState.hpp
new file mode 100644
index 00000000..02578cd2
--- /dev/null
+++ b/logbook/WorkedBeforeLoadState.hpp
@@ -0,0 +1,70 @@
+#ifndef WORKED_BEFORE_LOAD_STATE_HPP
+#define WORKED_BEFORE_LOAD_STATE_HPP
+
+#include <QtGlobal>
+
+class WorkedBeforeLoadState final
+{
+public:
+ enum class ReloadResult
+ {
+ Start,
+ Coalesced
+ };
+
+ enum class CompletionResult
+ {
+ Idle,
+ Restart
+ };
+
+ ReloadResult request_reload ()
+ {
+ if (Phase::Idle == phase_)
+ {
+ phase_ = Phase::Loading;
+ return ReloadResult::Start;
+ }
+
+ reload_pending_ = true;
+ return ReloadResult::Coalesced;
+ }
+
+ void begin_completion ()
+ {
+ Q_ASSERT (Phase::Loading == phase_);
+ phase_ = Phase::Completing;
+ }
+
+ CompletionResult finish_completion ()
+ {
+ Q_ASSERT (Phase::Completing == phase_);
+ if (reload_pending_)
+ {
+ reload_pending_ = false;
+ phase_ = Phase::Loading;
+ return CompletionResult::Restart;
+ }
+
+ phase_ = Phase::Idle;
+ return CompletionResult::Idle;
+ }
+
+ bool active () const
+ {
+ return Phase::Idle != phase_;
+ }
+
+private:
+ enum class Phase
+ {
+ Idle,
+ Loading,
+ Completing
+ };
+
+ Phase phase_ {Phase::Idle};
+ bool reload_pending_ {false};
+};
+
+#endif // WORKED_BEFORE_LOAD_STATE_HPP
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 ()
diff --git a/logbook/logbook.pri b/logbook/logbook.pri
deleted file mode 100644
index e67cdebd..00000000
--- a/logbook/logbook.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-SOURCES += \
- logbook/countriesworked.cpp \
- logbook/logbook.cpp \
- logbook/AD1CCty.cpp \
- logbook/WorkedBefore.cpp \
- logbook/Multiplier.cpp
-
-HEADERS += \
- logbook/WorkedBefore.hpp \
- logbook/logbook.h \
- logbook/countriesworked.h \
- logbook/AD1CCty.hpp \
- logbook/Multiplier.hpp