Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/linuxaccessibility/constant_mappings.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||
2 | ** | - | ||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||
5 | ** | - | ||||||||||||
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||
7 | ** | - | ||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||
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 http://www.qt.io/terms-conditions. For further | - | ||||||||||||
15 | ** information use the contact form at http://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 2.1 or version 3 as published by the Free | - | ||||||||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||
25 | ** | - | ||||||||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||
29 | ** | - | ||||||||||||
30 | ** $QT_END_LICENSE$ | - | ||||||||||||
31 | ** | - | ||||||||||||
32 | ****************************************************************************/ | - | ||||||||||||
33 | - | |||||||||||||
34 | - | |||||||||||||
35 | #include "constant_mappings_p.h" | - | ||||||||||||
36 | - | |||||||||||||
37 | #include <qobject.h> | - | ||||||||||||
38 | #include <qdebug.h> | - | ||||||||||||
39 | - | |||||||||||||
40 | // FIXME the assignment of roles is quite arbitrary, at some point go through this list and sort and check that it makes sense | - | ||||||||||||
41 | // "calendar" "check menu item" "color chooser" "column header" "dateeditor" "desktop icon" "desktop frame" | - | ||||||||||||
42 | // "directory pane" "drawing area" "file chooser" "fontchooser" "frame" "glass pane" "html container" "icon" | - | ||||||||||||
43 | // "internal frame" "option pane" "password text" "radio menu item" "root pane" "row header" "scroll pane" | - | ||||||||||||
44 | // "tear off menu item" "terminal" "toggle button" "tree table" "unknown" "viewport" "header" "footer" "paragraph" | - | ||||||||||||
45 | // "ruler" "autocomplete" "edit bar" "embedded component" "entry" "caption" | - | ||||||||||||
46 | // "heading" "page" "section" "redundant object" "form" "input method window" "menu" | - | ||||||||||||
47 | - | |||||||||||||
48 | #ifndef QT_NO_ACCESSIBILITY | - | ||||||||||||
49 | QT_BEGIN_NAMESPACE | - | ||||||||||||
50 | - | |||||||||||||
51 | QHash <QAccessible::Role, RoleNames> qSpiRoleMapping; | - | ||||||||||||
52 | - | |||||||||||||
53 | quint64 spiStatesFromQState(QAccessible::State state) | - | ||||||||||||
54 | { | - | ||||||||||||
55 | quint64 spiState = 0; | - | ||||||||||||
56 | - | |||||||||||||
57 | if (state.active)
| 0 | ||||||||||||
58 | setSpiStateBit(&spiState, ATSPI_STATE_ACTIVE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_ACTIVE); | 0 | ||||||||||||
59 | if (state.editable)
| 0 | ||||||||||||
60 | setSpiStateBit(&spiState, ATSPI_STATE_EDITABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_EDITABLE); | 0 | ||||||||||||
61 | if (!state.disabled) {
| 0 | ||||||||||||
62 | setSpiStateBit(&spiState, ATSPI_STATE_ENABLED); | - | ||||||||||||
63 | setSpiStateBit(&spiState, ATSPI_STATE_SENSITIVE); | - | ||||||||||||
64 | } never executed: end of block | 0 | ||||||||||||
65 | if (state.selected)
| 0 | ||||||||||||
66 | setSpiStateBit(&spiState, ATSPI_STATE_SELECTED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_SELECTED); | 0 | ||||||||||||
67 | if (state.focused)
| 0 | ||||||||||||
68 | setSpiStateBit(&spiState, ATSPI_STATE_FOCUSED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_FOCUSED); | 0 | ||||||||||||
69 | if (state.pressed)
| 0 | ||||||||||||
70 | setSpiStateBit(&spiState, ATSPI_STATE_PRESSED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_PRESSED); | 0 | ||||||||||||
71 | if (state.checked)
| 0 | ||||||||||||
72 | setSpiStateBit(&spiState, ATSPI_STATE_CHECKED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_CHECKED); | 0 | ||||||||||||
73 | if (state.checkStateMixed)
| 0 | ||||||||||||
74 | setSpiStateBit(&spiState, ATSPI_STATE_INDETERMINATE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_INDETERMINATE); | 0 | ||||||||||||
75 | if (state.readOnly)
| 0 | ||||||||||||
76 | unsetSpiStateBit(&spiState, ATSPI_STATE_EDITABLE); never executed: unsetSpiStateBit(&spiState, ATSPI_STATE_EDITABLE); | 0 | ||||||||||||
77 | // if (state.HotTracked) | - | ||||||||||||
78 | if (state.defaultButton)
| 0 | ||||||||||||
79 | setSpiStateBit(&spiState, ATSPI_STATE_IS_DEFAULT); never executed: setSpiStateBit(&spiState, ATSPI_STATE_IS_DEFAULT); | 0 | ||||||||||||
80 | if (state.expanded)
| 0 | ||||||||||||
81 | setSpiStateBit(&spiState, ATSPI_STATE_EXPANDED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_EXPANDED); | 0 | ||||||||||||
82 | if (state.collapsed)
| 0 | ||||||||||||
83 | setSpiStateBit(&spiState, ATSPI_STATE_COLLAPSED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_COLLAPSED); | 0 | ||||||||||||
84 | if (state.busy)
| 0 | ||||||||||||
85 | setSpiStateBit(&spiState, ATSPI_STATE_BUSY); never executed: setSpiStateBit(&spiState, ATSPI_STATE_BUSY); | 0 | ||||||||||||
86 | if (state.marqueed || state.animated)
| 0 | ||||||||||||
87 | setSpiStateBit(&spiState, ATSPI_STATE_ANIMATED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_ANIMATED); | 0 | ||||||||||||
88 | if (!state.invisible && !state.offscreen) {
| 0 | ||||||||||||
89 | setSpiStateBit(&spiState, ATSPI_STATE_SHOWING); | - | ||||||||||||
90 | setSpiStateBit(&spiState, ATSPI_STATE_VISIBLE); | - | ||||||||||||
91 | } never executed: end of block | 0 | ||||||||||||
92 | if (state.sizeable)
| 0 | ||||||||||||
93 | setSpiStateBit(&spiState, ATSPI_STATE_RESIZABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_RESIZABLE); | 0 | ||||||||||||
94 | // if (state.Movable) | - | ||||||||||||
95 | // if (state.SelfVoicing) | - | ||||||||||||
96 | if (state.focusable)
| 0 | ||||||||||||
97 | setSpiStateBit(&spiState, ATSPI_STATE_FOCUSABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_FOCUSABLE); | 0 | ||||||||||||
98 | if (state.selectable)
| 0 | ||||||||||||
99 | setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE); | 0 | ||||||||||||
100 | // if (state.Linked) | - | ||||||||||||
101 | if (state.traversed)
| 0 | ||||||||||||
102 | setSpiStateBit(&spiState, ATSPI_STATE_VISITED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_VISITED); | 0 | ||||||||||||
103 | if (state.multiSelectable)
| 0 | ||||||||||||
104 | setSpiStateBit(&spiState, ATSPI_STATE_MULTISELECTABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_MULTISELECTABLE); | 0 | ||||||||||||
105 | if (state.extSelectable)
| 0 | ||||||||||||
106 | setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE); | 0 | ||||||||||||
107 | // if (state.Protected) | - | ||||||||||||
108 | // if (state.HasPopup) | - | ||||||||||||
109 | if (state.modal)
| 0 | ||||||||||||
110 | setSpiStateBit(&spiState, ATSPI_STATE_MODAL); never executed: setSpiStateBit(&spiState, ATSPI_STATE_MODAL); | 0 | ||||||||||||
111 | if (state.multiLine)
| 0 | ||||||||||||
112 | setSpiStateBit(&spiState, ATSPI_STATE_MULTI_LINE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_MULTI_LINE); | 0 | ||||||||||||
113 | - | |||||||||||||
114 | return spiState; never executed: return spiState; | 0 | ||||||||||||
115 | } | - | ||||||||||||
116 | - | |||||||||||||
117 | QSpiUIntList spiStateSetFromSpiStates(quint64 states) | - | ||||||||||||
118 | { | - | ||||||||||||
119 | uint low = states & 0xFFFFFFFF; | - | ||||||||||||
120 | uint high = (states >> 32) & 0xFFFFFFFF; | - | ||||||||||||
121 | - | |||||||||||||
122 | QSpiUIntList stateList; | - | ||||||||||||
123 | stateList.append(low); | - | ||||||||||||
124 | stateList.append(high); | - | ||||||||||||
125 | return stateList; never executed: return stateList; | 0 | ||||||||||||
126 | } | - | ||||||||||||
127 | - | |||||||||||||
128 | AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relation) | - | ||||||||||||
129 | { | - | ||||||||||||
130 | switch (relation) { | - | ||||||||||||
131 | case QAccessible::Label: never executed: case QAccessible::Label: | 0 | ||||||||||||
132 | return ATSPI_RELATION_LABELLED_BY; never executed: return ATSPI_RELATION_LABELLED_BY; | 0 | ||||||||||||
133 | case QAccessible::Labelled: never executed: case QAccessible::Labelled: | 0 | ||||||||||||
134 | return ATSPI_RELATION_LABEL_FOR; never executed: return ATSPI_RELATION_LABEL_FOR; | 0 | ||||||||||||
135 | case QAccessible::Controller: never executed: case QAccessible::Controller: | 0 | ||||||||||||
136 | return ATSPI_RELATION_CONTROLLED_BY; never executed: return ATSPI_RELATION_CONTROLLED_BY; | 0 | ||||||||||||
137 | case QAccessible::Controlled: never executed: case QAccessible::Controlled: | 0 | ||||||||||||
138 | return ATSPI_RELATION_CONTROLLER_FOR; never executed: return ATSPI_RELATION_CONTROLLER_FOR; | 0 | ||||||||||||
139 | default: never executed: default: | 0 | ||||||||||||
140 | qWarning() << "Cannot return AT-SPI relation for:" << relation; | - | ||||||||||||
141 | } never executed: end of block | 0 | ||||||||||||
142 | return ATSPI_RELATION_NULL; never executed: return ATSPI_RELATION_NULL; | 0 | ||||||||||||
143 | } | - | ||||||||||||
144 | - | |||||||||||||
145 | QT_END_NAMESPACE | - | ||||||||||||
146 | #endif //QT_NO_ACCESSIBILITY | - | ||||||||||||
Source code | Switch to Preprocessed file |