1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Added support for OziExplorer files with UTF8 BOMs

This commit is contained in:
Martin Tůma 2018-06-02 16:41:27 +02:00
parent 815cb6cb91
commit ec247d5d1d
2 changed files with 8 additions and 4 deletions

View File

@ -24,7 +24,8 @@ bool PLTParser::parse(QFile *file, QList<TrackData> &tracks,
QByteArray line = file->readLine();
if (_errorLine == 1) {
if (!line.trimmed().startsWith("OziExplorer Track Point File")) {
QString fileType(QString::fromUtf8(line).trimmed());
if (!fileType.startsWith("OziExplorer Track Point File")) {
_errorString = "Not a PLT file";
return false;
}
@ -107,7 +108,8 @@ bool RTEParser::parse(QFile *file, QList<TrackData> &tracks,
QByteArray line = file->readLine();
if (_errorLine == 1) {
if (!line.trimmed().startsWith("OziExplorer Route File")) {
QString fileType(QString::fromUtf8(line).trimmed());
if (!fileType.startsWith("OziExplorer Route File")) {
_errorString = "Not a RTE file";
return false;
}
@ -201,7 +203,8 @@ bool WPTParser::parse(QFile *file, QList<TrackData> &tracks,
QByteArray line = file->readLine();
if (_errorLine == 1) {
if (!line.trimmed().startsWith("OziExplorer Waypoint File")) {
QString fileType(QString::fromUtf8(line).trimmed());
if (!fileType.startsWith("OziExplorer Waypoint File")) {
_errorString = "Not a WPT file";
return false;
}

View File

@ -26,7 +26,8 @@ int MapFile::parse(QIODevice &device, QList<CalibrationPoint> &points,
QByteArray line = device.readLine();
if (ln == 1) {
if (!line.trimmed().startsWith("OziExplorer Map Data File"))
QString fileType(QString::fromUtf8(line).trimmed());
if (!fileType.startsWith("OziExplorer Map Data File"))
return ln;
} else if (ln == 2)
_name = line.trimmed();