diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.h | 7 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.qdoc | 8 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_data_p.h | 10 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_icu.cpp | 29 | ||||
-rw-r--r-- | src/corelib/tools/qsimd_p.h | 16 |
6 files changed, 41 insertions, 31 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index e40917c5d8..2d1444c315 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2080,7 +2080,7 @@ QLocale::MeasurementSystem QLocalePrivate::measurementSystem() const for (int i = 0; i < ImperialMeasurementSystemsCount; ++i) { if (ImperialMeasurementSystems[i].languageId == m_language_id && ImperialMeasurementSystems[i].countryId == m_country_id) { - return QLocale::ImperialSystem; + return ImperialMeasurementSystems[i].system; } } return QLocale::MetricSystem; diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index c029f627b2..6c97a05ba8 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -565,7 +565,12 @@ public: }; // GENERATED PART ENDS HERE - enum MeasurementSystem { MetricSystem, ImperialSystem }; + enum MeasurementSystem { + MetricSystem, + ImperialUSSystem, + ImperialUKSystem, + ImperialSystem = ImperialUSSystem // Qt 4 compatibility + }; enum FormatType { LongFormat, ShortFormat, NarrowFormat }; enum NumberOption { diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc index ff994ca2f3..32822c2e6e 100644 --- a/src/corelib/tools/qlocale.qdoc +++ b/src/corelib/tools/qlocale.qdoc @@ -672,9 +672,11 @@ \value MetricSystem This value indicates metric units, such as meters, centimeters and millimeters. - \value ImperialSystem This value indicates imperial units, such as inches and - miles. There are several distinct imperial systems in the world; this - value stands for the official United States imperial units. + \value ImperialUSSystem This value indicates imperial units, such as inches and + miles as they are used in the United States. + \value ImperialUKSystem This value indicates imperial units, such as inches and + miles as they are used in the United Kingdom. + \value ImperialSystem Provided for compatibility. Same as ImperialUSSystem \since 4.4 */ diff --git a/src/corelib/tools/qlocale_data_p.h b/src/corelib/tools/qlocale_data_p.h index 7841b0aaff..977f54f151 100644 --- a/src/corelib/tools/qlocale_data_p.h +++ b/src/corelib/tools/qlocale_data_p.h @@ -62,12 +62,14 @@ struct CountryLanguage { quint16 languageId; quint16 countryId; + QLocale::MeasurementSystem system; }; static const CountryLanguage ImperialMeasurementSystems[] = { - { 31, 225 }, - { 31, 226 }, - { 111, 225 }, - { 163, 225 } + { QLocale::English, QLocale::UnitedStates, QLocale::ImperialUSSystem }, + { QLocale::English, QLocale::UnitedStatesMinorOutlyingIslands, QLocale::ImperialUSSystem }, + { QLocale::Spanish, QLocale::UnitedStates, QLocale::ImperialUSSystem }, + { QLocale::Hawaiian, QLocale::UnitedStates, QLocale::ImperialUSSystem }, + { QLocale::English, QLocale::UnitedKingdom, QLocale::ImperialUKSystem } }; static const int ImperialMeasurementSystemsCount = sizeof(ImperialMeasurementSystems)/sizeof(ImperialMeasurementSystems[0]); diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp index ee2e5f436a..b3b8836f11 100644 --- a/src/corelib/tools/qlocale_icu.cpp +++ b/src/corelib/tools/qlocale_icu.cpp @@ -81,9 +81,19 @@ bool qt_initIcu(const QString &localeString) if (status == NotLoaded) { // resolve libicui18n - QLibrary lib(QLatin1String("icui18n"), QLatin1String(U_ICU_VERSION_SHORT)); + const QString version = QString::fromLatin1(U_ICU_VERSION_SHORT); +#ifdef Q_OS_WIN + // QLibrary on Windows does not use the version number, the libraries + // are named "icuin<version>.dll", though. + QString libName = QStringLiteral("icuin") + version; +#else + QString libName = QStringLiteral("icui18n"); +#endif + QLibrary lib(libName, version); if (!lib.load()) { - qWarning() << "Unable to load library icui18n" << lib.errorString(); + qWarning("Unable to load library '%s' version %s: %s", + qPrintable(libName), qPrintable(version), + qPrintable(lib.errorString())); status = ErrorLoading; return false; } @@ -104,15 +114,22 @@ bool qt_initIcu(const QString &localeString) ptr_ucol_close = 0; ptr_ucol_strcoll = 0; - qWarning("Unable to find symbols in icui18n"); + qWarning("Unable to find symbols in '%s'.", qPrintable(libName)); status = ErrorLoading; return false; } // resolve libicuuc - QLibrary ucLib(QLatin1String("icuuc"), QLatin1String(U_ICU_VERSION_SHORT)); +#ifdef Q_OS_WIN + libName = QStringLiteral("icuuc") + version; +#else + libName = QStringLiteral("icuuc"); +#endif + QLibrary ucLib(libName, version); if (!ucLib.load()) { - qWarning() << "Unable to load library icuuc" << ucLib.errorString(); + qWarning("Unable to load library '%s' version %s: %s", + qPrintable(libName), qPrintable(version), + qPrintable(ucLib.errorString())); status = ErrorLoading; return false; } @@ -129,7 +146,7 @@ bool qt_initIcu(const QString &localeString) ptr_u_strToUpper = 0; ptr_u_strToLower = 0; - qWarning("Unable to find symbols in icuuc"); + qWarning("Unable to find symbols in '%s'", qPrintable(libName)); status = ErrorLoading; return false; } diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index baf697a6f5..88ac7597e2 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -44,24 +44,8 @@ #include <qglobal.h> - QT_BEGIN_HEADER - -#if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) -// Disable MMX and SSE on Mac/PPC builds, or if the compiler -// does not support -Xarch argument passing -#undef QT_HAVE_SSE -#undef QT_HAVE_SSE2 -#undef QT_HAVE_SSE3 -#undef QT_HAVE_SSSE3 -#undef QT_HAVE_SSE4_1 -#undef QT_HAVE_SSE4_2 -#undef QT_HAVE_AVX -#undef QT_HAVE_3DNOW -#undef QT_HAVE_MMX -#endif - #ifdef __MINGW64_VERSION_MAJOR #include <intrin.h> #endif |