Skip to content

Commit

Permalink
Added percussion preferences page
Browse files Browse the repository at this point in the history
  • Loading branch information
mathesoncalum committed Dec 17, 2024
1 parent 4e9f77b commit 99531ef
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/appshell/appshell.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,6 @@
<file>qml/Preferences/internal/MixerSection.qml</file>
<file>qml/DevTools/Extensions/ExtensionsListView.qml</file>
<file>qml/platform/PlatformMenuBar.qml</file>
<file>qml/Preferences/PercussionPreferencesPage.qml</file>
</qresource>
</RCC>
161 changes: 161 additions & 0 deletions src/appshell/qml/Preferences/PercussionPreferencesPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-Studio-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2024 MuseScore Limited
*
* 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 Muse.Ui 1.0
import Muse.UiComponents 1.0
import MuseScore.Preferences 1.0

import "internal"

PreferencesPage {
id: root

BaseSection {
id: percussionPanelPreferences

title: qsTrc("appshell/preferences", "Percussion")

navigation.section: root.navigationSection

CheckBox {
id: unpitchedSelectedCheckbox
width: parent.width

text: qsTrc("notation", "Open the percussion panel when an unpitched staff is selected")

navigation.name: "UnpitchedSelectedCheckbox"
navigation.panel: percussionPanelPreferences.navigation
navigation.row: 0

onClicked: {
// TODO: configuration - toggle autoShowPercussionPanel
}
}

StyledTextLabel {
id: padSwapInfo

width: parent.width

horizontalAlignment: Text.AlignLeft
wrapMode: Text.Wrap
text: qsTrc("notation", "When swapping the positions of two drum pads: ")
}

RadioButtonGroup {
id: radioButtons

property int navigationRowStart: unpitchedSelectedCheckbox.navigation.row + 1
property int navigationRowEnd: radioButtons.navigationRowStart + model.length

width: parent.width
spacing: percussionPanelPreferences.spacing

orientation: ListView.Vertical

model: [
{ text: qsTrc("notation", "Move MIDI notes and keyboard shortcuts with their sounds"), value: true },
{ text: qsTrc("notation", "Leave MIDI notes and keyboard shortcuts fixed to original pad positions"), value: false }
]

delegate: Row {
width: parent.width
spacing: 6

RoundedRadioButton {
id: radioButton

anchors.verticalCenter: parent.verticalCenter

navigation.name: modelData.text
navigation.panel: percussionPanelPreferences.navigation
navigation.row: radioButtons.navigationRowStart + model.index

// TODO: checked: modelData.value === pad swap preference

onToggled: {
// TODO: configuration - change pad swap preference
}
}

//! NOTE: Can't use radioButton.text because it won't wrap
StyledTextLabel {
width: parent.width - parent.spacing - radioButton.width

anchors.verticalCenter: parent.verticalCenter

horizontalAlignment: Text.AlignLeft
wrapMode: Text.Wrap
text: modelData.text

MouseArea {
id: mouseArea

anchors.fill: parent

onClicked: {
// TODO: configuration - change pad swap preference
}
}
}
}
}

CheckBox {
id: alwaysAsk

width: parent.width

text: qsTrc("notation", "Always ask")

navigation.name: "AlwaysAskCheckBox"
navigation.panel: percussionPanelPreferences.navigation
navigation.row: radioButtons.navigationRowEnd

onClicked: {
// TODO: configuration - toggle "show pad swap dialog"
}
}
}

FlatButton {
id: useNewPercussionPanel

anchors {
top: percussionPanelPreferences.bottom
topMargin: percussionPanelPreferences.spacing
left: parent.left
}

text: qsTrc("notation", "Switch to old percussion panel") // TODO: "old/new" depending on current configuration...

navigation.name: "SwitchPercussionPanels"
navigation.panel: percussionPanelPreferences.navigation
navigation.row: alwaysAsk.navigation.row + 1

onClicked: {
// TODO: configuration - toggle use of new percussion panel
}
}
}
3 changes: 3 additions & 0 deletions src/appshell/view/preferences/preferencesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ void PreferencesModel::load(const QString& currentPageId)
makeItem("midi-device-mapping", QT_TRANSLATE_NOOP("appshell/preferences", "MIDI mappings"), IconCode::Code::MIDI_INPUT,
"Preferences/MidiDeviceMappingPreferencesPage.qml"),

makeItem("percussion", QT_TRANSLATE_NOOP("appshell/preferences", "Percussion"), IconCode::Code::PERCUSSION,
"Preferences/PercussionPreferencesPage.qml"),

makeItem("import", QT_TRANSLATE_NOOP("appshell/preferences", "Import"), IconCode::Code::IMPORT,
"Preferences/ImportPreferencesPage.qml"),

Expand Down
2 changes: 2 additions & 0 deletions src/framework/ui/view/iconcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,8 @@ class IconCode
LV_CHORD_OUTSIDE = 0xF47F,
LV_CHORD_INSIDE = 0xF480,

PERCUSSION = 0xF479,

SYSTEM_LOCK_START = 0xF481,
SYSTEM_LOCK_END = 0xF482,

Expand Down

0 comments on commit 99531ef

Please sign in to comment.