From c5ebdbd72a8b6a39365db3fcfb4f27679b7442d1 Mon Sep 17 00:00:00 2001 From: Eism Date: Sat, 17 Sep 2022 16:49:21 +0200 Subject: [PATCH] fixed #13358: Added navigation and accessibility for migration dialog --- src/project/project.qrc | 4 +- .../qml/MuseScore/Project/MigrationDialog.qml | 236 +++------------ .../Migration/MigrationContentFor362.qml | 149 ++++++++++ .../Migration/MigrationContentForPre362.qml | 271 ++++++++++++++++++ .../{ => internal/Migration}/migration.png | Bin 5 files changed, 463 insertions(+), 197 deletions(-) create mode 100644 src/project/qml/MuseScore/Project/internal/Migration/MigrationContentFor362.qml create mode 100644 src/project/qml/MuseScore/Project/internal/Migration/MigrationContentForPre362.qml rename src/project/qml/MuseScore/Project/{ => internal/Migration}/migration.png (100%) diff --git a/src/project/project.qrc b/src/project/project.qrc index 423599e7966e1..226199f28e58f 100644 --- a/src/project/project.qrc +++ b/src/project/project.qrc @@ -37,7 +37,6 @@ qml/MuseScore/Project/internal/NewScore/TimeSignatureView.qml qml/MuseScore/Project/internal/NewScore/TitleListView.qml qml/MuseScore/Project/MigrationDialog.qml - qml/MuseScore/Project/migration.png qml/MuseScore/Project/internal/SaveToCloud/SaveLocationOption.qml qml/MuseScore/Project/internal/SaveToCloud/images/Cloud.png qml/MuseScore/Project/internal/SaveToCloud/images/Laptop.png @@ -55,5 +54,8 @@ resources/Placeholder_Other.png resources/CloudProject.svg resources/PublishScores.png + qml/MuseScore/Project/internal/Migration/MigrationContentFor362.qml + qml/MuseScore/Project/internal/Migration/MigrationContentForPre362.qml + qml/MuseScore/Project/internal/Migration/migration.png diff --git a/src/project/qml/MuseScore/Project/MigrationDialog.qml b/src/project/qml/MuseScore/Project/MigrationDialog.qml index a56c9ac48f47f..e85fa83d77d52 100644 --- a/src/project/qml/MuseScore/Project/MigrationDialog.qml +++ b/src/project/qml/MuseScore/Project/MigrationDialog.qml @@ -26,10 +26,13 @@ import MuseScore.Ui 1.0 import MuseScore.UiComponents 1.0 import MuseScore.Project 1.0 +import "internal/Migration" + StyledDialogView { id: dialog - title: qsTrc("project/migration", "Style improvements") + //! TODO: After setting title the accessibility for this dialog on VoiceOver stops working + //title: qsTrc("project/migration", "Style improvements") property string appVersion: "" property int migrationType: MigrationType.Unknown @@ -105,75 +108,36 @@ StyledDialogView { Loader { id: loader anchors.fill: parent + + onLoaded: { + item.activateNavigation() + } } //! NOTE for 3.6.2 Component { id: noteComp - ColumnLayout { - id: content - + MigrationContentFor362 { anchors.fill: parent anchors.margins: 16 - spacing: 16 - - StyledTextLabel { - id: headerTitle - - Layout.fillWidth: true - font: ui.theme.tabBoldFont + appVersion: dialog.appVersion + isAskAgain: dialog.isAskAgain - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignTop + navigationPanel.section: dialog.navigationSection - text: qsTrc("project/migration", "This file was last saved in MuseScore %1").arg(dialog.appVersion) + onIsAskAgainChangeRequested: { + dialog.isAskAgain = !dialog.isAskAgain } - StyledTextLabel { - id: headerSubtitle - - Layout.fillWidth: true - Layout.fillHeight: true - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - wrapMode: Text.WordWrap - elide: Text.ElideNone - - text: qsTrc("project/migration", "Please note that the appearance of your score will change due to improvements we have made to default settings for beaming, ties, slurs, system objects and horizontal spacing.") - } - - CheckBox { - id: askAgain - - Layout.fillWidth: true - - text: qsTrc("global", "Don't show this message again") - checked: !dialog.isAskAgain - onClicked: { dialog.isAskAgain = !dialog.isAskAgain } + onWatchVideoRequested: { + dialog.watchVideo() } - RowLayout { - FlatButton { - id: watchVideo - - text: qsTrc("project/migration", "Watch video about changes") - onClicked: { dialog.watchVideo() } - } - - Item { Layout.fillWidth: true } // spacer - - FlatButton { - id: applyBtn - - text: qsTrc("global", "OK") - onClicked: { - dialog.ret = dialog.makeRet(true) - dialog.hide() - } - } + onAccess: { + dialog.ret = dialog.makeRet(true) + dialog.hide() } } } @@ -182,151 +146,31 @@ StyledDialogView { Component { id: migrComp - Item { - id: content - + MigrationContentForPre362 { anchors.fill: parent - Column { - id: mainContent - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 16 - height: childrenRect.height - - StyledTextLabel { - id: headerTitle - anchors.left: parent.left - anchors.right: parent.right - height: 32 - - font: ui.theme.tabBoldFont - - horizontalAlignment: Qt.AlignLeft - verticalAlignment: Qt.AlignVCenter - - text: qsTrc("project/migration", "This file was last saved in MuseScore %1").arg(dialog.appVersion) - } - - StyledTextLabel { - id: headerSubtitle - anchors.left: parent.left - anchors.right: parent.right - height: 24 - - horizontalAlignment: Qt.AlignLeft - verticalAlignment: Qt.AlignVCenter - - text: qsTrc("project/migration", "Select the engraving improvements you would like to apply to your score") - } - - Item { - id: imageItem - anchors.left: parent.left - anchors.right: parent.right - height: 264 - - Image { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - height: 200 - fillMode: Image.PreserveAspectFit - source: "migration.png" - } - } - - CheckBox { - id: lelandOption - anchors.left: parent.left - height: 32 - text: qsTrc("project/migration", "Our new notation font, Leland") - checked: dialog.isApplyLeland - onClicked: dialog.isApplyLeland = !dialog.isApplyLeland - } - - CheckBox { - id: edwinOption - anchors.left: parent.left - height: 32 - text: qsTrc("project/migration", "Our new text font, Edwin") - checked: dialog.isApplyEdwin - onClicked: dialog.isApplyEdwin = !dialog.isApplyEdwin - } - - CheckBox { - id: spacingOption - anchors.left: parent.left - height: 32 - text: qsTrc("project/migration", "Automatic spacing (introduced in MuseScore 3.0)") - visible: dialog.migrationType === MigrationType.Pre300 - checked: dialog.isApplyAutoSpacing - onClicked: dialog.isApplyAutoSpacing = !dialog.isApplyAutoSpacing - } - - Item { - width: 1 - height: 16 - } - - StyledTextLabel { - id: noteLabel - anchors.left: parent.left - anchors.right: parent.right - height: 32 - - horizontalAlignment: Qt.AlignLeft - verticalAlignment: Qt.AlignVCenter - - text: qsTrc("project/migration", "Please note: score layouts will be affected by improvements to MuseScore 4") - } - - FlatButton { - id: watchVideo - - text: qsTrc("project/migration", "Watch video") - onClicked: dialog.watchVideo() - } + appVersion: dialog.appVersion + isAskAgain: dialog.isAskAgain + + isApplyLeland: dialog.isApplyLeland + isApplyEdwin: dialog.isApplyEdwin + isApplyAutoSpacing: dialog.isApplyAutoSpacing + + isPre300: dialog.migrationType === MigrationType.Pre300 + + navigationSection: dialog.navigationSection + + onIsAskAgainChangeRequested: { + dialog.isAskAgain = !dialog.isAskAgain + } + + onWatchVideoRequested: { + dialog.watchVideo() } - Item { - id: footer - - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.leftMargin: 16 - anchors.rightMargin: 16 - height: 56 - - Rectangle { - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: -16 - height: 2 - color: ui.theme.buttonColor - } - - CheckBox { - id: askAgain - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - text: qsTrc("global", "Don't ask again") - checked: !dialog.isAskAgain - onClicked: dialog.isAskAgain = !dialog.isAskAgain - } - - FlatButton { - id: applyBtn - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - text: qsTrc("global", "OK") - onClicked: { - dialog.ret = dialog.makeRet(true) - dialog.hide() - } - } + onAccess: { + dialog.ret = dialog.makeRet(true) + dialog.hide() } } } diff --git a/src/project/qml/MuseScore/Project/internal/Migration/MigrationContentFor362.qml b/src/project/qml/MuseScore/Project/internal/Migration/MigrationContentFor362.qml new file mode 100644 index 0000000000000..5aaac84026310 --- /dev/null +++ b/src/project/qml/MuseScore/Project/internal/Migration/MigrationContentFor362.qml @@ -0,0 +1,149 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-CLA-applies + * + * MuseScore + * Music Composition & Notation + * + * Copyright (C) 2021 MuseScore BVBA and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +import QtQuick 2.15 +import QtQuick.Layouts 1.15 + +import MuseScore.Ui 1.0 +import MuseScore.UiComponents 1.0 + +ColumnLayout { + id: root + + spacing: 16 + + property string appVersion: "" + property bool isAskAgain: false + + property NavigationPanel navigationPanel: NavigationPanel { + name: "MigrationPanel" + accessible.role: MUAccessible.Dialog + } + + function activateNavigation() { + applyBtn.navigation.requestActive() + accessibleInfo.readInfo() + } + + signal isAskAgainChangeRequested(bool askAgain) + signal watchVideoRequested() + signal access() + + AccessibleItem { + id: accessibleInfo + + accessibleParent: root.navigationPanel.accessible + visualItem: root + role: MUAccessible.Button + name: headerTitle.text + ". " + headerSubtitle.text + " " + applyBtn.text + + function readInfo() { + accessibleInfo.ignored = false + accessibleInfo.focused = true + } + + function resetFocus() { + accessibleInfo.ignored = true + accessibleInfo.focused = false + } + } + + StyledTextLabel { + id: headerTitle + + Layout.fillWidth: true + + font: ui.theme.tabBoldFont + + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignTop + + text: qsTrc("project/migration", "This file was last saved in MuseScore %1").arg(root.appVersion) + } + + StyledTextLabel { + id: headerSubtitle + + Layout.fillWidth: true + Layout.fillHeight: true + + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode: Text.WordWrap + elide: Text.ElideNone + + text: qsTrc("project/migration", "Please note that the appearance of your score will change due to improvements we have made to default settings for beaming, ties, slurs, system objects and horizontal spacing.") + } + + CheckBox { + id: askAgain + + Layout.fillWidth: true + + text: qsTrc("global", "Don't show this message again") + checked: !root.isAskAgain + + navigation.panel: navigationPanel + navigation.row: 3 + + onClicked: { + root.isAskAgainChangeRequested(!checked) + } + } + + RowLayout { + FlatButton { + id: watchVideo + + text: qsTrc("project/migration", "Watch video about changes") + + navigation.panel: root.navigationPanel + navigation.row: 2 + + onClicked: { + root.watchVideoRequested() + } + } + + Item { Layout.fillWidth: true } // spacer + + FlatButton { + id: applyBtn + + text: qsTrc("global", "OK") + + navigation.panel: root.navigationPanel + navigation.row: 1 + navigation.accessible.ignored: true + navigation.onActiveChanged: { + if (!navigation.active) { + accessible.ignored = false + accessible.focused = true + accessibleInfo.resetFocus() + } + } + + onClicked: { + root.access() + } + } + } +} diff --git a/src/project/qml/MuseScore/Project/internal/Migration/MigrationContentForPre362.qml b/src/project/qml/MuseScore/Project/internal/Migration/MigrationContentForPre362.qml new file mode 100644 index 0000000000000..07fcdd0eb7568 --- /dev/null +++ b/src/project/qml/MuseScore/Project/internal/Migration/MigrationContentForPre362.qml @@ -0,0 +1,271 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-CLA-applies + * + * MuseScore + * Music Composition & Notation + * + * Copyright (C) 2021 MuseScore BVBA and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +import QtQuick 2.15 +import QtQuick.Layouts 1.15 + +import MuseScore.Ui 1.0 +import MuseScore.UiComponents 1.0 +import MuseScore.Project 1.0 + +Item { + id: root + + property string appVersion: "" + property bool isAskAgain: false + + property bool isApplyLeland: true + property bool isApplyEdwin: true + property bool isApplyAutoSpacing: true + + property bool isPre300: false + + property NavigationSection navigationSection: null + + function activateNavigation() { + applyBtn.navigation.requestActive() + accessibleInfo.readInfo() + } + + signal isAskAgainChangeRequested(bool askAgain) + signal isApplyLelandChangeRequested(bool applyLeland) + signal isApplyEdwinChangeRequested(bool applyEdwin) + signal isApplyAutoSpacingChangeRequested(bool applyAutoSpacing) + + signal watchVideoRequested() + signal access() + + AccessibleItem { + id: accessibleInfo + + accessibleParent: footer.navigationPanel.accessible + visualItem: root + role: MUAccessible.Button + name: headerTitle.text + ". " + headerSubtitle.text + " " + applyBtn.text + + function readInfo() { + accessibleInfo.ignored = false + accessibleInfo.focused = true + } + + function resetFocus() { + accessibleInfo.ignored = true + accessibleInfo.focused = false + } + } + + Column { + id: mainContent + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 16 + height: childrenRect.height + + property NavigationPanel navigationPanel: NavigationPanel { + name: "MigrationContentPanel" + section: root.navigationSection + accessible.role: MUAccessible.Dialog + order: 2 + } + + StyledTextLabel { + id: headerTitle + anchors.left: parent.left + anchors.right: parent.right + height: 32 + + font: ui.theme.tabBoldFont + + horizontalAlignment: Qt.AlignLeft + verticalAlignment: Qt.AlignVCenter + + text: qsTrc("project/migration", "This file was last saved in MuseScore %1").arg(root.appVersion) + } + + StyledTextLabel { + id: headerSubtitle + anchors.left: parent.left + anchors.right: parent.right + height: 24 + + horizontalAlignment: Qt.AlignLeft + verticalAlignment: Qt.AlignVCenter + + text: qsTrc("project/migration", "Select the engraving improvements you would like to apply to your score") + } + + Item { + id: imageItem + anchors.left: parent.left + anchors.right: parent.right + height: 264 + + Image { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + height: 200 + fillMode: Image.PreserveAspectFit + source: "migration.png" + } + } + + CheckBox { + id: lelandOption + anchors.left: parent.left + height: 32 + text: qsTrc("project/migration", "Our new notation font, Leland") + checked: root.isApplyLeland + + navigation.panel: mainContent.navigationPanel + navigation.row: 1 + + onClicked: { + root.isApplyLelandChangeRequested(!checked) + } + } + + CheckBox { + id: edwinOption + anchors.left: parent.left + height: 32 + text: qsTrc("project/migration", "Our new text font, Edwin") + checked: root.isApplyEdwin + + navigation.panel: mainContent.navigationPanel + navigation.row: 2 + + onClicked: { + root.isApplyEdwinChangeRequested(!checked) + } + } + + CheckBox { + id: spacingOption + anchors.left: parent.left + height: 32 + text: qsTrc("project/migration", "Automatic spacing (introduced in MuseScore 3.0)") + visible: root.isPre300 + checked: root.isApplyAutoSpacing + + navigation.panel: mainContent.navigationPanel + navigation.row: 3 + + onClicked: { + root.isApplyAutoSpacingChangeRequested(!checked) + } + } + + Item { + width: 1 + height: 16 + } + + StyledTextLabel { + id: noteLabel + anchors.left: parent.left + anchors.right: parent.right + height: 32 + + horizontalAlignment: Qt.AlignLeft + verticalAlignment: Qt.AlignVCenter + + text: qsTrc("project/migration", "Please note: score layouts will be affected by improvements to MuseScore 4") + } + + FlatButton { + id: watchVideo + + text: qsTrc("project/migration", "Watch video") + + navigation.panel: mainContent.navigationPanel + navigation.row: 4 + + onClicked: { + root.watchVideoRequested() + } + } + } + + Item { + id: footer + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.leftMargin: 16 + anchors.rightMargin: 16 + height: 56 + + property NavigationPanel navigationPanel: NavigationPanel { + name: "MigrationFooterPanel" + section: root.navigationSection + accessible.role: MUAccessible.Dialog + order: 1 + } + + Rectangle { + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: -16 + height: 2 + color: ui.theme.buttonColor + } + + CheckBox { + id: askAgain + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + text: qsTrc("global", "Don't ask again") + checked: !root.isAskAgain + + navigation.panel: footer.navigationPanel + navigation.row: 2 + + onClicked: { + root.isAskAgainChangeRequested(!checked) + } + } + + FlatButton { + id: applyBtn + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: qsTrc("global", "OK") + + navigation.panel: footer.navigationPanel + navigation.row: 1 + navigation.accessible.ignored: true + navigation.onActiveChanged: { + if (!navigation.active) { + accessible.ignored = false + accessible.focused = true + accessibleInfo.resetFocus() + } + } + + onClicked: { + root.access() + } + } + } +} diff --git a/src/project/qml/MuseScore/Project/migration.png b/src/project/qml/MuseScore/Project/internal/Migration/migration.png similarity index 100% rename from src/project/qml/MuseScore/Project/migration.png rename to src/project/qml/MuseScore/Project/internal/Migration/migration.png