| 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) 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 | #include "constant_mappings_p.h" | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | #include <qobject.h> | - | ||||||||||||
| 44 | #include <qdebug.h> | - | ||||||||||||
| 45 | - | |||||||||||||
| 46 | // FIXME the assignment of roles is quite arbitrary, at some point go through this list and sort and check that it makes sense | - | ||||||||||||
| 47 | // "calendar" "check menu item" "color chooser" "column header" "dateeditor" "desktop icon" "desktop frame" | - | ||||||||||||
| 48 | // "directory pane" "drawing area" "file chooser" "fontchooser" "frame" "glass pane" "html container" "icon" | - | ||||||||||||
| 49 | // "internal frame" "option pane" "password text" "radio menu item" "root pane" "row header" "scroll pane" | - | ||||||||||||
| 50 | // "tear off menu item" "terminal" "toggle button" "tree table" "unknown" "viewport" "header" "footer" "paragraph" | - | ||||||||||||
| 51 | // "ruler" "autocomplete" "edit bar" "embedded component" "entry" "caption" | - | ||||||||||||
| 52 | // "heading" "page" "section" "redundant object" "form" "input method window" "menu" | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | #ifndef QT_NO_ACCESSIBILITY | - | ||||||||||||
| 55 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | QHash <QAccessible::Role, RoleNames> qSpiRoleMapping; | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | quint64 spiStatesFromQState(QAccessible::State state) | - | ||||||||||||
| 60 | { | - | ||||||||||||
| 61 | quint64 spiState = 0; | - | ||||||||||||
| 62 | - | |||||||||||||
| 63 | if (state.active)
| 0 | ||||||||||||
| 64 | setSpiStateBit(&spiState, ATSPI_STATE_ACTIVE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_ACTIVE); | 0 | ||||||||||||
| 65 | if (state.editable)
| 0 | ||||||||||||
| 66 | setSpiStateBit(&spiState, ATSPI_STATE_EDITABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_EDITABLE); | 0 | ||||||||||||
| 67 | if (!state.disabled) {
| 0 | ||||||||||||
| 68 | setSpiStateBit(&spiState, ATSPI_STATE_ENABLED); | - | ||||||||||||
| 69 | setSpiStateBit(&spiState, ATSPI_STATE_SENSITIVE); | - | ||||||||||||
| 70 | } never executed: end of block | 0 | ||||||||||||
| 71 | if (state.selected)
| 0 | ||||||||||||
| 72 | setSpiStateBit(&spiState, ATSPI_STATE_SELECTED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_SELECTED); | 0 | ||||||||||||
| 73 | if (state.focused)
| 0 | ||||||||||||
| 74 | setSpiStateBit(&spiState, ATSPI_STATE_FOCUSED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_FOCUSED); | 0 | ||||||||||||
| 75 | if (state.pressed)
| 0 | ||||||||||||
| 76 | setSpiStateBit(&spiState, ATSPI_STATE_PRESSED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_PRESSED); | 0 | ||||||||||||
| 77 | if (state.checked)
| 0 | ||||||||||||
| 78 | setSpiStateBit(&spiState, ATSPI_STATE_CHECKED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_CHECKED); | 0 | ||||||||||||
| 79 | if (state.checkStateMixed)
| 0 | ||||||||||||
| 80 | setSpiStateBit(&spiState, ATSPI_STATE_INDETERMINATE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_INDETERMINATE); | 0 | ||||||||||||
| 81 | if (state.readOnly)
| 0 | ||||||||||||
| 82 | unsetSpiStateBit(&spiState, ATSPI_STATE_EDITABLE); never executed: unsetSpiStateBit(&spiState, ATSPI_STATE_EDITABLE); | 0 | ||||||||||||
| 83 | // if (state.HotTracked) | - | ||||||||||||
| 84 | if (state.defaultButton)
| 0 | ||||||||||||
| 85 | setSpiStateBit(&spiState, ATSPI_STATE_IS_DEFAULT); never executed: setSpiStateBit(&spiState, ATSPI_STATE_IS_DEFAULT); | 0 | ||||||||||||
| 86 | if (state.expanded)
| 0 | ||||||||||||
| 87 | setSpiStateBit(&spiState, ATSPI_STATE_EXPANDED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_EXPANDED); | 0 | ||||||||||||
| 88 | if (state.collapsed)
| 0 | ||||||||||||
| 89 | setSpiStateBit(&spiState, ATSPI_STATE_COLLAPSED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_COLLAPSED); | 0 | ||||||||||||
| 90 | if (state.busy)
| 0 | ||||||||||||
| 91 | setSpiStateBit(&spiState, ATSPI_STATE_BUSY); never executed: setSpiStateBit(&spiState, ATSPI_STATE_BUSY); | 0 | ||||||||||||
| 92 | if (state.marqueed || state.animated)
| 0 | ||||||||||||
| 93 | setSpiStateBit(&spiState, ATSPI_STATE_ANIMATED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_ANIMATED); | 0 | ||||||||||||
| 94 | if (!state.invisible && !state.offscreen) {
| 0 | ||||||||||||
| 95 | setSpiStateBit(&spiState, ATSPI_STATE_SHOWING); | - | ||||||||||||
| 96 | setSpiStateBit(&spiState, ATSPI_STATE_VISIBLE); | - | ||||||||||||
| 97 | } never executed: end of block | 0 | ||||||||||||
| 98 | if (state.sizeable)
| 0 | ||||||||||||
| 99 | setSpiStateBit(&spiState, ATSPI_STATE_RESIZABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_RESIZABLE); | 0 | ||||||||||||
| 100 | // if (state.Movable) | - | ||||||||||||
| 101 | // if (state.SelfVoicing) | - | ||||||||||||
| 102 | if (state.focusable)
| 0 | ||||||||||||
| 103 | setSpiStateBit(&spiState, ATSPI_STATE_FOCUSABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_FOCUSABLE); | 0 | ||||||||||||
| 104 | if (state.selectable)
| 0 | ||||||||||||
| 105 | setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE); | 0 | ||||||||||||
| 106 | // if (state.Linked) | - | ||||||||||||
| 107 | if (state.traversed)
| 0 | ||||||||||||
| 108 | setSpiStateBit(&spiState, ATSPI_STATE_VISITED); never executed: setSpiStateBit(&spiState, ATSPI_STATE_VISITED); | 0 | ||||||||||||
| 109 | if (state.multiSelectable)
| 0 | ||||||||||||
| 110 | setSpiStateBit(&spiState, ATSPI_STATE_MULTISELECTABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_MULTISELECTABLE); | 0 | ||||||||||||
| 111 | if (state.extSelectable)
| 0 | ||||||||||||
| 112 | setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_SELECTABLE); | 0 | ||||||||||||
| 113 | // if (state.Protected) | - | ||||||||||||
| 114 | // if (state.HasPopup) | - | ||||||||||||
| 115 | if (state.modal)
| 0 | ||||||||||||
| 116 | setSpiStateBit(&spiState, ATSPI_STATE_MODAL); never executed: setSpiStateBit(&spiState, ATSPI_STATE_MODAL); | 0 | ||||||||||||
| 117 | if (state.multiLine)
| 0 | ||||||||||||
| 118 | setSpiStateBit(&spiState, ATSPI_STATE_MULTI_LINE); never executed: setSpiStateBit(&spiState, ATSPI_STATE_MULTI_LINE); | 0 | ||||||||||||
| 119 | - | |||||||||||||
| 120 | return spiState; never executed: return spiState; | 0 | ||||||||||||
| 121 | } | - | ||||||||||||
| 122 | - | |||||||||||||
| 123 | QSpiUIntList spiStateSetFromSpiStates(quint64 states) | - | ||||||||||||
| 124 | { | - | ||||||||||||
| 125 | uint low = states & 0xFFFFFFFF; | - | ||||||||||||
| 126 | uint high = (states >> 32) & 0xFFFFFFFF; | - | ||||||||||||
| 127 | - | |||||||||||||
| 128 | QSpiUIntList stateList; | - | ||||||||||||
| 129 | stateList.append(low); | - | ||||||||||||
| 130 | stateList.append(high); | - | ||||||||||||
| 131 | return stateList; never executed: return stateList; | 0 | ||||||||||||
| 132 | } | - | ||||||||||||
| 133 | - | |||||||||||||
| 134 | AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relation) | - | ||||||||||||
| 135 | { | - | ||||||||||||
| 136 | switch (relation) { | - | ||||||||||||
| 137 | case QAccessible::Label: never executed: case QAccessible::Label: | 0 | ||||||||||||
| 138 | return ATSPI_RELATION_LABELLED_BY; never executed: return ATSPI_RELATION_LABELLED_BY; | 0 | ||||||||||||
| 139 | case QAccessible::Labelled: never executed: case QAccessible::Labelled: | 0 | ||||||||||||
| 140 | return ATSPI_RELATION_LABEL_FOR; never executed: return ATSPI_RELATION_LABEL_FOR; | 0 | ||||||||||||
| 141 | case QAccessible::Controller: never executed: case QAccessible::Controller: | 0 | ||||||||||||
| 142 | return ATSPI_RELATION_CONTROLLED_BY; never executed: return ATSPI_RELATION_CONTROLLED_BY; | 0 | ||||||||||||
| 143 | case QAccessible::Controlled: never executed: case QAccessible::Controlled: | 0 | ||||||||||||
| 144 | return ATSPI_RELATION_CONTROLLER_FOR; never executed: return ATSPI_RELATION_CONTROLLER_FOR; | 0 | ||||||||||||
| 145 | default: never executed: default: | 0 | ||||||||||||
| 146 | qWarning() << "Cannot return AT-SPI relation for:" << relation; | - | ||||||||||||
| 147 | } never executed: end of block | 0 | ||||||||||||
| 148 | return ATSPI_RELATION_NULL; never executed: return ATSPI_RELATION_NULL; | 0 | ||||||||||||
| 149 | } | - | ||||||||||||
| 150 | - | |||||||||||||
| 151 | QT_END_NAMESPACE | - | ||||||||||||
| 152 | #endif //QT_NO_ACCESSIBILITY | - | ||||||||||||
| Source code | Switch to Preprocessed file |