Skip to content

Commit

Permalink
Dialog layout fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miiizen committed Nov 14, 2024
1 parent 52f1090 commit b6a5a0c
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 92 deletions.
2 changes: 2 additions & 0 deletions src/notation/notationscene.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,7 @@
<file>qml/MuseScore/NotationScene/internal/EditStyle/NoteLineSection.qml</file>
<file>qml/MuseScore/NotationScene/internal/EditStyle/LineStyleSection.qml</file>
<file>qml/MuseScore/NotationScene/internal/EditStyle/RadioButtonSelectorWithReset.qml</file>
<file>qml/MuseScore/NotationScene/internal/EditStyle/StyleControlRowWithReset.qml</file>
<file>qml/MuseScore/NotationScene/internal/EditStyle/TextFieldWithReset.qml</file>
</qresource>
</RCC>
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,23 @@ import MuseScore.NotationScene 1.0
import Muse.UiComponents 1.0
import Muse.Ui 1.0

RowLayout {
required property StyleItem styleItem
required property string label

StyleControlRowWithReset {
id: root
property string suffix: ''
property bool inPercentage: false
property double step: 0.01

StyledTextLabel {
id: optionLabel
horizontalAlignment: Text.AlignLeft
Layout.minimumWidth: 120
text: label
}
controlWidth: 80

IncrementalPropertyControl {
Layout.preferredWidth: 80
id: spinBox
Layout.fillWidth: false

currentValue: inPercentage ? Math.round(styleItem.value * 100) : styleItem.value
minValue: 0
maxValue: inPercentage ? 999 : 99
step: inPercentage ? 1 : 0.01
step: inPercentage ? 1 : root.step
decimals: inPercentage ? 0 : 2

measureUnitsSymbol: inPercentage ? '%' : suffix
Expand All @@ -57,13 +53,4 @@ RowLayout {
}
}

Item {
Layout.fillWidth: true
}

FlatButton {
icon: IconCode.UNDO
enabled: !styleItem.isDefault
onClicked: styleItem.value = styleItem.defaultValue
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ Rectangle {
}

ColumnLayout {
width: parent.width

spacing: 12
width: parent.width

BasicStyleSelectorWithSpinboxAndReset {
styleItem: fretboardsPage.fretY
Expand All @@ -63,8 +62,9 @@ Rectangle {

RowLayout {
StyledTextLabel {
Layout.fillWidth: true
Layout.maximumWidth: 120
horizontalAlignment: Qt.AlignLeft
Layout.minimumWidth: 120
text: qsTrc("notation", "Orientation:")
}

Expand Down Expand Up @@ -97,10 +97,6 @@ Rectangle {
onToggled: fretboardsPage.fretOrientation.value = modelData.value
}
}

Item {
Layout.fillWidth: true
}
}

BasicStyleSelectorWithSpinboxAndReset {
Expand Down Expand Up @@ -214,11 +210,12 @@ Rectangle {
height: parent.height
RowLayout {
Layout.preferredHeight: 70
width: parent.width

StyledTextLabel {
Layout.minimumWidth: 120
horizontalAlignment: Text.AlignLeft
Layout.fillWidth: true
Layout.maximumWidth: 120
wrapMode: Text.WordWrap
text: qsTrc("notation", "Appearance:")
}

Expand Down Expand Up @@ -251,9 +248,6 @@ Rectangle {
onToggled: fretboardsPage.barreAppearanceSlur.value = modelData.value
}
}
Item {
Layout.fillWidth: true
}
}

BasicStyleSelectorWithSpinboxAndReset {
Expand All @@ -279,10 +273,9 @@ Rectangle {
}

RowLayout {
width: parent.width

StyledTextLabel {
Layout.minimumWidth: 120
Layout.fillWidth: true
Layout.maximumWidth: 120
horizontalAlignment: Text.AlignLeft
text: qsTrc("notation", "Fretboard style:")
}
Expand Down Expand Up @@ -316,10 +309,6 @@ Rectangle {
onToggled: fretboardsPage.fretStyleExtended.value = modelData.value
}
}

Item {
Layout.fillWidth: true
}
}

BasicStyleSelectorWithSpinboxAndReset {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ Rectangle {
id: glissandoSectionModel
}

signal goToTextStylePage(string s)

ColumnLayout {
width: parent.width
spacing: 12
Layout.minimumWidth: 120
Layout.fillWidth: true
Layout.maximumWidth: 120

RadioButtonSelectorWithReset {
styleItem: glissandoSectionModel.glissandoLineType
Expand Down Expand Up @@ -76,34 +79,18 @@ Rectangle {
}
}

StyledTextLabel {
Layout.minimumWidth: 120 - textRow.spacing - showTextCheckBox.width
horizontalAlignment: Text.AlignLeft
text: qsTrc("notation", "Show text:")
}

TextInputField {
id: textField
Layout.preferredWidth: 80
Layout.fillWidth: false
currentText: glissandoSectionModel.glissandoText ? glissandoSectionModel.glissandoText.value : ""
enabled: glissandoSectionModel.glissandoShowText

onTextEditingFinished: function(newTextValue) {
if (glissandoSectionModel.glissandoShowText) {
glissandoSectionModel.glissandoText.value = newTextValue
}
}
TextFieldWithReset {
styleItem: glissandoSectionModel.glissandoText
label: qsTrc("notation", "Show text:")
labelWidth: maxLabelWidth - showTextCheckBox.width - textRow.spacing
}
}

Item {
Layout.fillWidth: true
}
FlatButton {
text: qsTrc("notation", "Edit glissando text style")

FlatButton {
icon: IconCode.UNDO
enabled: !glissandoSectionModel.glissandoText.isDefault
onClicked: glissandoSectionModel.glissandoText.value = glissandoSectionModel.glissandoText.defaultValue
onClicked: {
root.goToTextStylePage("glissando")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ ColumnLayout {
BasicStyleSelectorWithSpinboxAndReset {
styleItem: dashLineLength
label: qsTrc("notation", "Dash:")
step: 0.1
}

BasicStyleSelectorWithSpinboxAndReset {
styleItem: dashGapLength
label: qsTrc("notation", "Gap:")
step: 0.1
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Rectangle {
id: noteLineSectionModel
}

signal goToTextStylePage(string s)

ColumnLayout {
width: parent.width
spacing: 12
Expand All @@ -49,5 +51,13 @@ Rectangle {
dashGapLength: noteLineSectionModel ? noteLineSectionModel.noteLineStyleGapSize : null
lineWidth: noteLineSectionModel ? noteLineSectionModel.noteLineWidth : null
}

FlatButton {
text: qsTrc("notation", "Edit note-anchored line text style")

onClicked: {
root.goToTextStylePage("note-line")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,18 @@ import MuseScore.NotationScene 1.0
import Muse.UiComponents 1.0
import Muse.Ui 1.0

RowLayout {
required property StyleItem styleItem
required property string label
property alias model: radioButtonGroup.model

StyledTextLabel {
id: optionLabel
horizontalAlignment: Text.AlignLeft
Layout.minimumWidth: 120
text: label
}
StyleControlRowWithReset {
id: root
property alias model: radioButtonGroup.model

RadioButtonGroup {
id: radioButtonGroup

height: 30
anchors.fill: parent

delegate: FlatRadioButton {
width: 106
height: 30

checked: modelData.value === styleItem.value
text: modelData.text ? modelData.text : ""
iconCode: modelData.iconCode ? modelData.iconCode : IconCode.NONE
Expand All @@ -58,14 +49,4 @@ RowLayout {
}
}
}

Item {
Layout.fillWidth: true
}

FlatButton {
icon: IconCode.UNDO
enabled: !styleItem.isDefault
onClicked: styleItem.value = styleItem.defaultValue
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/

import QtQuick 2.15
import QtQuick.Layouts 1.15

import MuseScore.NotationScene 1.0
import Muse.UiComponents 1.0
import Muse.Ui 1.0

RowLayout {
id: root
required property StyleItem styleItem
required property string label
readonly property double maxLabelWidth: 120
readonly property double maxControlWidth: 326

property double labelWidth: maxLabelWidth
property double controlWidth: maxControlWidth

default property alias data: control.data

property bool hasReset: true

StyledTextLabel {
id: optionLabel
horizontalAlignment: Text.AlignLeft
Layout.fillWidth: true
Layout.maximumWidth: Math.min(root.labelWidth, root.maxLabelWidth)
wrapMode: Text.WordWrap
text: label
}

Item {
id: control
Layout.preferredWidth: Math.min(root.controlWidth, root.maxControlWidth)
Layout.alignment: Qt.AlignTop
}

Item {
Layout.preferredWidth: Math.max(root.maxControlWidth - control.width - root.spacing - 1, 0)
}

FlatButton {
id: resetButton
visible: hasReset
icon: IconCode.UNDO
enabled: !styleItem.isDefault
onClicked: styleItem.value = styleItem.defaultValue
}
}
Loading

0 comments on commit b6a5a0c

Please sign in to comment.