diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-11 15:54:50 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-28 05:58:52 +0200 |
commit | 7b6b133746aa8bf23e08753851d7e23cc9d76170 (patch) | |
tree | 472044ff758e685d88618996fbccc76bbfe930b6 /src/gui/accessible | |
parent | 852bb436057be518f864fb57fc1efc9d6a95f8c1 (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/accessible')
-rw-r--r-- | src/gui/accessible/linux/atspiadaptor.cpp | 568 | ||||
-rw-r--r-- | src/gui/accessible/linux/dbusconnection.cpp | 10 | ||||
-rw-r--r-- | src/gui/accessible/linux/qspiaccessiblebridge.cpp | 6 | ||||
-rw-r--r-- | src/gui/accessible/linux/qspidbuscache.cpp | 4 | ||||
-rw-r--r-- | src/gui/accessible/qaccessible.cpp | 12 | ||||
-rw-r--r-- | src/gui/accessible/qplatformaccessibility.cpp | 4 |
6 files changed, 299 insertions, 305 deletions
diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp index 6c485e8cf3..374a9d15c3 100644 --- a/src/gui/accessible/linux/atspiadaptor.cpp +++ b/src/gui/accessible/linux/atspiadaptor.cpp @@ -66,6 +66,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + Q_LOGGING_CATEGORY(lcAccessibilityAtspi, "qt.accessibility.atspi") Q_LOGGING_CATEGORY(lcAccessibilityAtspiCreation, "qt.accessibility.atspi.creation") @@ -133,11 +135,11 @@ AtSpiAdaptor::AtSpiAdaptor(DBusConnection *connection, QObject *parent) connect(m_applicationAdaptor, SIGNAL(windowActivated(QObject*,bool)), this, SLOT(windowActivated(QObject*,bool))); updateEventListeners(); - bool success = m_dbus->connection().connect(QLatin1String("org.a11y.atspi.Registry"), QLatin1String("/org/a11y/atspi/registry"), - QLatin1String("org.a11y.atspi.Registry"), QLatin1String("EventListenerRegistered"), this, + bool success = m_dbus->connection().connect("org.a11y.atspi.Registry"_L1, "/org/a11y/atspi/registry"_L1, + "org.a11y.atspi.Registry"_L1, "EventListenerRegistered"_L1, this, SLOT(eventListenerRegistered(QString,QString))); - success = success && m_dbus->connection().connect(QLatin1String("org.a11y.atspi.Registry"), QLatin1String("/org/a11y/atspi/registry"), - QLatin1String("org.a11y.atspi.Registry"), QLatin1String("EventListenerDeregistered"), this, + success = success && m_dbus->connection().connect("org.a11y.atspi.Registry"_L1, "/org/a11y/atspi/registry"_L1, + "org.a11y.atspi.Registry"_L1, "EventListenerDeregistered"_L1, this, SLOT(eventListenerDeregistered(QString,QString))); } @@ -594,19 +596,19 @@ QString AtSpiAdaptor::introspect(const QString &path) const QString xml; xml.append(accessibleIntrospection); - if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_COMPONENT))) + if (interfaces.contains(ATSPI_DBUS_INTERFACE_COMPONENT ""_L1)) xml.append(componentIntrospection); - if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_TEXT))) + if (interfaces.contains(ATSPI_DBUS_INTERFACE_TEXT ""_L1)) xml.append(textIntrospection); - if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_EDITABLE_TEXT))) + if (interfaces.contains(ATSPI_DBUS_INTERFACE_EDITABLE_TEXT ""_L1)) xml.append(editableTextIntrospection); - if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_ACTION))) + if (interfaces.contains(ATSPI_DBUS_INTERFACE_ACTION ""_L1)) xml.append(actionIntrospection); - if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_TABLE))) + if (interfaces.contains(ATSPI_DBUS_INTERFACE_TABLE ""_L1)) xml.append(tableIntrospection); - if (interfaces.contains(QLatin1String(ATSPI_DBUS_INTERFACE_VALUE))) + if (interfaces.contains(ATSPI_DBUS_INTERFACE_VALUE ""_L1)) xml.append(valueIntrospection); - if (path == QLatin1String(QSPI_OBJECT_PATH_ROOT)) + if (path == QSPI_OBJECT_PATH_ROOT ""_L1) xml.append(applicationIntrospection); return xml; @@ -624,74 +626,74 @@ void AtSpiAdaptor::setBitFlag(const QString &flag) } else { // Object:Foo:Bar QString right = flag.mid(7); if (false) { - } else if (right.startsWith(QLatin1String("ActiveDescendantChanged"))) { + } else if (right.startsWith("ActiveDescendantChanged"_L1)) { sendObject_active_descendant_changed = 1; - } else if (right.startsWith(QLatin1String("AttributesChanged"))) { + } else if (right.startsWith("AttributesChanged"_L1)) { sendObject_attributes_changed = 1; - } else if (right.startsWith(QLatin1String("BoundsChanged"))) { + } else if (right.startsWith("BoundsChanged"_L1)) { sendObject_bounds_changed = 1; - } else if (right.startsWith(QLatin1String("ChildrenChanged"))) { + } else if (right.startsWith("ChildrenChanged"_L1)) { sendObject_children_changed = 1; - } else if (right.startsWith(QLatin1String("ColumnDeleted"))) { + } else if (right.startsWith("ColumnDeleted"_L1)) { sendObject_column_deleted = 1; - } else if (right.startsWith(QLatin1String("ColumnInserted"))) { + } else if (right.startsWith("ColumnInserted"_L1)) { sendObject_column_inserted = 1; - } else if (right.startsWith(QLatin1String("ColumnReordered"))) { + } else if (right.startsWith("ColumnReordered"_L1)) { sendObject_column_reordered = 1; - } else if (right.startsWith(QLatin1String("LinkSelected"))) { + } else if (right.startsWith("LinkSelected"_L1)) { sendObject_link_selected = 1; - } else if (right.startsWith(QLatin1String("ModelChanged"))) { + } else if (right.startsWith("ModelChanged"_L1)) { sendObject_model_changed = 1; - } else if (right.startsWith(QLatin1String("PropertyChange"))) { - if (right == QLatin1String("PropertyChange:AccessibleDescription")) { + } else if (right.startsWith("PropertyChange"_L1)) { + if (right == "PropertyChange:AccessibleDescription"_L1) { sendObject_property_change_accessible_description = 1; - } else if (right == QLatin1String("PropertyChange:AccessibleName")) { + } else if (right == "PropertyChange:AccessibleName"_L1) { sendObject_property_change_accessible_name = 1; - } else if (right == QLatin1String("PropertyChange:AccessibleParent")) { + } else if (right == "PropertyChange:AccessibleParent"_L1) { sendObject_property_change_accessible_parent = 1; - } else if (right == QLatin1String("PropertyChange:AccessibleRole")) { + } else if (right == "PropertyChange:AccessibleRole"_L1) { sendObject_property_change_accessible_role = 1; - } else if (right == QLatin1String("PropertyChange:TableCaption")) { + } else if (right == "PropertyChange:TableCaption"_L1) { sendObject_property_change_accessible_table_caption = 1; - } else if (right == QLatin1String("PropertyChange:TableColumnDescription")) { + } else if (right == "PropertyChange:TableColumnDescription"_L1) { sendObject_property_change_accessible_table_column_description = 1; - } else if (right == QLatin1String("PropertyChange:TableColumnHeader")) { + } else if (right == "PropertyChange:TableColumnHeader"_L1) { sendObject_property_change_accessible_table_column_header = 1; - } else if (right == QLatin1String("PropertyChange:TableRowDescription")) { + } else if (right == "PropertyChange:TableRowDescription"_L1) { sendObject_property_change_accessible_table_row_description = 1; - } else if (right == QLatin1String("PropertyChange:TableRowHeader")) { + } else if (right == "PropertyChange:TableRowHeader"_L1) { sendObject_property_change_accessible_table_row_header = 1; - } else if (right == QLatin1String("PropertyChange:TableSummary")) { + } else if (right == "PropertyChange:TableSummary"_L1) { sendObject_property_change_accessible_table_summary = 1; - } else if (right == QLatin1String("PropertyChange:AccessibleValue")) { + } else if (right == "PropertyChange:AccessibleValue"_L1) { sendObject_property_change_accessible_value = 1; } else { sendObject_property_change = 1; } - } else if (right.startsWith(QLatin1String("RowDeleted"))) { + } else if (right.startsWith("RowDeleted"_L1)) { sendObject_row_deleted = 1; - } else if (right.startsWith(QLatin1String("RowInserted"))) { + } else if (right.startsWith("RowInserted"_L1)) { sendObject_row_inserted = 1; - } else if (right.startsWith(QLatin1String("RowReordered"))) { + } else if (right.startsWith("RowReordered"_L1)) { sendObject_row_reordered = 1; - } else if (right.startsWith(QLatin1String("SelectionChanged"))) { + } else if (right.startsWith("SelectionChanged"_L1)) { sendObject_selection_changed = 1; - } else if (right.startsWith(QLatin1String("StateChanged"))) { + } else if (right.startsWith("StateChanged"_L1)) { sendObject_state_changed = 1; - } else if (right.startsWith(QLatin1String("TextAttributesChanged"))) { + } else if (right.startsWith("TextAttributesChanged"_L1)) { sendObject_text_attributes_changed = 1; - } else if (right.startsWith(QLatin1String("TextBoundsChanged"))) { + } else if (right.startsWith("TextBoundsChanged"_L1)) { sendObject_text_bounds_changed = 1; - } else if (right.startsWith(QLatin1String("TextCaretMoved"))) { + } else if (right.startsWith("TextCaretMoved"_L1)) { sendObject_text_caret_moved = 1; - } else if (right.startsWith(QLatin1String("TextChanged"))) { + } else if (right.startsWith("TextChanged"_L1)) { sendObject_text_changed = 1; - } else if (right.startsWith(QLatin1String("TextSelectionChanged"))) { + } else if (right.startsWith("TextSelectionChanged"_L1)) { sendObject_text_selection_changed = 1; - } else if (right.startsWith(QLatin1String("ValueChanged"))) { + } else if (right.startsWith("ValueChanged"_L1)) { sendObject_value_changed = 1; - } else if (right.startsWith(QLatin1String("VisibleDataChanged")) - || right.startsWith(QLatin1String("VisibledataChanged"))) { // typo in libatspi + } else if (right.startsWith("VisibleDataChanged"_L1) + || right.startsWith("VisibledataChanged"_L1)) { // typo in libatspi sendObject_visible_data_changed = 1; } else { qCDebug(lcAccessibilityAtspi) << "WARNING: subscription string not handled:" << flag; @@ -705,39 +707,39 @@ void AtSpiAdaptor::setBitFlag(const QString &flag) } else { // object:Foo:Bar QString right = flag.mid(7); if (false) { - } else if (right.startsWith(QLatin1String("Activate"))) { + } else if (right.startsWith("Activate"_L1)) { sendWindow_activate = 1; - } else if (right.startsWith(QLatin1String("Close"))) { + } else if (right.startsWith("Close"_L1)) { sendWindow_close= 1; - } else if (right.startsWith(QLatin1String("Create"))) { + } else if (right.startsWith("Create"_L1)) { sendWindow_create = 1; - } else if (right.startsWith(QLatin1String("Deactivate"))) { + } else if (right.startsWith("Deactivate"_L1)) { sendWindow_deactivate = 1; - } else if (right.startsWith(QLatin1String("Lower"))) { + } else if (right.startsWith("Lower"_L1)) { sendWindow_lower = 1; - } else if (right.startsWith(QLatin1String("Maximize"))) { + } else if (right.startsWith("Maximize"_L1)) { sendWindow_maximize = 1; - } else if (right.startsWith(QLatin1String("Minimize"))) { + } else if (right.startsWith("Minimize"_L1)) { sendWindow_minimize = 1; - } else if (right.startsWith(QLatin1String("Move"))) { + } else if (right.startsWith("Move"_L1)) { sendWindow_move = 1; - } else if (right.startsWith(QLatin1String("Raise"))) { + } else if (right.startsWith("Raise"_L1)) { sendWindow_raise = 1; - } else if (right.startsWith(QLatin1String("Reparent"))) { + } else if (right.startsWith("Reparent"_L1)) { sendWindow_reparent = 1; - } else if (right.startsWith(QLatin1String("Resize"))) { + } else if (right.startsWith("Resize"_L1)) { sendWindow_resize = 1; - } else if (right.startsWith(QLatin1String("Restore"))) { + } else if (right.startsWith("Restore"_L1)) { sendWindow_restore = 1; - } else if (right.startsWith(QLatin1String("Restyle"))) { + } else if (right.startsWith("Restyle"_L1)) { sendWindow_restyle = 1; - } else if (right.startsWith(QLatin1String("Shade"))) { + } else if (right.startsWith("Shade"_L1)) { sendWindow_shade = 1; - } else if (right.startsWith(QLatin1String("Unshade"))) { + } else if (right.startsWith("Unshade"_L1)) { sendWindow_unshade = 1; - } else if (right.startsWith(QLatin1String("DesktopCreate"))) { + } else if (right.startsWith("DesktopCreate"_L1)) { // ignore this one - } else if (right.startsWith(QLatin1String("DesktopDestroy"))) { + } else if (right.startsWith("DesktopDestroy"_L1)) { // ignore this one } else { qCDebug(lcAccessibilityAtspi) << "WARNING: subscription string not handled:" << flag; @@ -768,9 +770,9 @@ void AtSpiAdaptor::setBitFlag(const QString &flag) */ void AtSpiAdaptor::updateEventListeners() { - QDBusMessage m = QDBusMessage::createMethodCall(QLatin1String("org.a11y.atspi.Registry"), - QLatin1String("/org/a11y/atspi/registry"), - QLatin1String("org.a11y.atspi.Registry"), QLatin1String("GetRegisteredEvents")); + QDBusMessage m = QDBusMessage::createMethodCall("org.a11y.atspi.Registry"_L1, + "/org/a11y/atspi/registry"_L1, + "org.a11y.atspi.Registry"_L1, "GetRegisteredEvents"_L1); QDBusReply<QSpiEventListenerArray> listenersReply = m_dbus->connection().call(m); if (listenersReply.isValid()) { const QSpiEventListenerArray evList = listenersReply.value(); @@ -819,13 +821,12 @@ void AtSpiAdaptor::windowActivated(QObject* window, bool active) QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(data)); - QString status = active ? QLatin1String("Activate") : QLatin1String("Deactivate"); + QString status = active ? "Activate"_L1 : "Deactivate"_L1; QString path = pathForObject(window); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_WINDOW), status, args); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_WINDOW ""_L1, status, args); - QVariantList stateArgs = packDBusSignalArguments(QLatin1String("active"), active ? 1 : 0, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("StateChanged"), stateArgs); + QVariantList stateArgs = packDBusSignalArguments("active"_L1, active ? 1 : 0, 0, variantForPath(path)); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "StateChanged"_L1, stateArgs); } QVariantList AtSpiAdaptor::packDBusSignalArguments(const QString &type, int data1, int data2, const QVariant &variantData) const @@ -852,7 +853,7 @@ bool AtSpiAdaptor::sendDBusSignal(const QString &path, const QString &interface, QAccessibleInterface *AtSpiAdaptor::interfaceFromPath(const QString& dbusPath) const { - if (dbusPath == QLatin1String(QSPI_OBJECT_PATH_ROOT)) + if (dbusPath == QSPI_OBJECT_PATH_ROOT ""_L1) return QAccessible::queryAccessibleInterface(qApp); QStringList parts = dbusPath.split(u'/'); @@ -875,8 +876,7 @@ void AtSpiAdaptor::notifyStateChange(QAccessibleInterface *interface, const QStr { QString path = pathForInterface(interface); QVariantList stateArgs = packDBusSignalArguments(state, value, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("StateChanged"), stateArgs); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "StateChanged"_L1, stateArgs); } @@ -892,13 +892,13 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) break; case QAccessible::ObjectShow: { if (sendObject || sendObject_state_changed) { - notifyStateChange(event->accessibleInterface(), QLatin1String("showing"), 1); + notifyStateChange(event->accessibleInterface(), "showing"_L1, 1); } break; } case QAccessible::ObjectHide: { if (sendObject || sendObject_state_changed) { - notifyStateChange(event->accessibleInterface(), QLatin1String("showing"), 0); + notifyStateChange(event->accessibleInterface(), "showing"_L1, 0); } break; } @@ -915,18 +915,18 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) case QAccessible::NameChanged: { if (sendObject || sendObject_property_change || sendObject_property_change_accessible_name) { QString path = pathForInterface(event->accessibleInterface()); - QVariantList args = packDBusSignalArguments(QLatin1String("accessible-name"), 0, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("PropertyChange"), args); + QVariantList args = packDBusSignalArguments("accessible-name"_L1, 0, 0, variantForPath(path)); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "PropertyChange"_L1, args); } break; } case QAccessible::DescriptionChanged: { if (sendObject || sendObject_property_change || sendObject_property_change_accessible_description) { QString path = pathForInterface(event->accessibleInterface()); - QVariantList args = packDBusSignalArguments(QLatin1String("accessible-description"), 0, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("PropertyChange"), args); + QVariantList args = packDBusSignalArguments("accessible-description"_L1, 0, 0, variantForPath(path)); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "PropertyChange"_L1, args); } break; } @@ -973,16 +973,16 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) if (!textRemoved.isEmpty()) { data.setVariant(QVariant::fromValue(textRemoved)); - QVariantList args = packDBusSignalArguments(QLatin1String("delete"), changePosition, textRemoved.length(), QVariant::fromValue(data)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("TextChanged"), args); + QVariantList args = packDBusSignalArguments("delete"_L1, changePosition, textRemoved.length(), QVariant::fromValue(data)); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "TextChanged"_L1, args); } if (!textInserted.isEmpty()) { data.setVariant(QVariant::fromValue(textInserted)); - QVariantList args = packDBusSignalArguments(QLatin1String("insert"), changePosition, textInserted.length(), QVariant::fromValue(data)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("TextChanged"), args); + QVariantList args = packDBusSignalArguments("insert"_L1, changePosition, textInserted.length(), QVariant::fromValue(data)); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "TextChanged"_L1, args); } // send a cursor update @@ -990,8 +990,8 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) // QDBusVariant cursorData; // cursorData.setVariant(QVariant::fromValue(cursorPosition)); // QVariantList args = packDBusSignalArguments(QString(), cursorPosition, 0, QVariant::fromValue(cursorData)); -// sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), -// QLatin1String("TextCaretMoved"), args); +// sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, +// "TextCaretMoved"_L1, args); } break; } @@ -1008,8 +1008,8 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) int pos = iface->textInterface()->cursorPosition(); cursorData.setVariant(QVariant::fromValue(pos)); QVariantList args = packDBusSignalArguments(QString(), pos, 0, QVariant::fromValue(cursorData)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("TextCaretMoved"), args); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "TextCaretMoved"_L1, args); } break; } @@ -1018,8 +1018,8 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) QAccessibleInterface * iface = event->accessibleInterface(); QString path = pathForInterface(iface); QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(QString())))); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("TextSelectionChanged"), args); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "TextSelectionChanged"_L1, args); } break; } @@ -1032,19 +1032,19 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) } if (iface->valueInterface()) { QString path = pathForInterface(iface); - QVariantList args = packDBusSignalArguments(QLatin1String("accessible-value"), 0, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("PropertyChange"), args); + QVariantList args = packDBusSignalArguments("accessible-value"_L1, 0, 0, variantForPath(path)); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "PropertyChange"_L1, args); } else if (iface->role() == QAccessible::ComboBox) { // Combo Box with AT-SPI likes to be special // It requires a name-change to update caches and then selection-changed QString path = pathForInterface(iface); - QVariantList args1 = packDBusSignalArguments(QLatin1String("accessible-name"), 0, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("PropertyChange"), args1); + QVariantList args1 = packDBusSignalArguments("accessible-name"_L1, 0, 0, variantForPath(path)); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "PropertyChange"_L1, args1); QVariantList args2 = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(0)))); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("SelectionChanged"), args2); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "SelectionChanged"_L1, args2); } else { qCWarning(lcAccessibilityAtspi) << "ValueChanged event and no ValueInterface or ComboBox: " << iface; } @@ -1061,9 +1061,8 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) } QString path = pathForInterface(iface); int selected = iface->state().selected ? 1 : 0; - QVariantList stateArgs = packDBusSignalArguments(QLatin1String("selected"), selected, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("StateChanged"), stateArgs); + QVariantList stateArgs = packDBusSignalArguments("selected"_L1, selected, 0, variantForPath(path)); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "StateChanged"_L1, stateArgs); break; } @@ -1077,7 +1076,7 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) return; } int checked = iface->state().checked; - notifyStateChange(iface, QLatin1String("checked"), checked); + notifyStateChange(iface, "checked"_L1, checked); } else if (stateChange.active) { QAccessibleInterface * iface = event->accessibleInterface(); if (!iface || !(iface->role() == QAccessible::Window && (sendWindow || sendWindow_activate))) @@ -1087,17 +1086,17 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) QDBusVariant data; data.setVariant(windowTitle); QVariantList args = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(data)); - QString status = isActive ? QLatin1String("Activate") : QLatin1String("Deactivate"); + QString status = isActive ? "Activate"_L1 : "Deactivate"_L1; QString path = pathForInterface(iface); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_WINDOW), status, args); - notifyStateChange(iface, QLatin1String("active"), isActive); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_WINDOW ""_L1, status, args); + notifyStateChange(iface, "active"_L1, isActive); } else if (stateChange.disabled) { QAccessibleInterface *iface = event->accessibleInterface(); QAccessible::State state = iface->state(); bool enabled = !state.disabled; - notifyStateChange(iface, QLatin1String("enabled"), enabled); - notifyStateChange(iface, QLatin1String("sensitive"), enabled); + notifyStateChange(iface, "enabled"_L1, enabled); + notifyStateChange(iface, "sensitive"_L1, enabled); } } break; @@ -1166,21 +1165,20 @@ void AtSpiAdaptor::sendFocusChanged(QAccessibleInterface *interface) const static QString lastFocusPath; // "remove" old focus if (!lastFocusPath.isEmpty()) { - QVariantList stateArgs = packDBusSignalArguments(QLatin1String("focused"), 0, 0, variantForPath(lastFocusPath)); - sendDBusSignal(lastFocusPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("StateChanged"), stateArgs); + QVariantList stateArgs = packDBusSignalArguments("focused"_L1, 0, 0, variantForPath(lastFocusPath)); + sendDBusSignal(lastFocusPath, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "StateChanged"_L1, stateArgs); } // send new focus { QString path = pathForInterface(interface); - QVariantList stateArgs = packDBusSignalArguments(QLatin1String("focused"), 1, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), - QLatin1String("StateChanged"), stateArgs); + QVariantList stateArgs = packDBusSignalArguments("focused"_L1, 1, 0, variantForPath(path)); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, + "StateChanged"_L1, stateArgs); QVariantList focusArgs = packDBusSignalArguments(QString(), 0, 0, variantForPath(path)); - sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_FOCUS), - QLatin1String("Focus"), focusArgs); + sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_FOCUS ""_L1, "Focus"_L1, focusArgs); lastFocusPath = path; } } @@ -1191,8 +1189,8 @@ void AtSpiAdaptor::childrenChanged(QAccessibleInterface *interface) const int childCount = interface->childCount(); for (int i = 0; i < interface->childCount(); ++i) { QString childPath = pathForInterface(interface->child(i)); - QVariantList args = packDBusSignalArguments(QLatin1String("add"), childCount, 0, childPath); - sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args); + QVariantList args = packDBusSignalArguments("add"_L1, childCount, 0, childPath); + sendDBusSignal(parentPath, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "ChildrenChanged"_L1, args); } } @@ -1210,8 +1208,8 @@ void AtSpiAdaptor::notifyAboutCreation(QAccessibleInterface *interface) const QString path = pathForInterface(interface); int childCount = parent->childCount(); QString parentPath = pathForInterface(parent); - QVariantList args = packDBusSignalArguments(QLatin1String("add"), childCount, 0, variantForPath(path)); - sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args); + QVariantList args = packDBusSignalArguments("add"_L1, childCount, 0, variantForPath(path)); + sendDBusSignal(parentPath, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "ChildrenChanged"_L1, args); } void AtSpiAdaptor::notifyAboutDestruction(QAccessibleInterface *interface) const @@ -1236,8 +1234,8 @@ void AtSpiAdaptor::notifyAboutDestruction(QAccessibleInterface *interface) const // } QString parentPath = pathForInterface(parent); - QVariantList args = packDBusSignalArguments(QLatin1String("remove"), childIndex, 0, variantForPath(path)); - sendDBusSignal(parentPath, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT), QLatin1String("ChildrenChanged"), args); + QVariantList args = packDBusSignalArguments("remove"_L1, childIndex, 0, variantForPath(path)); + sendDBusSignal(parentPath, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1, "ChildrenChanged"_L1, args); } /*! @@ -1262,34 +1260,34 @@ bool AtSpiAdaptor::handleMessage(const QDBusMessage &message, const QDBusConnect // qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::handleMessage: " << interface << function; - if (function == QLatin1String("Introspect")) { + if (function == "Introspect"_L1) { //introspect(message.path()); return false; } // handle properties like regular functions - if (interface == QLatin1String("org.freedesktop.DBus.Properties")) { + if (interface == "org.freedesktop.DBus.Properties"_L1) { interface = message.arguments().at(0).toString(); // Get/Set + Name function = message.member() + message.arguments().at(1).toString(); } // switch interface to call - if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_ACCESSIBLE)) + if (interface == ATSPI_DBUS_INTERFACE_ACCESSIBLE ""_L1) return accessibleInterface(accessible, function, message, connection); - if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_APPLICATION)) + if (interface == ATSPI_DBUS_INTERFACE_APPLICATION ""_L1) return applicationInterface(accessible, function, message, connection); - if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_COMPONENT)) + if (interface == ATSPI_DBUS_INTERFACE_COMPONENT ""_L1) return componentInterface(accessible, function, message, connection); - if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_ACTION)) + if (interface == ATSPI_DBUS_INTERFACE_ACTION ""_L1) return actionInterface(accessible, function, message, connection); - if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_TEXT)) + if (interface == ATSPI_DBUS_INTERFACE_TEXT ""_L1) return textInterface(accessible, function, message, connection); - if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_EDITABLE_TEXT)) + if (interface == ATSPI_DBUS_INTERFACE_EDITABLE_TEXT ""_L1) return editableTextInterface(accessible, function, message, connection); - if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_VALUE)) + if (interface == ATSPI_DBUS_INTERFACE_VALUE ""_L1) return valueInterface(accessible, function, message, connection); - if (interface == QLatin1String(ATSPI_DBUS_INTERFACE_TABLE)) + if (interface == ATSPI_DBUS_INTERFACE_TABLE ""_L1) return tableInterface(accessible, function, message, connection); qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::handleMessage with unknown interface: " << message.path() << interface << function; @@ -1299,35 +1297,35 @@ bool AtSpiAdaptor::handleMessage(const QDBusMessage &message, const QDBusConnect // Application bool AtSpiAdaptor::applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) { - if (message.path() != QLatin1String(ATSPI_DBUS_PATH_ROOT)) { + if (message.path() != ATSPI_DBUS_PATH_ROOT ""_L1) { qCDebug(lcAccessibilityAtspi) << "WARNING Qt AtSpiAdaptor: Could not find application interface for: " << message.path() << interface; return false; } - if (function == QLatin1String("SetId")) { - Q_ASSERT(message.signature() == QLatin1String("ssv")); + if (function == "SetId"_L1) { + Q_ASSERT(message.signature() == "ssv"_L1); QVariant value = qvariant_cast<QDBusVariant>(message.arguments().at(2)).variant(); m_applicationId = value.toInt(); return true; } - if (function == QLatin1String("GetId")) { - Q_ASSERT(message.signature() == QLatin1String("ss")); + if (function == "GetId"_L1) { + Q_ASSERT(message.signature() == "ss"_L1); QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(m_applicationId))); return connection.send(reply); } - if (function == QLatin1String("GetToolkitName")) { - Q_ASSERT(message.signature() == QLatin1String("ss")); - QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1String("Qt")))); + if (function == "GetToolkitName"_L1) { + Q_ASSERT(message.signature() == "ss"_L1); + QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant("Qt"_L1))); return connection.send(reply); } - if (function == QLatin1String("GetVersion")) { - Q_ASSERT(message.signature() == QLatin1String("ss")); + if (function == "GetVersion"_L1) { + Q_ASSERT(message.signature() == "ss"_L1); QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1String(qVersion())))); return connection.send(reply); } - if (function == QLatin1String("GetLocale")) { - Q_ASSERT(message.signature() == QLatin1String("u")); + if (function == "GetLocale"_L1) { + Q_ASSERT(message.signature() == "u"_L1); QDBusMessage reply = message.createReply(QVariant::fromValue(QLocale().name())); return connection.send(reply); } @@ -1341,8 +1339,8 @@ bool AtSpiAdaptor::applicationInterface(QAccessibleInterface *interface, const Q void AtSpiAdaptor::registerApplication() { OrgA11yAtspiSocketInterface *registry; - registry = new OrgA11yAtspiSocketInterface(QLatin1String(QSPI_REGISTRY_NAME), - QLatin1String(QSPI_OBJECT_PATH_ROOT), m_dbus->connection()); + registry = new OrgA11yAtspiSocketInterface(QSPI_REGISTRY_NAME ""_L1, + QSPI_OBJECT_PATH_ROOT ""_L1, m_dbus->connection()); QDBusPendingReply<QSpiObjectReference> reply; QSpiObjectReference ref = QSpiObjectReference(m_dbus->connection(), QDBusObjectPath(QSPI_OBJECT_PATH_ROOT)); @@ -1362,17 +1360,17 @@ void AtSpiAdaptor::registerApplication() // Accessible bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) { - if (function == QLatin1String("GetRole")) { + if (function == "GetRole"_L1) { sendReply(connection, message, (uint) getRole(interface)); - } else if (function == QLatin1String("GetName")) { + } else if (function == "GetName"_L1) { sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->text(QAccessible::Name)))); - } else if (function == QLatin1String("GetRoleName")) { + } else if (function == "GetRoleName"_L1) { sendReply(connection, message, QSpiAccessibleBridge::namesForRole(interface->role()).name()); - } else if (function == QLatin1String("GetLocalizedRoleName")) { + } else if (function == "GetLocalizedRoleName"_L1) { sendReply(connection, message, QVariant::fromValue(QSpiAccessibleBridge::namesForRole(interface->role()).localizedName())); - } else if (function == QLatin1String("GetChildCount")) { + } else if (function == "GetChildCount"_L1) { sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->childCount()))); - } else if (function == QLatin1String("GetIndexInParent")) { + } else if (function == "GetIndexInParent"_L1) { int childIndex = -1; QAccessibleInterface * parent = interface->parent(); if (parent) { @@ -1382,20 +1380,20 @@ bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QS } } sendReply(connection, message, childIndex); - } else if (function == QLatin1String("GetParent")) { + } else if (function == "GetParent"_L1) { QString path; QAccessibleInterface * parent = interface->parent(); if (!parent) { - path = QLatin1String(ATSPI_DBUS_PATH_NULL); + path = ATSPI_DBUS_PATH_NULL ""_L1; } else if (parent->role() == QAccessible::Application) { - path = QLatin1String(ATSPI_DBUS_PATH_ROOT); + path = ATSPI_DBUS_PATH_ROOT ""_L1; } else { path = pathForInterface(parent); } // Parent is a property, so it needs to be wrapped inside an extra variant. sendReply(connection, message, QVariant::fromValue( QDBusVariant(QVariant::fromValue(QSpiObjectReference(connection, QDBusObjectPath(path)))))); - } else if (function == QLatin1String("GetChildAtIndex")) { + } else if (function == "GetChildAtIndex"_L1) { const int index = message.arguments().at(0).toInt(); if (index < 0) { sendReply(connection, message, QVariant::fromValue( @@ -1405,11 +1403,11 @@ bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QS sendReply(connection, message, QVariant::fromValue( QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(childInterface))))); } - } else if (function == QLatin1String("GetInterfaces")) { + } else if (function == "GetInterfaces"_L1) { sendReply(connection, message, accessibleInterfaces(interface)); - } else if (function == QLatin1String("GetDescription")) { + } else if (function == "GetDescription"_L1) { sendReply(connection, message, QVariant::fromValue(QDBusVariant(interface->text(QAccessible::Description)))); - } else if (function == QLatin1String("GetState")) { + } else if (function == "GetState"_L1) { quint64 spiState = spiStatesFromQState(interface->state()); if (interface->tableInterface()) { setSpiStateBit(&spiState, ATSPI_STATE_MANAGES_DESCENDANTS); @@ -1425,14 +1423,14 @@ bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QS } sendReply(connection, message, QVariant::fromValue(spiStateSetFromSpiStates(spiState))); - } else if (function == QLatin1String("GetAttributes")) { + } else if (function == "GetAttributes"_L1) { sendReply(connection, message, QVariant::fromValue(QSpiAttributeSet())); - } else if (function == QLatin1String("GetRelationSet")) { + } else if (function == "GetRelationSet"_L1) { sendReply(connection, message, QVariant::fromValue(relationSet(interface, connection))); - } else if (function == QLatin1String("GetApplication")) { + } else if (function == "GetApplication"_L1) { sendReply(connection, message, QVariant::fromValue( QSpiObjectReference(connection, QDBusObjectPath(QSPI_OBJECT_PATH_ROOT)))); - } else if (function == QLatin1String("GetChildren")) { + } else if (function == "GetChildren"_L1) { QSpiObjectReferenceArray children; const int numChildren = interface->childCount(); children.reserve(numChildren); @@ -1460,7 +1458,7 @@ QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface) { QStringList ifaces; qCDebug(lcAccessibilityAtspiCreation) << "AtSpiAdaptor::accessibleInterfaces create: " << interface->object(); - ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_ACCESSIBLE); + ifaces << ATSPI_DBUS_INTERFACE_ACCESSIBLE ""_L1; if ( (!interface->rect().isEmpty()) || (interface->object() && interface->object()->isWidgetType()) || @@ -1470,27 +1468,27 @@ QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface) (interface->role() == QAccessible::Row) || (interface->object() && interface->object()->inherits("QSGItem")) ) { - ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_COMPONENT); + ifaces << ATSPI_DBUS_INTERFACE_COMPONENT ""_L1; } else { qCDebug(lcAccessibilityAtspiCreation) << " IS NOT a component"; } if (interface->role() == QAccessible::Application) - ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_APPLICATION); + ifaces << ATSPI_DBUS_INTERFACE_APPLICATION ""_L1; if (interface->actionInterface() || interface->valueInterface()) - ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_ACTION); + ifaces << ATSPI_DBUS_INTERFACE_ACTION ""_L1; if (interface->textInterface()) - ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_TEXT); + ifaces << ATSPI_DBUS_INTERFACE_TEXT ""_L1; if (interface->editableTextInterface()) - ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_EDITABLE_TEXT); + ifaces << ATSPI_DBUS_INTERFACE_EDITABLE_TEXT ""_L1; if (interface->valueInterface()) - ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_VALUE); + ifaces << ATSPI_DBUS_INTERFACE_VALUE ""_L1; if (interface->tableInterface()) - ifaces << QLatin1String(ATSPI_DBUS_INTERFACE_TABLE); + ifaces << ATSPI_DBUS_INTERFACE_TABLE ""_L1; return ifaces; } @@ -1537,13 +1535,13 @@ QString AtSpiAdaptor::pathForObject(QObject *object) const QString AtSpiAdaptor::pathForInterface(QAccessibleInterface *interface) const { if (!interface || !interface->isValid()) - return QLatin1String(ATSPI_DBUS_PATH_NULL); + return ATSPI_DBUS_PATH_NULL ""_L1; if (interface->role() == QAccessible::Application) - return QLatin1String(QSPI_OBJECT_PATH_ROOT); + return QSPI_OBJECT_PATH_ROOT ""_L1; QAccessible::Id id = QAccessible::uniqueId(interface); Q_ASSERT((int)id < 0); - return QLatin1String(QSPI_OBJECT_PATH_PREFIX) + QString::number(id); + return QSPI_OBJECT_PATH_PREFIX ""_L1 + QString::number(id); } bool AtSpiAdaptor::inheritsQAction(QObject *object) @@ -1551,7 +1549,7 @@ bool AtSpiAdaptor::inheritsQAction(QObject *object) const QMetaObject *mo = object->metaObject(); while (mo) { const QLatin1String cn(mo->className()); - if (cn == QLatin1String("QAction")) + if (cn == "QAction"_L1) return true; mo = mo->superClass(); } @@ -1590,7 +1588,7 @@ static QRect getRelativeRect(QAccessibleInterface *interface) bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) { - if (function == QLatin1String("Contains")) { + if (function == "Contains"_L1) { bool ret = false; int x = message.arguments().at(0).toInt(); int y = message.arguments().at(1).toInt(); @@ -1600,7 +1598,7 @@ bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QSt else ret = getRelativeRect(interface).contains(x, y); sendReply(connection, message, ret); - } else if (function == QLatin1String("GetAccessibleAtPoint")) { + } else if (function == "GetAccessibleAtPoint"_L1) { int x = message.arguments().at(0).toInt(); int y = message.arguments().at(1).toInt(); uint coordType = message.arguments().at(2).toUInt(); @@ -1626,16 +1624,16 @@ bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QSt sendReply(connection, message, QVariant::fromValue( QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL)))); } - } else if (function == QLatin1String("GetAlpha")) { + } else if (function == "GetAlpha"_L1) { sendReply(connection, message, (double) 1.0); - } else if (function == QLatin1String("GetExtents")) { + } else if (function == "GetExtents"_L1) { uint coordType = message.arguments().at(0).toUInt(); sendReply(connection, message, QVariant::fromValue(getExtents(interface, coordType))); - } else if (function == QLatin1String("GetLayer")) { + } else if (function == "GetLayer"_L1) { sendReply(connection, message, QVariant::fromValue((uint)1)); - } else if (function == QLatin1String("GetMDIZOrder")) { + } else if (function == "GetMDIZOrder"_L1) { sendReply(connection, message, QVariant::fromValue((short)0)); - } else if (function == QLatin1String("GetPosition")) { + } else if (function == "GetPosition"_L1) { uint coordType = message.arguments().at(0).toUInt(); QRect rect; if (coordType == ATSPI_COORD_TYPE_SCREEN) @@ -1645,12 +1643,12 @@ bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QSt QVariantList pos; pos << rect.x() << rect.y(); connection.send(message.createReply(pos)); - } else if (function == QLatin1String("GetSize")) { + } else if (function == "GetSize"_L1) { QRect rect = interface->rect(); QVariantList size; size << rect.width() << rect.height(); connection.send(message.createReply(size)); - } else if (function == QLatin1String("GrabFocus")) { + } else if (function == "GrabFocus"_L1) { QAccessibleActionInterface *actionIface = interface->actionInterface(); if (actionIface && actionIface->actionNames().contains(QAccessibleActionInterface::setFocusAction())) { actionIface->doAction(QAccessibleActionInterface::setFocusAction()); @@ -1658,7 +1656,7 @@ bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QSt } else { sendReply(connection, message, false); } - } else if (function == QLatin1String("SetExtents")) { + } else if (function == "SetExtents"_L1) { // int x = message.arguments().at(0).toInt(); // int y = message.arguments().at(1).toInt(); // int width = message.arguments().at(2).toInt(); @@ -1666,13 +1664,13 @@ bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QSt // uint coordinateType = message.arguments().at(4).toUInt(); qCDebug(lcAccessibilityAtspi) << "SetExtents is not implemented."; sendReply(connection, message, false); - } else if (function == QLatin1String("SetPosition")) { + } else if (function == "SetPosition"_L1) { // int x = message.arguments().at(0).toInt(); // int y = message.arguments().at(1).toInt(); // uint coordinateType = message.arguments().at(2).toUInt(); qCDebug(lcAccessibilityAtspi) << "SetPosition is not implemented."; sendReply(connection, message, false); - } else if (function == QLatin1String("SetSize")) { + } else if (function == "SetSize"_L1) { // int width = message.arguments().at(0).toInt(); // int height = message.arguments().at(1).toInt(); qCDebug(lcAccessibilityAtspi) << "SetSize is not implemented."; @@ -1692,10 +1690,10 @@ QRect AtSpiAdaptor::getExtents(QAccessibleInterface *interface, uint coordType) // Action interface bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) { - if (function == QLatin1String("GetNActions")) { + if (function == "GetNActions"_L1) { int count = QAccessibleBridgeUtils::effectiveActionNames(interface).count(); sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(count)))); - } else if (function == QLatin1String("DoAction")) { + } else if (function == "DoAction"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); if (index < 0 || index >= actionNames.count()) @@ -1703,15 +1701,15 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin const QString actionName = actionNames.at(index); bool success = QAccessibleBridgeUtils::performEffectiveAction(interface, actionName); sendReply(connection, message, success); - } else if (function == QLatin1String("GetActions")) { + } else if (function == "GetActions"_L1) { sendReply(connection, message, QVariant::fromValue(getActions(interface))); - } else if (function == QLatin1String("GetName")) { + } else if (function == "GetName"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); if (index < 0 || index >= actionNames.count()) return false; sendReply(connection, message, actionNames.at(index)); - } else if (function == QLatin1String("GetDescription")) { + } else if (function == "GetDescription"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); if (index < 0 || index >= actionNames.count()) @@ -1722,7 +1720,7 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin else description = qAccessibleLocalizedActionDescription(actionNames.at(index)); sendReply(connection, message, description); - } else if (function == QLatin1String("GetKeyBinding")) { + } else if (function == "GetKeyBinding"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); if (index < 0 || index >= actionNames.count()) @@ -1777,31 +1775,31 @@ bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString return false; // properties - if (function == QLatin1String("GetCaretOffset")) { + if (function == "GetCaretOffset"_L1) { sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(interface->textInterface()->cursorPosition())))); - } else if (function == QLatin1String("GetCharacterCount")) { + } else if (function == "GetCharacterCount"_L1) { sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(interface->textInterface()->characterCount())))); // functions - } else if (function == QLatin1String("AddSelection")) { + } else if (function == "AddSelection"_L1) { int startOffset = message.arguments().at(0).toInt(); int endOffset = message.arguments().at(1).toInt(); int lastSelection = interface->textInterface()->selectionCount(); interface->textInterface()->setSelection(lastSelection, startOffset, endOffset); sendReply(connection, message, (interface->textInterface()->selectionCount() > lastSelection)); - } else if (function == QLatin1String("GetAttributeRun")) { + } else if (function == "GetAttributeRun"_L1) { int offset = message.arguments().at(0).toInt(); bool includeDefaults = message.arguments().at(1).toBool(); Q_UNUSED(includeDefaults); connection.send(message.createReply(getAttributes(interface, offset, includeDefaults))); - } else if (function == QLatin1String("GetAttributeValue")) { + } else if (function == "GetAttributeValue"_L1) { int offset = message.arguments().at(0).toInt(); QString attributeName = message.arguments().at(1).toString(); connection.send(message.createReply(getAttributeValue(interface, offset, attributeName))); - } else if (function == QLatin1String("GetAttributes")) { + } else if (function == "GetAttributes"_L1) { int offset = message.arguments().at(0).toInt(); connection.send(message.createReply(getAttributes(interface, offset, true))); - } else if (function == QLatin1String("GetBoundedRanges")) { + } else if (function == "GetBoundedRanges"_L1) { int x = message.arguments().at(0).toInt(); int y = message.arguments().at(1).toInt(); int width = message.arguments().at(2).toInt(); @@ -1818,23 +1816,23 @@ bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString Q_UNUSED(yClipType); qCDebug(lcAccessibilityAtspi) << "Not implemented: QSpiAdaptor::GetBoundedRanges"; sendReply(connection, message, QVariant::fromValue(QSpiTextRangeList())); - } else if (function == QLatin1String("GetCharacterAtOffset")) { + } else if (function == "GetCharacterAtOffset"_L1) { int offset = message.arguments().at(0).toInt(); int start; int end; QString result = interface->textInterface()->textAtOffset(offset, QAccessible::CharBoundary, &start, &end); sendReply(connection, message, (int) *(qPrintable (result))); - } else if (function == QLatin1String("GetCharacterExtents")) { + } else if (function == "GetCharacterExtents"_L1) { int offset = message.arguments().at(0).toInt(); int coordType = message.arguments().at(1).toUInt(); connection.send(message.createReply(getCharacterExtents(interface, offset, coordType))); - } else if (function == QLatin1String("GetDefaultAttributeSet") || function == QLatin1String("GetDefaultAttributes")) { + } else if (function == "GetDefaultAttributeSet"_L1 || function == "GetDefaultAttributes"_L1) { // GetDefaultAttributes is deprecated in favour of GetDefaultAttributeSet. // Empty set seems reasonable. There is no default attribute set. sendReply(connection, message, QVariant::fromValue(QSpiAttributeSet())); - } else if (function == QLatin1String("GetNSelections")) { + } else if (function == "GetNSelections"_L1) { sendReply(connection, message, interface->textInterface()->selectionCount()); - } else if (function == QLatin1String("GetOffsetAtPoint")) { + } else if (function == "GetOffsetAtPoint"_L1) { qCDebug(lcAccessibilityAtspi) << message.signature(); Q_ASSERT(!message.signature().isEmpty()); QPoint point(message.arguments().at(0).toInt(), message.arguments().at(1).toInt()); @@ -1845,12 +1843,12 @@ bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString } int offset = interface->textInterface()->offsetAtPoint(point); sendReply(connection, message, offset); - } else if (function == QLatin1String("GetRangeExtents")) { + } else if (function == "GetRangeExtents"_L1) { int startOffset = message.arguments().at(0).toInt(); int endOffset = message.arguments().at(1).toInt(); uint coordType = message.arguments().at(2).toUInt(); connection.send(message.createReply(getRangeExtents(interface, startOffset, endOffset, coordType))); - } else if (function == QLatin1String("GetSelection")) { + } else if (function == "GetSelection"_L1) { int selectionNum = message.arguments().at(0).toInt(); int start, end; interface->textInterface()->selection(selectionNum, &start, &end); @@ -1859,13 +1857,13 @@ bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString QVariantList sel; sel << start << end; connection.send(message.createReply(sel)); - } else if (function == QLatin1String("GetText")) { + } else if (function == "GetText"_L1) { int startOffset = message.arguments().at(0).toInt(); int endOffset = message.arguments().at(1).toInt(); if (endOffset == -1) // AT-SPI uses -1 to signal all characters endOffset = interface->textInterface()->characterCount(); sendReply(connection, message, interface->textInterface()->text(startOffset, endOffset)); - } else if (function == QLatin1String("GetTextAfterOffset")) { + } else if (function == "GetTextAfterOffset"_L1) { int offset = message.arguments().at(0).toInt(); int type = message.arguments().at(1).toUInt(); int startOffset, endOffset; @@ -1873,7 +1871,7 @@ bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString QVariantList ret; ret << text << startOffset << endOffset; connection.send(message.createReply(ret)); - } else if (function == QLatin1String("GetTextAtOffset")) { + } else if (function == "GetTextAtOffset"_L1) { int offset = message.arguments().at(0).toInt(); int type = message.arguments().at(1).toUInt(); int startOffset, endOffset; @@ -1881,7 +1879,7 @@ bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString QVariantList ret; ret << text << startOffset << endOffset; connection.send(message.createReply(ret)); - } else if (function == QLatin1String("GetTextBeforeOffset")) { + } else if (function == "GetTextBeforeOffset"_L1) { int offset = message.arguments().at(0).toInt(); int type = message.arguments().at(1).toUInt(); int startOffset, endOffset; @@ -1889,15 +1887,15 @@ bool AtSpiAdaptor::textInterface(QAccessibleInterface *interface, const QString QVariantList ret; ret << text << startOffset << endOffset; connection.send(message.createReply(ret)); - } else if (function == QLatin1String("RemoveSelection")) { + } else if (function == "RemoveSelection"_L1) { int selectionNum = message.arguments().at(0).toInt(); interface->textInterface()->removeSelection(selectionNum); sendReply(connection, message, true); - } else if (function == QLatin1String("SetCaretOffset")) { + } else if (function == "SetCaretOffset"_L1) { int offset = message.arguments().at(0).toInt(); interface->textInterface()->setCursorPosition(offset); sendReply(connection, message, true); - } else if (function == QLatin1String("SetSelection")) { + } else if (function == "SetSelection"_L1) { int selectionNum = message.arguments().at(0).toInt(); int startOffset = message.arguments().at(1).toInt(); int endOffset = message.arguments().at(2).toInt(); @@ -1962,75 +1960,61 @@ namespace // https://bugzilla.gnome.org/show_bug.cgi?id=744553 "ATK docs provide no guidance for allowed values of some text attributes" // specifically for "weight", "invalid", "language" and value range for colors - if (ia2Name == QLatin1String("background-color")) { + if (ia2Name == "background-color"_L1) { name = QStringLiteral("bg-color"); value = atspiColor(value); - } else if (ia2Name == QLatin1String("font-family")) { + } else if (ia2Name == "font-family"_L1) { name = QStringLiteral("family-name"); - } else if (ia2Name == QLatin1String("color")) { + } else if (ia2Name == "color"_L1) { name = QStringLiteral("fg-color"); value = atspiColor(value); - } else if (ia2Name == QLatin1String("text-align")) { + } else if (ia2Name == "text-align"_L1) { name = QStringLiteral("justification"); - if (value == QLatin1String("justify")) { + if (value == "justify"_L1) { value = QStringLiteral("fill"); - } else { - if (value != QLatin1String("left") && - value != QLatin1String("right") && - value != QLatin1String("center") - ) { - qCDebug(lcAccessibilityAtspi) << "Unknown text-align attribute value \"" - << value << "\" cannot be translated to AT-SPI."; - value = QString(); - } + } else if (value != "left"_L1 && value != "right"_L1 && value != "center"_L1) { + qCDebug(lcAccessibilityAtspi) << "Unknown text-align attribute value \"" + << value << "\" cannot be translated to AT-SPI."; + value = QString(); } - } else if (ia2Name == QLatin1String("font-size")) { + } else if (ia2Name == "font-size"_L1) { name = QStringLiteral("size"); value = atspiSize(value); - } else if (ia2Name == QLatin1String("font-style")) { + } else if (ia2Name == "font-style"_L1) { name = QStringLiteral("style"); - if (value != QLatin1String("normal") && - value != QLatin1String("italic") && - value != QLatin1String("oblique") - ) { + if (value != "normal"_L1 && value != "italic"_L1 && value != "oblique"_L1) { qCDebug(lcAccessibilityAtspi) << "Unknown font-style attribute value \"" << value << "\" cannot be translated to AT-SPI."; value = QString(); } - } else if (ia2Name == QLatin1String("text-underline-type")) { + } else if (ia2Name == "text-underline-type"_L1) { name = QStringLiteral("underline"); - if (value != QLatin1String("none") && - value != QLatin1String("single") && - value != QLatin1String("double") - ) { + if (value != "none"_L1 && value != "single"_L1 && value != "double"_L1) { qCDebug(lcAccessibilityAtspi) << "Unknown text-underline-type attribute value \"" << value << "\" cannot be translated to AT-SPI."; value = QString(); } - } else if (ia2Name == QLatin1String("font-weight")) { + } else if (ia2Name == "font-weight"_L1) { name = QStringLiteral("weight"); - if (value == QLatin1String("normal")) + if (value == "normal"_L1) // Orca seems to accept all IAccessible2 values except for "normal" // (on which it produces traceback and fails to read any following text attributes), // but that is the default value, so omit it anyway value = QString(); - } else if (ia2Name == QLatin1String("text-position")) { + } else if (ia2Name == "text-position"_L1) { name = QStringLiteral("vertical-align"); - if (value != QLatin1String("baseline") && - value != QLatin1String("super") && - value != QLatin1String("sub") - ) { + if (value != "baseline"_L1 && value != "super"_L1 && value != "sub"_L1) { qCDebug(lcAccessibilityAtspi) << "Unknown text-position attribute value \"" << value << "\" cannot be translated to AT-SPI."; value = QString(); } - } else if (ia2Name == QLatin1String("writing-mode")) { + } else if (ia2Name == "writing-mode"_L1) { name = QStringLiteral("direction"); - if (value == QLatin1String("lr")) + if (value == "lr"_L1) value = QStringLiteral("ltr"); - else if (value == QLatin1String("rl")) + else if (value == "rl"_L1) value = QStringLiteral("rtl"); - else if (value == QLatin1String("tb")) { + else if (value == "tb"_L1) { // IAccessible2 docs refer to XSL, which specifies "tb" is shorthand for "tb-rl"; so at least give a hint about the horizontal direction (ATK does not support vertical direction in this attribute (yet)) value = QStringLiteral("rtl"); qCDebug(lcAccessibilityAtspi) << "writing-mode attribute value \"tb\" translated only w.r.t. horizontal direction; vertical direction ignored"; @@ -2039,9 +2023,9 @@ namespace << "\" cannot be translated to AT-SPI."; value = QString(); } - } else if (ia2Name == QLatin1String("language")) { + } else if (ia2Name == "language"_L1) { // OK - ATK has no docs on the format of the value, IAccessible2 has reasonable format - leave it at that now - } else if (ia2Name == QLatin1String("invalid")) { + } else if (ia2Name == "invalid"_L1) { // OK - ATK docs are vague but suggest they support the same range of values as IAccessible2 } else { // attribute we know nothing about @@ -2170,7 +2154,7 @@ static void replaceTextFallback(QAccessibleInterface *accessible, long startOffs bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) { - if (function == QLatin1String("CopyText")) { + if (function == "CopyText"_L1) { #ifndef QT_NO_CLIPBOARD int startOffset = message.arguments().at(0).toInt(); int endOffset = message.arguments().at(1).toInt(); @@ -2178,7 +2162,7 @@ bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const QGuiApplication::clipboard()->setText(t); #endif connection.send(message.createReply(true)); - } else if (function == QLatin1String("CutText")) { + } else if (function == "CutText"_L1) { #ifndef QT_NO_CLIPBOARD int startOffset = message.arguments().at(0).toInt(); int endOffset = message.arguments().at(1).toInt(); @@ -2190,7 +2174,7 @@ bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const QGuiApplication::clipboard()->setText(t); #endif connection.send(message.createReply(true)); - } else if (function == QLatin1String("DeleteText")) { + } else if (function == "DeleteText"_L1) { int startOffset = message.arguments().at(0).toInt(); int endOffset = message.arguments().at(1).toInt(); if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface()) @@ -2198,7 +2182,7 @@ bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const else replaceTextFallback(interface, startOffset, endOffset, QString()); connection.send(message.createReply(true)); - } else if (function == QLatin1String("InsertText")) { + } else if (function == "InsertText"_L1) { int position = message.arguments().at(0).toInt(); QString text = message.arguments().at(1).toString(); int length = message.arguments().at(2).toInt(); @@ -2208,7 +2192,7 @@ bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const else replaceTextFallback(interface, position, position, text); connection.send(message.createReply(true)); - } else if (function == QLatin1String("PasteText")) { + } else if (function == "PasteText"_L1) { #ifndef QT_NO_CLIPBOARD int position = message.arguments().at(0).toInt(); const QString txt = QGuiApplication::clipboard()->text(); @@ -2218,14 +2202,14 @@ bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const replaceTextFallback(interface, position, position, txt); #endif connection.send(message.createReply(true)); - } else if (function == QLatin1String("SetTextContents")) { + } else if (function == "SetTextContents"_L1) { QString newContents = message.arguments().at(0).toString(); if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface()) editableTextIface->replaceText(0, interface->textInterface()->characterCount(), newContents); else replaceTextFallback(interface, 0, -1, newContents); connection.send(message.createReply(true)); - } else if (function == QLatin1String("")) { + } else if (function == ""_L1) { connection.send(message.createReply()); } else { qCDebug(lcAccessibilityAtspi) << "WARNING: AtSpiAdaptor::editableTextInterface does not implement " << function << message.path(); @@ -2241,7 +2225,7 @@ bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString if (!valueIface) return false; - if (function == QLatin1String("SetCurrentValue")) { + if (function == "SetCurrentValue"_L1) { QDBusVariant v = qvariant_cast<QDBusVariant>(message.arguments().at(2)); double value = v.variant().toDouble(); //Temporary fix @@ -2250,13 +2234,13 @@ bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString connection.send(message.createReply()); // FIXME is the reply needed? } else { QVariant value; - if (function == QLatin1String("GetCurrentValue")) + if (function == "GetCurrentValue"_L1) value = valueIface->currentValue(); - else if (function == QLatin1String("GetMaximumValue")) + else if (function == "GetMaximumValue"_L1) value = valueIface->maximumValue(); - else if (function == QLatin1String("GetMinimumIncrement")) + else if (function == "GetMinimumIncrement"_L1) value = valueIface->minimumStepSize(); - else if (function == QLatin1String("GetMinimumValue")) + else if (function == "GetMinimumValue"_L1) value = valueIface->minimumValue(); else { qCDebug(lcAccessibilityAtspi) << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path(); @@ -2284,7 +2268,7 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString if (0) { // properties - } else if (function == QLatin1String("GetCaption")) { + } else if (function == "GetCaption"_L1) { QAccessibleInterface * captionInterface= interface->tableInterface()->caption(); if (captionInterface) { QSpiObjectReference ref = QSpiObjectReference(connection, QDBusObjectPath(pathForInterface(captionInterface))); @@ -2293,23 +2277,23 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString sendReply(connection, message, QVariant::fromValue( QSpiObjectReference(connection, QDBusObjectPath(ATSPI_DBUS_PATH_NULL)))); } - } else if (function == QLatin1String("GetNColumns")) { + } else if (function == "GetNColumns"_L1) { connection.send(message.createReply(QVariant::fromValue(QDBusVariant( QVariant::fromValue(interface->tableInterface()->columnCount()))))); - } else if (function == QLatin1String("GetNRows")) { + } else if (function == "GetNRows"_L1) { connection.send(message.createReply(QVariant::fromValue(QDBusVariant( QVariant::fromValue(interface->tableInterface()->rowCount()))))); - } else if (function == QLatin1String("GetNSelectedColumns")) { + } else if (function == "GetNSelectedColumns"_L1) { connection.send(message.createReply(QVariant::fromValue(QDBusVariant( QVariant::fromValue(interface->tableInterface()->selectedColumnCount()))))); - } else if (function == QLatin1String("GetNSelectedRows")) { + } else if (function == "GetNSelectedRows"_L1) { connection.send(message.createReply(QVariant::fromValue(QDBusVariant( QVariant::fromValue(interface->tableInterface()->selectedRowCount()))))); - } else if (function == QLatin1String("GetSummary")) { + } else if (function == "GetSummary"_L1) { QAccessibleInterface *summary = interface->tableInterface() ? interface->tableInterface()->summary() : nullptr; QSpiObjectReference ref(connection, QDBusObjectPath(pathForInterface(summary))); connection.send(message.createReply(QVariant::fromValue(QDBusVariant(QVariant::fromValue(ref))))); - } else if (function == QLatin1String("GetAccessibleAt")) { + } else if (function == "GetAccessibleAt"_L1) { int row = message.arguments().at(0).toInt(); int column = message.arguments().at(1).toInt(); if ((row < 0) || @@ -2330,7 +2314,7 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString } connection.send(message.createReply(QVariant::fromValue(ref))); - } else if (function == QLatin1String("GetIndexAt")) { + } else if (function == "GetIndexAt"_L1) { int row = message.arguments().at(0).toInt(); int column = message.arguments().at(1).toInt(); QAccessibleInterface *cell = interface->tableInterface()->cellAt(row, column); @@ -2342,13 +2326,13 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString qCDebug(lcAccessibilityAtspi) << "QSpiAdaptor::GetIndexAt row:" << row << " col:" << column << " logical index:" << index; Q_ASSERT(index > 0); connection.send(message.createReply(index)); - } else if ((function == QLatin1String("GetColumnAtIndex")) || (function == QLatin1String("GetRowAtIndex"))) { + } else if ((function == "GetColumnAtIndex"_L1) || (function == "GetRowAtIndex"_L1)) { int index = message.arguments().at(0).toInt(); int ret = -1; if (index >= 0) { QAccessibleInterface * cell = interface->child(index); if (cell) { - if (function == QLatin1String("GetColumnAtIndex")) { + if (function == "GetColumnAtIndex"_L1) { if (cell->role() == QAccessible::ColumnHeader) { ret = index; } else if (cell->role() == QAccessible::RowHeader) { @@ -2380,16 +2364,16 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString } connection.send(message.createReply(ret)); - } else if (function == QLatin1String("GetColumnDescription")) { + } else if (function == "GetColumnDescription"_L1) { int column = message.arguments().at(0).toInt(); connection.send(message.createReply(interface->tableInterface()->columnDescription(column))); - } else if (function == QLatin1String("GetRowDescription")) { + } else if (function == "GetRowDescription"_L1) { int row = message.arguments().at(0).toInt(); connection.send(message.createReply(interface->tableInterface()->rowDescription(row))); - } else if (function == QLatin1String("GetRowColumnExtentsAtIndex")) { + } else if (function == "GetRowColumnExtentsAtIndex"_L1) { int index = message.arguments().at(0).toInt(); bool success = false; @@ -2417,17 +2401,17 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString list << success << row << col << rowExtents << colExtents << isSelected; connection.send(message.createReply(list)); - } else if (function == QLatin1String("GetColumnExtentAt")) { + } else if (function == "GetColumnExtentAt"_L1) { int row = message.arguments().at(0).toInt(); int column = message.arguments().at(1).toInt(); connection.send(message.createReply(interface->tableInterface()->cellAt(row, column)->tableCellInterface()->columnExtent())); - } else if (function == QLatin1String("GetRowExtentAt")) { + } else if (function == "GetRowExtentAt"_L1) { int row = message.arguments().at(0).toInt(); int column = message.arguments().at(1).toInt(); connection.send(message.createReply(interface->tableInterface()->cellAt(row, column)->tableCellInterface()->rowExtent())); - } else if (function == QLatin1String("GetColumnHeader")) { + } else if (function == "GetColumnHeader"_L1) { int column = message.arguments().at(0).toInt(); QSpiObjectReference ref; @@ -2440,7 +2424,7 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString } connection.send(message.createReply(QVariant::fromValue(ref))); - } else if (function == QLatin1String("GetRowHeader")) { + } else if (function == "GetRowHeader"_L1) { int row = message.arguments().at(0).toInt(); QSpiObjectReference ref; QAccessibleTableCellInterface *cell = interface->tableInterface()->cellAt(row, 0)->tableCellInterface(); @@ -2452,31 +2436,31 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString } connection.send(message.createReply(QVariant::fromValue(ref))); - } else if (function == QLatin1String("GetSelectedColumns")) { + } else if (function == "GetSelectedColumns"_L1) { connection.send(message.createReply(QVariant::fromValue(interface->tableInterface()->selectedColumns()))); - } else if (function == QLatin1String("GetSelectedRows")) { + } else if (function == "GetSelectedRows"_L1) { connection.send(message.createReply(QVariant::fromValue(interface->tableInterface()->selectedRows()))); - } else if (function == QLatin1String("IsColumnSelected")) { + } else if (function == "IsColumnSelected"_L1) { int column = message.arguments().at(0).toInt(); connection.send(message.createReply(interface->tableInterface()->isColumnSelected(column))); - } else if (function == QLatin1String("IsRowSelected")) { + } else if (function == "IsRowSelected"_L1) { int row = message.arguments().at(0).toInt(); connection.send(message.createReply(interface->tableInterface()->isRowSelected(row))); - } else if (function == QLatin1String("IsSelected")) { + } else if (function == "IsSelected"_L1) { int row = message.arguments().at(0).toInt(); int column = message.arguments().at(1).toInt(); QAccessibleTableCellInterface* cell = interface->tableInterface()->cellAt(row, column)->tableCellInterface(); connection.send(message.createReply(cell->isSelected())); - } else if (function == QLatin1String("AddColumnSelection")) { + } else if (function == "AddColumnSelection"_L1) { int column = message.arguments().at(0).toInt(); connection.send(message.createReply(interface->tableInterface()->selectColumn(column))); - } else if (function == QLatin1String("AddRowSelection")) { + } else if (function == "AddRowSelection"_L1) { int row = message.arguments().at(0).toInt(); connection.send(message.createReply(interface->tableInterface()->selectRow(row))); - } else if (function == QLatin1String("RemoveColumnSelection")) { + } else if (function == "RemoveColumnSelection"_L1) { int column = message.arguments().at(0).toInt(); connection.send(message.createReply(interface->tableInterface()->unselectColumn(column))); - } else if (function == QLatin1String("RemoveRowSelection")) { + } else if (function == "RemoveRowSelection"_L1) { int row = message.arguments().at(0).toInt(); connection.send(message.createReply(interface->tableInterface()->unselectRow(row))); } else { diff --git a/src/gui/accessible/linux/dbusconnection.cpp b/src/gui/accessible/linux/dbusconnection.cpp index 2a25fda9a5..8b56b71aac 100644 --- a/src/gui/accessible/linux/dbusconnection.cpp +++ b/src/gui/accessible/linux/dbusconnection.cpp @@ -53,11 +53,13 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + /* note: do not change these to QStringLiteral; we are unloaded before QtDBus is done using the strings. */ -#define A11Y_SERVICE QLatin1String("org.a11y.Bus") -#define A11Y_PATH QLatin1String("/org/a11y/bus") +#define A11Y_SERVICE "org.a11y.Bus"_L1 +#define A11Y_PATH "/org/a11y/bus"_L1 /*! \class DBusConnection @@ -137,7 +139,7 @@ void DBusConnection::serviceRegistered() } else { QDBusConnection c = QDBusConnection::sessionBus(); QDBusMessage m = QDBusMessage::createMethodCall(A11Y_SERVICE, A11Y_PATH, A11Y_SERVICE, - QLatin1String("GetAddress")); + "GetAddress"_L1); c.callWithCallback(m, this, SLOT(connectA11yBus(QString)), SLOT(dbusError(QDBusError))); } } @@ -156,7 +158,7 @@ void DBusConnection::connectA11yBus(const QString &address) qWarning("Could not find Accessibility DBus address."); return; } - m_a11yConnection = QDBusConnection(QDBusConnection::connectToBus(address, QLatin1String("a11y"))); + m_a11yConnection = QDBusConnection(QDBusConnection::connectToBus(address, "a11y"_L1)); if (m_enabled) emit enabledChanged(true); diff --git a/src/gui/accessible/linux/qspiaccessiblebridge.cpp b/src/gui/accessible/linux/qspiaccessiblebridge.cpp index 9b9b7a46a5..ba59586348 100644 --- a/src/gui/accessible/linux/qspiaccessiblebridge.cpp +++ b/src/gui/accessible/linux/qspiaccessiblebridge.cpp @@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + /*! \class QSpiAccessibleBridge \internal @@ -95,10 +97,10 @@ void QSpiAccessibleBridge::updateStatus() cache = new QSpiDBusCache(dbusConnection->connection(), this); dec = new DeviceEventControllerAdaptor(this); - dbusConnection->connection().registerObject(QLatin1String(ATSPI_DBUS_PATH_DEC), this, QDBusConnection::ExportAdaptors); + dbusConnection->connection().registerObject(ATSPI_DBUS_PATH_DEC ""_L1, this, QDBusConnection::ExportAdaptors); dbusAdaptor = new AtSpiAdaptor(dbusConnection, this); - dbusConnection->connection().registerVirtualObject(QLatin1String(QSPI_OBJECT_PATH_ACCESSIBLE), dbusAdaptor, QDBusConnection::SubPath); + dbusConnection->connection().registerVirtualObject(QSPI_OBJECT_PATH_ACCESSIBLE ""_L1, dbusAdaptor, QDBusConnection::SubPath); dbusAdaptor->registerApplication(); } } diff --git a/src/gui/accessible/linux/qspidbuscache.cpp b/src/gui/accessible/linux/qspidbuscache.cpp index 189cd2adf8..8b90cd28e6 100644 --- a/src/gui/accessible/linux/qspidbuscache.cpp +++ b/src/gui/accessible/linux/qspidbuscache.cpp @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + /*! \class QSpiDBusCache \internal @@ -69,7 +71,7 @@ QSpiDBusCache::QSpiDBusCache(QDBusConnection c, QObject* parent) : QObject(parent) { new CacheAdaptor(this); - c.registerObject(QLatin1String(QSPI_OBJECT_PATH_CACHE), this, QDBusConnection::ExportAdaptors); + c.registerObject(QSPI_OBJECT_PATH_CACHE ""_L1, this, QDBusConnection::ExportAdaptors); } void QSpiDBusCache::emitAddAccessible(const QSpiAccessibleCacheItem& item) diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index a4654a06e8..ca19e442cb 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core"); /*! @@ -470,7 +472,7 @@ QAccessibleInterface::~QAccessibleInterface() /* accessible widgets plugin discovery stuff */ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QAccessibleFactoryInterface_iid, QLatin1String("/accessible"))) + (QAccessibleFactoryInterface_iid, "/accessible"_L1)) typedef QHash<QString, QAccessiblePlugin*> QAccessiblePluginsHash; Q_GLOBAL_STATIC(QAccessiblePluginsHash, qAccessiblePlugins) @@ -1841,13 +1843,13 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface) QStringList stateStrings; QAccessible::State st = iface->state(); if (st.focusable) - stateStrings << QLatin1String("focusable"); + stateStrings << "focusable"_L1; if (st.focused) - stateStrings << QLatin1String("focused"); + stateStrings << "focused"_L1; if (st.selected) - stateStrings << QLatin1String("selected"); + stateStrings << "selected"_L1; if (st.invisible) - stateStrings << QLatin1String("invisible"); + stateStrings << "invisible"_L1; if (!stateStrings.isEmpty()) d << stateStrings.join(u'|'); diff --git a/src/gui/accessible/qplatformaccessibility.cpp b/src/gui/accessible/qplatformaccessibility.cpp index 75caeec5dc..ba96c361e5 100644 --- a/src/gui/accessible/qplatformaccessibility.cpp +++ b/src/gui/accessible/qplatformaccessibility.cpp @@ -47,11 +47,13 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + #ifndef QT_NO_ACCESSIBILITY /* accessiblebridge plugin discovery stuff */ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, bridgeloader, - (QAccessibleBridgeFactoryInterface_iid, QLatin1String("/accessiblebridge"))) + (QAccessibleBridgeFactoryInterface_iid, "/accessiblebridge"_L1)) Q_GLOBAL_STATIC(QList<QAccessibleBridge *>, bridges) |