Skip to content

Commit

Permalink
FIX(a11y): Make plugin config accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Jan 7, 2024
1 parent 1f41199 commit cd14b9f
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/mumble/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ set(MUMBLE_SOURCES
"widgets/MUComboBox.h"
"widgets/MultiStyleWidgetWrapper.cpp"
"widgets/MultiStyleWidgetWrapper.h"
"widgets/MultiColumnTreeWidget.cpp"
"widgets/MultiColumnTreeWidget.h"
"widgets/RichTextItemDelegate.cpp"
"widgets/RichTextItemDelegate.h"
"widgets/SearchDialogItemDelegate.cpp"
Expand Down
9 changes: 8 additions & 1 deletion src/mumble/PluginConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,25 @@ void PluginConfig::refillPluginList() {
if (currentPlugin->getFeatures() & MUMBLE_FEATURE_POSITIONAL) {
i->setCheckState(2, currentPlugin->isPositionalDataEnabled() ? Qt::Checked : Qt::Unchecked);
i->setToolTip(2, tr("Whether the positional audio feature of this plugin should be enabled"));
i->setData(2, Qt::AccessibleTextRole, tr("Plugin positional audio enabled checkbox"));
} else {
i->setToolTip(2, tr("This plugin does not provide support for positional audio"));
QString text = tr("This plugin does not provide support for positional audio");
i->setToolTip(2, text);
i->setData(2, Qt::AccessibleTextRole, text);
}

i->setCheckState(3, currentPlugin->isKeyboardMonitoringAllowed() ? Qt::Checked : Qt::Unchecked);
i->setToolTip(3, tr("Whether this plugin has the permission to be listening to all keyboard events that occur "
"while Mumble has focus"));
i->setData(3, Qt::AccessibleTextRole, tr("Plugin keyboard event listen permission checkbox"));

i->setText(0, currentPlugin->getName());
i->setToolTip(0, currentPlugin->getDescription().toHtmlEscaped());
i->setToolTip(1, tr("Whether this plugin should be enabled"));
i->setData(0, Qt::UserRole, currentPlugin->getID());

i->setData(0, Qt::AccessibleTextRole, tr("Plugin name"));
i->setData(1, Qt::AccessibleTextRole, tr("Plugin enabled checkbox"));
}

qtwPlugins->setCurrentItem(qtwPlugins->topLevelItem(0));
Expand Down
15 changes: 14 additions & 1 deletion src/mumble/PluginConfig.ui
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTreeWidget" name="qtwPlugins">
<widget class="MultiColumnTreeWidget" name="qtwPlugins">
<property name="accessibleName">
<string>List of plugins</string>
</property>
<property name="accessibleDescription">
<string>Use up and down keys to navigate through plugins. Use left and right keys to navigate between single plugin permissions.</string>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
Expand Down Expand Up @@ -159,6 +165,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>MultiColumnTreeWidget</class>
<extends>QTreeWidget</extends>
<header>widgets/MultiColumnTreeWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
33 changes: 33 additions & 0 deletions src/mumble/widgets/MultiColumnTreeWidget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2024 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "MultiColumnTreeWidget.h"

#include <algorithm>

#include <QDebug>

MultiColumnTreeWidget::MultiColumnTreeWidget(QWidget *parent) : QTreeWidget(parent) {
}

QModelIndex MultiColumnTreeWidget::moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) {
QModelIndex mi = QTreeWidget::moveCursor(cursorAction, modifiers);

if (cursorAction == QAbstractItemView::MoveLeft) {
mi = model()->index(mi.row(), std::max(0, mi.column() - 1));
}

if (cursorAction == QAbstractItemView::MoveRight) {
mi = model()->index(mi.row(), std::min(model()->columnCount() - 1, mi.column() + 1));
}

if (cursorAction == QAbstractItemView::MoveUp || cursorAction == QAbstractItemView::MoveDown) {
mi = model()->index(mi.row(), 0);
}

qDebug() << cursorAction << " - " << modifiers << " = " << mi;

return mi;
}
22 changes: 22 additions & 0 deletions src/mumble/widgets/MultiColumnTreeWidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2024 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#ifndef MUMBLE_MUMBLE_WIDGETS_MULTICOLUMNTREEWIDGET_H_
#define MUMBLE_MUMBLE_WIDGETS_MULTICOLUMNTREEWIDGET_H_

#include <QTreeWidget>
#include <QModelIndex>
#include <QAbstractItemView>

class MultiColumnTreeWidget : public QTreeWidget {
Q_OBJECT;

public:
MultiColumnTreeWidget(QWidget *parent = nullptr);

QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
};

#endif

0 comments on commit cd14b9f

Please sign in to comment.