-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25810 from mathesoncalum/percussions_refinements_3
Percussion panel - refinements round 3
- Loading branch information
Showing
39 changed files
with
1,090 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
174 changes: 174 additions & 0 deletions
174
src/appshell/qml/Preferences/PercussionPreferencesPage.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
/* | ||
* 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 | ||
|
||
PercussionPreferencesModel { | ||
id: percussionPreferencesModel | ||
} | ||
|
||
Component.onCompleted: { | ||
percussionPreferencesModel.init() | ||
} | ||
|
||
BaseSection { | ||
id: percussionPanelPreferences | ||
|
||
title: qsTrc("appshell/preferences", "Percussion") | ||
|
||
navigation.section: root.navigationSection | ||
|
||
CheckBox { | ||
id: unpitchedSelectedCheckbox | ||
|
||
visible: percussionPreferencesModel.useNewPercussionPanel | ||
width: parent.width | ||
|
||
text: qsTrc("appshell/preferences", "Open the percussion panel when an unpitched staff is selected") | ||
|
||
navigation.name: "UnpitchedSelectedCheckbox" | ||
navigation.panel: percussionPanelPreferences.navigation | ||
navigation.row: 0 | ||
|
||
checked: percussionPreferencesModel.autoShowPercussionPanel | ||
|
||
onClicked: { | ||
percussionPreferencesModel.autoShowPercussionPanel = !unpitchedSelectedCheckbox.checked | ||
} | ||
} | ||
|
||
StyledTextLabel { | ||
id: padSwapInfo | ||
|
||
visible: percussionPreferencesModel.useNewPercussionPanel | ||
width: parent.width | ||
|
||
horizontalAlignment: Text.AlignLeft | ||
wrapMode: Text.Wrap | ||
text: qsTrc("notation/percussion", "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 | ||
|
||
visible: percussionPreferencesModel.useNewPercussionPanel | ||
|
||
width: parent.width | ||
spacing: percussionPanelPreferences.spacing | ||
|
||
orientation: ListView.Vertical | ||
|
||
model: [ | ||
{ text: qsTrc("notation/percussion", "Move MIDI notes and keyboard shortcuts with their sounds"), value: true }, | ||
{ text: qsTrc("notation/percussion", "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 | ||
|
||
checked: modelData.value === percussionPreferencesModel.percussionPanelMoveMidiNotesAndShortcuts | ||
|
||
onToggled: { | ||
percussionPreferencesModel.percussionPanelMoveMidiNotesAndShortcuts = modelData.value | ||
} | ||
} | ||
|
||
//! 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: { | ||
percussionPreferencesModel.percussionPanelMoveMidiNotesAndShortcuts = modelData.value | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
CheckBox { | ||
id: alwaysAsk | ||
|
||
visible: percussionPreferencesModel.useNewPercussionPanel | ||
width: parent.width | ||
|
||
text: qsTrc("global", "Always ask") | ||
|
||
navigation.name: "AlwaysAskCheckBox" | ||
navigation.panel: percussionPanelPreferences.navigation | ||
navigation.row: radioButtons.navigationRowEnd | ||
|
||
checked: percussionPreferencesModel.showPercussionPanelPadSwapDialog | ||
|
||
onClicked: { | ||
percussionPreferencesModel.showPercussionPanelPadSwapDialog = !alwaysAsk.checked | ||
} | ||
} | ||
|
||
FlatButton { | ||
id: useNewPercussionPanel | ||
|
||
text: percussionPreferencesModel.useNewPercussionPanel ? qsTrc("notation/percussion", "Switch to old percussion panel") | ||
: qsTrc("notation/percussion", "Switch to new percussion panel") | ||
|
||
navigation.name: "SwitchPercussionPanels" | ||
navigation.panel: percussionPanelPreferences.navigation | ||
navigation.row: alwaysAsk.navigation.row + 1 | ||
|
||
onClicked: { | ||
percussionPreferencesModel.useNewPercussionPanel = !percussionPreferencesModel.useNewPercussionPanel | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
src/appshell/view/preferences/percussionpreferencesmodel.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* 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/>. | ||
*/ | ||
|
||
#include "percussionpreferencesmodel.h" | ||
|
||
PercussionPreferencesModel::PercussionPreferencesModel(QObject* parent) | ||
: QObject(parent), muse::Injectable(muse::iocCtxForQmlObject(this)) | ||
{ | ||
} | ||
|
||
void PercussionPreferencesModel::init() | ||
{ | ||
configuration()->useNewPercussionPanelChanged().onNotify(this, [this]() { | ||
emit useNewPercussionPanelChanged(); | ||
}); | ||
|
||
configuration()->autoShowPercussionPanelChanged().onNotify(this, [this]() { | ||
emit autoShowPercussionPanelChanged(); | ||
}); | ||
|
||
configuration()->showPercussionPanelPadSwapDialogChanged().onNotify(this, [this]() { | ||
emit showPercussionPanelPadSwapDialogChanged(); | ||
}); | ||
|
||
configuration()->percussionPanelMoveMidiNotesAndShortcutsChanged().onNotify(this, [this]() { | ||
emit percussionPanelMoveMidiNotesAndShortcutsChanged(); | ||
}); | ||
} | ||
|
||
bool PercussionPreferencesModel::useNewPercussionPanel() const | ||
{ | ||
return configuration()->useNewPercussionPanel(); | ||
} | ||
|
||
void PercussionPreferencesModel::setUseNewPercussionPanel(bool use) | ||
{ | ||
configuration()->setUseNewPercussionPanel(use); | ||
} | ||
|
||
bool PercussionPreferencesModel::autoShowPercussionPanel() const | ||
{ | ||
return configuration()->autoShowPercussionPanel(); | ||
} | ||
|
||
void PercussionPreferencesModel::setAutoShowPercussionPanel(bool autoShow) | ||
{ | ||
configuration()->setAutoShowPercussionPanel(autoShow); | ||
} | ||
|
||
bool PercussionPreferencesModel::showPercussionPanelPadSwapDialog() const | ||
{ | ||
return configuration()->showPercussionPanelPadSwapDialog(); | ||
} | ||
|
||
void PercussionPreferencesModel::setShowPercussionPanelPadSwapDialog(bool show) | ||
{ | ||
configuration()->setShowPercussionPanelPadSwapDialog(show); | ||
} | ||
|
||
bool PercussionPreferencesModel::percussionPanelMoveMidiNotesAndShortcuts() const | ||
{ | ||
return configuration()->percussionPanelMoveMidiNotesAndShortcuts(); | ||
} | ||
|
||
void PercussionPreferencesModel::setPercussionPanelMoveMidiNotesAndShortcuts(bool move) | ||
{ | ||
configuration()->setPercussionPanelMoveMidiNotesAndShortcuts(move); | ||
} |
Oops, something went wrong.