Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | #include "qplatformaccessibility.h" | - |
40 | #include <private/qfactoryloader_p.h> | - |
41 | #include "qaccessibleplugin.h" | - |
42 | #include "qaccessibleobject.h" | - |
43 | #include "qaccessiblebridge.h" | - |
44 | #include <QtGui/QGuiApplication> | - |
45 | | - |
46 | #include <QDebug> | - |
47 | | - |
48 | QT_BEGIN_NAMESPACE | - |
49 | | - |
50 | #ifndef QT_NO_ACCESSIBILITY | - |
51 | | - |
52 | | - |
| #ifndef QT_NO_LIBRARYQ_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, bridgeloader, | |
54 | (QAccessibleBridgeFactoryInterface_iid, QLatin1String("/accessiblebridge"))) | - |
55 | | - |
| #endifQ_GLOBAL_STATIC(QVector<QAccessibleBridge *>, bridges) | |
57 | | - |
58 | | - |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | | - |
67 | | - |
68 | | - |
69 | | - |
70 | | - |
71 | QPlatformAccessibility::QPlatformAccessibility() | - |
72 | : m_active(false) | - |
73 | { | - |
74 | } | - |
75 | | - |
76 | QPlatformAccessibility::~QPlatformAccessibility() | - |
77 | { | - |
78 | } | - |
79 | | - |
80 | void QPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) | - |
81 | { | - |
82 | initialize(); | - |
83 | | - |
84 | if (!bridges() || bridges()->isEmpty()) | - |
85 | return; | - |
86 | | - |
87 | for (int i = 0; i < bridges()->count(); ++i) | - |
88 | bridges()->at(i)->notifyAccessibilityUpdate(event); | - |
89 | } | - |
90 | | - |
91 | void QPlatformAccessibility::setRootObject(QObject *o) | - |
92 | { | - |
93 | initialize(); | - |
94 | if (bridges()->isEmpty()) | - |
95 | return; | - |
96 | | - |
97 | if (!o) | - |
98 | return; | - |
99 | | - |
100 | for (int i = 0; i < bridges()->count(); ++i) { | - |
101 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o); | - |
102 | bridges()->at(i)->setRootObject(iface); | - |
103 | } | - |
104 | } | - |
105 | | - |
106 | void QPlatformAccessibility::initialize() | - |
107 | { | - |
108 | static bool isInit = false; | - |
109 | if (isInit)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
110 | return; never executed: return; | 0 |
111 | isInit = true; | - |
112 | | - |
113 | #ifndef QT_NO_LIBRARYtypedef QMultiMap<int, QString> PluginKeyMap; | - |
114 | typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; | - |
115 | | - |
116 | const PluginKeyMap keyMap = bridgeloader()->keyMap(); | - |
117 | QAccessibleBridgePlugin *factory = 0; | - |
118 | int i = -1; | - |
119 | const PluginKeyMapConstIterator cend = keyMap.constEnd(); | - |
120 | for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
121 | if (it.key() != i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
122 | i = it.key(); | - |
123 | factory = qobject_cast<QAccessibleBridgePlugin*>(bridgeloader()->instance(i)); | - |
124 | } never executed: end of block | 0 |
125 | if (factory)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
126 | if (QAccessibleBridge *bridge = factory->create(it.value()))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
127 | bridges()->append(bridge); never executed: bridges()->append(bridge); | 0 |
128 | }#endif never executed: end of block | 0 |
129 | } never executed: end of block | 0 |
130 | | - |
131 | void QPlatformAccessibility::cleanup() | - |
132 | { | - |
133 | qDeleteAll(*bridges()); | - |
134 | } | - |
135 | | - |
136 | void QPlatformAccessibility::setActive(bool active) | - |
137 | { | - |
138 | m_active = active; | - |
139 | QAccessible::setActive(active); | - |
140 | } | - |
141 | | - |
142 | #endif // QT_NO_ACCESSIBILITY | - |
143 | | - |
144 | QT_END_NAMESPACE | - |
| | |