| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | |
| 5 | #ifndef QSPIACCESSIBLEBRIDGE_H |
| 6 | #define QSPIACCESSIBLEBRIDGE_H |
| 7 | |
| 8 | // |
| 9 | // W A R N I N G |
| 10 | // ------------- |
| 11 | // |
| 12 | // This file is not part of the Qt API. It exists purely as an |
| 13 | // implementation detail. This header file may change from version to |
| 14 | // version without notice, or even be removed. |
| 15 | // |
| 16 | // We mean it. |
| 17 | // |
| 18 | |
| 19 | #include <QtGui/private/qtguiglobal_p.h> |
| 20 | #include <QtDBus/qdbusconnection.h> |
| 21 | #include <qpa/qplatformaccessibility.h> |
| 22 | #include <QtCore/qhash.h> |
| 23 | |
| 24 | class DeviceEventControllerAdaptor; |
| 25 | |
| 26 | QT_REQUIRE_CONFIG(accessibility); |
| 27 | |
| 28 | QT_BEGIN_NAMESPACE |
| 29 | |
| 30 | class QAtSpiDBusConnection; |
| 31 | class QSpiDBusCache; |
| 32 | class AtSpiAdaptor; |
| 33 | struct RoleNames; |
| 34 | |
| 35 | class Q_GUI_EXPORT QSpiAccessibleBridge: public QObject, public QPlatformAccessibility |
| 36 | { |
| 37 | Q_OBJECT |
| 38 | public: |
| 39 | using SpiRoleMapping = QHash <QAccessible::Role, RoleNames>; |
| 40 | |
| 41 | QSpiAccessibleBridge(); |
| 42 | |
| 43 | virtual ~QSpiAccessibleBridge(); |
| 44 | |
| 45 | void notifyAccessibilityUpdate(QAccessibleEvent *event) override; |
| 46 | QDBusConnection dBusConnection() const; |
| 47 | |
| 48 | const SpiRoleMapping &spiRoleNames() const { return m_spiRoleMapping; } |
| 49 | |
| 50 | static QSpiAccessibleBridge *instance(); |
| 51 | static RoleNames namesForRole(QAccessible::Role role); |
| 52 | |
| 53 | public Q_SLOTS: |
| 54 | void enabledChanged(bool enabled); |
| 55 | |
| 56 | private: |
| 57 | void initializeConstantMappings(); |
| 58 | void updateStatus(); |
| 59 | |
| 60 | QSpiDBusCache *cache; |
| 61 | DeviceEventControllerAdaptor *dec; |
| 62 | AtSpiAdaptor *dbusAdaptor; |
| 63 | QAtSpiDBusConnection* dbusConnection; |
| 64 | SpiRoleMapping m_spiRoleMapping; |
| 65 | }; |
| 66 | |
| 67 | QT_END_NAMESPACE |
| 68 | |
| 69 | #endif |
| 70 |
