Enhance the ADIF parser to accept newlines between fields

ADIF allows any characters between fields to aid readability.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8082 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-09-09 22:59:13 +00:00
parent 1b1936d8d2
commit 8db9f1fc54

View File

@ -58,16 +58,27 @@ void ADIF::load()
QFile inputFile(_filename);
if (inputFile.open(QIODevice::ReadOnly))
{
QTextStream in(&inputFile);
while ( !in.atEnd() )
QTextStream in(&inputFile);
QString record;
// skip header record
while (!in.atEnd () && !record.contains ("<EOH>", Qt::CaseInsensitive))
{
QString line = in.readLine();
QSO q;
q.call = _extractField(line,"CALL:");
q.band = _extractField(line,"BAND:");
q.mode = _extractField(line,"MODE:");
q.date = _extractField(line,"QSO_DATE:");
if (q.call != "")
record += in.readLine ();
}
while ( !in.atEnd() )
{
record.clear ();
while (!in.atEnd () && !record.contains ("<EOR>", Qt::CaseInsensitive))
{
record += in.readLine ();
}
QSO q;
q.call = _extractField(record,"CALL:");
q.band = _extractField(record,"BAND:");
q.mode = _extractField(record,"MODE:");
q.date = _extractField(record,"QSO_DATE:");
if (q.call != "")
_data.insert(q.call,q);
}
inputFile.close();