Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/notationscene/widgets/editstaff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ EditStaff::EditStaff(QWidget* parent)
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
setModal(true);

initStaff();

editStaffTypeDialog = new EditStaffType(this);
editStaffTypeDialog->setWindowModality(Qt::WindowModal);

Expand Down Expand Up @@ -166,6 +164,7 @@ void EditStaff::setStaff(Staff* s, const Fraction& tick)

void EditStaff::showEvent(QShowEvent* event)
{
initStaff();
WidgetStateStore::restoreGeometry(this);
QDialog::showEvent(event);
}
Expand Down Expand Up @@ -443,6 +442,10 @@ INotationPartsPtr EditStaff::masterNotationParts() const

void EditStaff::initStaff()
{
if (!globalContext()) {
return;
}

const INotationPtr notation = this->notation();
const INotationInteractionPtr interaction = notation ? notation->interaction() : nullptr;
auto context = interaction ? interaction->hitElementContext() : INotationInteraction::HitElementContext();
Expand Down Expand Up @@ -522,8 +525,10 @@ void EditStaff::applyPartProperties()
String _lsn = longStaffName->toPlainText();
if (!mu::engraving::Text::validateText(_sn) || !mu::engraving::Text::validateText(_ln)
|| !mu::engraving::Text::validateText(_ssn) || !mu::engraving::Text::validateText(_lsn)) {
interactive()->warning(muse::trc("notation/staffpartproperties", "Invalid instrument name"),
muse::trc("notation/staffpartproperties", "The instrument name is invalid."));
if (interactive()) {
interactive()->warning(muse::trc("notation/staffpartproperties", "Invalid instrument name"),
muse::trc("notation/staffpartproperties", "The instrument name is invalid."));
}
return;
}
QString sn = _sn;
Expand Down Expand Up @@ -577,6 +582,10 @@ void EditStaff::applyPartProperties()

void EditStaff::showReplaceInstrumentDialog()
{
if (!selectInstrumentsScenario()) {
return;
}

async::Promise<InstrumentTemplate> templ = selectInstrumentsScenario()->selectInstrument(m_instrumentKey);
templ.onResolve(this, [this](const InstrumentTemplate& val) {
const StaffType* staffType = val.staffTypePreset;
Expand Down
Loading