Skip to content
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

Init ChordList before importing #18737

Merged
Merged
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
22 changes: 15 additions & 7 deletions src/project/internal/notationproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,26 +286,34 @@ mu::Ret NotationProject::doImport(const io::path_t& path, const io::path_t& styl
options[INotationReader::OptionKey::ForceMode] = Val(forceMode);
}

// Read(import) master score
// Setup engraving project
mu::engraving::ScoreLoad sl;
m_engravingProject->setFileInfoProvider(std::make_shared<ProjectFileInfoProvider>(this));
mu::engraving::MasterScore* score = m_engravingProject->masterScore();

// The order of the steps matches the order in MS3
// (see https://github.com/musescore/MuseScore/blob/2513676e512d29d554cb6c4d37d3efaf53ea2c5b/mscore/file.cpp#L2260)

// Load style if present
if (!stylePath.empty()) {
cbjeukendrup marked this conversation as resolved.
Show resolved Hide resolved
score->loadStyle(stylePath.toQString());
}

// Init ChordList
cbjeukendrup marked this conversation as resolved.
Show resolved Hide resolved
score->checkChordList();

// Read (import) master score
Ret ret = scoreReader->read(score, path, options);
if (!ret) {
return ret;
}

// Setup master score
// Setup master score post-reading
ret = m_engravingProject->setupMasterScore(forceMode);
if (!ret) {
return ret;
}

// Load style if present
if (!stylePath.empty()) {
score->loadStyle(stylePath.toQString());
}

// Setup audio settings
m_projectAudioSettings->makeDefault();

Expand Down