summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-04-11 15:54:50 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2022-04-28 05:58:52 +0200
commit7b6b133746aa8bf23e08753851d7e23cc9d76170 (patch)
tree472044ff758e685d88618996fbccc76bbfe930b6 /src/gui/opengl
parent852bb436057be518f864fb57fc1efc9d6a95f8c1 (diff)
QtGui: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r--src/gui/opengl/qopengl.cpp48
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp8
-rw-r--r--src/gui/opengl/qopenglprogrambinarycache.cpp4
3 files changed, 32 insertions, 28 deletions
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<Operator>(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;
}
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 6192a49685..d74b7236a2 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -57,6 +57,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
#define QT_OPENGL_FUNCTION_NAMES(ret, name, args) \
"gl"#name"\0"
@@ -431,9 +433,9 @@ static int qt_gl_resolve_extensions()
QString *deviceName =
static_cast<QString *>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("AndroidDeviceName"));
static bool wrongfullyReportsBgra8888Support = deviceName != 0
- && (deviceName->compare(QLatin1String("samsung SM-T211"), Qt::CaseInsensitive) == 0
- || deviceName->compare(QLatin1String("samsung SM-T210"), Qt::CaseInsensitive) == 0
- || deviceName->compare(QLatin1String("samsung SM-T215"), Qt::CaseInsensitive) == 0);
+ && (deviceName->compare("samsung SM-T211"_L1, Qt::CaseInsensitive) == 0
+ || deviceName->compare("samsung SM-T210"_L1, Qt::CaseInsensitive) == 0
+ || deviceName->compare("samsung SM-T215"_L1, Qt::CaseInsensitive) == 0);
if (wrongfullyReportsBgra8888Support)
extensions &= ~QOpenGLExtensions::BGRATextureFormat;
#endif
diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp
index 9ca6c19ec1..95955cf55f 100644
--- a/src/gui/opengl/qopenglprogrambinarycache.cpp
+++ b/src/gui/opengl/qopenglprogrambinarycache.cpp
@@ -54,6 +54,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(lcOpenGLProgramDiskCache, "qt.opengl.diskcache")
#ifndef GL_CONTEXT_LOST
@@ -117,7 +119,7 @@ static inline bool qt_ensureWritableDir(const QString &name)
QOpenGLProgramBinaryCache::QOpenGLProgramBinaryCache()
: m_cacheWritable(false)
{
- const QString subPath = QLatin1String("/qtshadercache-") + QSysInfo::buildAbi() + u'/';
+ const QString subPath = "/qtshadercache-"_L1 + QSysInfo::buildAbi() + u'/';
const QString sharedCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
m_globalCacheDir = sharedCachePath + subPath;
m_localCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + subPath;