From c342e03749e436c3a619c8637c3ad3f513ae2083 Mon Sep 17 00:00:00 2001 From: Eism Date: Wed, 15 Sep 2021 15:16:02 +0200 Subject: [PATCH] Simplified the canvas page --- src/appshell/appshell.qrc | 2 + .../qml/Preferences/CanvasPreferencesPage.qml | 132 +++--------------- .../internal/ScrollPagesSection.qml | 85 +++++++++++ .../qml/Preferences/internal/ZoomSection.qml | 98 +++++++++++++ .../Shortcuts/MidiDeviceMappingPage.qml | 2 + 5 files changed, 205 insertions(+), 114 deletions(-) create mode 100644 src/appshell/qml/Preferences/internal/ScrollPagesSection.qml create mode 100644 src/appshell/qml/Preferences/internal/ZoomSection.qml diff --git a/src/appshell/appshell.qrc b/src/appshell/appshell.qrc index a9fe87d104..f73fb83290 100644 --- a/src/appshell/appshell.qrc +++ b/src/appshell/appshell.qrc @@ -86,5 +86,7 @@ qml/Preferences/internal/FoldersSection.qml qml/Preferences/internal/ResetThemeButtonSection.qml qml/Preferences/internal/AdvancedTopSection.qml + qml/Preferences/internal/ZoomSection.qml + qml/Preferences/internal/ScrollPagesSection.qml diff --git a/src/appshell/qml/Preferences/CanvasPreferencesPage.qml b/src/appshell/qml/Preferences/CanvasPreferencesPage.qml index 43167e2466..f75cda45f1 100644 --- a/src/appshell/qml/Preferences/CanvasPreferencesPage.qml +++ b/src/appshell/qml/Preferences/CanvasPreferencesPage.qml @@ -43,132 +43,36 @@ PreferencesPage { anchors.fill: parent spacing: 24 - Column { - anchors.left: parent.left - anchors.right: parent.right - spacing: 18 + ZoomSection { + defaultZoom: preferencesModel.defaultZoom + zoomTypes: preferencesModel.zoomTypes() + mouseZoomPrecision: preferencesModel.mouseZoomPrecision - StyledTextLabel { - text: qsTrc("appshell", "Zoom") - font: ui.theme.bodyBoldFont + onDefaultZoomTypeChangeRequested: { + preferencesModel.setDefaultZoomType(zoomType) } - Column { - spacing: 8 + onDefaultZoomLevelChangeRequested: { + preferencesModel.setDefaultZoomLevel(zoomLevel) + } - Row { - spacing: 12 - - ComboBoxWithTitle { - title: qsTrc("appshell", "Default zoom:") - titleWidth: 210 - - control.textRole: "title" - control.valueRole: "value" - - currentIndex: control.indexOfValue(preferencesModel.defaultZoom.type) - - model: preferencesModel.zoomTypes() - - onValueEdited: { - preferencesModel.setDefaultZoomType(newValue) - } - } - - IncrementalPropertyControl { - id: defaultZoomControl - width: 64 - - maxValue: 1600 - minValue: 10 - step: 10 - decimals: 0 - - measureUnitsSymbol: "%" - - currentValue: preferencesModel.defaultZoom.level - enabled: preferencesModel.defaultZoom.isPercentage - - onValueEdited: { - preferencesModel.setDefaultZoomLevel(newValue) - } - } - } - - IncrementalPropertyControlWithTitle { - title: qsTrc("appshell", "Mouse zoom precision:") - - titleWidth: 208 - control.width: 60 - - minValue: 1 - maxValue: 16 - currentValue: preferencesModel.mouseZoomPrecision - - onValueEdited: { - preferencesModel.mouseZoomPrecision = newValue - } - } + onMouseZoomPrecisionChangeRequested: { + preferencesModel.mouseZoomPrecision = zoomPrecision } } SeparatorLine { } - Column { - anchors.left: parent.left - anchors.right: parent.right - spacing: 18 + ScrollPagesSection { + orientation: preferencesModel.scrollPagesOrientation + limitScrollArea: preferencesModel.limitScrollArea - StyledTextLabel { - text: qsTrc("appshell", "Scroll pages") - font: ui.theme.bodyBoldFont + onOrientationChangeRequested: { + preferencesModel.scrollPagesOrientation = orientation } - Column { - spacing: 16 - - RadioButtonGroup { - id: radioButtonList - - width: 100 - height: implicitHeight - - spacing: 12 - orientation: ListView.Vertical - - model: [ - { title: qsTrc("appshell", "Horizontal"), value: Qt.Horizontal }, - { title: qsTrc("appshell", "Vertical"), value: Qt.Vertical } - ] - - delegate: RoundedRadioButton { - width: parent.width - leftPadding: 0 - spacing: 6 - - ButtonGroup.group: radioButtonList.radioButtonGroup - - checked: preferencesModel.scrollPagesOrientation === modelData["value"] - - StyledTextLabel { - text: modelData["title"] - horizontalAlignment: Text.AlignLeft - } - - onToggled: { - preferencesModel.scrollPagesOrientation = modelData["value"] - } - } - } - - CheckBox { - text: qsTrc("appshell", "Limit scroll area to page borders") - checked: preferencesModel.limitScrollArea - - onClicked: { - preferencesModel.limitScrollArea = !preferencesModel.limitScrollArea - } - } + onLimitScrollAreaChangeRequested: { + preferencesModel.limitScrollArea = limit } } } diff --git a/src/appshell/qml/Preferences/internal/ScrollPagesSection.qml b/src/appshell/qml/Preferences/internal/ScrollPagesSection.qml new file mode 100644 index 0000000000..3c4a3e939e --- /dev/null +++ b/src/appshell/qml/Preferences/internal/ScrollPagesSection.qml @@ -0,0 +1,85 @@ +/* + * 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.Controls 2.15 + +import MuseScore.UiComponents 1.0 + +BaseSection { + id: root + + title: qsTrc("appshell", "Scroll pages") + + property int orientation: Qt.Horizontal + property alias limitScrollArea: limitScrollAreaBox.checked + + signal orientationChangeRequested(int orientation) + signal limitScrollAreaChangeRequested(bool limit) + + Column { + spacing: 16 + + RadioButtonGroup { + id: radioButtonList + + width: 100 + height: implicitHeight + + spacing: 12 + orientation: ListView.Vertical + + model: [ + { title: qsTrc("appshell", "Horizontal"), value: Qt.Horizontal }, + { title: qsTrc("appshell", "Vertical"), value: Qt.Vertical } + ] + + delegate: RoundedRadioButton { + width: parent.width + leftPadding: 0 + spacing: 6 + + ButtonGroup.group: radioButtonList.radioButtonGroup + + checked: root.orientation === modelData["value"] + + StyledTextLabel { + text: modelData["title"] + horizontalAlignment: Text.AlignLeft + } + + onToggled: { + root.orientationChangeRequested(modelData["value"]) + } + } + } + + CheckBox { + id: limitScrollAreaBox + + text: qsTrc("appshell", "Limit scroll area to page borders") + + onClicked: { + root.limitScrollAreaChangeRequested(!checked) + } + } + } +} diff --git a/src/appshell/qml/Preferences/internal/ZoomSection.qml b/src/appshell/qml/Preferences/internal/ZoomSection.qml new file mode 100644 index 0000000000..cd71fd3897 --- /dev/null +++ b/src/appshell/qml/Preferences/internal/ZoomSection.qml @@ -0,0 +1,98 @@ +/* + * 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.Controls 2.15 + +import MuseScore.UiComponents 1.0 + +BaseSection { + id: root + + title: qsTrc("appshell", "Zoom") + + property var defaultZoom: null + property alias zoomTypes: defaultZoomTypesBox.model + property alias mouseZoomPrecision: mouseZoomPrecisionControl.currentValue + + signal defaultZoomTypeChangeRequested(int zoomType) + signal defaultZoomLevelChangeRequested(int zoomLevel) + signal mouseZoomPrecisionChangeRequested(int zoomPrecision) + + Column { + spacing: 8 + + Row { + spacing: 12 + + ComboBoxWithTitle { + id: defaultZoomTypesBox + + title: qsTrc("appshell", "Default zoom:") + titleWidth: 210 + + control.textRole: "title" + control.valueRole: "value" + + currentIndex: control.indexOfValue(root.defaultZoom.type) + + onValueEdited: { + root.defaultZoomTypeChangeRequested(newValue) + } + } + + IncrementalPropertyControl { + id: defaultZoomControl + width: 64 + + maxValue: 1600 + minValue: 10 + step: 10 + decimals: 0 + + measureUnitsSymbol: "%" + + currentValue: root.defaultZoom.level + enabled: root.defaultZoom.isPercentage + + onValueEdited: { + root.defaultZoomLevelChangeRequested(newValue) + } + } + } + + IncrementalPropertyControlWithTitle { + id: mouseZoomPrecisionControl + + title: qsTrc("appshell", "Mouse zoom precision:") + + titleWidth: 208 + control.width: 60 + + minValue: 1 + maxValue: 16 + + onValueEdited: { + root.mouseZoomPrecisionChangeRequested(newValue) + } + } + } +} diff --git a/src/framework/shortcuts/qml/MuseScore/Shortcuts/MidiDeviceMappingPage.qml b/src/framework/shortcuts/qml/MuseScore/Shortcuts/MidiDeviceMappingPage.qml index 3fff3aaca0..8b6cda7fb0 100644 --- a/src/framework/shortcuts/qml/MuseScore/Shortcuts/MidiDeviceMappingPage.qml +++ b/src/framework/shortcuts/qml/MuseScore/Shortcuts/MidiDeviceMappingPage.qml @@ -69,6 +69,8 @@ Item { spacing: 20 MidiMappingTopPanel { + useRemoteControl: mappingsModel.useRemoteControl + navigation.section: root.navigationSection navigation.order: root.navigationOrderStart + 1