-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Percussion panel - refinements round 3 #25810
Merged
mathesoncalum
merged 10 commits into
musescore:master
from
mathesoncalum:percussions_refinements_3
Dec 20, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
60d9b72
Percussion panel - escape to finish editing
mathesoncalum ea82362
Percussion panel - various navigation fixes
mathesoncalum 36cc850
Percussion panel - copy change (Instrument names to Pad names)
mathesoncalum ab11c42
Don't always move focus to notation when entering note input
mathesoncalum 3dd2de2
Percussion panel - keep focus in panel when starting note entry
mathesoncalum 7497598
Percussion panel - implement sound title label
mathesoncalum 71e9a30
Percussion panel - implement pad swap options dialog
mathesoncalum 393cb6d
Added percussion preferences page
mathesoncalum 7c43a48
Implement percussion preferences
mathesoncalum a728361
Added notation/percussion translation context
mathesoncalum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should improve it and add the ability to specify the wrap mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - I'll address this in a separate PR.