From 22c7ea7de64886b3571e7719a22c8bb88e357124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 16 Oct 2024 01:21:28 +0200 Subject: [PATCH] Do not use functions deprecated in Qt 6.8 --- src/data/exifparser.cpp | 3 ++- src/data/fitparser.cpp | 9 +++++---- src/data/igcparser.cpp | 3 ++- src/data/nmeaparser.cpp | 8 +++++--- src/data/onmoveparsers.cpp | 8 ++++---- src/data/onmoveparsers.h | 9 +++++---- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/data/exifparser.cpp b/src/data/exifparser.cpp index dc3afad8..f84c59cd 100644 --- a/src/data/exifparser.cpp +++ b/src/data/exifparser.cpp @@ -1,4 +1,5 @@ #include +#include #include "common/tifffile.h" #include "common/util.h" #include "exifparser.h" @@ -213,7 +214,7 @@ bool EXIFParser::parseTIFF(QFile *file, QVector &waypoints) GPSIFD.value(GPSAltitudeRef))); wp.setTimestamp(QDateTime(QDate::fromString(text(tiff, GPSIFD.value(GPSDateStamp)), "yyyy:MM:dd"), time(tiff, - GPSIFD.value(GPSTimeStamp)), Qt::UTC)); + GPSIFD.value(GPSTimeStamp)), QTimeZone::utc())); wp.setDescription(text(tiff, IFD0.value(ImageDescription)).trimmed()); waypoints.append(wp); diff --git a/src/data/fitparser.cpp b/src/data/fitparser.cpp index 58b66128..e22bce5f 100644 --- a/src/data/fitparser.cpp +++ b/src/data/fitparser.cpp @@ -1,4 +1,5 @@ #include +#include #include "GUI/format.h" #include "fitparser.h" @@ -307,7 +308,7 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def) switch (field->id) { case 1: waypoint.setTimestamp(QDateTime::fromSecsSinceEpoch( - val.toUInt() + 631065600, Qt::UTC)); + val.toUInt() + 631065600, QTimeZone::utc())); break; case 2: waypoint.rcoordinates().setLat( @@ -380,7 +381,7 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def) } else if (def->globalId == RECORD) { if (ctx.trackpoint.coordinates().isValid()) { ctx.trackpoint.setTimestamp(QDateTime::fromSecsSinceEpoch( - ctx.timestamp + 631065600, Qt::UTC)); + ctx.timestamp + 631065600, QTimeZone::utc())); ctx.trackpoint.setRatio(ctx.ratio); ctx.segment.append(ctx.trackpoint); ctx.trackpoint = Trackpoint(); @@ -391,7 +392,7 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def) } else if (def->globalId == LOCATION) { if (waypoint.coordinates().isValid()) { waypoint.setTimestamp(QDateTime::fromSecsSinceEpoch(ctx.timestamp - + 631065600, Qt::UTC)); + + 631065600, QTimeZone::utc())); ctx.waypoints.append(waypoint); } } else if (def->globalId == LAP && trigger >= 0) { @@ -401,7 +402,7 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def) else waypoint.setName("Lap " + QString::number(++ctx.laps)); waypoint.setTimestamp(QDateTime::fromSecsSinceEpoch(ctx.timestamp - + 631065600, Qt::UTC)); + + 631065600, QTimeZone::utc())); if (trigger != 7 || ctx.laps > 1) ctx.waypoints.append(waypoint); } diff --git a/src/data/igcparser.cpp b/src/data/igcparser.cpp index 50f01bfd..253bd0b1 100644 --- a/src/data/igcparser.cpp +++ b/src/data/igcparser.cpp @@ -1,4 +1,5 @@ #include +#include #include "common/util.h" #include "igcparser.h" @@ -160,7 +161,7 @@ bool IGCParser::readBRecord(CTX &ctx, const char *line, int len, ctx.time = time; Trackpoint t(Coordinates(lon, lat)); - t.setTimestamp(QDateTime(ctx.date, ctx.time, Qt::UTC)); + t.setTimestamp(QDateTime(ctx.date, ctx.time, QTimeZone::utc())); t.setElevation(ele); segment.append(t); diff --git a/src/data/nmeaparser.cpp b/src/data/nmeaparser.cpp index 5c4ce844..648bfdab 100644 --- a/src/data/nmeaparser.cpp +++ b/src/data/nmeaparser.cpp @@ -1,4 +1,5 @@ #include +#include #include "common/util.h" #include "nmeaparser.h" @@ -282,7 +283,8 @@ bool NMEAParser::readRMC(CTX &ctx, const char *line, int len, if (!date.isNull()) { if (ctx.date.isNull() && !ctx.time.isNull() && !segment.isEmpty()) - segment.last().setTimestamp(QDateTime(date, ctx.time, Qt::UTC)); + segment.last().setTimestamp(QDateTime(date, ctx.time, + QTimeZone::utc())); ctx.date = date; } @@ -290,7 +292,7 @@ bool NMEAParser::readRMC(CTX &ctx, const char *line, int len, if (valid && !ctx.GGA && c.isValid()) { Trackpoint t(c); if (!ctx.date.isNull() && !time.isNull()) - t.setTimestamp(QDateTime(ctx.date, time, Qt::UTC)); + t.setTimestamp(QDateTime(ctx.date, time, QTimeZone::utc())); segment.append(t); } @@ -363,7 +365,7 @@ bool NMEAParser::readGGA(CTX &ctx, const char *line, int len, if (c.isValid()) { Trackpoint t(c); if (!(ctx.time.isNull() || ctx.date.isNull())) - t.setTimestamp(QDateTime(ctx.date, ctx.time, Qt::UTC)); + t.setTimestamp(QDateTime(ctx.date, ctx.time, QTimeZone::utc())); if (!std::isnan(ele)) t.setElevation(ele - gh); segment.append(t); diff --git a/src/data/onmoveparsers.cpp b/src/data/onmoveparsers.cpp index 9df1139b..7f65be5c 100644 --- a/src/data/onmoveparsers.cpp +++ b/src/data/onmoveparsers.cpp @@ -46,7 +46,7 @@ bool OMDParser::readHeaderFile(const QString &omdPath, Header &hdr) quint8 avgHr = buffer[12]; quint8 maxHr = buffer[13]; - QDateTime date(QDate(Y + 2000, M, D), QTime(h, m), Qt::UTC); + QDateTime date(QDate(Y + 2000, M, D), QTime(h, m), QTimeZone::utc()); if (!date.isValid()) { qWarning("%s: invalid date", qPrintable(path)); return false; @@ -80,7 +80,7 @@ bool OMDParser::readF1(const char *chunk, const Header &hdr, Sequence &seq, return false; } t.setTimestamp(QDateTime(hdr.date.date(), - hdr.date.time().addSecs(sec), Qt::UTC)); + hdr.date.time().addSecs(sec), QTimeZone::utc())); if (hdr.elevation) t.setElevation(alt); @@ -200,7 +200,7 @@ bool GHPParser::readHeaderFile(const QString &ghpPath, Header &hdr) quint8 avgHr = buffer[61]; quint8 maxHr = buffer[60]; - QDateTime date(QDate(Y + 2000, M, D), QTime(h, m, s), Qt::UTC); + QDateTime date(QDate(Y + 2000, M, D), QTime(h, m, s), QTimeZone::utc()); if (!date.isValid()) { qWarning("%s: invalid date", qPrintable(path)); return false; @@ -230,7 +230,7 @@ bool GHPParser::readF0(const char *chunk, const Header &hdr, int &time, return false; } t.setTimestamp(QDateTime(hdr.date.date(), - hdr.date.time().addMSecs(time * 100), Qt::UTC)); + hdr.date.time().addMSecs(time * 100), QTimeZone::utc())); t.setSpeed(speed / 360.0); t.setElevation(alt); if (hdr.hr) diff --git a/src/data/onmoveparsers.h b/src/data/onmoveparsers.h index 62dca989..988bdbbc 100644 --- a/src/data/onmoveparsers.h +++ b/src/data/onmoveparsers.h @@ -1,6 +1,7 @@ #ifndef ONMOVEPARSERS_H #define ONMOVEPARSERS_H +#include #include "parser.h" class OMDParser : public Parser @@ -14,8 +15,8 @@ public: private: struct Header { - Header() : date(QDateTime(QDate(1970, 1, 1), QTime(0, 0), Qt::UTC)), - elevation(true), hr(true) {} + Header() : date(QDateTime(QDate(1970, 1, 1), QTime(0, 0), + QTimeZone::utc())), elevation(true), hr(true) {} QDateTime date; bool elevation; @@ -50,8 +51,8 @@ public: private: struct Header { - Header() : date(QDateTime(QDate(1970, 1, 1), QTime(0, 0), Qt::UTC)), - hr(true) {} + Header() : date(QDateTime(QDate(1970, 1, 1), QTime(0, 0), + QTimeZone::utc())), hr(true) {} QDateTime date; bool hr;