Skip to content

Commit

Permalink
Merge pull request #25481 from mathesoncalum/customize_kit
Browse files Browse the repository at this point in the history
Percussion panel - open "customize kit" dialog with the customize kit button
  • Loading branch information
mathesoncalum authored Nov 12, 2024
2 parents be92b77 + 5e96ce9 commit 1436a5f
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Item {
navigation.row: 0

onClicked: {
api.launcher.open("muse://devtools/interactive/sample")
root.model.customizeKit()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/notation/view/notationcontextmenumodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ MenuItemList NotationContextMenuModel::makeMeasureItems()
items << makeSeparator();

if (isDrumsetStaff()) {
items << makeMenuItem("edit-drumset");
items << makeMenuItem("customize-kit");
}

items << makeMenuItem("staff-properties");
Expand Down
5 changes: 5 additions & 0 deletions src/notation/view/percussionpanel/percussionpanelmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ void PercussionPanelModel::finishEditing()
setCurrentPanelMode(m_panelModeToRestore);
}

void PercussionPanelModel::customizeKit()
{
dispatcher()->dispatch("customize-kit");
}

void PercussionPanelModel::setUpConnections()
{
const auto updatePadModels = [this](const mu::engraving::Drumset* drumset) {
Expand Down
4 changes: 4 additions & 0 deletions src/notation/view/percussionpanel/percussionpanelmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "async/asyncable.h"

#include "context/iglobalcontext.h"
#include "actions/iactionsdispatcher.h"
#include "playback/iplaybackcontroller.h"

#include "percussionpanelpadlistmodel.h"
Expand All @@ -49,6 +50,7 @@ class PanelMode
class PercussionPanelModel : public QObject, public muse::Injectable, public muse::async::Asyncable
{
muse::Inject<context::IGlobalContext> globalContext = { this };
muse::Inject<muse::actions::IActionsDispatcher> dispatcher = { this };
muse::Inject<playback::IPlaybackController> playbackController = { this };

Q_OBJECT
Expand Down Expand Up @@ -78,6 +80,8 @@ class PercussionPanelModel : public QObject, public muse::Injectable, public mus

Q_INVOKABLE void finishEditing();

Q_INVOKABLE void customizeKit();

signals:
void currentPanelModeChanged(const PanelMode::Mode& panelMode);
void useNotationPreviewChanged(bool useNotationPreview);
Expand Down
8 changes: 4 additions & 4 deletions src/palette/internal/paletteactionscontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ using namespace muse::actions;
static const muse::UriQuery MASTER_PALETTE_URI("musescore://palette/masterpalette?sync=false&modal=false");
static const muse::UriQuery SPECIAL_CHARACTERS_URI("musescore://palette/specialcharacters?sync=false");
static const muse::UriQuery TIME_SIGNATURE_PROPERTIES_URI("musescore://palette/timesignatureproperties");
static const muse::UriQuery EDIT_DRUMSET_URI("musescore://palette/editdrumset");
static const muse::UriQuery CUSTOMIZE_KIT_URI("musescore://palette/customizekit");

void PaletteActionsController::init()
{
dispatcher()->reg(this, "masterpalette", this, &PaletteActionsController::toggleMasterPalette);
dispatcher()->reg(this, "show-keys", this, &PaletteActionsController::toggleSpecialCharactersDialog);
dispatcher()->reg(this, "time-signature-properties", this, &PaletteActionsController::openTimeSignaturePropertiesDialog);
dispatcher()->reg(this, "edit-drumset", this, &PaletteActionsController::openEditDrumsetDialog);
dispatcher()->reg(this, "customize-kit", this, &PaletteActionsController::openCustomizeKitDialog);

interactive()->currentUri().ch.onReceive(this, [this](const Uri& uri) {
//! NOTE If MasterPalette are not open, then it is reasonably to compare with the current uri,
Expand Down Expand Up @@ -94,7 +94,7 @@ void PaletteActionsController::openTimeSignaturePropertiesDialog()
interactive()->open(TIME_SIGNATURE_PROPERTIES_URI);
}

void PaletteActionsController::openEditDrumsetDialog()
void PaletteActionsController::openCustomizeKitDialog()
{
interactive()->open(EDIT_DRUMSET_URI);
interactive()->open(CUSTOMIZE_KIT_URI);
}
2 changes: 1 addition & 1 deletion src/palette/internal/paletteactionscontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PaletteActionsController : public muse::actions::Actionable, public muse::
void toggleMasterPalette(const muse::actions::ActionData& args);
void toggleSpecialCharactersDialog();
void openTimeSignaturePropertiesDialog();
void openEditDrumsetDialog();
void openCustomizeKitDialog();

muse::ValCh<bool> m_masterPaletteOpened;
muse::async::Channel<muse::actions::ActionCodeList> m_actionsReceiveAvailableChanged;
Expand Down
6 changes: 3 additions & 3 deletions src/palette/internal/paletteuiactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ const UiActionList PaletteUiActions::m_actions = {
TranslatableString("action", "Time signature properties…"),
TranslatableString("action", "Time signature properties…")
),
UiAction("edit-drumset",
UiAction("customize-kit",
mu::context::UiCtxProjectOpened,
mu::context::CTX_NOTATION_OPENED,
TranslatableString("action", "Edit drumset"),
TranslatableString("action", "Edit drumset")
TranslatableString("action", "Customize kit"),
TranslatableString("action", "Customize kit")
),
UiAction("apply-current-palette-element",
mu::context::UiCtxProjectOpened,
Expand Down
4 changes: 2 additions & 2 deletions src/palette/palettemodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

#include "view/widgets/masterpalette.h"
#include "view/widgets/specialcharactersdialog.h"
#include "view/widgets/editdrumsetdialog.h"
#include "view/widgets/customizekitdialog.h"
#include "view/widgets/timesignaturepropertiesdialog.h"
#include "view/widgets/keyedit.h"
#include "view/widgets/timedialog.h"
Expand Down Expand Up @@ -91,7 +91,7 @@ void PaletteModule::resolveImports()
ir->registerWidgetUri<MasterPalette>(Uri("musescore://palette/masterpalette"));
ir->registerWidgetUri<SpecialCharactersDialog>(Uri("musescore://palette/specialcharacters"));
ir->registerWidgetUri<TimeSignaturePropertiesDialog>(Uri("musescore://palette/timesignatureproperties"));
ir->registerWidgetUri<EditDrumsetDialog>(Uri("musescore://palette/editdrumset"));
ir->registerWidgetUri<CustomizeKitDialog>(Uri("musescore://palette/customizekit"));
ir->registerWidgetUri<KeyEditor>(Uri("musescore://notation/keysignatures"));
ir->registerWidgetUri<TimeDialog>(Uri("musescore://notation/timesignatures"));

Expand Down
8 changes: 4 additions & 4 deletions src/palette/qml/MuseScore/Palette/DrumsetPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter

height: 20
width: editDrumsetButton.width
width: customizeKitButton.width

text: drumsetView.pitchName
}

FlatButton {
id: editDrumsetButton
id: customizeKitButton

text: qsTrc("palette", "Edit drumset")
text: qsTrc("palette", "Customize kit")

onClicked: {
drumsetView.editDrumset()
drumsetView.customizeKit()
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/palette/view/drumsetpanelview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ QString DrumsetPanelView::pitchName() const
return m_pitchName;
}

void DrumsetPanelView::editDrumset()
void DrumsetPanelView::customizeKit()
{
dispatcher()->dispatch("edit-drumset");
dispatcher()->dispatch("customize-kit");
}

void DrumsetPanelView::componentComplete()
Expand Down
2 changes: 1 addition & 1 deletion src/palette/view/drumsetpanelview.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DrumsetPanelView : public muse::uicomponents::WidgetView, public muse::asy

QString pitchName() const;

Q_INVOKABLE void editDrumset();
Q_INVOKABLE void customizeKit();

signals:
void pitchNameChanged();
Expand Down
Loading

0 comments on commit 1436a5f

Please sign in to comment.