summaryrefslogtreecommitdiffstats
path: root/src/corelib/time/qtimezoneprivate_win.cpp
diff options
context:
space:
mode:
authorJiDe Zhang <zhangjide@uniontech.com>2021-03-09 16:19:54 +0800
committerJiDe Zhang <zhangjide@uniontech.com>2021-04-15 20:17:49 +0800
commit50a7eb8cf75a2f9cebde6d0d23c108e5e7f1870b (patch)
treec947e4746bb55f723c4005534cb98501f083036a /src/corelib/time/qtimezoneprivate_win.cpp
parent7c8d45cb2635ab44d85d85288fd74ef72909264c (diff)
Add the "Territory" enumerated type for QLocale
The use of "Country" is misleading as some entries in the enumeration are not countries (eg, HongKong), for all that most are. The Unicode Consortium's Common Locale Data Repository (CLDR, from which QLocale's data is taken) calls these territories, so introduce territory-based names and prepare to deprecate the country-based ones in due course. [ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for its Country enumeration, and associated territory-based names to match its country-named methods, to better match the usage in relevant standards. The country-based names shall in due course be deprecated in favor of the territory-based names. Fixes: QTBUG-91686 Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/time/qtimezoneprivate_win.cpp')
-rw-r--r--src/corelib/time/qtimezoneprivate_win.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/time/qtimezoneprivate_win.cpp b/src/corelib/time/qtimezoneprivate_win.cpp
index 7c80dbc38b..0846890b60 100644
--- a/src/corelib/time/qtimezoneprivate_win.cpp
+++ b/src/corelib/time/qtimezoneprivate_win.cpp
@@ -376,13 +376,13 @@ int yearEndOffset(const QWinTimeZonePrivate::QWinTransitionRule &rule, int year)
return offset;
}
-QLocale::Country userCountry()
+QLocale::Territory userTerritory()
{
const GEOID id = GetUserGeoID(GEOCLASS_NATION);
wchar_t code[3];
const int size = GetGeoInfo(id, GEO_ISO2, code, 3, 0);
- return (size == 3) ? QLocalePrivate::codeToCountry(QStringView(code, size))
- : QLocale::AnyCountry;
+ return (size == 3) ? QLocalePrivate::codeToTerritory(QStringView(code, size))
+ : QLocale::AnyTerritory;
}
// Index of last rule in rules with .startYear <= year:
@@ -727,13 +727,13 @@ QTimeZonePrivate::Data QWinTimeZonePrivate::previousTransition(qint64 beforeMSec
QByteArray QWinTimeZonePrivate::systemTimeZoneId() const
{
- const QLocale::Country country = userCountry();
+ const QLocale::Territory territory = userTerritory();
const QByteArray windowsId = windowsSystemZoneId();
QByteArray ianaId;
- // If we have a real country, then try get a specific match for that country
- if (country != QLocale::AnyCountry)
- ianaId = windowsIdToDefaultIanaId(windowsId, country);
- // If we don't have a real country, or there wasn't a specific match, try the global default
+ // If we have a real territory, then try get a specific match for that territory
+ if (territory != QLocale::AnyTerritory)
+ ianaId = windowsIdToDefaultIanaId(windowsId, territory);
+ // If we don't have a real territory, or there wasn't a specific match, try the global default
if (ianaId.isEmpty())
ianaId = windowsIdToDefaultIanaId(windowsId);
return ianaId;