moved Settings to DevTools
This commit is contained in:
parent
3afd1b1f1a
commit
2f3a6dbf39
4 changed files with 176 additions and 187 deletions
|
@ -6,6 +6,7 @@ import MuseScore.UiComponents 1.0
|
|||
import MuseScore.Plugins 1.0
|
||||
import MuseScore.Audio 1.0
|
||||
|
||||
import "../Settings"
|
||||
import "./Gallery"
|
||||
import "./Interactive"
|
||||
import "./NotationDialogs"
|
||||
|
@ -37,6 +38,7 @@ DockPage {
|
|||
anchors.right: parent.right
|
||||
|
||||
model: [
|
||||
{ "name": "settings", "title": "Settings" },
|
||||
{ "name": "gallery", "title": "UI Gallery" },
|
||||
{ "name": "interactive", "title": "Interactive" },
|
||||
{ "name": "mu3dialogs", "title": "MU3Dialogs" },
|
||||
|
@ -60,11 +62,12 @@ DockPage {
|
|||
id: devtoolsCentral
|
||||
objectName: "devtoolsCentral"
|
||||
|
||||
property var currentComp: galleryComp
|
||||
property var currentComp: settingsComp
|
||||
|
||||
function load(name) {
|
||||
console.info("loadCentral: " + name)
|
||||
switch (name) {
|
||||
case "settings": currentComp = settingsComp; break
|
||||
case "gallery": currentComp = galleryComp; break
|
||||
case "interactive": currentComp = interactiveComp; break
|
||||
case "mu3dialogs": currentComp = notationDialogs; break
|
||||
|
@ -86,6 +89,11 @@ DockPage {
|
|||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: settingsComp
|
||||
SettingsPage {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: galleryComp
|
||||
GeneralComponentsGallery {}
|
||||
|
|
|
@ -26,10 +26,6 @@ Rectangle {
|
|||
title: qsTrc("appshell", "Publish"),
|
||||
uri: "musescore://publish"
|
||||
},
|
||||
{
|
||||
title: qsTrc("appshell", "Settings"),
|
||||
uri: "musescore://settings"
|
||||
},
|
||||
{
|
||||
title: qsTrc("appshell", "DevTools"),
|
||||
uri: "musescore://devtools"
|
||||
|
@ -39,7 +35,7 @@ Rectangle {
|
|||
signal selected(string uri)
|
||||
|
||||
function select(uri) {
|
||||
root.selected(uri);
|
||||
root.selected(uri)
|
||||
}
|
||||
|
||||
RadioButtonGroup {
|
||||
|
|
|
@ -7,201 +7,190 @@ import MuseScore.UiComponents 1.0
|
|||
import MuseScore.Dock 1.0
|
||||
import MuseScore.Settings 1.0
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
DockPage {
|
||||
id: settingsPage
|
||||
objectName: "settings"
|
||||
color: ui.theme.backgroundPrimaryColor
|
||||
|
||||
central: DockCentral {
|
||||
id: settingsCentral
|
||||
objectName: "settingsCentral"
|
||||
SettingListModel {
|
||||
id: settingsModel
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Component.onCompleted: {
|
||||
settingsModel.load()
|
||||
}
|
||||
|
||||
id: content
|
||||
color: ui.theme.backgroundPrimaryColor
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
|
||||
SettingListModel {
|
||||
id: settingsModel
|
||||
}
|
||||
model: settingsModel
|
||||
|
||||
Component.onCompleted: {
|
||||
settingsModel.load()
|
||||
}
|
||||
|
||||
ListView {
|
||||
section.property: "sectionRole"
|
||||
section.delegate: Rectangle {
|
||||
width: parent.width
|
||||
height: 24
|
||||
color: ui.theme.backgroundSecondaryColor
|
||||
StyledTextLabel {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
text: section
|
||||
}
|
||||
}
|
||||
|
||||
model: settingsModel
|
||||
delegate: Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 8
|
||||
anchors.rightMargin: 8
|
||||
height: 32
|
||||
color: root.color
|
||||
|
||||
section.property: "sectionRole"
|
||||
section.delegate: Rectangle {
|
||||
width: parent.width
|
||||
height: 24
|
||||
color: ui.theme.backgroundSecondaryColor
|
||||
StyledTextLabel {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
text: section
|
||||
}
|
||||
}
|
||||
StyledTextLabel {
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: control.left
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
|
||||
delegate: Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: 8
|
||||
anchors.rightMargin: 8
|
||||
height: 32
|
||||
color: content.color
|
||||
text: keyRole
|
||||
}
|
||||
|
||||
StyledTextLabel {
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: control.left
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
Item {
|
||||
id: control
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 2
|
||||
width: 150
|
||||
|
||||
text: keyRole
|
||||
}
|
||||
|
||||
Item {
|
||||
id: control
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 2
|
||||
width: 150
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
property var val: valRole
|
||||
anchors.fill: parent
|
||||
sourceComponent: content.componentByType(typeRole)
|
||||
onLoaded: loader.item.val = loader.val
|
||||
onValChanged: {
|
||||
if (loader.item) {
|
||||
loader.item.val = loader.val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: loader.item
|
||||
function onChanged(newVal) {
|
||||
settingsModel.changeVal(model.index, newVal)
|
||||
}
|
||||
Loader {
|
||||
id: loader
|
||||
property var val: valRole
|
||||
anchors.fill: parent
|
||||
sourceComponent: root.componentByType(typeRole)
|
||||
onLoaded: loader.item.val = loader.val
|
||||
onValChanged: {
|
||||
if (loader.item) {
|
||||
loader.item.val = loader.val
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function componentByType(type) {
|
||||
switch (type) {
|
||||
case "Undefined": return textComp;
|
||||
case "Bool": return boolComp;
|
||||
case "Int": return intComp;
|
||||
case "Double": return doubleComp;
|
||||
case "String": return textComp;
|
||||
case "Color": return colorComp;
|
||||
}
|
||||
|
||||
return textComp;
|
||||
}
|
||||
|
||||
Component {
|
||||
id: textComp
|
||||
|
||||
Rectangle {
|
||||
id: textControl
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.fill: parent
|
||||
border.width: 1
|
||||
border.color: ui.theme.strokeColor
|
||||
TextEdit {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: val
|
||||
onEditingFinished: textControl.changed(text)
|
||||
Connections {
|
||||
target: loader.item
|
||||
function onChanged(newVal) {
|
||||
settingsModel.changeVal(model.index, newVal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: colorComp
|
||||
Rectangle {
|
||||
id: colorControl
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.fill: parent
|
||||
color: val
|
||||
|
||||
ColorDialog {
|
||||
id: colorDialog
|
||||
title: "Please choose a color"
|
||||
onAccepted: colorControl.changed(colorDialog.color)
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: colorDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: intComp
|
||||
SpinBox {
|
||||
id: spinbox
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.fill: parent
|
||||
value: val
|
||||
stepSize: 1
|
||||
textFromValue: function(value, locale) { return String(value) }
|
||||
valueFromText: function(text, locale) { return Number(text) }
|
||||
onValueModified: spinbox.changed(Number(spinbox.value))
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: doubleComp
|
||||
SpinBox {
|
||||
id: spinbox
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.centerIn: parent
|
||||
value: val * 10
|
||||
stepSize: 10
|
||||
from: -1000
|
||||
to: 1000
|
||||
|
||||
property int decimals: 1
|
||||
property real realValue: value / 10
|
||||
|
||||
textFromValue: function(value, locale) {
|
||||
return Number(value / 10).toLocaleString(locale, 'f', spinbox.decimals)
|
||||
}
|
||||
|
||||
valueFromText: function(text, locale) {
|
||||
return Number.fromLocaleString(locale, text) * 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: boolComp
|
||||
CheckBox {
|
||||
id: checkbox
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.fill: parent
|
||||
checked: val ? true : false
|
||||
onClicked: checkbox.changed(!checkbox.checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function componentByType(type) {
|
||||
switch (type) {
|
||||
case "Undefined": return textComp;
|
||||
case "Bool": return boolComp;
|
||||
case "Int": return intComp;
|
||||
case "Double": return doubleComp;
|
||||
case "String": return textComp;
|
||||
case "Color": return colorComp;
|
||||
}
|
||||
|
||||
return textComp;
|
||||
}
|
||||
|
||||
Component {
|
||||
id: textComp
|
||||
|
||||
Rectangle {
|
||||
id: textControl
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.fill: parent
|
||||
border.width: 1
|
||||
border.color: ui.theme.strokeColor
|
||||
TextEdit {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: val
|
||||
onEditingFinished: textControl.changed(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: colorComp
|
||||
Rectangle {
|
||||
id: colorControl
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.fill: parent
|
||||
color: val
|
||||
|
||||
ColorDialog {
|
||||
id: colorDialog
|
||||
title: "Please choose a color"
|
||||
onAccepted: colorControl.changed(colorDialog.color)
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: colorDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: intComp
|
||||
SpinBox {
|
||||
id: spinbox
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.fill: parent
|
||||
value: val
|
||||
stepSize: 1
|
||||
textFromValue: function(value, locale) { return String(value) }
|
||||
valueFromText: function(text, locale) { return Number(text) }
|
||||
onValueModified: spinbox.changed(Number(spinbox.value))
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: doubleComp
|
||||
SpinBox {
|
||||
id: spinbox
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.centerIn: parent
|
||||
value: val * 10
|
||||
stepSize: 10
|
||||
from: -1000
|
||||
to: 1000
|
||||
|
||||
property int decimals: 1
|
||||
property real realValue: value / 10
|
||||
|
||||
textFromValue: function(value, locale) {
|
||||
return Number(value / 10).toLocaleString(locale, 'f', spinbox.decimals)
|
||||
}
|
||||
|
||||
valueFromText: function(text, locale) {
|
||||
return Number.fromLocaleString(locale, text) * 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: boolComp
|
||||
CheckBox {
|
||||
id: checkbox
|
||||
property var val
|
||||
signal changed(var newVal)
|
||||
anchors.fill: parent
|
||||
checked: val ? true : false
|
||||
onClicked: checkbox.changed(!checkbox.checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ DockWindow {
|
|||
toolbars: [
|
||||
DockToolBar {
|
||||
objectName: "mainToolBar"
|
||||
minimumWidth: 456
|
||||
minimumWidth: 376
|
||||
minimumHeight: dockWindow.toolbarHeight
|
||||
|
||||
color: dockWindow.color
|
||||
|
@ -100,10 +100,6 @@ DockWindow {
|
|||
uri: "musescore://publish"
|
||||
}
|
||||
|
||||
SettingsPage {
|
||||
uri: "musescore://settings"
|
||||
}
|
||||
|
||||
DevToolsPage {
|
||||
uri: "musescore://devtools"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue