Remove system locale dependency from timezone code that doesn't need it
Various parts of QTimeZone's code were, for no immediately apparent reason, conditioned on !defined(QT_NO_SYSTEMLOCALE). All are in any case conditioned on feature timezone; and none had any obvious relationship with QLocale::system(). Assume this is a fossil left over from initial development of timezone support and purge. [ChangeLog][QtCore][QTimeZone] Some features are now available whenever feature timezone is enabled, that were previously dependent on system locale support. Change-Id: I7f2246e17ace22d2aecc9286295ae522ee2a0f5f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c23d3ca1f0
commit
62b3720a20
@ -10,7 +10,7 @@
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qrect.h>
|
||||
|
||||
#if QT_CONFIG(timezone) && !defined(QT_NO_SYSTEMLOCALE)
|
||||
#if QT_CONFIG(timezone)
|
||||
#include <QtCore/qtimezone.h>
|
||||
#include <QtCore/private/qtimezoneprivate_p.h>
|
||||
#include <QtCore/private/qcore_mac_p.h>
|
||||
@ -466,7 +466,7 @@ NSDate *QDateTime::toNSDate() const
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if QT_CONFIG(timezone) && !defined(QT_NO_SYSTEMLOCALE)
|
||||
#if QT_CONFIG(timezone)
|
||||
/*!
|
||||
\brief Constructs a new QTimeZone containing a copy of the CFTimeZone \a timeZone.
|
||||
|
||||
|
@ -22,13 +22,6 @@ using namespace Qt::StringLiterals;
|
||||
// Create default time zone using appropriate backend
|
||||
static QTimeZonePrivate *newBackendTimeZone()
|
||||
{
|
||||
#ifdef QT_NO_SYSTEMLOCALE
|
||||
#if QT_CONFIG(icu)
|
||||
return new QIcuTimeZonePrivate();
|
||||
#else
|
||||
return new QUtcTimeZonePrivate();
|
||||
#endif
|
||||
#else
|
||||
#if defined(Q_OS_DARWIN)
|
||||
return new QMacTimeZonePrivate();
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
@ -41,21 +34,13 @@ static QTimeZonePrivate *newBackendTimeZone()
|
||||
return new QWinTimeZonePrivate();
|
||||
#else
|
||||
return new QUtcTimeZonePrivate();
|
||||
#endif // System Locales
|
||||
#endif // QT_NO_SYSTEMLOCALE
|
||||
#endif // Backend selection
|
||||
}
|
||||
|
||||
// Create named time zone using appropriate backend
|
||||
static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
|
||||
{
|
||||
Q_ASSERT(!ianaId.isEmpty());
|
||||
#ifdef QT_NO_SYSTEMLOCALE
|
||||
#if QT_CONFIG(icu)
|
||||
return new QIcuTimeZonePrivate(ianaId);
|
||||
#else
|
||||
return new QUtcTimeZonePrivate(ianaId);
|
||||
#endif
|
||||
#else
|
||||
#if defined(Q_OS_DARWIN)
|
||||
return new QMacTimeZonePrivate(ianaId);
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
@ -68,8 +53,7 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
|
||||
return new QWinTimeZonePrivate(ianaId);
|
||||
#else
|
||||
return new QUtcTimeZonePrivate(ianaId);
|
||||
#endif // System Locales
|
||||
#endif // QT_NO_SYSTEMLOCALE
|
||||
#endif // Backend selection
|
||||
}
|
||||
|
||||
class QTimeZoneSingleton
|
||||
@ -77,10 +61,11 @@ class QTimeZoneSingleton
|
||||
public:
|
||||
QTimeZoneSingleton() : backend(newBackendTimeZone()) {}
|
||||
|
||||
// The global_tz is the tz to use in static methods such as availableTimeZoneIds() and
|
||||
// isTimeZoneIdAvailable() and to create named IANA time zones. This is usually the host
|
||||
// system, but may be different if the host resources are insufficient or if
|
||||
// QT_NO_SYSTEMLOCALE is set. A simple UTC backend is used if no alternative is available.
|
||||
// The global_tz is the tz to use in static methods such as
|
||||
// availableTimeZoneIds() and isTimeZoneIdAvailable() and to create named
|
||||
// IANA time zones. This is usually the host system, but may be different if
|
||||
// the host resources are insufficient. A simple UTC backend is used if no
|
||||
// alternative is available.
|
||||
QExplicitlySharedDataPointer<QTimeZonePrivate> backend;
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#if QT_CONFIG(timezone) && (defined(Q_OS_DARWIN) || defined(Q_QDOC)) && !defined(QT_NO_SYSTEMLOCALE)
|
||||
#if QT_CONFIG(timezone) && (defined(Q_OS_DARWIN) || defined(Q_QDOC))
|
||||
Q_FORWARD_DECLARE_CF_TYPE(CFTimeZone);
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(NSTimeZone);
|
||||
#endif
|
||||
@ -214,7 +214,7 @@ public:
|
||||
static QList<QByteArray> windowsIdToIanaIds(const QByteArray &windowsId,
|
||||
QLocale::Territory territory);
|
||||
|
||||
# if (defined(Q_OS_DARWIN) || defined(Q_QDOC)) && !defined(QT_NO_SYSTEMLOCALE)
|
||||
# if defined(Q_OS_DARWIN) || defined(Q_QDOC)
|
||||
static QTimeZone fromCFTimeZone(CFTimeZoneRef timeZone);
|
||||
CFTimeZoneRef toCFTimeZone() const Q_DECL_CF_RETURNS_RETAINED;
|
||||
static QTimeZone fromNSTimeZone(const NSTimeZone *timeZone);
|
||||
|
@ -756,8 +756,11 @@ static bool isEntryInIanaList(QByteArrayView id, QByteArrayView ianaIds)
|
||||
}
|
||||
|
||||
/*
|
||||
UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and ICU is not being used,
|
||||
or for QDateTimes with a Qt:Spec of Qt::OffsetFromUtc.
|
||||
UTC Offset backend.
|
||||
|
||||
Always present, based on UTC-offset zones.
|
||||
Complements platform-specific backends.
|
||||
Equivalent to Qt::OffsetFromUtc lightweight time representations.
|
||||
*/
|
||||
|
||||
// Create default UTC time zone
|
||||
|
Loading…
x
Reference in New Issue
Block a user