-
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 4 #25958
base: master
Are you sure you want to change the base?
Percussion panel - refinements round 4 #25958
Conversation
5ac593c
to
ce17022
Compare
Cheers @cbjeukendrup - that should be everything addressed now |
? TranslatableString("notation/percussion", "Finish editing") | ||
: TranslatableString("notation/percussion", "Edit layout"); | ||
const int editLayoutIcon = static_cast<int>(IconCode::Code::CONFIGURE); | ||
static const auto editLayoutTitle = m_currentPanelMode == PanelMode::Mode::EDIT_LAYOUT |
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.
This static
depends on the non-static m_currentPanelMode
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.
Actually, in this method, there is no need to use TranslatableString
, because the only thing you do with it, is calling .qTranslated()
. So it should be possible to use just qtrc
.
@@ -224,8 +224,7 @@ void PercussionPanelModel::finishEditing(bool discardChanges) | |||
} | |||
|
|||
// Return if nothing changed after edit... | |||
if (inst->drumset() && updatedDrumset | |||
&& *inst->drumset() == *updatedDrumset) { | |||
if (inst->drumset() && *inst->drumset() == updatedDrumset) { |
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.
At this point we're already certain that inst->drumset()
is not nullptr, because of the check above, right?
@@ -74,7 +81,45 @@ const QVariant PercussionPanelPadModel::notationPreviewItemVariant() const | |||
return QVariant::fromValue(m_notationPreviewItem); | |||
} | |||
|
|||
QList<QVariantMap> PercussionPanelPadModel::footerContextMenuItems() const | |||
{ | |||
static const auto duplicatePadTitle = muse::TranslatableString("global", "Duplicate"); |
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.
(Same about using qtrc
instead of TranslatableString)
Also includes a small refactor to PercussionPanelModel::layoutMenuItems (fixed translatable strings and simplified checkables)
- Fixed notation preview background colour - Fixed alignment of disabled state text - Fixed panel not updating properly after selecting an unpitched stave - Ensured keyboard focus moves to pads when entering/exiting edit layout mode - Fixed clipped navigation outline for add row button - Fixed sounds not previewing properly - Added missing overrides - Make the Drumset argument in ChangeDrumset const
ce17022
to
16cb93c
Compare
Thanks @cbjeukendrup - pushed those tweaks |
This PR contains an assortment of small fixes for the percussion panel, alongside two more substantial changes.
Small Fixes
The small fixes (ce17022) are as follows:
paintNotationPreview
)PercussionPanel.qml
)finishEditing
)handleMenuItem
)PercussionPanel.qml
)getDrumNoteForPreview
so that the playback controller receives the correct noteheads, etc.)overrides
from recent refinements PR (notationconfiguration.h
)ChangeDrumset
(see comment)Footer Context Menus
One of the "substantial changes" (89156ff) was to implement "footer context menus" for the pads (see image), with associated "duplicate" and "delete" actions. A menu option for assigning keyboard shortcuts to the pads has also been included, but the logic for this action does not exist yet (will be included in a future PR).
This commit also includes a quick refactor to
PercussionPanelModel::layoutMenuItems
. The "checkable" logic has been simplified, and the definition of translatable strings has been corrected (per this comment).Fixing undo, redo, and reset
The other substantial change (7335c37) isn't substantial LOC-wise, but has implications beyond the new percussion panel and requires some explanation. This seeks to resolve a bug where the panel doesn't always update visually on undo, redo, and reset layout.
The underlying cause was that
NotationNoteInput::stateChanged
(the main notification that the percussion panel uses to update) was not being triggered on undo/redo. To my eye, this seems incorrect asNotationInteraction::undo
does eventually lead to aScore::setInputState
call (insideUndoMacro::undo
).The second part of this commit (the changes the
finishEditing
) are mostly academic. The idea is to makePercussionPanelPadListModel::drumset
const so that the drumset can only be modified through the sanctioned setter.