Skip to content

Commit

Permalink
Merge pull request #21841 from Eism/sound_flag_accessibility_fix
Browse files Browse the repository at this point in the history
fixed #21739: Sound Flags Accessibility
  • Loading branch information
RomanPudashkin committed Mar 7, 2024
2 parents 4ece464 + bad66ef commit a03ad21
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/engraving/dom/navigate.cpp
Expand Up @@ -33,6 +33,7 @@
#include "segment.h"
#include "spanner.h"
#include "staff.h"
#include "soundflag.h"
#include "guitarbend.h"

using namespace mu;
Expand Down Expand Up @@ -834,6 +835,11 @@ EngravingItem* Score::nextElement()
case ElementType::LAYOUT_BREAK: {
staffId = 0; // otherwise it will equal -1, which breaks the navigation
}
case ElementType::SOUND_FLAG:
if (EngravingItem* parent = toSoundFlag(e)->parentItem()) {
return parent;
}
break;
default:
break;
}
Expand Down
13 changes: 13 additions & 0 deletions src/engraving/dom/segment.cpp
Expand Up @@ -1921,6 +1921,12 @@ EngravingItem* Segment::nextElement(staff_idx_t activeStaff)
if (!m_annotations.empty()) {
EngravingItem* next = firstAnnotation(seg, activeStaff);
if (next) {
if (next->isStaffText()) {
if (SoundFlag* soundFlag = toStaffText(next)->soundFlag()) {
return soundFlag;
}
}

return next;
}
}
Expand Down Expand Up @@ -1983,6 +1989,7 @@ EngravingItem* Segment::prevElement(staff_idx_t activeStaff)
case ElementType::FRET_DIAGRAM:
case ElementType::TEMPO_TEXT:
case ElementType::STAFF_TEXT:
case ElementType::SOUND_FLAG:
case ElementType::SYSTEM_TEXT:
case ElementType::TRIPLET_FEEL:
case ElementType::PLAYTECH_ANNOTATION:
Expand All @@ -1999,6 +2006,12 @@ EngravingItem* Segment::prevElement(staff_idx_t activeStaff)
case ElementType::INSTRUMENT_CHANGE:
case ElementType::HARP_DIAGRAM:
case ElementType::STICKING: {
if (e->isStaffText()) {
if (SoundFlag* soundFlag = toStaffText(e)->soundFlag()) {
return soundFlag;
}
}

EngravingItem* prev = nullptr;
if (e->explicitParent() == this) {
prev = prevAnnotation(e);
Expand Down
34 changes: 25 additions & 9 deletions src/playback/qml/MuseScore/Playback/SoundFlagPopup.qml
Expand Up @@ -75,6 +75,15 @@ StyledPopupView {

spacing: 6

NavigationPanel {
id: navPanel
name: "SoundFlagSettings"
direction: NavigationPanel.Vertical
section: root.notationViewNavigationSection
order: root.navigationOrderStart
accessible.name: qsTrc("playback", "Sound flag settings")
}

StyledIconLabel {
Layout.preferredWidth: 24
Layout.preferredHeight: width
Expand All @@ -90,6 +99,18 @@ StyledPopupView {
text: soundFlagModel.title
font: ui.theme.largeBodyBoldFont
horizontalAlignment: Text.AlignLeft

NavigationControl {
name: "SoundFlagTitle"
enabled: titleLabel.enabled && titleLabel.visible
panel: navPanel

order: 1

accessible.role: MUAccessible.StaticText
accessible.visualItem: titleLabel
accessible.name: titleLabel.text
}
}

MenuButton {
Expand All @@ -98,14 +119,9 @@ StyledPopupView {

menuModel: soundFlagModel.contextMenuModel

navigation.panel: NavigationPanel {
id: menuNavPanel
name: "SoundFlagMenu"
direction: NavigationPanel.Vertical
section: root.notationViewNavigationSection
order: museSoundsParams.navigationPanelOrderEnd + 1
accessible.name: qsTrc("notation", "Sound flag menu")
}
navigation.panel: navPanel
navigation.order: 2
navigation.accessible.name: qsTrc("playback", "Sound flag menu")

onHandleMenuItem: function(itemId) {
soundFlagModel.handleContextMenuItem(itemId)
Expand All @@ -123,7 +139,7 @@ StyledPopupView {
visible: soundFlagModel.inited

navigationPanelSection: root.notationViewNavigationSection
navigationPanelOrderStart: root.navigationOrderStart
navigationPanelOrderStart: navPanel.order + 1
}
}
}
Expand Up @@ -100,6 +100,7 @@ Column {
Layout.preferredWidth: (gridView.width - gridView.rowSpacing) / 2
Layout.preferredHeight: implicitHeight

text: modelData["name"]
accentButton: root.selectionModel.indexOf(modelData["code"]) !== -1

drawFocusBorderInsideRect: true
Expand All @@ -116,14 +117,16 @@ Column {
}
}

accessible.name: text + "; " + (accentButton ? qsTrc("global", "On") : qsTrc("global", "Off"))

onClicked: {
root.toggleParamRequested(modelData["code"])
}

contentItem: StyledTextLabel {
width: button.width - 24 // 12px padding on each side

text: modelData["name"]
text: button.text
font: ui.theme.bodyFont
}
}
Expand Down

0 comments on commit a03ad21

Please sign in to comment.