Debugger: Restrict QTimeZone use to Qt >= 5.2

Change-Id: Iba786c265ddf7163fd7bb779d103065de3f83547
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2013-12-02 15:46:22 +01:00
parent cfe84eaae2
commit b0da255acf

View File

@@ -33,7 +33,9 @@
#include <QDateTime>
#include <QDebug>
#include <QHostAddress>
#if QT_VERSION >= 0x050200
#include <QTimeZone>
#endif
#include <ctype.h>
@@ -504,6 +506,7 @@ static QTime timeFromData(int ms)
return ms == -1 ? QTime() : QTime(0, 0, 0, 0).addMSecs(ms);
}
#if QT_VERSION >= 0x050200
// Stolen and adapted from qdatetime.cpp
static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time)
{
@@ -550,6 +553,7 @@ static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time)
*date = (status & NullDate) ? QDate() : QDate::fromJulianDay(jd);
*time = (status & NullTime) ? QTime() : QTime::fromMSecsSinceStartOfDay(ds);
}
#endif
QString decodeData(const QByteArray &ba, int encoding)
{
@@ -678,6 +682,7 @@ QString decodeData(const QByteArray &ba, int encoding)
return QString::fromUtf8(decodedBa);
}
case DateTimeInternal: { // 29, DateTimeInternal: msecs, spec, offset, tz, status
#if QT_VERSION >= 0x050200
int p0 = ba.indexOf('/');
int p1 = ba.indexOf('/', p0 + 1);
int p2 = ba.indexOf('/', p1 + 1);
@@ -708,6 +713,10 @@ QString decodeData(const QByteArray &ba, int encoding)
dateTime = QDateTime(date, time, spec);
}
return dateTime.toString();
#else
// "Very plain".
return QString::fromLatin1(ba);
#endif
}
}
qDebug() << "ENCODING ERROR: " << encoding;