Skip to content

Commit

Permalink
Fix UI spacing in migration dialogs
Browse files Browse the repository at this point in the history
Fix #23777
  • Loading branch information
shoogle committed Aug 22, 2024
1 parent cbe6e2c commit c421231
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 270 deletions.
153 changes: 90 additions & 63 deletions src/project/qml/MuseScore/Project/MigrationDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import MuseScore.Project 1.0
import "internal/Migration"

StyledDialogView {
id: dialog
id: root
modal: true

//! TODO: After setting title the accessibility for this dialog on VoiceOver stops working
//title: qsTrc("project/migration", "Style improvements")
Expand All @@ -43,35 +44,33 @@ StyledDialogView {
property bool isAskAgain: true

contentHeight: {
switch (dialog.migrationType) {
case MigrationType.Pre_3_6: return 556
case MigrationType.Ver_3_6: return 208
switch (root.migrationType) {
case MigrationType.Pre_3_6: return 533 // 517 just fits, then add 16
case MigrationType.Ver_3_6: return 271 // 255 just fits, then add 16
case MigrationType.Unknown: return 0
}
return 600
}

contentWidth: {
switch (dialog.migrationType) {
case MigrationType.Pre_3_6: return 600
case MigrationType.Ver_3_6: return 480
contentWidth: {
switch (root.migrationType) {
case MigrationType.Pre_3_6: return 590
case MigrationType.Ver_3_6: return 491
case MigrationType.Unknown: return 0
}
return 600
}

modal: true

//! NOTE Different dialogs for different migration versions
onOpened: {
switch(dialog.migrationType) {
switch(root.migrationType) {
case MigrationType.Pre_3_6:
loader.sourceComponent = migrComp
loader.sourceComponent = migrCompPre362
break;
case MigrationType.Ver_3_6:
isApplyLeland = false
isApplyEdwin = false
loader.sourceComponent = noteComp
loader.sourceComponent = migrComp362
break;
default:
console.assert(false, "Wrong migration type!")
Expand All @@ -83,10 +82,10 @@ StyledDialogView {
errcode: 0,
value: {
isApplyMigration: isApply,
isAskAgain: dialog.isAskAgain,
isApplyLeland: dialog.isApplyLeland,
isApplyEdwin: dialog.isApplyEdwin,
isRemapPercussion: dialog.isRemapPercussion,
isAskAgain: root.isAskAgain,
isApplyLeland: root.isApplyLeland,
isApplyEdwin: root.isApplyEdwin,
isRemapPercussion: root.isRemapPercussion,
}
}

Expand All @@ -97,87 +96,115 @@ StyledDialogView {
Qt.openUrlExternally("https://youtu.be/U7dagae87eM")
}

Loader {
id: loader
ColumnLayout {
spacing: 0
anchors.fill: parent

onLoaded: {
item.activateNavigation()
Loader {
id: loader

Layout.fillWidth: true
Layout.margins: 20

onLoaded: {
item.activateNavigation()
}
}

SeparatorLine { }

RowLayout {
id: footer

Layout.leftMargin: 20
Layout.rightMargin: 20
Layout.topMargin: 16
Layout.bottomMargin: 16

CheckBox {
id: askAgain
text: qsTrc("global", "Don’t ask again")
checked: !root.isAskAgain

navigation.panel: buttonBox.navigationPanel
navigation.column: 100

onClicked: {
root.isAskAgain = checked // not `!checked` because the negation is in `checked: !dialog.isAskAgain`
}
}

ButtonBox {
id: buttonBox
buttons: [ ButtonBoxModel.Ok ]

Layout.fillWidth: true

navigationPanel.section: root.navigationSection
navigationPanel.order: 1

onStandardButtonClicked: function(buttonId) {
if (buttonId === ButtonBoxModel.Ok) {
root.ret = root.makeRet(true)
root.hide()
}
}
}
}
}

//! NOTE for 3.6.2
Component {
id: noteComp
id: migrComp362

MigrationContentFor362 {
anchors.fill: parent
anchors.margins: 16
appVersion: root.appVersion
isRemapPercussion: root.isRemapPercussion

appVersion: dialog.appVersion
isAskAgain: dialog.isAskAgain
isRemapPercussion: dialog.isRemapPercussion
anchors.fill: parent

navigationPanel.section: dialog.navigationSection
navigationPanel.section: root.navigationSection
navigationPanel.order: 2

onIsRemapPercussionChangeRequested: function(remapPercussion) {
dialog.isRemapPercussion = remapPercussion
}

onIsAskAgainChangeRequested: function(askAgain) {
dialog.isAskAgain = askAgain
root.isRemapPercussion = remapPercussion
}

onWatchVideoRequested: {
dialog.watchVideo()
}

onAccess: {
dialog.ret = dialog.makeRet(true)
dialog.hide()
root.watchVideo()
}
}
}

//! NOTE for pre-3.6.2 files
Component {
id: migrComp
id: migrCompPre362

MigrationContentForPre362 {
anchors.fill: parent

appVersion: dialog.appVersion
isAskAgain: dialog.isAskAgain
appVersion: root.appVersion
isApplyLeland: root.isApplyLeland
isApplyEdwin: root.isApplyEdwin
isRemapPercussion: root.isRemapPercussion

isApplyLeland: dialog.isApplyLeland
isApplyEdwin: dialog.isApplyEdwin
isRemapPercussion: dialog.isRemapPercussion
anchors.fill: parent

navigationSection: dialog.navigationSection

onIsApplyEdwinChangeRequested: function(applyEdwin) {
dialog.isApplyEdwin = applyEdwin
}
navigationPanel.section: root.navigationSection
navigationPanel.order: 2

onIsApplyLelandChangeRequested: function(applyLeland) {
dialog.isApplyLeland = applyLeland
root.isApplyLeland = applyLeland
}

onIsRemapPercussionChangeRequested: function(remapPercussion) {
dialog.isRemapPercussion = remapPercussion
onIsApplyEdwinChangeRequested: function(applyEdwin) {
root.isApplyEdwin = applyEdwin
}

onIsAskAgainChangeRequested: function(askAgain) {
dialog.isAskAgain = askAgain
onIsRemapPercussionChangeRequested: function(remapPercussion) {
root.isRemapPercussion = remapPercussion
}

onWatchVideoRequested: {
dialog.watchVideo()
}

onAccess: {
dialog.ret = dialog.makeRet(true)
dialog.hide()
root.watchVideo()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,23 @@ import Muse.UiComponents 1.0

ColumnLayout {
id: root

spacing: 16

property string appVersion: ""
property bool isAskAgain: false
property bool isRemapPercussion: true

property NavigationPanel navigationPanel: NavigationPanel {
name: "MigrationPanel"
accessible.role: MUAccessible.Dialog
}

function activateNavigation() {
applyBtn.navigation.requestActive()
accessibleInfo.readInfo()
}

signal isAskAgainChangeRequested(bool askAgain)
signal isRemapPercussionChangeRequested(bool remapPercussion)
signal watchVideoRequested()
signal access()

property NavigationPanel navigationPanel: NavigationPanel {
name: "MigrationPanel"
accessible.role: MUAccessible.Dialog
}

AccessibleItem {
id: accessibleInfo
Expand All @@ -70,100 +66,44 @@ ColumnLayout {

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)
font: ui.theme.tabBoldFont
}

StyledTextLabel {
id: headerSubtitle

Layout.fillWidth: true
Layout.fillHeight: true

horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
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.")
wrapMode: Text.WordWrap
elide: Text.ElideNone
horizontalAlignment: Text.AlignLeft

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.")
Layout.fillHeight: true
Layout.fillWidth: true
}

CheckBox {
id: percussionOption

Layout.fillWidth: true
height: 32

text: qsTrc("project/migration", "Use our new notation and sound mapping for <a href=\"%1\">MDL percussion</a>")
.arg("https://musescore.org/en/handbook/4") // TODO: Replace with link to page about MDL migration.
checked: root.isRemapPercussion

navigation.panel: navigationPanel
navigation.row: 3
navigation.panel: root.navigationPanel
navigation.row: 1

onClicked: {
root.isRemapPercussionChangeRequested(!checked)
}
}

CheckBox {
id: askAgain

Layout.fillWidth: true
FlatButton {
id: watchVideo

text: qsTrc("global", "Don’t show this message again")
checked: !root.isAskAgain
text: qsTrc("project/migration", "Watch video about changes")

navigation.panel: navigationPanel
navigation.row: 3
navigation.panel: root.navigationPanel
navigation.row: 2

onClicked: {
root.isAskAgainChangeRequested(checked) // not `!checked` because the negation is in `checked: !root.isAskAgain`
}
}

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()
}
root.watchVideoRequested()
}
}
}
Loading

0 comments on commit c421231

Please sign in to comment.