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