1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40
41#ifndef Q_SPI_STRUCT_MARSHALLERS_H
42#define Q_SPI_STRUCT_MARSHALLERS_H
43
44//
45// W A R N I N G
46// -------------
47//
48// This file is not part of the Qt API. It exists purely as an
49// implementation detail. This header file may change from version to
50// version without notice, or even be removed.
51//
52// We mean it.
53//
54
55#include <QtGui/private/qtguiglobal_p.h>
56#include <QtCore/qvector.h>
57#include <QtCore/qpair.h>
58#include <QtDBus/QDBusArgument>
59#include <QtDBus/QDBusConnection>
60#include <QtDBus/QDBusObjectPath>
61
62QT_REQUIRE_CONFIG(accessibility);
63
64QT_BEGIN_NAMESPACE
65
66typedef QVector<int> QSpiIntList;
67typedef QVector<uint> QSpiUIntList;
68
69// FIXME: make this copy on write
70struct QSpiObjectReference
71{
72 QString service;
73 QDBusObjectPath path;
74
75 QSpiObjectReference();
76 QSpiObjectReference(const QDBusConnection& connection, const QDBusObjectPath& path)
77 : service(connection.baseService()), path(path) {}
78};
79Q_DECLARE_TYPEINFO(QSpiObjectReference, Q_MOVABLE_TYPE); // QDBusObjectPath is movable, even though it
80 // cannot be marked that way until Qt 6
81
82QDBusArgument &operator<<(QDBusArgument &argument, const QSpiObjectReference &address);
83const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiObjectReference &address);
84
85typedef QVector<QSpiObjectReference> QSpiObjectReferenceArray;
86
87struct QSpiAccessibleCacheItem
88{
89 QSpiObjectReference path;
90 QSpiObjectReference application;
91 QSpiObjectReference parent;
92 QSpiObjectReferenceArray children;
93 QStringList supportedInterfaces;
94 QString name;
95 uint role;
96 QString description;
97 QSpiUIntList state;
98};
99Q_DECLARE_TYPEINFO(QSpiAccessibleCacheItem, Q_MOVABLE_TYPE);
100
101typedef QVector<QSpiAccessibleCacheItem> QSpiAccessibleCacheArray;
102
103QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAccessibleCacheItem &item);
104const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAccessibleCacheItem &item);
105
106struct QSpiAction
107{
108 QString name;
109 QString description;
110 QString keyBinding;
111};
112Q_DECLARE_TYPEINFO(QSpiAction, Q_MOVABLE_TYPE);
113
114typedef QVector<QSpiAction> QSpiActionArray;
115
116QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAction &action);
117const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAction &action);
118
119struct QSpiEventListener
120{
121 QString listenerAddress;
122 QString eventName;
123};
124Q_DECLARE_TYPEINFO(QSpiEventListener, Q_MOVABLE_TYPE);
125
126typedef QVector<QSpiEventListener> QSpiEventListenerArray;
127
128QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &action);
129const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &action);
130
131typedef QPair<unsigned int, QSpiObjectReferenceArray> QSpiRelationArrayEntry;
132typedef QVector<QSpiRelationArrayEntry> QSpiRelationArray;
133
134//a(iisv)
135struct QSpiTextRange {
136 int startOffset;
137 int endOffset;
138 QString contents;
139 QVariant v;
140};
141Q_DECLARE_TYPEINFO(QSpiTextRange, Q_MOVABLE_TYPE);
142
143typedef QVector<QSpiTextRange> QSpiTextRangeList;
144typedef QMap <QString, QString> QSpiAttributeSet;
145
146enum QSpiAppUpdateType {
147 QSPI_APP_UPDATE_ADDED = 0,
148 QSPI_APP_UPDATE_REMOVED = 1
149};
150Q_DECLARE_TYPEINFO(QSpiAppUpdateType, Q_PRIMITIVE_TYPE);
151
152struct QSpiAppUpdate {
153 int type; /* Is an application added or removed */
154 QString address; /* D-Bus address of application added or removed */
155};
156Q_DECLARE_TYPEINFO(QSpiAppUpdate, Q_MOVABLE_TYPE);
157
158QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update);
159const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update);
160
161struct QSpiDeviceEvent {
162 unsigned int type;
163 int id;
164 int hardwareCode;
165 int modifiers;
166 int timestamp;
167 QString text;
168 bool isText;
169};
170Q_DECLARE_TYPEINFO(QSpiDeviceEvent, Q_MOVABLE_TYPE);
171
172QDBusArgument &operator<<(QDBusArgument &argument, const QSpiDeviceEvent &event);
173const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiDeviceEvent &event);
174
175void qSpiInitializeStructTypes();
176
177QT_END_NAMESPACE
178
179Q_DECLARE_METATYPE(QSpiIntList)
180Q_DECLARE_METATYPE(QSpiUIntList)
181Q_DECLARE_METATYPE(QSpiObjectReference)
182Q_DECLARE_METATYPE(QSpiObjectReferenceArray)
183Q_DECLARE_METATYPE(QSpiAccessibleCacheItem)
184Q_DECLARE_METATYPE(QSpiAccessibleCacheArray)
185Q_DECLARE_METATYPE(QSpiAction)
186Q_DECLARE_METATYPE(QSpiActionArray)
187Q_DECLARE_METATYPE(QSpiEventListener)
188Q_DECLARE_METATYPE(QSpiEventListenerArray)
189Q_DECLARE_METATYPE(QSpiRelationArrayEntry)
190Q_DECLARE_METATYPE(QSpiRelationArray)
191Q_DECLARE_METATYPE(QSpiTextRange)
192Q_DECLARE_METATYPE(QSpiTextRangeList)
193Q_DECLARE_METATYPE(QSpiAttributeSet)
194Q_DECLARE_METATYPE(QSpiAppUpdate)
195Q_DECLARE_METATYPE(QSpiDeviceEvent)
196
197#endif /* Q_SPI_STRUCT_MARSHALLERS_H */
198

source code of qtbase/src/platformsupport/linuxaccessibility/struct_marshallers_p.h