Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/accessible/qaccessible.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | QAccessibleInterface::~QAccessibleInterface() | - | ||||||
6 | { | - | ||||||
7 | } | - | ||||||
8 | namespace { namespace Q_QGS_loader { typedef QFactoryLoader Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ("org.qt-project.Qt.QAccessibleFactoryInterface", QLatin1String("/accessible")))) : value ("org.qt-project.Qt.QAccessibleFactoryInterface", QLatin1String("/accessible")) { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QFactoryLoader, Q_QGS_loader::innerFunction, Q_QGS_loader::guard> loader; | - | ||||||
9 | - | |||||||
10 | typedef QHash<QString, QAccessiblePlugin*> QAccessiblePluginsHash; | - | ||||||
11 | namespace { namespace Q_QGS_qAccessiblePlugins { typedef QAccessiblePluginsHash Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QAccessiblePluginsHash, Q_QGS_qAccessiblePlugins::innerFunction, Q_QGS_qAccessiblePlugins::guard> qAccessiblePlugins; | - | ||||||
12 | - | |||||||
13 | - | |||||||
14 | namespace { namespace Q_QGS_qAccessibleFactories { typedef QList<QAccessible::InterfaceFactory> Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QList<QAccessible::InterfaceFactory>, Q_QGS_qAccessibleFactories::innerFunction, Q_QGS_qAccessibleFactories::guard> qAccessibleFactories; | - | ||||||
15 | namespace { namespace Q_QGS_qAccessibleActivationObservers { typedef QList<QAccessible::ActivationObserver *> Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QList<QAccessible::ActivationObserver *>, Q_QGS_qAccessibleActivationObservers::innerFunction, Q_QGS_qAccessibleActivationObservers::guard> qAccessibleActivationObservers; | - | ||||||
16 | - | |||||||
17 | QAccessible::UpdateHandler QAccessible::updateHandler = 0; | - | ||||||
18 | QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0; | - | ||||||
19 | - | |||||||
20 | static bool cleanupAdded = false; | - | ||||||
21 | - | |||||||
22 | static QPlatformAccessibility *platformAccessibility() | - | ||||||
23 | { | - | ||||||
24 | QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); | - | ||||||
25 | return pfIntegration ? pfIntegration->accessibility() : 0; | - | ||||||
26 | } | - | ||||||
27 | void QAccessible::cleanup() | - | ||||||
28 | { | - | ||||||
29 | if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) | - | ||||||
30 | pfAccessibility->cleanup(); | - | ||||||
31 | } | - | ||||||
32 | - | |||||||
33 | static void qAccessibleCleanup() | - | ||||||
34 | { | - | ||||||
35 | qAccessibleActivationObservers()->clear(); | - | ||||||
36 | qAccessibleFactories()->clear(); | - | ||||||
37 | } | - | ||||||
38 | void QAccessible::installFactory(InterfaceFactory factory) | - | ||||||
39 | { | - | ||||||
40 | if (!factory) | - | ||||||
41 | return; | - | ||||||
42 | - | |||||||
43 | if (!cleanupAdded) { | - | ||||||
44 | qAddPostRoutine(qAccessibleCleanup); | - | ||||||
45 | cleanupAdded = true; | - | ||||||
46 | } | - | ||||||
47 | if (qAccessibleFactories()->contains(factory)) | - | ||||||
48 | return; | - | ||||||
49 | qAccessibleFactories()->append(factory); | - | ||||||
50 | } | - | ||||||
51 | - | |||||||
52 | - | |||||||
53 | - | |||||||
54 | - | |||||||
55 | void QAccessible::removeFactory(InterfaceFactory factory) | - | ||||||
56 | { | - | ||||||
57 | qAccessibleFactories()->removeAll(factory); | - | ||||||
58 | } | - | ||||||
59 | QAccessible::UpdateHandler QAccessible::installUpdateHandler(UpdateHandler handler) | - | ||||||
60 | { | - | ||||||
61 | UpdateHandler old = updateHandler; | - | ||||||
62 | updateHandler = handler; | - | ||||||
63 | return old; | - | ||||||
64 | } | - | ||||||
65 | - | |||||||
66 | - | |||||||
67 | - | |||||||
68 | - | |||||||
69 | - | |||||||
70 | - | |||||||
71 | - | |||||||
72 | QAccessible::RootObjectHandler QAccessible::installRootObjectHandler(RootObjectHandler handler) | - | ||||||
73 | { | - | ||||||
74 | RootObjectHandler old = rootObjectHandler; | - | ||||||
75 | rootObjectHandler = handler; | - | ||||||
76 | return old; | - | ||||||
77 | } | - | ||||||
78 | QAccessible::ActivationObserver::~ActivationObserver() | - | ||||||
79 | { | - | ||||||
80 | - | |||||||
81 | } | - | ||||||
82 | - | |||||||
83 | - | |||||||
84 | - | |||||||
85 | - | |||||||
86 | - | |||||||
87 | - | |||||||
88 | void QAccessible::installActivationObserver(QAccessible::ActivationObserver *observer) | - | ||||||
89 | { | - | ||||||
90 | if (!observer) | - | ||||||
91 | return; | - | ||||||
92 | - | |||||||
93 | if (!cleanupAdded) { | - | ||||||
94 | qAddPostRoutine(qAccessibleCleanup); | - | ||||||
95 | cleanupAdded = true; | - | ||||||
96 | } | - | ||||||
97 | if (qAccessibleActivationObservers()->contains(observer)) | - | ||||||
98 | return; | - | ||||||
99 | qAccessibleActivationObservers()->append(observer); | - | ||||||
100 | } | - | ||||||
101 | - | |||||||
102 | - | |||||||
103 | - | |||||||
104 | - | |||||||
105 | - | |||||||
106 | - | |||||||
107 | - | |||||||
108 | void QAccessible::removeActivationObserver(ActivationObserver *observer) | - | ||||||
109 | { | - | ||||||
110 | qAccessibleActivationObservers()->removeAll(observer); | - | ||||||
111 | } | - | ||||||
112 | QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) | - | ||||||
113 | { | - | ||||||
114 | if (!object
| 0 | ||||||
115 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
116 | - | |||||||
117 | if (Id id = QAccessibleCache::instance()->objectToId.value(object)
| 0 | ||||||
118 | return never executed: QAccessibleCache::instance()->interfaceForId(id);return QAccessibleCache::instance()->interfaceForId(id); never executed: return QAccessibleCache::instance()->interfaceForId(id); | 0 | ||||||
119 | - | |||||||
120 | - | |||||||
121 | - | |||||||
122 | const QMetaObject *mo = object->metaObject(); | - | ||||||
123 | while (mo
| 0 | ||||||
124 | const QString cn = QLatin1String(mo->className()); | - | ||||||
125 | - | |||||||
126 | - | |||||||
127 | for (int i = qAccessibleFactories()->count(); i > 0
| 0 | ||||||
128 | InterfaceFactory factory = qAccessibleFactories()->at(i - 1); | - | ||||||
129 | if (QAccessibleInterface *iface = factory(cn, object)
| 0 | ||||||
130 | QAccessibleCache::instance()->insert(object, iface); | - | ||||||
131 | ((!(QAccessibleCache::instance()->objectToId.contains(object))) ? qt_assert("QAccessibleCache::instance()->objectToId.contains(object)",__FILE__,683688) : qt_noop()); | - | ||||||
132 | return never executed: iface;return iface; never executed: return iface; | 0 | ||||||
133 | } | - | ||||||
134 | } never executed: end of block | 0 | ||||||
135 | - | |||||||
136 | - | |||||||
137 | if (!qAccessiblePlugins()->contains(cn)
| 0 | ||||||
138 | QAccessiblePlugin *factory = 0; | - | ||||||
139 | const int index = loader()->indexOf(cn); | - | ||||||
140 | if (index != -1
| 0 | ||||||
141 | factory = qobject_cast<QAccessiblePlugin *>(loader()->instance(index)); never executed: factory = qobject_cast<QAccessiblePlugin *>(loader()->instance(index)); | 0 | ||||||
142 | qAccessiblePlugins()->insert(cn, factory); | - | ||||||
143 | } never executed: end of block | 0 | ||||||
144 | - | |||||||
145 | - | |||||||
146 | ((!(qAccessiblePlugins()->contains(cn))) ? qt_assert("qAccessiblePlugins()->contains(cn)",__FILE__,699703) : qt_noop()); | - | ||||||
147 | QAccessiblePlugin *factory = qAccessiblePlugins()->value(cn); | - | ||||||
148 | if (factory
| 0 | ||||||
149 | QAccessibleInterface *result = factory->create(cn, object); | - | ||||||
150 | if (result
| 0 | ||||||
151 | QAccessibleCache::instance()->insert(object, result); | - | ||||||
152 | ((!(QAccessibleCache::instance()->objectToId.contains(object))) ? qt_assert("QAccessibleCache::instance()->objectToId.contains(object)",__FILE__,705709) : qt_noop()); | - | ||||||
153 | } never executed: end of block | 0 | ||||||
154 | return never executed: result;return result; never executed: return result; | 0 | ||||||
155 | } | - | ||||||
156 | mo = mo->superClass(); | - | ||||||
157 | } never executed: end of block | 0 | ||||||
158 | - | |||||||
159 | if (object == (static_cast<QGuiApplication *>(QCoreApplication::instance()))
| 0 | ||||||
160 | QAccessibleInterface *appInterface = new QAccessibleApplication; | - | ||||||
161 | QAccessibleCache::instance()->insert(object, appInterface); | - | ||||||
162 | ((!(QAccessibleCache::instance()->objectToId.contains((static_cast<QGuiApplication *>(QCoreApplication::instance()))))) ? qt_assert("QAccessibleCache::instance()->objectToId.contains(qApp)",__FILE__,716719) : qt_noop()); | - | ||||||
163 | return never executed: appInterface;return appInterface; never executed: return appInterface; | 0 | ||||||
164 | } | - | ||||||
165 | - | |||||||
166 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
167 | } | - | ||||||
168 | QAccessible::Id QAccessible::registerAccessibleInterface(QAccessibleInterface *iface) | - | ||||||
169 | { | - | ||||||
170 | ((!(iface)) ? qt_assert("iface",__FILE__,739742) : qt_noop()); | - | ||||||
171 | return QAccessibleCache::instance()->insert(iface->object(), iface); | - | ||||||
172 | } | - | ||||||
173 | - | |||||||
174 | - | |||||||
175 | - | |||||||
176 | - | |||||||
177 | - | |||||||
178 | - | |||||||
179 | void QAccessible::deleteAccessibleInterface(Id id) | - | ||||||
180 | { | - | ||||||
181 | QAccessibleCache::instance()->deleteInterface(id); | - | ||||||
182 | } | - | ||||||
183 | - | |||||||
184 | - | |||||||
185 | - | |||||||
186 | - | |||||||
187 | QAccessible::Id QAccessible::uniqueId(QAccessibleInterface *iface) | - | ||||||
188 | { | - | ||||||
189 | Id id = QAccessibleCache::instance()->idForInterface(iface); | - | ||||||
190 | if (!id) | - | ||||||
191 | id = registerAccessibleInterface(iface); | - | ||||||
192 | return id; | - | ||||||
193 | } | - | ||||||
194 | - | |||||||
195 | - | |||||||
196 | - | |||||||
197 | - | |||||||
198 | - | |||||||
199 | - | |||||||
200 | QAccessibleInterface *QAccessible::accessibleInterface(Id id) | - | ||||||
201 | { | - | ||||||
202 | return QAccessibleCache::instance()->interfaceForId(id); | - | ||||||
203 | } | - | ||||||
204 | bool QAccessible::isActive() | - | ||||||
205 | { | - | ||||||
206 | if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) | - | ||||||
207 | return pfAccessibility->isActive(); | - | ||||||
208 | return false; | - | ||||||
209 | } | - | ||||||
210 | - | |||||||
211 | - | |||||||
212 | - | |||||||
213 | - | |||||||
214 | void QAccessible::setActive(bool active) | - | ||||||
215 | { | - | ||||||
216 | for (int i = 0; i < qAccessibleActivationObservers()->count() ;++i) | - | ||||||
217 | qAccessibleActivationObservers()->at(i)->accessibilityActiveChanged(active); | - | ||||||
218 | } | - | ||||||
219 | void QAccessible::setRootObject(QObject *object) | - | ||||||
220 | { | - | ||||||
221 | if (rootObjectHandler) { | - | ||||||
222 | rootObjectHandler(object); | - | ||||||
223 | return; | - | ||||||
224 | } | - | ||||||
225 | - | |||||||
226 | if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) | - | ||||||
227 | pfAccessibility->setRootObject(object); | - | ||||||
228 | } | - | ||||||
229 | void QAccessible::updateAccessibility(QAccessibleEvent *event) | - | ||||||
230 | { | - | ||||||
231 | - | |||||||
232 | - | |||||||
233 | - | |||||||
234 | - | |||||||
235 | - | |||||||
236 | - | |||||||
237 | QAccessibleInterface *iface = event->accessibleInterface(); | - | ||||||
238 | if (isActive() && iface) { | - | ||||||
239 | if (event->type() == QAccessible::TableModelChanged) { | - | ||||||
240 | if (iface->tableInterface()) | - | ||||||
241 | iface->tableInterface()->modelChange(static_cast<QAccessibleTableModelChangeEvent*>(event)); | - | ||||||
242 | } | - | ||||||
243 | - | |||||||
244 | if (updateHandler) { | - | ||||||
245 | updateHandler(event); | - | ||||||
246 | return; | - | ||||||
247 | } | - | ||||||
248 | } | - | ||||||
249 | - | |||||||
250 | if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) | - | ||||||
251 | pfAccessibility->notifyAccessibilityUpdate(event); | - | ||||||
252 | } | - | ||||||
253 | QPair< int, int > QAccessible::qAccessibleTextBoundaryHelper(const QTextCursor &offsetCursor, TextBoundaryType boundaryType) | - | ||||||
254 | { | - | ||||||
255 | ((!(!offsetCursor.isNull())) ? qt_assert("!offsetCursor.isNull()",__FILE__,890893) : qt_noop()); | - | ||||||
256 | - | |||||||
257 | QTextCursor endCursor = offsetCursor; | - | ||||||
258 | endCursor.movePosition(QTextCursor::End); | - | ||||||
259 | int characterCount = endCursor.position(); | - | ||||||
260 | - | |||||||
261 | QPair<int, int> result; | - | ||||||
262 | QTextCursor cursor = offsetCursor; | - | ||||||
263 | switch (boundaryType) { | - | ||||||
264 | case CharBoundary: | - | ||||||
265 | result.first = cursor.position(); | - | ||||||
266 | cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); | - | ||||||
267 | result.second = cursor.position(); | - | ||||||
268 | break; | - | ||||||
269 | case WordBoundary: | - | ||||||
270 | cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::MoveAnchor); | - | ||||||
271 | result.first = cursor.position(); | - | ||||||
272 | cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); | - | ||||||
273 | result.second = cursor.position(); | - | ||||||
274 | break; | - | ||||||
275 | case SentenceBoundary: { | - | ||||||
276 | - | |||||||
277 | - | |||||||
278 | - | |||||||
279 | cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor); | - | ||||||
280 | result.first = cursor.position(); | - | ||||||
281 | cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); | - | ||||||
282 | result.second = cursor.position(); | - | ||||||
283 | QString blockText = cursor.selectedText(); | - | ||||||
284 | const int offsetWithinBlockText = offsetCursor.position() - result.first; | - | ||||||
285 | QTextBoundaryFinder sentenceFinder(QTextBoundaryFinder::Sentence, blockText); | - | ||||||
286 | sentenceFinder.setPosition(offsetWithinBlockText); | - | ||||||
287 | int prevBoundary = offsetWithinBlockText; | - | ||||||
288 | int nextBoundary = offsetWithinBlockText; | - | ||||||
289 | if (!(sentenceFinder.boundaryReasons() & QTextBoundaryFinder::StartOfItem)) | - | ||||||
290 | prevBoundary = sentenceFinder.toPreviousBoundary(); | - | ||||||
291 | nextBoundary = sentenceFinder.toNextBoundary(); | - | ||||||
292 | if (nextBoundary != -1) | - | ||||||
293 | result.second = result.first + nextBoundary; | - | ||||||
294 | if (prevBoundary != -1) | - | ||||||
295 | result.first += prevBoundary; | - | ||||||
296 | break; } | - | ||||||
297 | case LineBoundary: | - | ||||||
298 | cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor); | - | ||||||
299 | result.first = cursor.position(); | - | ||||||
300 | cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); | - | ||||||
301 | result.second = cursor.position(); | - | ||||||
302 | break; | - | ||||||
303 | case ParagraphBoundary: | - | ||||||
304 | cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor); | - | ||||||
305 | result.first = cursor.position(); | - | ||||||
306 | cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); | - | ||||||
307 | result.second = cursor.position(); | - | ||||||
308 | break; | - | ||||||
309 | case NoBoundary: | - | ||||||
310 | result.first = 0; | - | ||||||
311 | result.second = characterCount; | - | ||||||
312 | break; | - | ||||||
313 | } | - | ||||||
314 | return result; | - | ||||||
315 | } | - | ||||||
316 | QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > | - | ||||||
317 | QAccessibleInterface::relations(QAccessible::Relation ) const | - | ||||||
318 | { | - | ||||||
319 | return QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >(); | - | ||||||
320 | } | - | ||||||
321 | - | |||||||
322 | - | |||||||
323 | - | |||||||
324 | - | |||||||
325 | - | |||||||
326 | - | |||||||
327 | QAccessibleInterface *QAccessibleInterface::focusChild() const | - | ||||||
328 | { | - | ||||||
329 | return 0; | - | ||||||
330 | } | - | ||||||
331 | QColor QAccessibleInterface::foregroundColor() const | - | ||||||
332 | { | - | ||||||
333 | return QColor(); | - | ||||||
334 | } | - | ||||||
335 | - | |||||||
336 | - | |||||||
337 | - | |||||||
338 | - | |||||||
339 | - | |||||||
340 | - | |||||||
341 | QColor QAccessibleInterface::backgroundColor() const | - | ||||||
342 | { | - | ||||||
343 | return QColor(); | - | ||||||
344 | } | - | ||||||
345 | QAccessibleEvent::~QAccessibleEvent() | - | ||||||
346 | { | - | ||||||
347 | - | |||||||
348 | } | - | ||||||
349 | QAccessible::Id QAccessibleEvent::uniqueId() const | - | ||||||
350 | { | - | ||||||
351 | if (!m_object) | - | ||||||
352 | return m_uniqueId; | - | ||||||
353 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object); | - | ||||||
354 | if (!iface) | - | ||||||
355 | return 0; | - | ||||||
356 | if (m_child != -1) | - | ||||||
357 | iface = iface->child(m_child); | - | ||||||
358 | return QAccessible::uniqueId(iface); | - | ||||||
359 | } | - | ||||||
360 | QAccessibleValueChangeEvent::~QAccessibleValueChangeEvent() | - | ||||||
361 | { | - | ||||||
362 | - | |||||||
363 | } | - | ||||||
364 | QAccessibleStateChangeEvent::~QAccessibleStateChangeEvent() | - | ||||||
365 | { | - | ||||||
366 | - | |||||||
367 | } | - | ||||||
368 | QAccessibleTableModelChangeEvent::~QAccessibleTableModelChangeEvent() | - | ||||||
369 | { | - | ||||||
370 | - | |||||||
371 | } | - | ||||||
372 | QAccessibleTextCursorEvent::~QAccessibleTextCursorEvent() | - | ||||||
373 | { | - | ||||||
374 | - | |||||||
375 | } | - | ||||||
376 | QAccessibleTextInsertEvent::~QAccessibleTextInsertEvent() | - | ||||||
377 | { | - | ||||||
378 | - | |||||||
379 | } | - | ||||||
380 | QAccessibleTextRemoveEvent::~QAccessibleTextRemoveEvent() | - | ||||||
381 | { | - | ||||||
382 | - | |||||||
383 | } | - | ||||||
384 | QAccessibleTextUpdateEvent::~QAccessibleTextUpdateEvent() | - | ||||||
385 | { | - | ||||||
386 | - | |||||||
387 | } | - | ||||||
388 | QAccessibleTextSelectionEvent::~QAccessibleTextSelectionEvent() | - | ||||||
389 | { | - | ||||||
390 | - | |||||||
391 | } | - | ||||||
392 | - | |||||||
393 | - | |||||||
394 | - | |||||||
395 | - | |||||||
396 | - | |||||||
397 | - | |||||||
398 | - | |||||||
399 | QAccessibleInterface *QAccessibleEvent::accessibleInterface() const | - | ||||||
400 | { | - | ||||||
401 | if (m_object == 0) | - | ||||||
402 | return QAccessible::accessibleInterface(m_uniqueId); | - | ||||||
403 | - | |||||||
404 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object); | - | ||||||
405 | if (!iface || !iface->isValid()) | - | ||||||
406 | return 0; | - | ||||||
407 | - | |||||||
408 | if (m_child >= 0) { | - | ||||||
409 | QAccessibleInterface *child = iface->child(m_child); | - | ||||||
410 | if (child) { | - | ||||||
411 | iface = child; | - | ||||||
412 | } else { | - | ||||||
413 | QMessageLogger(__FILE__, 17691772, __PRETTY_FUNCTION__).warning() << "Cannot creat accessible child interface for object: " << m_object << " index: " << m_child; | - | ||||||
414 | } | - | ||||||
415 | } | - | ||||||
416 | return iface; | - | ||||||
417 | } | - | ||||||
418 | QWindow *QAccessibleInterface::window() const | - | ||||||
419 | { | - | ||||||
420 | return 0; | - | ||||||
421 | } | - | ||||||
422 | void QAccessibleInterface::virtual_hook(int , void * ) | - | ||||||
423 | { | - | ||||||
424 | } | - | ||||||
425 | const char *qAccessibleRoleString(QAccessible::Role role) | - | ||||||
426 | { | - | ||||||
427 | if (role >= QAccessible::UserRole) | - | ||||||
428 | role = QAccessible::UserRole; | - | ||||||
429 | static int roleEnum = QAccessible::staticMetaObject.indexOfEnumerator("Role"); | - | ||||||
430 | return QAccessible::staticMetaObject.enumerator(roleEnum).valueToKey(role); | - | ||||||
431 | } | - | ||||||
432 | - | |||||||
433 | - | |||||||
434 | const char *qAccessibleEventString(QAccessible::Event event) | - | ||||||
435 | { | - | ||||||
436 | static int eventEnum = QAccessible::staticMetaObject.indexOfEnumerator("Event"); | - | ||||||
437 | return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event); | - | ||||||
438 | } | - | ||||||
439 | - | |||||||
440 | - | |||||||
441 | bool operator==(const QAccessible::State &first, const QAccessible::State &second) | - | ||||||
442 | { | - | ||||||
443 | return memcmp(&first, &second, sizeof(QAccessible::State)) == 0; | - | ||||||
444 | } | - | ||||||
445 | - | |||||||
446 | - | |||||||
447 | - | |||||||
448 | __attribute__((visibility("default"))) QDebug operator<<(QDebug d, const QAccessibleInterface *iface) | - | ||||||
449 | { | - | ||||||
450 | QDebugStateSaver saver(d); | - | ||||||
451 | if (!iface) { | - | ||||||
452 | d << "QAccessibleInterface(null)"; | - | ||||||
453 | return d; | - | ||||||
454 | } | - | ||||||
455 | d.nospace(); | - | ||||||
456 | d << "QAccessibleInterface(" << hex << (const void *) iface << dec; | - | ||||||
457 | if (iface->isValid()) { | - | ||||||
458 | d << " name=" << iface->text(QAccessible::Name) << ' '; | - | ||||||
459 | d << "role=" << qAccessibleRoleString(iface->role()) << ' '; | - | ||||||
460 | if (iface->childCount()) | - | ||||||
461 | d << "childc=" << iface->childCount() << ' '; | - | ||||||
462 | if (iface->object()) { | - | ||||||
463 | d << "obj=" << iface->object(); | - | ||||||
464 | } | - | ||||||
465 | QStringList stateStrings; | - | ||||||
466 | QAccessible::State st = iface->state(); | - | ||||||
467 | if (st.focusable) | - | ||||||
468 | stateStrings << QLatin1String("focusable"); | - | ||||||
469 | if (st.focused) | - | ||||||
470 | stateStrings << QLatin1String("focused"); | - | ||||||
471 | if (st.selected) | - | ||||||
472 | stateStrings << QLatin1String("selected"); | - | ||||||
473 | if (st.invisible) | - | ||||||
474 | stateStrings << QLatin1String("invisible"); | - | ||||||
475 | - | |||||||
476 | if (!stateStrings.isEmpty()) | - | ||||||
477 | d << stateStrings.join(QLatin1Char('|')); | - | ||||||
478 | - | |||||||
479 | if (!st.invisible) | - | ||||||
480 | d << "rect=" << iface->rect(); | - | ||||||
481 | - | |||||||
482 | } else { | - | ||||||
483 | d << " invalid"; | - | ||||||
484 | } | - | ||||||
485 | d << ')'; | - | ||||||
486 | return d; | - | ||||||
487 | } | - | ||||||
488 | - | |||||||
489 | - | |||||||
490 | QDebug operator<<(QDebug d, const QAccessibleEvent &ev) | - | ||||||
491 | { | - | ||||||
492 | QDebugStateSaver saver(d); | - | ||||||
493 | d.nospace() << "QAccessibleEvent("; | - | ||||||
494 | if (ev.object()) { | - | ||||||
495 | d.nospace() << "object=" << hex << ev.object() << dec; | - | ||||||
496 | d.nospace() << "child=" << ev.child(); | - | ||||||
497 | } else { | - | ||||||
498 | d.nospace() << "no object, uniqueId=" << ev.uniqueId(); | - | ||||||
499 | } | - | ||||||
500 | d << " event=" << qAccessibleEventString(ev.type()); | - | ||||||
501 | if (ev.type() == QAccessible::StateChanged) { | - | ||||||
502 | QAccessible::State changed = static_cast<const QAccessibleStateChangeEvent*>(&ev)->changedStates(); | - | ||||||
503 | d << "State changed:"; | - | ||||||
504 | if (changed.disabled) d << "disabled"; | - | ||||||
505 | if (changed.selected) d << "selected"; | - | ||||||
506 | if (changed.focusable) d << "focusable"; | - | ||||||
507 | if (changed.focused) d << "focused"; | - | ||||||
508 | if (changed.pressed) d << "pressed"; | - | ||||||
509 | if (changed.checkable) d << "checkable"; | - | ||||||
510 | if (changed.checked) d << "checked"; | - | ||||||
511 | if (changed.checkStateMixed) d << "checkStateMixed"; | - | ||||||
512 | if (changed.readOnly) d << "readOnly"; | - | ||||||
513 | if (changed.hotTracked) d << "hotTracked"; | - | ||||||
514 | if (changed.defaultButton) d << "defaultButton"; | - | ||||||
515 | if (changed.expanded) d << "expanded"; | - | ||||||
516 | if (changed.collapsed) d << "collapsed"; | - | ||||||
517 | if (changed.busy) d << "busy"; | - | ||||||
518 | if (changed.expandable) d << "expandable"; | - | ||||||
519 | if (changed.marqueed) d << "marqueed"; | - | ||||||
520 | if (changed.animated) d << "animated"; | - | ||||||
521 | if (changed.invisible) d << "invisible"; | - | ||||||
522 | if (changed.offscreen) d << "offscreen"; | - | ||||||
523 | if (changed.sizeable) d << "sizeable"; | - | ||||||
524 | if (changed.movable) d << "movable"; | - | ||||||
525 | if (changed.selfVoicing) d << "selfVoicing"; | - | ||||||
526 | if (changed.selectable) d << "selectable"; | - | ||||||
527 | if (changed.linked) d << "linked"; | - | ||||||
528 | if (changed.traversed) d << "traversed"; | - | ||||||
529 | if (changed.multiSelectable) d << "multiSelectable"; | - | ||||||
530 | if (changed.extSelectable) d << "extSelectable"; | - | ||||||
531 | if (changed.passwordEdit) d << "passwordEdit"; | - | ||||||
532 | if (changed.hasPopup) d << "hasPopup"; | - | ||||||
533 | if (changed.modal) d << "modal"; | - | ||||||
534 | - | |||||||
535 | - | |||||||
536 | - | |||||||
537 | if (changed.active) d << "active"; | - | ||||||
538 | if (changed.invalid) d << "invalid"; | - | ||||||
539 | if (changed.editable) d << "editable"; | - | ||||||
540 | if (changed.multiLine) d << "multiLine"; | - | ||||||
541 | if (changed.selectableText) d << "selectableText"; | - | ||||||
542 | if (changed.supportsAutoCompletion) d << "supportsAutoCompletion"; | - | ||||||
543 | - | |||||||
544 | } | - | ||||||
545 | d << ')'; | - | ||||||
546 | return d; | - | ||||||
547 | } | - | ||||||
548 | QAccessibleTextInterface::~QAccessibleTextInterface() | - | ||||||
549 | { | - | ||||||
550 | - | |||||||
551 | } | - | ||||||
552 | static QString textLineBoundary(int beforeAtAfter, const QString &text, int offset, int *startOffset, int *endOffset) | - | ||||||
553 | { | - | ||||||
554 | ((!(beforeAtAfter >= -1 && beforeAtAfter <= 1)) ? qt_assert("beforeAtAfter >= -1 && beforeAtAfter <= 1",__FILE__,20562059) : qt_noop()); | - | ||||||
555 | ((!(*startOffset == -1 && *endOffset == -1)) ? qt_assert("*startOffset == -1 && *endOffset == -1",__FILE__,20572060) : qt_noop()); | - | ||||||
556 | int length = text.length(); | - | ||||||
557 | ((!(offset >= 0 && offset <= length)) ? qt_assert("offset >= 0 && offset <= length",__FILE__,20592062) : qt_noop()); | - | ||||||
558 | - | |||||||
559 | - | |||||||
560 | if (beforeAtAfter == 1) { | - | ||||||
561 | offset = text.indexOf(QChar::LineFeed, qMin(offset, length - 1)); | - | ||||||
562 | if (offset < 0) | - | ||||||
563 | return QString(); | - | ||||||
564 | ++offset; | - | ||||||
565 | } else if (beforeAtAfter == -1) { | - | ||||||
566 | offset = text.lastIndexOf(QChar::LineFeed, qMax(offset - 1, 0)); | - | ||||||
567 | if (offset < 0) | - | ||||||
568 | return QString(); | - | ||||||
569 | } | - | ||||||
570 | - | |||||||
571 | if (offset > 0) | - | ||||||
572 | *startOffset = text.lastIndexOf(QChar::LineFeed, offset - 1); | - | ||||||
573 | ++*startOffset; | - | ||||||
574 | - | |||||||
575 | *endOffset = text.indexOf(QChar::LineFeed, qMin(offset, length - 1)) + 1; | - | ||||||
576 | if (*endOffset <= 0 || *endOffset > length) | - | ||||||
577 | *endOffset = length; | - | ||||||
578 | - | |||||||
579 | return text.mid(*startOffset, *endOffset - *startOffset); | - | ||||||
580 | } | - | ||||||
581 | QString QAccessibleTextInterface::textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, | - | ||||||
582 | int *startOffset, int *endOffset) const | - | ||||||
583 | { | - | ||||||
584 | const QString txt = text(0, characterCount()); | - | ||||||
585 | - | |||||||
586 | if (offset == -1) | - | ||||||
587 | offset = txt.length(); | - | ||||||
588 | - | |||||||
589 | *startOffset = *endOffset = -1; | - | ||||||
590 | if (txt.isEmpty() || offset <= 0 || offset > txt.length()) | - | ||||||
591 | return QString(); | - | ||||||
592 | - | |||||||
593 | - | |||||||
594 | QTextBoundaryFinder::BoundaryType type = QTextBoundaryFinder::Grapheme; | - | ||||||
595 | switch (boundaryType) { | - | ||||||
596 | case QAccessible::CharBoundary: | - | ||||||
597 | type = QTextBoundaryFinder::Grapheme; | - | ||||||
598 | break; | - | ||||||
599 | case QAccessible::WordBoundary: | - | ||||||
600 | type = QTextBoundaryFinder::Word; | - | ||||||
601 | break; | - | ||||||
602 | case QAccessible::SentenceBoundary: | - | ||||||
603 | type = QTextBoundaryFinder::Sentence; | - | ||||||
604 | break; | - | ||||||
605 | case QAccessible::LineBoundary: | - | ||||||
606 | case QAccessible::ParagraphBoundary: | - | ||||||
607 | - | |||||||
608 | return textLineBoundary(-1, txt, offset, startOffset, endOffset); | - | ||||||
609 | case QAccessible::NoBoundary: | - | ||||||
610 | - | |||||||
611 | return QString(); | - | ||||||
612 | default: | - | ||||||
613 | do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,21332136) : qt_noop()); __builtin_unreachable(); } while (0); | - | ||||||
614 | } | - | ||||||
615 | - | |||||||
616 | - | |||||||
617 | - | |||||||
618 | QTextBoundaryFinder boundary(type, txt); | - | ||||||
619 | boundary.setPosition(offset); | - | ||||||
620 | - | |||||||
621 | do { | - | ||||||
622 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) | - | ||||||
623 | break; | - | ||||||
624 | } while (boundary.toPreviousBoundary() > 0); | - | ||||||
625 | ((!(boundary.position() >= 0)) ? qt_assert("boundary.position() >= 0",__FILE__,21452148) : qt_noop()); | - | ||||||
626 | *endOffset = boundary.position(); | - | ||||||
627 | - | |||||||
628 | while (boundary.toPreviousBoundary() > 0) { | - | ||||||
629 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) | - | ||||||
630 | break; | - | ||||||
631 | } | - | ||||||
632 | ((!(boundary.position() >= 0)) ? qt_assert("boundary.position() >= 0",__FILE__,21522155) : qt_noop()); | - | ||||||
633 | *startOffset = boundary.position(); | - | ||||||
634 | - | |||||||
635 | return txt.mid(*startOffset, *endOffset - *startOffset); | - | ||||||
636 | } | - | ||||||
637 | QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, | - | ||||||
638 | int *startOffset, int *endOffset) const | - | ||||||
639 | { | - | ||||||
640 | const QString txt = text(0, characterCount()); | - | ||||||
641 | - | |||||||
642 | if (offset == -1) | - | ||||||
643 | offset = txt.length(); | - | ||||||
644 | - | |||||||
645 | *startOffset = *endOffset = -1; | - | ||||||
646 | if (txt.isEmpty() || offset < 0 || offset >= txt.length()) | - | ||||||
647 | return QString(); | - | ||||||
648 | - | |||||||
649 | - | |||||||
650 | QTextBoundaryFinder::BoundaryType type = QTextBoundaryFinder::Grapheme; | - | ||||||
651 | switch (boundaryType) { | - | ||||||
652 | case QAccessible::CharBoundary: | - | ||||||
653 | type = QTextBoundaryFinder::Grapheme; | - | ||||||
654 | break; | - | ||||||
655 | case QAccessible::WordBoundary: | - | ||||||
656 | type = QTextBoundaryFinder::Word; | - | ||||||
657 | break; | - | ||||||
658 | case QAccessible::SentenceBoundary: | - | ||||||
659 | type = QTextBoundaryFinder::Sentence; | - | ||||||
660 | break; | - | ||||||
661 | case QAccessible::LineBoundary: | - | ||||||
662 | case QAccessible::ParagraphBoundary: | - | ||||||
663 | - | |||||||
664 | return textLineBoundary(1, txt, offset, startOffset, endOffset); | - | ||||||
665 | case QAccessible::NoBoundary: | - | ||||||
666 | - | |||||||
667 | return QString(); | - | ||||||
668 | default: | - | ||||||
669 | do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,22072210) : qt_noop()); __builtin_unreachable(); } while (0); | - | ||||||
670 | } | - | ||||||
671 | - | |||||||
672 | - | |||||||
673 | - | |||||||
674 | QTextBoundaryFinder boundary(type, txt); | - | ||||||
675 | boundary.setPosition(offset); | - | ||||||
676 | - | |||||||
677 | while (true) { | - | ||||||
678 | int toNext = boundary.toNextBoundary(); | - | ||||||
679 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) | - | ||||||
680 | break; | - | ||||||
681 | if (toNext < 0 || toNext >= txt.length()) | - | ||||||
682 | break; | - | ||||||
683 | } | - | ||||||
684 | ((!(boundary.position() <= txt.length())) ? qt_assert("boundary.position() <= txt.length()",__FILE__,22222225) : qt_noop()); | - | ||||||
685 | *startOffset = boundary.position(); | - | ||||||
686 | - | |||||||
687 | while (true) { | - | ||||||
688 | int toNext = boundary.toNextBoundary(); | - | ||||||
689 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) | - | ||||||
690 | break; | - | ||||||
691 | if (toNext < 0 || toNext >= txt.length()) | - | ||||||
692 | break; | - | ||||||
693 | } | - | ||||||
694 | ((!(boundary.position() <= txt.length())) ? qt_assert("boundary.position() <= txt.length()",__FILE__,22322235) : qt_noop()); | - | ||||||
695 | *endOffset = boundary.position(); | - | ||||||
696 | - | |||||||
697 | if ((*startOffset == -1) || (*endOffset == -1) || (*startOffset == *endOffset)) { | - | ||||||
698 | *endOffset = -1; | - | ||||||
699 | *startOffset = -1; | - | ||||||
700 | } | - | ||||||
701 | - | |||||||
702 | return txt.mid(*startOffset, *endOffset - *startOffset); | - | ||||||
703 | } | - | ||||||
704 | QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, | - | ||||||
705 | int *startOffset, int *endOffset) const | - | ||||||
706 | { | - | ||||||
707 | const QString txt = text(0, characterCount()); | - | ||||||
708 | - | |||||||
709 | if (offset == -1) | - | ||||||
710 | offset = txt.length(); | - | ||||||
711 | - | |||||||
712 | *startOffset = *endOffset = -1; | - | ||||||
713 | if (txt.isEmpty() || offset < 0 || offset > txt.length()) | - | ||||||
714 | return QString(); | - | ||||||
715 | - | |||||||
716 | if (offset == txt.length() && boundaryType == QAccessible::CharBoundary) | - | ||||||
717 | return QString(); | - | ||||||
718 | - | |||||||
719 | - | |||||||
720 | QTextBoundaryFinder::BoundaryType type = QTextBoundaryFinder::Grapheme; | - | ||||||
721 | switch (boundaryType) { | - | ||||||
722 | case QAccessible::CharBoundary: | - | ||||||
723 | type = QTextBoundaryFinder::Grapheme; | - | ||||||
724 | break; | - | ||||||
725 | case QAccessible::WordBoundary: | - | ||||||
726 | type = QTextBoundaryFinder::Word; | - | ||||||
727 | break; | - | ||||||
728 | case QAccessible::SentenceBoundary: | - | ||||||
729 | type = QTextBoundaryFinder::Sentence; | - | ||||||
730 | break; | - | ||||||
731 | case QAccessible::LineBoundary: | - | ||||||
732 | case QAccessible::ParagraphBoundary: | - | ||||||
733 | - | |||||||
734 | return textLineBoundary(0, txt, offset, startOffset, endOffset); | - | ||||||
735 | case QAccessible::NoBoundary: | - | ||||||
736 | *startOffset = 0; | - | ||||||
737 | *endOffset = txt.length(); | - | ||||||
738 | return txt; | - | ||||||
739 | default: | - | ||||||
740 | do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,22962299) : qt_noop()); __builtin_unreachable(); } while (0); | - | ||||||
741 | } | - | ||||||
742 | - | |||||||
743 | - | |||||||
744 | - | |||||||
745 | QTextBoundaryFinder boundary(type, txt); | - | ||||||
746 | boundary.setPosition(offset); | - | ||||||
747 | - | |||||||
748 | do { | - | ||||||
749 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) | - | ||||||
750 | break; | - | ||||||
751 | } while (boundary.toPreviousBoundary() > 0); | - | ||||||
752 | ((!(boundary.position() >= 0)) ? qt_assert("boundary.position() >= 0",__FILE__,23082311) : qt_noop()); | - | ||||||
753 | *startOffset = boundary.position(); | - | ||||||
754 | - | |||||||
755 | while (boundary.toNextBoundary() < txt.length()) { | - | ||||||
756 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) | - | ||||||
757 | break; | - | ||||||
758 | } | - | ||||||
759 | ((!(boundary.position() <= txt.length())) ? qt_assert("boundary.position() <= txt.length()",__FILE__,23152318) : qt_noop()); | - | ||||||
760 | *endOffset = boundary.position(); | - | ||||||
761 | - | |||||||
762 | return txt.mid(*startOffset, *endOffset - *startOffset); | - | ||||||
763 | } | - | ||||||
764 | QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface() | - | ||||||
765 | { | - | ||||||
766 | - | |||||||
767 | } | - | ||||||
768 | QAccessibleValueInterface::~QAccessibleValueInterface() | - | ||||||
769 | { | - | ||||||
770 | - | |||||||
771 | } | - | ||||||
772 | QAccessibleImageInterface::~QAccessibleImageInterface() | - | ||||||
773 | { | - | ||||||
774 | - | |||||||
775 | } | - | ||||||
776 | QAccessibleTableCellInterface::~QAccessibleTableCellInterface() | - | ||||||
777 | { | - | ||||||
778 | - | |||||||
779 | } | - | ||||||
780 | QAccessibleTableInterface::~QAccessibleTableInterface() | - | ||||||
781 | { | - | ||||||
782 | - | |||||||
783 | } | - | ||||||
784 | QAccessibleActionInterface::~QAccessibleActionInterface() | - | ||||||
785 | { | - | ||||||
786 | - | |||||||
787 | } | - | ||||||
788 | struct QAccessibleActionStrings | - | ||||||
789 | { | - | ||||||
790 | QAccessibleActionStrings() : | - | ||||||
791 | pressAction(([]() -> QString { enum { Size = sizeof(u"" "Press")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Press" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
792 | increaseAction(([]() -> QString { enum { Size = sizeof(u"" "Increase")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Increase" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
793 | decreaseAction(([]() -> QString { enum { Size = sizeof(u"" "Decrease")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Decrease" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
794 | showMenuAction(([]() -> QString { enum { Size = sizeof(u"" "ShowMenu")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ShowMenu" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
795 | setFocusAction(([]() -> QString { enum { Size = sizeof(u"" "SetFocus")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "SetFocus" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
796 | toggleAction(([]() -> QString { enum { Size = sizeof(u"" "Toggle")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Toggle" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
797 | scrollLeftAction(([]() -> QString { enum { Size = sizeof(u"" "Scroll Left")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Scroll Left" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
798 | scrollRightAction(([]() -> QString { enum { Size = sizeof(u"" "Scroll Right")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Scroll Right" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
799 | scrollUpAction(([]() -> QString { enum { Size = sizeof(u"" "Scroll Up")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Scroll Up" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
800 | scrollDownAction(([]() -> QString { enum { Size = sizeof(u"" "Scroll Down")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Scroll Down" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
801 | previousPageAction(([]() -> QString { enum { Size = sizeof(u"" "Previous Page")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Previous Page" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())), | - | ||||||
802 | nextPageAction(([]() -> QString { enum { Size = sizeof(u"" "Next Page")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Next Page" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) | - | ||||||
803 | {} | - | ||||||
804 | - | |||||||
805 | const QString pressAction; | - | ||||||
806 | const QString increaseAction; | - | ||||||
807 | const QString decreaseAction; | - | ||||||
808 | const QString showMenuAction; | - | ||||||
809 | const QString setFocusAction; | - | ||||||
810 | const QString toggleAction; | - | ||||||
811 | const QString scrollLeftAction; | - | ||||||
812 | const QString scrollRightAction; | - | ||||||
813 | const QString scrollUpAction; | - | ||||||
814 | const QString scrollDownAction; | - | ||||||
815 | const QString previousPageAction; | - | ||||||
816 | const QString nextPageAction; | - | ||||||
817 | - | |||||||
818 | QString localizedDescription(const QString &actionName) | - | ||||||
819 | { | - | ||||||
820 | if (actionName == pressAction) | - | ||||||
821 | return QAccessibleActionInterface::tr("Triggers the action"); | - | ||||||
822 | else if (actionName == increaseAction) | - | ||||||
823 | return QAccessibleActionInterface::tr("Increase the value"); | - | ||||||
824 | else if (actionName == decreaseAction) | - | ||||||
825 | return QAccessibleActionInterface::tr("Decrease the value"); | - | ||||||
826 | else if (actionName == showMenuAction) | - | ||||||
827 | return QAccessibleActionInterface::tr("Shows the menu"); | - | ||||||
828 | else if (actionName == setFocusAction) | - | ||||||
829 | return QAccessibleActionInterface::tr("Sets the focus"); | - | ||||||
830 | else if (actionName == toggleAction) | - | ||||||
831 | return QAccessibleActionInterface::tr("Toggles the state"); | - | ||||||
832 | else if (actionName == scrollLeftAction) | - | ||||||
833 | return QAccessibleActionInterface::tr("Scrolls to the left"); | - | ||||||
834 | else if (actionName == scrollRightAction) | - | ||||||
835 | return QAccessibleActionInterface::tr("Scrolls to the right"); | - | ||||||
836 | else if (actionName == scrollUpAction) | - | ||||||
837 | return QAccessibleActionInterface::tr("Scrolls up"); | - | ||||||
838 | else if (actionName == scrollDownAction) | - | ||||||
839 | return QAccessibleActionInterface::tr("Scrolls down"); | - | ||||||
840 | else if (actionName == previousPageAction) | - | ||||||
841 | return QAccessibleActionInterface::tr("Goes back a page"); | - | ||||||
842 | else if (actionName == nextPageAction) | - | ||||||
843 | return QAccessibleActionInterface::tr("Goes to the next page"); | - | ||||||
844 | - | |||||||
845 | - | |||||||
846 | return QString(); | - | ||||||
847 | } | - | ||||||
848 | }; | - | ||||||
849 | - | |||||||
850 | namespace { namespace Q_QGS_accessibleActionStrings { typedef QAccessibleActionStrings Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QAccessibleActionStrings, Q_QGS_accessibleActionStrings::innerFunction, Q_QGS_accessibleActionStrings::guard> accessibleActionStrings; | - | ||||||
851 | - | |||||||
852 | QString QAccessibleActionInterface::localizedActionName(const QString &actionName) const | - | ||||||
853 | { | - | ||||||
854 | return QAccessibleActionInterface::tr(QString(actionName).toLocal8Bit().constData()); | - | ||||||
855 | } | - | ||||||
856 | - | |||||||
857 | QString QAccessibleActionInterface::localizedActionDescription(const QString &actionName) const | - | ||||||
858 | { | - | ||||||
859 | return accessibleActionStrings()->localizedDescription(actionName); | - | ||||||
860 | } | - | ||||||
861 | - | |||||||
862 | - | |||||||
863 | - | |||||||
864 | - | |||||||
865 | - | |||||||
866 | const QString &QAccessibleActionInterface::pressAction() | - | ||||||
867 | { | - | ||||||
868 | return accessibleActionStrings()->pressAction; | - | ||||||
869 | } | - | ||||||
870 | - | |||||||
871 | - | |||||||
872 | - | |||||||
873 | - | |||||||
874 | - | |||||||
875 | const QString &QAccessibleActionInterface::increaseAction() | - | ||||||
876 | { | - | ||||||
877 | return accessibleActionStrings()->increaseAction; | - | ||||||
878 | } | - | ||||||
879 | - | |||||||
880 | - | |||||||
881 | - | |||||||
882 | - | |||||||
883 | - | |||||||
884 | const QString &QAccessibleActionInterface::decreaseAction() | - | ||||||
885 | { | - | ||||||
886 | return accessibleActionStrings()->decreaseAction; | - | ||||||
887 | } | - | ||||||
888 | - | |||||||
889 | - | |||||||
890 | - | |||||||
891 | - | |||||||
892 | - | |||||||
893 | const QString &QAccessibleActionInterface::showMenuAction() | - | ||||||
894 | { | - | ||||||
895 | return accessibleActionStrings()->showMenuAction; | - | ||||||
896 | } | - | ||||||
897 | - | |||||||
898 | - | |||||||
899 | - | |||||||
900 | - | |||||||
901 | - | |||||||
902 | const QString &QAccessibleActionInterface::setFocusAction() | - | ||||||
903 | { | - | ||||||
904 | return accessibleActionStrings()->setFocusAction; | - | ||||||
905 | } | - | ||||||
906 | - | |||||||
907 | - | |||||||
908 | - | |||||||
909 | - | |||||||
910 | - | |||||||
911 | const QString &QAccessibleActionInterface::toggleAction() | - | ||||||
912 | { | - | ||||||
913 | return accessibleActionStrings()->toggleAction; | - | ||||||
914 | } | - | ||||||
915 | - | |||||||
916 | - | |||||||
917 | - | |||||||
918 | - | |||||||
919 | - | |||||||
920 | QString QAccessibleActionInterface::scrollLeftAction() | - | ||||||
921 | { | - | ||||||
922 | return accessibleActionStrings()->scrollLeftAction; | - | ||||||
923 | } | - | ||||||
924 | - | |||||||
925 | - | |||||||
926 | - | |||||||
927 | - | |||||||
928 | - | |||||||
929 | QString QAccessibleActionInterface::scrollRightAction() | - | ||||||
930 | { | - | ||||||
931 | return accessibleActionStrings()->scrollRightAction; | - | ||||||
932 | } | - | ||||||
933 | - | |||||||
934 | - | |||||||
935 | - | |||||||
936 | - | |||||||
937 | - | |||||||
938 | QString QAccessibleActionInterface::scrollUpAction() | - | ||||||
939 | { | - | ||||||
940 | return accessibleActionStrings()->scrollUpAction; | - | ||||||
941 | } | - | ||||||
942 | - | |||||||
943 | - | |||||||
944 | - | |||||||
945 | - | |||||||
946 | - | |||||||
947 | QString QAccessibleActionInterface::scrollDownAction() | - | ||||||
948 | { | - | ||||||
949 | return accessibleActionStrings()->scrollDownAction; | - | ||||||
950 | } | - | ||||||
951 | - | |||||||
952 | - | |||||||
953 | - | |||||||
954 | - | |||||||
955 | - | |||||||
956 | QString QAccessibleActionInterface::previousPageAction() | - | ||||||
957 | { | - | ||||||
958 | return accessibleActionStrings()->previousPageAction; | - | ||||||
959 | } | - | ||||||
960 | - | |||||||
961 | - | |||||||
962 | - | |||||||
963 | - | |||||||
964 | - | |||||||
965 | QString QAccessibleActionInterface::nextPageAction() | - | ||||||
966 | { | - | ||||||
967 | return accessibleActionStrings()->nextPageAction; | - | ||||||
968 | } | - | ||||||
969 | - | |||||||
970 | - | |||||||
971 | QString qAccessibleLocalizedActionDescription(const QString &actionName) | - | ||||||
972 | { | - | ||||||
973 | return accessibleActionStrings()->localizedDescription(actionName); | - | ||||||
974 | } | - | ||||||
975 | - | |||||||
976 | - | |||||||
977 | - | |||||||
978 | - | |||||||
Switch to Source code | Preprocessed file |