summaryrefslogtreecommitdiff
path: root/logbook/WorkedBefore.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2020-09-28 23:28:26 +0200
committerChristoph Berg <myon@debian.org>2020-09-28 23:28:26 +0200
commitc345880e5818351aec994d60cfb9a42351a4a6bd (patch)
tree82e554ce75a62e7cca37968ee6e8ce08972eef04 /logbook/WorkedBefore.cpp
parentd55aefc872a0b03ac40c44e8b7d635dc0fa19f4e (diff)
parent7aa3c56b01768ba7d38fccedc17b30a4046b3fbb (diff)
Update upstream source from tag 'upstream/2.3.0_rc1+repack'
Update to upstream version '2.3.0~rc1+repack' with Debian dir 278ece20e94e89020b1ea45fb83e61a2cecbb31e
Diffstat (limited to 'logbook/WorkedBefore.cpp')
-rw-r--r--logbook/WorkedBefore.cpp24
1 files changed, 19 insertions, 5 deletions
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