diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-22 16:31:23 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-26 18:59:42 +0200 |
commit | 6df137ca2f770e458231f4548e08ca0192bffaf8 (patch) | |
tree | 444fbc7c0fcb2e6422429f33d051138d6dbfcad2 /src/platformsupport/input | |
parent | 436774f15306889f0e43b44f823a1976d3482ef1 (diff) |
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>
Diffstat (limited to 'src/platformsupport/input')
9 files changed, 43 insertions, 25 deletions
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp index 5a0fbee6a6..32269bf185 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp @@ -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(); } diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp index 1d4da0d200..39b7f2df7f 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp @@ -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) { diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp index abf3e75348..a8b7bbe19b 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp @@ -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; diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp index 108d03fac6..09edcdaab8 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp @@ -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(); } } diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp index 3be93ff868..2f796888ad 100644 --- a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp +++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp @@ -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)); diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 191a578d9f..15474f8089 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -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; diff --git a/src/platformsupport/input/shared/qevdevutil.cpp b/src/platformsupport/input/shared/qevdevutil.cpp index 31afabe56a..3466a5f685 100644 --- a/src/platformsupport/input/shared/qevdevutil.cpp +++ b/src/platformsupport/input/shared/qevdevutil.cpp @@ -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 { diff --git a/src/platformsupport/input/shared/qoutputmapping.cpp b/src/platformsupport/input/shared/qoutputmapping.cpp index b1c428dee2..9cb193b315 100644 --- a/src/platformsupport/input/shared/qoutputmapping.cpp +++ b/src/platformsupport/input/shared/qoutputmapping.cpp @@ -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"))) diff --git a/src/platformsupport/input/tslib/qtslib.cpp b/src/platformsupport/input/tslib/qtslib.cpp index e105f5ea98..2671129476 100644 --- a/src/platformsupport/input/tslib/qtslib.cpp +++ b/src/platformsupport/input/tslib/qtslib.cpp @@ -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) { |