Platformsupport: use _L1 for for creating Latin-1 string literals

Task-number: QTBUG-98434
Change-Id: I4fa7ca58b4a298e81d35f19b439ed7702bd9700d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Sona Kurazyan 2022-04-22 16:31:23 +02:00
parent 436774f153
commit 6df137ca2f
12 changed files with 63 additions and 39 deletions

View File

@ -83,6 +83,8 @@ static bool testBit(long bit, const long *field)
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcDD, "qt.qpa.input")
QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
@ -139,7 +141,7 @@ bool QDeviceDiscoveryStatic::checkDeviceType(const QString &device)
qCDebug(lcDD) << "doing static device discovery for " << device;
if ((m_types & Device_DRM) && device.contains(QLatin1String(QT_DRM_DEVICE_PREFIX))) {
if ((m_types & Device_DRM) && device.contains(QT_DRM_DEVICE_PREFIX ""_L1)) {
QT_CLOSE(fd);
return true;
}

View File

@ -54,6 +54,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcDD, "qt.qpa.input")
QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
@ -140,9 +142,9 @@ QStringList QDeviceDiscoveryUDev::scanConnectedDevices()
const char *syspath = udev_list_entry_get_name(entry);
udev_device *udevice = udev_device_new_from_syspath(m_udev, syspath);
QString candidate = QString::fromUtf8(udev_device_get_devnode(udevice));
if ((m_types & Device_InputMask) && candidate.startsWith(QLatin1String(QT_EVDEV_DEVICE)))
if ((m_types & Device_InputMask) && candidate.startsWith(QT_EVDEV_DEVICE ""_L1))
devices << candidate;
if ((m_types & Device_VideoMask) && candidate.startsWith(QLatin1String(QT_DRM_DEVICE))) {
if ((m_types & Device_VideoMask) && candidate.startsWith(QT_DRM_DEVICE ""_L1)) {
if (m_types & Device_DRM_PrimaryGPU) {
udev_device *pci = udev_device_get_parent_with_subsystem_devtype(udevice, "pci", 0);
if (pci) {
@ -186,9 +188,9 @@ void QDeviceDiscoveryUDev::handleUDevNotification()
const char *subsystem;
devNode = QString::fromUtf8(str);
if (devNode.startsWith(QLatin1String(QT_EVDEV_DEVICE)))
if (devNode.startsWith(QT_EVDEV_DEVICE ""_L1))
subsystem = "input";
else if (devNode.startsWith(QLatin1String(QT_DRM_DEVICE)))
else if (devNode.startsWith(QT_DRM_DEVICE ""_L1))
subsystem = "drm";
else goto cleanup;

View File

@ -69,6 +69,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(qLcEvdevKey, "qt.qpa.input")
Q_LOGGING_CATEGORY(qLcEvdevKeyMap, "qt.qpa.input.keymap")
@ -90,7 +92,7 @@ QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer
{
qCDebug(qLcEvdevKey) << "Create keyboard handler with for device" << device;
setObjectName(QLatin1String("LinuxInput Keyboard Handler"));
setObjectName("LinuxInput Keyboard Handler"_L1);
memset(m_locks, 0, sizeof(m_locks));
@ -123,17 +125,17 @@ std::unique_ptr<QEvdevKeyboardHandler> QEvdevKeyboardHandler::create(const QStri
const auto args = QStringView{specification}.split(u':');
for (const auto &arg : args) {
if (arg.startsWith(QLatin1String("keymap=")))
if (arg.startsWith("keymap="_L1))
keymapFile = arg.mid(7).toString();
else if (arg == QLatin1String("disable-zap"))
else if (arg == "disable-zap"_L1)
disableZap = true;
else if (arg == QLatin1String("enable-compose"))
else if (arg == "enable-compose"_L1)
enableCompose = true;
else if (arg.startsWith(QLatin1String("repeat-delay=")))
else if (arg.startsWith("repeat-delay="_L1))
repeatDelay = arg.mid(13).toInt();
else if (arg.startsWith(QLatin1String("repeat-rate=")))
else if (arg.startsWith("repeat-rate="_L1))
repeatRate = arg.mid(12).toInt();
else if (arg.startsWith(QLatin1String("grab=")))
else if (arg.startsWith("grab="_L1))
grab = arg.mid(5).toInt();
}

View File

@ -50,6 +50,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_DECLARE_LOGGING_CATEGORY(qLcEvdevKey)
QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &specification, QObject *parent)
@ -126,7 +128,7 @@ void QEvdevKeyboardManager::loadKeymap(const QString &file)
QString keymapFromSpec;
const auto specs = QStringView{m_spec}.split(u':');
for (const auto &arg : specs) {
if (arg.startsWith(QLatin1String("keymap=")))
if (arg.startsWith("keymap="_L1))
keymapFromSpec = arg.mid(7).toString();
}
for (const auto &keyboard : m_keyboards) {

View File

@ -64,6 +64,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(qLcEvdevMouse, "qt.qpa.input")
std::unique_ptr<QEvdevMouseHandler> QEvdevMouseHandler::create(const QString &device, const QString &specification)
@ -77,13 +79,13 @@ std::unique_ptr<QEvdevMouseHandler> QEvdevMouseHandler::create(const QString &de
const auto args = QStringView{specification}.split(u':');
for (const auto &arg : args) {
if (arg == QLatin1String("nocompress"))
if (arg == "nocompress"_L1)
compression = false;
else if (arg.startsWith(QLatin1String("dejitter=")))
else if (arg.startsWith("dejitter="_L1))
jitterLimit = arg.mid(9).toInt();
else if (arg.startsWith(QLatin1String("grab=")))
else if (arg.startsWith("grab="_L1))
grab = arg.mid(5).toInt();
else if (arg == QLatin1String("abs"))
else if (arg == "abs"_L1)
abs = true;
}
@ -101,7 +103,7 @@ std::unique_ptr<QEvdevMouseHandler> QEvdevMouseHandler::create(const QString &de
QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool abs, bool compression, int jitterLimit)
: m_device(device), m_fd(fd), m_abs(abs), m_compression(compression)
{
setObjectName(QLatin1String("Evdev Mouse Handler"));
setObjectName("Evdev Mouse Handler"_L1);
m_jitterLimitSquared = jitterLimit * jitterLimit;

View File

@ -53,6 +53,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_DECLARE_LOGGING_CATEGORY(qLcEvdevMouse)
QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent)
@ -69,9 +71,9 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
m_spec = std::move(parsed.spec);
for (const auto &arg : qAsConst(parsed.args)) {
if (arg.startsWith(QLatin1String("xoffset="))) {
if (arg.startsWith("xoffset="_L1)) {
m_xoffset = arg.mid(8).toInt();
} else if (arg.startsWith(QLatin1String("yoffset="))) {
} else if (arg.startsWith("yoffset="_L1)) {
m_yoffset = arg.mid(8).toInt();
}
}

View File

@ -54,6 +54,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(qLcEvdevTablet, "qt.qpa.input")
class QEvdevTabletData
@ -171,7 +173,7 @@ QEvdevTabletHandler::QEvdevTabletHandler(const QString &device, const QString &s
{
Q_UNUSED(spec);
setObjectName(QLatin1String("Evdev Tablet Handler"));
setObjectName("Evdev Tablet Handler"_L1);
qCDebug(qLcEvdevTablet, "evdevtablet: using %ls", qUtf16Printable(device));

View File

@ -77,6 +77,8 @@ extern "C" {
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(qLcEvdevTouch, "qt.qpa.input")
Q_LOGGING_CATEGORY(qLcEvents, "qt.qpa.input.events")
@ -209,14 +211,14 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
, m_mtdev(nullptr)
#endif
{
setObjectName(QLatin1String("Evdev Touch Handler"));
setObjectName("Evdev Touch Handler"_L1);
const QStringList args = spec.split(u':');
int rotationAngle = 0;
bool invertx = false;
bool inverty = false;
for (int i = 0; i < args.count(); ++i) {
if (args.at(i).startsWith(QLatin1String("rotate"))) {
if (args.at(i).startsWith("rotate"_L1)) {
QString rotateArg = args.at(i).section(u'=', 1, 1);
bool ok;
uint argValue = rotateArg.toUInt(&ok);
@ -230,9 +232,9 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
break;
}
}
} else if (args.at(i) == QLatin1String("invertx")) {
} else if (args.at(i) == "invertx"_L1) {
invertx = true;
} else if (args.at(i) == QLatin1String("inverty")) {
} else if (args.at(i) == "inverty"_L1) {
inverty = true;
}
}
@ -323,7 +325,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
}
// Fix up the coordinate ranges for am335x in case the kernel driver does not have them fixed.
if (d->hw_name == QLatin1String("ti-tsc")) {
if (d->hw_name == "ti-tsc"_L1) {
if (d->hw_range_x_min == 0 && d->hw_range_x_max == 4095) {
d->hw_range_x_min = 165;
d->hw_range_x_max = 4016;

View File

@ -41,6 +41,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
namespace QEvdevUtil {
ParsedSpecification parseSpecification(const QString &specification)
@ -50,7 +52,7 @@ ParsedSpecification parseSpecification(const QString &specification)
result.args = QStringView{specification}.split(u':');
for (const auto &arg : qAsConst(result.args)) {
if (arg.startsWith(QLatin1String("/dev/"))) {
if (arg.startsWith("/dev/"_L1)) {
// if device is specified try to use it
result.devices.append(arg.toString());
} else {

View File

@ -47,6 +47,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static QOutputMapping *s_outputMapping = nullptr;
QOutputMapping *QOutputMapping::get()
@ -104,7 +106,7 @@ bool QDefaultOutputMapping::load()
// What we are interested is the virtualIndex and touchDevice properties for
// each element in the outputs array.
const QJsonArray outputs = doc.object().value(QLatin1String("outputs")).toArray();
const QJsonArray outputs = doc.object().value("outputs"_L1).toArray();
for (int i = 0; i < outputs.size(); ++i) {
const QVariantMap output = outputs.at(i).toObject().toVariantMap();
if (!output.contains(QStringLiteral("touchDevice")))

View File

@ -51,16 +51,18 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(qLcTsLib, "qt.qpa.input")
QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
const QString &specification,
QObject *parent)
: QObject(parent),
m_rawMode(!key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive))
m_rawMode(!key.compare("TslibRaw"_L1, Qt::CaseInsensitive))
{
qCDebug(qLcTsLib) << "Initializing tslib plugin" << key << specification;
setObjectName(QLatin1String("TSLib Mouse Handler"));
setObjectName("TSLib Mouse Handler"_L1);
m_dev = ts_setup(nullptr, 1);
if (!m_dev) {

View File

@ -53,6 +53,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(qLcKmsDebug, "qt.qpa.eglfs.kms")
enum OutputConfiguration {
@ -1062,7 +1064,7 @@ void QKmsScreenConfig::loadConfig()
const QJsonObject object = doc.object();
const QString headlessStr = object.value(QLatin1String("headless")).toString();
const QString headlessStr = object.value("headless"_L1).toString();
const QByteArray headless = headlessStr.toUtf8();
QSize headlessSize;
if (sscanf(headless.constData(), "%dx%d", &headlessSize.rwidth(), &headlessSize.rheight()) == 2) {
@ -1072,22 +1074,22 @@ void QKmsScreenConfig::loadConfig()
m_headless = false;
}
m_hwCursor = object.value(QLatin1String("hwcursor")).toBool(m_hwCursor);
m_pbuffers = object.value(QLatin1String("pbuffers")).toBool(m_pbuffers);
m_devicePath = object.value(QLatin1String("device")).toString();
m_separateScreens = object.value(QLatin1String("separateScreens")).toBool(m_separateScreens);
m_hwCursor = object.value("hwcursor"_L1).toBool(m_hwCursor);
m_pbuffers = object.value("pbuffers"_L1).toBool(m_pbuffers);
m_devicePath = object.value("device"_L1).toString();
m_separateScreens = object.value("separateScreens"_L1).toBool(m_separateScreens);
const QString vdOriString = object.value(QLatin1String("virtualDesktopLayout")).toString();
const QString vdOriString = object.value("virtualDesktopLayout"_L1).toString();
if (!vdOriString.isEmpty()) {
if (vdOriString == QLatin1String("horizontal"))
if (vdOriString == "horizontal"_L1)
m_virtualDesktopLayout = VirtualDesktopLayoutHorizontal;
else if (vdOriString == QLatin1String("vertical"))
else if (vdOriString == "vertical"_L1)
m_virtualDesktopLayout = VirtualDesktopLayoutVertical;
else
qCWarning(qLcKmsDebug) << "Unknown virtualDesktopOrientation value" << vdOriString;
}
const QJsonArray outputs = object.value(QLatin1String("outputs")).toArray();
const QJsonArray outputs = object.value("outputs"_L1).toArray();
for (int i = 0; i < outputs.size(); i++) {
const QVariantMap outputSettings = outputs.at(i).toObject().toVariantMap();