From 7b6b133746aa8bf23e08753851d7e23cc9d76170 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Mon, 11 Apr 2022 15:54:50 +0200 Subject: QtGui: use _L1 for for creating Latin-1 string literals Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne --- src/gui/opengl/qopengl.cpp | 48 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/gui/opengl/qopengl.cpp') diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index 3066b83282..07d2bccf7b 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -56,6 +56,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + #if defined(QT_OPENGL_3) typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint); #endif @@ -210,8 +212,8 @@ VersionTerm VersionTerm::fromJson(const QJsonValue &v) if (!v.isObject()) return result; const QJsonObject o = v.toObject(); - result.number = QVersionNumber::fromString(o.value(QLatin1String("value")).toString()); - const QString opS = o.value(QLatin1String("op")).toString(); + result.number = QVersionNumber::fromString(o.value("value"_L1).toString()); + const QString opS = o.value("op"_L1).toString(); for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) { if (opS == QLatin1String(operators[i])) { result.op = static_cast(i); @@ -282,9 +284,9 @@ OsTypeTerm OsTypeTerm::fromJson(const QJsonValue &v) if (!v.isObject()) return result; const QJsonObject o = v.toObject(); - result.type = o.value(QLatin1String("type")).toString(); - result.versionTerm = VersionTerm::fromJson(o.value(QLatin1String("version"))); - result.release = o.value(QLatin1String("release")).toArray(); + result.type = o.value("type"_L1).toString(); + result.versionTerm = VersionTerm::fromJson(o.value("version"_L1)); + result.release = o.value("release"_L1).toArray(); return result; } @@ -308,8 +310,8 @@ QString OsTypeTerm::hostOs() static QString msgSyntaxWarning(const QJsonObject &object, const QString &what) { QString result; - QTextStream(&result) << "Id " << object.value(QLatin1String("id")).toInt() - << " (\"" << object.value(QLatin1String("description")).toString() + QTextStream(&result) << "Id " << object.value("id"_L1).toInt() + << " (\"" << object.value("description"_L1).toString() << "\"): " << what; return result; } @@ -323,11 +325,11 @@ static bool matches(const QJsonObject &object, const QString &osRelease, const QOpenGLConfig::Gpu &gpu) { - const OsTypeTerm os = OsTypeTerm::fromJson(object.value(QLatin1String("os"))); + const OsTypeTerm os = OsTypeTerm::fromJson(object.value("os"_L1)); if (!os.isNull() && !os.matches(osName, kernelVersion, osRelease)) return false; - const QJsonValue exceptionsV = object.value(QLatin1String("exceptions")); + const QJsonValue exceptionsV = object.value("exceptions"_L1); if (exceptionsV.isArray()) { const QJsonArray exceptionsA = exceptionsV.toArray(); for (JsonArrayConstIt it = exceptionsA.constBegin(), cend = exceptionsA.constEnd(); it != cend; ++it) { @@ -336,20 +338,20 @@ static bool matches(const QJsonObject &object, } } - const QJsonValue vendorV = object.value(QLatin1String("vendor_id")); + const QJsonValue vendorV = object.value("vendor_id"_L1); if (vendorV.isString()) { if (gpu.vendorId != vendorV.toString().toUInt(nullptr, /* base */ 0)) return false; } else { - if (object.contains(QLatin1String("gl_vendor"))) { - const QByteArray glVendorV = object.value(QLatin1String("gl_vendor")).toString().toUtf8(); + if (object.contains("gl_vendor"_L1)) { + const QByteArray glVendorV = object.value("gl_vendor"_L1).toString().toUtf8(); if (!gpu.glVendor.contains(glVendorV)) return false; } } if (gpu.deviceId) { - const QJsonValue deviceIdV = object.value(QLatin1String("device_id")); + const QJsonValue deviceIdV = object.value("device_id"_L1); switch (deviceIdV.type()) { case QJsonValue::Array: if (!contains(deviceIdV.toArray(), gpu.deviceId)) @@ -360,12 +362,11 @@ static bool matches(const QJsonObject &object, break; default: qWarning().noquote() - << msgSyntaxWarning(object, - QLatin1String("Device ID must be of type array.")); + << msgSyntaxWarning(object, "Device ID must be of type array."_L1); } } if (!gpu.driverVersion.isNull()) { - const QJsonValue driverVersionV = object.value(QLatin1String("driver_version")); + const QJsonValue driverVersionV = object.value("driver_version"_L1); switch (driverVersionV.type()) { case QJsonValue::Object: if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion)) @@ -376,13 +377,12 @@ static bool matches(const QJsonObject &object, break; default: qWarning().noquote() - << msgSyntaxWarning(object, - QLatin1String("Driver version must be of type object.")); + << msgSyntaxWarning(object, "Driver version must be of type object."_L1); } } if (!gpu.driverDescription.isEmpty()) { - const QJsonValue driverDescriptionV = object.value(QLatin1String("driver_description")); + const QJsonValue driverDescriptionV = object.value("driver_description"_L1); if (driverDescriptionV.isString()) { if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8())) return false; @@ -402,9 +402,9 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu, { result->clear(); errorMessage->clear(); - const QJsonValue entriesV = doc.object().value(QLatin1String("entries")); + const QJsonValue entriesV = doc.object().value("entries"_L1); if (!entriesV.isArray()) { - *errorMessage = QLatin1String("No entries read."); + *errorMessage = "No entries read."_L1; return false; } @@ -413,7 +413,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu, if (eit->isObject()) { const QJsonObject object = eit->toObject(); if (matches(object, osName, kernelVersion, osRelease, gpu)) { - const QJsonValue featuresListV = object.value(QLatin1String("features")); + const QJsonValue featuresListV = object.value("features"_L1); if (featuresListV.isArray()) { const QJsonArray featuresListA = featuresListV.toArray(); for (JsonArrayConstIt fit = featuresListA.constBegin(), fcend = featuresListA.constEnd(); fit != fcend; ++fit) @@ -465,9 +465,9 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu, } const bool success = readGpuFeatures(gpu, osName, kernelVersion, osRelease, file.readAll(), result, errorMessage); if (!success) { - errorMessage->prepend(QLatin1String("Error reading \"") + errorMessage->prepend("Error reading \""_L1 + QDir::toNativeSeparators(fileName) - + QLatin1String("\": ")); + + "\": "_L1); } return success; } -- cgit v1.2.3