summaryrefslogtreecommitdiff
path: root/logbook
diff options
context:
space:
mode:
Diffstat (limited to 'logbook')
-rw-r--r--logbook/AD1CCty.cpp4
-rw-r--r--logbook/WorkedBefore.cpp24
-rw-r--r--logbook/logbook.cpp5
-rw-r--r--logbook/logbook.h2
4 files changed, 25 insertions, 10 deletions
diff --git a/logbook/AD1CCty.cpp b/logbook/AD1CCty.cpp
index 23d34fb4..4112ddfb 100644
--- a/logbook/AD1CCty.cpp
+++ b/logbook/AD1CCty.cpp
@@ -319,12 +319,12 @@ AD1CCty::AD1CCty (Configuration const * configuration)
{
Q_ASSERT (configuration);
// TODO: G4WJS - consider doing the following asynchronously to
- // speed up startup. Not urgent as it takes less than 1s on a Core
+ // speed up startup. Not urgent as it takes less than 0.5s on a Core
// i7 reading BIG CTY.DAT.
QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
m_->path_ = dataPath.exists (file_name)
? dataPath.absoluteFilePath (file_name) // user override
- : QString {":/"} + file_name; // or original in the resources FS
+ : configuration->data_dir ().absoluteFilePath (file_name); // or original
QFile file {m_->path_};
if (file.open (QFile::ReadOnly))
{
diff --git a/logbook/WorkedBefore.cpp b/logbook/WorkedBefore.cpp
index 438243d4..e7214d41 100644
--- a/logbook/WorkedBefore.cpp
+++ b/logbook/WorkedBefore.cpp
@@ -8,6 +8,7 @@
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/key_extractors.hpp>
#include <boost/range/iterator_range.hpp>
+#include <QCoreApplication>
#include <QtConcurrent/QtConcurrentRun>
#include <QFuture>
#include <QFutureWatcher>
@@ -19,7 +20,9 @@
#include <QFileInfo>
#include <QFile>
#include <QTextStream>
+#include <QDateTime>
#include "Configuration.hpp"
+#include "revision_utils.hpp"
#include "qt_helpers.hpp"
#include "pimpl_impl.hpp"
@@ -252,7 +255,7 @@ namespace
}
else
{
- throw LoaderException (std::runtime_error {"Invalid ADIF field " + fieldName.toStdString () + ": " + record.toStdString ()});
+ throw LoaderException (std::runtime_error {QCoreApplication::translate ("WorkedBefore", "Invalid ADIF field %0: %1").arg (fieldName).arg (record).toLocal8Bit ()});
}
if (closingBracketIndex > fieldNameIndex && fieldLengthIndex > fieldNameIndex && fieldLengthIndex < closingBracketIndex)
@@ -269,7 +272,7 @@ namespace
}
else
{
- throw LoaderException (std::runtime_error {"Malformed ADIF field " + fieldName.toStdString () + ": " + record.toStdString ()});
+ throw LoaderException (std::runtime_error {QCoreApplication::translate ("WorkedBefore", "Malformed ADIF field %0: %1").arg (fieldName).arg (record).toLocal8Bit ()});
}
}
return QString {};
@@ -306,7 +309,7 @@ namespace
{
if (end_position < 0)
{
- throw LoaderException (std::runtime_error {"Invalid ADIF header"});
+ throw LoaderException (std::runtime_error {QCoreApplication::translate ("WorkedBefore", "Invalid ADIF header").toLocal8Bit ()});
}
buffer.remove (0, end_position + 5);
}
@@ -352,7 +355,7 @@ namespace
}
else
{
- throw LoaderException (std::runtime_error {"Error opening ADIF log file for read: " + inputFile.errorString ().toStdString ()});
+ throw LoaderException (std::runtime_error {QCoreApplication::translate ("WorkedBefore", "Error opening ADIF log file for read: %0").arg (inputFile.errorString ()).toLocal8Bit ()});
}
}
return worked;
@@ -442,7 +445,18 @@ bool WorkedBefore::add (QString const& call
QTextStream out {&file};
if (!file.size ())
{
- out << "WSJT-X ADIF Export<eh>" << // new file
+ auto ts = QDateTime::currentDateTimeUtc ().toString ("yyyyMMdd HHmmss");
+ auto ver = version (true);
+ out << // new file
+ QString {
+ "ADIF Export\n"
+ "<adif_ver:5>3.1.1\n"
+ "<created_timestamp:15>%0\n"
+ "<programid:6>WSJT-X\n"
+ "<programversion:%1>%2\n"
+ "<eoh>"
+ }.arg (ts).arg (ver.size ()).arg (ver)
+ <<
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
endl
#else
diff --git a/logbook/logbook.cpp b/logbook/logbook.cpp
index 316901f9..2cfa8741 100644
--- a/logbook/logbook.cpp
+++ b/logbook/logbook.cpp
@@ -74,12 +74,12 @@ QByteArray LogBook::QSOToADIF (QString const& hisCall, QString const& hisGrid, Q
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& xSent, QString const& xRcvd, QString const& propmode)
{
QString t;
t = "<call:" + QString::number(hisCall.size()) + ">" + hisCall;
t += " <gridsquare:" + QString::number(hisGrid.size()) + ">" + hisGrid;
- if (mode != "FT4")
+ if (mode != "FT4" && mode != "FST4")
{
t += " <mode:" + QString::number(mode.size()) + ">" + mode;
}
@@ -101,6 +101,7 @@ QByteArray LogBook::QSOToADIF (QString const& hisCall, QString const& hisGrid, Q
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 (xSent.size ())
{
auto words = xSent.split (' '
diff --git a/logbook/logbook.h b/logbook/logbook.h
index 858bb64d..de7ffae1 100644
--- a/logbook/logbook.h
+++ b/logbook/logbook.h
@@ -44,7 +44,7 @@ public:
QDateTime const& dateTimeOff, QString const& band, QString const& comments,
QString const& name, QString const& strDialFreq, QString const& myCall,
QString const& m_myGrid, QString const& m_txPower, QString const& operator_call,
- QString const& xSent, QString const& xRcvd);
+ QString const& xSent, QString const& xRcvd, QString const& propmode);
Q_SIGNAL void finished_loading (int worked_before_record_count, QString const& error) const;