1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 23:05:48 +02:00

accessibility: fix buttons

Fix the frameless, conversations and invitations buttons for
accessibility.

GitLab: #2049
Change-Id: I82b6722de53c40a260e706a2517aa7cb37dd99a5
This commit is contained in:
pmagnier-slimani 2025-06-03 15:08:42 -04:00
parent 869aef8929
commit 436e11a6a4
4 changed files with 21 additions and 9 deletions

View file

@ -37,12 +37,16 @@ Row {
SystemButton { SystemButton {
id: minButton id: minButton
Accessible.name: JamiStrings.minimize
Accessible.role: Accessible.Button
source: JamiResources.window_bar_minimize_svg source: JamiResources.window_bar_minimize_svg
onClicked: appWindow.showMinimized() onClicked: appWindow.showMinimized()
} }
SystemButton { SystemButton {
id: maxButton id: maxButton
Accessible.name: JamiStrings.maximize
Accessible.role: Accessible.Button
source: appWindow.visibility === Window.Maximized ? source: appWindow.visibility === Window.Maximized ?
JamiResources.window_bar_restore_svg : JamiResources.window_bar_restore_svg :
JamiResources.window_bar_maximize_svg JamiResources.window_bar_maximize_svg
@ -53,6 +57,8 @@ Row {
SystemButton { SystemButton {
id: closeButton id: closeButton
Accessible.name: JamiStrings.closeApplication
Accessible.role: Accessible.Button
source: JamiResources.window_bar_close_svg source: JamiResources.window_bar_close_svg
baseColor: "#e81123" baseColor: "#e81123"
onClicked: appWindow.close() onClicked: appWindow.close()

View file

@ -44,12 +44,12 @@ ItemDelegate {
Accessible.role: Accessible.Button Accessible.role: Accessible.Button
Accessible.name: ItemAction.text Accessible.name: ItemAction.text
Accessible.description: { Accessible.description: {
if (!ItemAction?.text) return "" if (!ItemAction?.text)
return "";
if (ItemAction.checkable) { if (ItemAction.checkable) {
return JamiStrings.pressToToggle.arg(ItemAction.text) return JamiStrings.pressToToggle.arg(ItemAction.text).arg(ItemAction.checked ? JamiStrings.active : JamiStrings.inactive);
.arg(ItemAction.checked ? JamiStrings.active : JamiStrings.inactive)
} }
return JamiStrings.pressToAction.arg(ItemAction.text) return JamiStrings.pressToAction.arg(ItemAction.text);
} }
Accessible.pressed: pressed Accessible.pressed: pressed
Accessible.checkable: ItemAction ? ItemAction.checkable : false Accessible.checkable: ItemAction ? ItemAction.checkable : false
@ -87,7 +87,7 @@ ItemDelegate {
return HalfPill.None; return HalfPill.None;
} }
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: JamiTheme.shortFadeDuration duration: JamiTheme.shortFadeDuration
} }
@ -104,7 +104,7 @@ ItemDelegate {
radius: isLast ? 5 : width / 2 radius: isLast ? 5 : width / 2
type: isLast ? HalfPill.Right : HalfPill.None type: isLast ? HalfPill.Right : HalfPill.None
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: JamiTheme.shortFadeDuration duration: JamiTheme.shortFadeDuration
} }
@ -123,7 +123,7 @@ ItemDelegate {
source: ItemAction ? ItemAction.icon.source : "" source: ItemAction ? ItemAction.icon.source : ""
color: ItemAction ? (ItemAction.enabled ? ItemAction.icon.color : Qt.lighter(ItemAction.icon.color)) : null color: ItemAction ? (ItemAction.enabled ? ItemAction.icon.color : Qt.lighter(ItemAction.icon.color)) : null
SequentialAnimation on opacity { SequentialAnimation on opacity {
loops: Animation.Infinite loops: Animation.Infinite
running: ItemAction !== undefined && ItemAction.blinksWhenChecked !== undefined && ItemAction.blinksWhenChecked && checked running: ItemAction !== undefined && ItemAction.blinksWhenChecked !== undefined && ItemAction.blinksWhenChecked && checked
onStopped: icon.opacity = 1 onStopped: icon.opacity = 1
@ -198,7 +198,7 @@ ItemDelegate {
radius: 4 radius: 4
} }
onActivated: index => menuAction.accept(index); onActivated: index => menuAction.accept(index)
model: visible ? menuAction.listModel : null model: visible ? menuAction.listModel : null
delegate: ItemDelegate { delegate: ItemDelegate {
id: menuItem id: menuItem
@ -323,7 +323,6 @@ ItemDelegate {
// it fits within the overlay, with an extra leftward margin of 24 pixels. // it fits within the overlay, with an extra leftward margin of 24 pixels.
return diff > 0 ? xValue - diff - 24 : xValue; return diff > 0 ? xValue - diff - 24 : xValue;
} }
} }
implicitWidth: contentItem.implicitWidth implicitWidth: contentItem.implicitWidth

View file

@ -43,6 +43,10 @@ TabButton {
hoverEnabled: true hoverEnabled: true
onClicked: selected() onClicked: selected()
Accessible.name: root.labelText
Accessible.role: Accessible.Button
Accessible.description: root.acceleratorSequence
Rectangle { Rectangle {
id: contentRect id: contentRect

View file

@ -940,4 +940,7 @@ Item {
property string pressToToggle: qsTr("Press to toggle %1 (%2)") property string pressToToggle: qsTr("Press to toggle %1 (%2)")
property string active: qsTr("active") property string active: qsTr("active")
property string inactive: qsTr("inactive") property string inactive: qsTr("inactive")
property string minimize: qsTr("Minimize application")
property string maximize: qsTr("Maximize application")
property string closeApplication: qsTr("Close application")
} }