forked from mumble-voip/mumble
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX(a11y): Add semantic description to sliders in Settings
- Loading branch information
Showing
8 changed files
with
177 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright 2023-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 "SemanticSlider.h" | ||
|
||
#include <QDebug> | ||
|
||
SemanticSlider::SemanticSlider(QWidget *parent) | ||
: QSlider(parent), m_semanticValue("test 1.56 milliseconds") | ||
{ | ||
} | ||
|
||
AccessibleAbstractSlider::AccessibleAbstractSlider(QWidget *w, QAccessible::Role r) | ||
: QAccessibleWidget(w, r) | ||
{ | ||
Q_ASSERT(qobject_cast<QAbstractSlider *>(w)); | ||
} | ||
|
||
void *AccessibleAbstractSlider::interface_cast(QAccessible::InterfaceType t) | ||
{ | ||
return QAccessibleWidget::interface_cast(t); | ||
} | ||
|
||
QAbstractSlider *AccessibleAbstractSlider::abstractSlider() const | ||
{ | ||
return static_cast<QAbstractSlider *>(object()); | ||
} | ||
|
||
AccessibleSlider::AccessibleSlider(QWidget *w) | ||
: AccessibleAbstractSlider(w) | ||
{ | ||
Q_ASSERT(slider()); | ||
addControllingSignal(QLatin1String("valueChanged(int)")); | ||
} | ||
|
||
SemanticSlider *AccessibleSlider::slider() const | ||
{ | ||
return qobject_cast<SemanticSlider*>(object()); | ||
} | ||
|
||
QString AccessibleSlider::text(QAccessible::Text t) const | ||
{ | ||
qDebug() << "text method" << t; | ||
if (t == QAccessible::Name) { | ||
qDebug() << "send text"; | ||
qDebug() << (AccessibleAbstractSlider::text(t) + " " + slider()->m_semanticValue); | ||
return AccessibleAbstractSlider::text(t) + " " + slider()->m_semanticValue; | ||
} | ||
|
||
return AccessibleAbstractSlider::text(t); | ||
} | ||
|
||
QAccessibleInterface *AccessibleSlider::semanticSliderFactory(const QString &classname, QObject *object) { | ||
QAccessibleInterface *interface = nullptr; | ||
|
||
if(object && object->isWidgetType()) { | ||
if (classname == QLatin1String("SemanticSlider")) { | ||
interface = new AccessibleSlider(static_cast<QWidget *>(object)); | ||
qDebug() << "created interface"; | ||
} else { | ||
qDebug() << "not interfaced"; | ||
} | ||
} | ||
|
||
return interface; | ||
} |
Oops, something went wrong.