| 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 Q_SPI_STRUCT_MARSHALLERS_H |
| 6 | #define Q_SPI_STRUCT_MARSHALLERS_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 <QtCore/qlist.h> |
| 21 | #include <QtDBus/QDBusArgument> |
| 22 | #include <QtDBus/QDBusConnection> |
| 23 | #include <QtDBus/QDBusObjectPath> |
| 24 | |
| 25 | QT_REQUIRE_CONFIG(accessibility); |
| 26 | |
| 27 | QT_BEGIN_NAMESPACE |
| 28 | |
| 29 | using QSpiIntList = QList<int>; |
| 30 | using QSpiUIntList = QList<uint>; |
| 31 | |
| 32 | // FIXME: make this copy on write |
| 33 | struct QSpiObjectReference |
| 34 | { |
| 35 | QString service; |
| 36 | QDBusObjectPath path; |
| 37 | |
| 38 | QSpiObjectReference(); |
| 39 | QSpiObjectReference(const QDBusConnection& connection, const QDBusObjectPath& path) |
| 40 | : service(connection.baseService()), path(path) {} |
| 41 | }; |
| 42 | Q_DECLARE_TYPEINFO(QSpiObjectReference, Q_RELOCATABLE_TYPE); // QDBusObjectPath is movable, even though it |
| 43 | // cannot be marked that way until Qt 6 |
| 44 | |
| 45 | QDBusArgument &operator<<(QDBusArgument &argument, const QSpiObjectReference &address); |
| 46 | const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiObjectReference &address); |
| 47 | |
| 48 | typedef QList<QSpiObjectReference> QSpiObjectReferenceArray; |
| 49 | |
| 50 | struct QSpiAccessibleCacheItem |
| 51 | { |
| 52 | QSpiObjectReference path; |
| 53 | QSpiObjectReference application; |
| 54 | QSpiObjectReference parent; |
| 55 | QSpiObjectReferenceArray children; |
| 56 | QStringList supportedInterfaces; |
| 57 | QString name; |
| 58 | uint role; |
| 59 | QString description; |
| 60 | QSpiUIntList state; |
| 61 | }; |
| 62 | Q_DECLARE_TYPEINFO(QSpiAccessibleCacheItem, Q_RELOCATABLE_TYPE); |
| 63 | |
| 64 | typedef QList<QSpiAccessibleCacheItem> QSpiAccessibleCacheArray; |
| 65 | |
| 66 | QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAccessibleCacheItem &item); |
| 67 | const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAccessibleCacheItem &item); |
| 68 | |
| 69 | struct QSpiAction |
| 70 | { |
| 71 | QString name; |
| 72 | QString description; |
| 73 | QString keyBinding; |
| 74 | }; |
| 75 | Q_DECLARE_TYPEINFO(QSpiAction, Q_RELOCATABLE_TYPE); |
| 76 | |
| 77 | typedef QList<QSpiAction> QSpiActionArray; |
| 78 | |
| 79 | QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAction &action); |
| 80 | const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAction &action); |
| 81 | |
| 82 | struct QSpiEventListener |
| 83 | { |
| 84 | QString listenerAddress; |
| 85 | QString eventName; |
| 86 | }; |
| 87 | Q_DECLARE_TYPEINFO(QSpiEventListener, Q_RELOCATABLE_TYPE); |
| 88 | |
| 89 | typedef QList<QSpiEventListener> QSpiEventListenerArray; |
| 90 | |
| 91 | QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &action); |
| 92 | const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &action); |
| 93 | |
| 94 | typedef std::pair<unsigned int, QSpiObjectReferenceArray> QSpiRelationArrayEntry; |
| 95 | typedef QList<QSpiRelationArrayEntry> QSpiRelationArray; |
| 96 | |
| 97 | //a(iisv) |
| 98 | struct { |
| 99 | int ; |
| 100 | int ; |
| 101 | QString ; |
| 102 | QVariant ; |
| 103 | }; |
| 104 | Q_DECLARE_TYPEINFO(QSpiTextRange, Q_RELOCATABLE_TYPE); |
| 105 | |
| 106 | typedef QList<QSpiTextRange> ; |
| 107 | typedef QMap <QString, QString> QSpiAttributeSet; |
| 108 | |
| 109 | enum QSpiAppUpdateType { |
| 110 | QSPI_APP_UPDATE_ADDED = 0, |
| 111 | QSPI_APP_UPDATE_REMOVED = 1 |
| 112 | }; |
| 113 | Q_DECLARE_TYPEINFO(QSpiAppUpdateType, Q_PRIMITIVE_TYPE); |
| 114 | |
| 115 | struct QSpiAppUpdate { |
| 116 | int type; /* Is an application added or removed */ |
| 117 | QString address; /* D-Bus address of application added or removed */ |
| 118 | }; |
| 119 | Q_DECLARE_TYPEINFO(QSpiAppUpdate, Q_RELOCATABLE_TYPE); |
| 120 | |
| 121 | QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update); |
| 122 | const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update); |
| 123 | |
| 124 | struct QSpiDeviceEvent { |
| 125 | unsigned int type; |
| 126 | int id; |
| 127 | int hardwareCode; |
| 128 | int modifiers; |
| 129 | int timestamp; |
| 130 | QString text; |
| 131 | bool isText; |
| 132 | }; |
| 133 | Q_DECLARE_TYPEINFO(QSpiDeviceEvent, Q_RELOCATABLE_TYPE); |
| 134 | |
| 135 | QDBusArgument &operator<<(QDBusArgument &argument, const QSpiDeviceEvent &event); |
| 136 | const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiDeviceEvent &event); |
| 137 | |
| 138 | void qSpiInitializeStructTypes(); |
| 139 | |
| 140 | QT_END_NAMESPACE |
| 141 | |
| 142 | QT_DECL_METATYPE_EXTERN(QSpiIntList, /* not exported */) |
| 143 | QT_DECL_METATYPE_EXTERN(QSpiUIntList, /* not exported */) |
| 144 | QT_DECL_METATYPE_EXTERN(QSpiObjectReference, /* not exported */) |
| 145 | QT_DECL_METATYPE_EXTERN(QSpiObjectReferenceArray, /* not exported */) |
| 146 | QT_DECL_METATYPE_EXTERN(QSpiAccessibleCacheItem, /* not exported */) |
| 147 | QT_DECL_METATYPE_EXTERN(QSpiAccessibleCacheArray, /* not exported */) |
| 148 | QT_DECL_METATYPE_EXTERN(QSpiAction, /* not exported */) |
| 149 | QT_DECL_METATYPE_EXTERN(QSpiActionArray, /* not exported */) |
| 150 | QT_DECL_METATYPE_EXTERN(QSpiEventListener, /* not exported */) |
| 151 | QT_DECL_METATYPE_EXTERN(QSpiEventListenerArray, /* not exported */) |
| 152 | QT_DECL_METATYPE_EXTERN(QSpiRelationArrayEntry, /* not exported */) |
| 153 | QT_DECL_METATYPE_EXTERN(QSpiRelationArray, /* not exported */) |
| 154 | QT_DECL_METATYPE_EXTERN(QSpiTextRange, /* not exported */) |
| 155 | QT_DECL_METATYPE_EXTERN(QSpiTextRangeList, /* not exported */) |
| 156 | QT_DECL_METATYPE_EXTERN(QSpiAttributeSet, /* not exported */) |
| 157 | QT_DECL_METATYPE_EXTERN(QSpiAppUpdate, /* not exported */) |
| 158 | QT_DECL_METATYPE_EXTERN(QSpiDeviceEvent, /* not exported */) |
| 159 | |
| 160 | // For qdbusxml2cpp-generated code |
| 161 | QT_USE_NAMESPACE |
| 162 | |
| 163 | #endif /* Q_SPI_STRUCT_MARSHALLERS_H */ |
| 164 | |