summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-11-18 13:32:19 +0100
committerLars Knoll <lars.knoll@qt.io>2016-11-29 19:04:37 +0000
commite3555fe9705a44072a05b95cca36579745e14125 (patch)
tree1685f95a262415e2f458fb0e75fcc255835a48af /src/corelib/tools
parent0c8f3229de8ec4a8e70d4b41672074b94a45b1fe (diff)
Properly use QT_CONFIG macro to check for ICU
And remove the QT_USE_ICU define. Change-Id: I8134ee18af7c90ed7070926ca31b3a57b3ec37dd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qcollator_p.h6
-rw-r--r--src/corelib/tools/qlocale.cpp4
-rw-r--r--src/corelib/tools/qlocale_p.h2
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--src/corelib/tools/qtimezone.cpp12
-rw-r--r--src/corelib/tools/qtimezoneprivate.cpp2
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h12
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp20
-rw-r--r--src/corelib/tools/tools.pri1
9 files changed, 31 insertions, 32 deletions
diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h
index fbbce00676..423ba0325a 100644
--- a/src/corelib/tools/qcollator_p.h
+++ b/src/corelib/tools/qcollator_p.h
@@ -55,7 +55,7 @@
#include <QtCore/private/qglobal_p.h>
#include "qcollator.h"
#include <QVector>
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
#include <unicode/ucol.h>
#elif defined(Q_OS_OSX)
#include <CoreServices/CoreServices.h>
@@ -65,7 +65,7 @@
QT_BEGIN_NAMESPACE
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
typedef UCollator *CollatorType;
typedef QByteArray CollatorKeyType;
@@ -90,7 +90,7 @@ class Q_CORE_EXPORT QCollatorPrivate
public:
QAtomicInt ref;
QLocale locale;
-#if defined(Q_OS_WIN) && !defined(QT_USE_ICU)
+#if defined(Q_OS_WIN) && !QT_CONFIG(icu)
#ifdef USE_COMPARESTRINGEX
QString localeName;
#else
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 847fc2d55e..f499681ca9 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2431,7 +2431,7 @@ Qt::LayoutDirection QLocale::textDirection() const
*/
QString QLocale::toUpper(const QString &str) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
bool ok = true;
QString result = QIcu::toUpper(d->bcp47Name('_'), str, &ok);
if (ok)
@@ -2455,7 +2455,7 @@ QString QLocale::toUpper(const QString &str) const
*/
QString QLocale::toLower(const QString &str) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
bool ok = true;
const QString result = QIcu::toLower(d->bcp47Name('_'), str, &ok);
if (ok)
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index c83c9d3333..20eff8fd64 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -134,7 +134,7 @@ Q_DECLARE_TYPEINFO(QSystemLocale::QueryType, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QSystemLocale::CurrencyToStringArgument, Q_MOVABLE_TYPE);
#endif
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
namespace QIcu {
QString toUpper(const QByteArray &localeId, const QString &str, bool *ok);
QString toLower(const QByteArray &localeId, const QString &str, bool *ok);
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index eef375fe72..8888eced87 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -5575,7 +5575,7 @@ int QString::localeAwareCompare(const QString &other) const
return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
}
-#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN)
+#if QT_CONFIG(icu) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN)
Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator)
#endif
@@ -5621,7 +5621,7 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
CFRelease(thisString);
CFRelease(otherString);
return result;
-#elif defined(QT_USE_ICU)
+#elif QT_CONFIG(icu)
if (!defaultCollator()->hasLocalData())
defaultCollator()->setLocalData(QCollator());
return defaultCollator()->localData().compare(data1, length1, data2, length2);
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index e423d9af0c..359c2d0bdb 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -54,11 +54,11 @@ QT_BEGIN_NAMESPACE
static QTimeZonePrivate *newBackendTimeZone()
{
#ifdef QT_NO_SYSTEMLOCALE
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return new QIcuTimeZonePrivate();
#else
return new QUtcTimeZonePrivate();
-#endif // QT_USE_ICU
+#endif
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate();
@@ -69,7 +69,7 @@ static QTimeZonePrivate *newBackendTimeZone()
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
return new QWinTimeZonePrivate();
-#elif defined QT_USE_ICU
+#elif QT_CONFIG(icu)
return new QIcuTimeZonePrivate();
#else
return new QUtcTimeZonePrivate();
@@ -81,11 +81,11 @@ static QTimeZonePrivate *newBackendTimeZone()
static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
{
#ifdef QT_NO_SYSTEMLOCALE
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return new QIcuTimeZonePrivate(ianaId);
#else
return new QUtcTimeZonePrivate(ianaId);
-#endif // QT_USE_ICU
+#endif
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate(ianaId);
@@ -96,7 +96,7 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
return new QWinTimeZonePrivate(ianaId);
-#elif defined QT_USE_ICU
+#elif QT_CONFIG(icu)
return new QIcuTimeZonePrivate(ianaId);
#else
return new QUtcTimeZonePrivate(ianaId);
diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp
index 56da197542..2ff03eddec 100644
--- a/src/corelib/tools/qtimezoneprivate.cpp
+++ b/src/corelib/tools/qtimezoneprivate.cpp
@@ -590,7 +590,7 @@ template<> QTimeZonePrivate *QSharedDataPointer<QTimeZonePrivate>::clone()
}
/*
- UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and QT_USE_ICU not set,
+ 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.
*/
diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h
index d7fbb12344..d06784b0f9 100644
--- a/src/corelib/tools/qtimezoneprivate_p.h
+++ b/src/corelib/tools/qtimezoneprivate_p.h
@@ -56,9 +56,9 @@
#include "qlocale_p.h"
#include "qvector.h"
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
#include <unicode/ucal.h>
-#endif // QT_USE_ICU
+#endif
#ifdef Q_OS_MAC
#ifdef __OBJC__
@@ -227,7 +227,7 @@ private:
int m_offsetFromUtc;
};
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
class Q_AUTOTEST_EXPORT QIcuTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
{
public:
@@ -268,7 +268,7 @@ private:
UCalendar *m_ucal;
};
-#endif // QT_USE_ICU
+#endif
#if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_ANDROID
struct QTzTransitionTime
@@ -337,9 +337,9 @@ private:
QVector<QTzTransitionTime> m_tranTimes;
QVector<QTzTransitionRule> m_tranRules;
QList<QByteArray> m_abbreviations;
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
mutable QSharedDataPointer<QTimeZonePrivate> m_icu;
-#endif // QT_USE_ICU
+#endif
QByteArray m_posixRule;
};
#endif // Q_OS_UNIX
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 96d04df0e2..10b61c3a40 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -598,18 +598,18 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
// Create the system default time zone
QTzTimeZonePrivate::QTzTimeZonePrivate()
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
: m_icu(0)
-#endif // QT_USE_ICU
+#endif
{
init(systemTimeZoneId());
}
// Create a named time zone
QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
: m_icu(0)
-#endif // QT_USE_ICU
+#endif
{
init(ianaId);
}
@@ -617,9 +617,9 @@ QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
QTzTimeZonePrivate::QTzTimeZonePrivate(const QTzTimeZonePrivate &other)
: QTimeZonePrivate(other), m_tranTimes(other.m_tranTimes),
m_tranRules(other.m_tranRules), m_abbreviations(other.m_abbreviations),
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
m_icu(other.m_icu),
-#endif // QT_USE_ICU
+#endif
m_posixRule(other.m_posixRule)
{
}
@@ -778,7 +778,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
@@ -788,7 +788,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
#else
Q_UNUSED(nameType)
Q_UNUSED(locale)
-#endif // QT_USE_ICU
+#endif
return abbreviation(atMSecsSinceEpoch);
}
@@ -796,7 +796,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
@@ -807,7 +807,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
Q_UNUSED(timeType)
Q_UNUSED(nameType)
Q_UNUSED(locale)
-#endif // QT_USE_ICU
+#endif
// If no ICU available then have to use abbreviations instead
// Abbreviations don't have GenericTime
if (timeType == QTimeZone::GenericTime)
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index fb80bbd6b8..fa8e07abbc 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -144,7 +144,6 @@ qtConfig(icu) {
SOURCES += tools/qlocale_icu.cpp \
tools/qcollator_icu.cpp
- DEFINES += QT_USE_ICU
} else: win32 {
SOURCES += tools/qcollator_win.cpp
} else: macx {