Skip to content

Commit

Permalink
Merge pull request #26044 from Eism/dynamics_popup_nav_fix
Browse files Browse the repository at this point in the history
Dynamics popup navigation fix
  • Loading branch information
DmitryArefiev authored Jan 15, 2025
2 parents 21fdb1b + 8b9f5a5 commit fcdafac
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/appshell/qml/NotationPage/NotationPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ DockPage {
Component.onCompleted: {
root.notationView = notationView.paintView

root.setDefaultNavigationControl(root.defaultNavigationControl)
root.setDefaultNavigationControl(notationView.defaultNavigationControl)
}

Component.onDestruction: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ StyledPopupView {
name: "CapoSettings"
direction: NavigationPanel.Vertical
accessible.name: qsTrc("notation", "Capo settings")

onNavigationEvent: function(event) {
if (event.type === NavigationEvent.Escape) {
root.close()
}
}
}

StyledTextLabel {
Expand Down
74 changes: 63 additions & 11 deletions src/notation/qml/MuseScore/NotationScene/internal/DynamicPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,40 @@ StyledPopupView {
NavigationPanel {
id: dynamicsNavPanel
name: "DynamicsPopup"
direction: NavigationPanel.Vertical
direction: NavigationPanel.Horizontal
section: root.notationViewNavigationSection
order: root.navigationOrderStart
accessible.name: qsTrc("notation", "Dynamics Popup")

onNavigationEvent: function(event) {
if (event.type === NavigationEvent.Escape) {
root.close()
}
}
}

function goToPreviousPage() {
if (currentPage > 0) {
currentPage--
} else {
currentPage = dynamicModel.pages.length - 1
}

Qt.callLater(requestNavigationActive, dynamicRepeater.count - 1)
}

function goToNextPage() {
if (currentPage < dynamicModel.pages.length - 1) {
currentPage++
} else {
currentPage = 0
}

Qt.callLater(requestNavigationActive, 0)
}

function requestNavigationActive(index) {
dynamicRepeater.itemAt(index).navigation.requestActive()
}

FlatButton {
Expand All @@ -70,11 +100,7 @@ StyledPopupView {
}

onClicked: {
if (currentPage > 0) {
currentPage--
} else {
currentPage = dynamicModel.pages.length - 1
}
content.goToPreviousPage()
}
}

Expand All @@ -84,6 +110,7 @@ StyledPopupView {

Repeater {
id: dynamicRepeater

model: dynamicModel.pages[currentPage]

delegate: FlatButton {
Expand All @@ -97,6 +124,35 @@ StyledPopupView {
modelData.type === DynamicPopupModel.Crescendo ? crescHairpinComp :
modelData.type === DynamicPopupModel.Decrescendo ? dimHairpinComp : null

navigation.panel: dynamicsNavPanel
navigation.order: index
accessible.name: modelData.accessibleName
navigation.onNavigationEvent: function(event) {
switch (event.type) {
case NavigationEvent.Up:
case NavigationEvent.Left: {
if (index == 0) {
content.goToPreviousPage()

event.accepted = true
}

break
}

case NavigationEvent.Right:
case NavigationEvent.Down: {
if (index == dynamicRepeater.count - 1) {
content.goToNextPage()

event.accepted = true
}

break
}
}
}

Component {
id: dynamicComp

Expand Down Expand Up @@ -191,11 +247,7 @@ StyledPopupView {
}

onClicked: {
if (currentPage < dynamicModel.pages.length - 1) {
currentPage++
} else {
currentPage = 0
}
content.goToNextPage()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ StyledPopupView {
name: "PedalSettings"
direction: NavigationPanel.Vertical
accessible.name: qsTrc("notation", "Pedal settings buttons")

onNavigationEvent: function(event) {
if (event.type === NavigationEvent.Escape) {
root.close()
}
}
}

// Accidental symbols
Expand Down Expand Up @@ -266,6 +272,12 @@ StyledPopupView {
direction: NavigationPanel.Horizontal
order: pedalSettingsNavPanel.order + 1
accessible.name: qsTrc("notation", "Diagram type buttons")

onNavigationEvent: function(event) {
if (event.type === NavigationEvent.Escape) {
root.close()
}
}
}

RoundedRadioButton {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ StyledPopupView {
section: root.notationViewNavigationSection
order: root.navigationOrderStart
accessible.name: qsTrc("notation", "String tunings settings")

onNavigationEvent: function(event) {
if (event.type === NavigationEvent.Escape) {
root.close()
}
}
}

StyledTextLabel {
Expand Down Expand Up @@ -135,6 +141,12 @@ StyledPopupView {
section: root.notationViewNavigationSection
order: navPanel.order + 1
accessible.name: qsTrc("notation", "Strings")

onNavigationEvent: function(event) {
if (event.type === NavigationEvent.Escape) {
root.close()
}
}
}

GridLayout {
Expand Down
2 changes: 2 additions & 0 deletions src/notation/view/internal/dynamicpopupmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "engraving/dom/dynamic.h"
#include "engraving/dom/factory.h"
#include "engraving/types/symnames.h"
#include "engraving/types/typesconv.h"

#include "log.h"

Expand Down Expand Up @@ -136,6 +137,7 @@ void DynamicPopupModel::init()
for (const DynamicPopupModel::PageItem& item : page) {
QVariantMap variantMap {
{ "text", xmlTextToQString(Dynamic::dynamicText(item.dynType).toStdString(), engravingFont) },
{ "accessibleName", TConv::userName(item.dynType).translated().toQString() },
{ "width", item.width },
{ "offset", item.offset },
{ "type", item.itemType }
Expand Down
10 changes: 10 additions & 0 deletions src/playback/qml/MuseScore/Playback/SoundFlagPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ StyledPopupView {
section: root.notationViewNavigationSection
order: root.navigationOrderStart
accessible.name: qsTrc("playback", "Sound flag settings")

onNavigationEvent: function(event) {
if (event.type === NavigationEvent.Escape) {
root.close()
}
}
}

StyledIconLabel {
Expand Down Expand Up @@ -155,6 +161,10 @@ StyledPopupView {

navigationPanelSection: root.notationViewNavigationSection
navigationPanelOrderStart: navPanel.order + 1

onCloseRequested: {
root.close()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Item {

height: !noOptions ? content.childrenRect.height : noOptionsLabel.implicitHeight

signal closeRequested()

Column {
id: content

Expand Down Expand Up @@ -66,6 +68,10 @@ Item {
onToggleParamRequested: {
root.model.togglePreset(paramCode)
}

onCloseRequested: {
root.closeRequested()
}
}

ParamsGridView {
Expand All @@ -89,6 +95,10 @@ Item {
onToggleParamRequested: {
root.model.togglePlayingTechnique(paramCode)
}

onCloseRequested: {
root.closeRequested()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,16 @@ Column {
name: "SoundFlagParams" + title
direction: NavigationPanel.Vertical
accessible.name: title

onNavigationEvent: function(event) {
if (event.type === NavigationEvent.Escape) {
root.closeRequested()
}
}
}

signal toggleParamRequested(string paramCode)
signal closeRequested()

spacing: 8

Expand Down

0 comments on commit fcdafac

Please sign in to comment.