diff --git a/src/engraving/dom/navigate.cpp b/src/engraving/dom/navigate.cpp index cc416cc0a25c8..f9593cf3d46b5 100644 --- a/src/engraving/dom/navigate.cpp +++ b/src/engraving/dom/navigate.cpp @@ -35,6 +35,7 @@ #include "staff.h" #include "soundflag.h" #include "guitarbend.h" +#include "notation/notationtypes.h" using namespace mu; @@ -392,12 +393,12 @@ Note* Score::downAltCtrl(Note* note) const // or top/bottom of next/previous track's chord if at wit's end //--------------------------------------------------------- -EngravingItem* Score::moveAlt(EngravingItem* element, DirectionV direction) +EngravingItem* Score::moveAlt(EngravingItem* element, notation::MoveDirection direction) { EngravingItem* result = nullptr; ChordRest* cr = nullptr; auto originalTrack = element->track(); - bool moveUp = (direction == DirectionV::UP); + bool moveUp = (direction == notation::MoveDirection::Up); bool isNote = element->isNote(); bool isRest = element->isRest(); diff --git a/src/engraving/dom/score.h b/src/engraving/dom/score.h index 519a7d7683c76..cd231cb298109 100644 --- a/src/engraving/dom/score.h +++ b/src/engraving/dom/score.h @@ -90,6 +90,10 @@ namespace mu::engraving::compat { class WriteScoreHook; } +namespace mu::notation { +enum class MoveDirection; +} + namespace mu::engraving { class Articulation; class Audio; @@ -934,7 +938,7 @@ class Score : public EngravingObject, public muse::Injectable Note* upAltCtrl(Note*) const; EngravingItem* downAlt(EngravingItem*); Note* downAltCtrl(Note*) const; - EngravingItem* moveAlt(EngravingItem*, DirectionV); + EngravingItem* moveAlt(EngravingItem*, notation::MoveDirection); EngravingItem* firstElement(bool frame = true); EngravingItem* lastElement(bool frame = true); diff --git a/src/instrumentsscene/internal/selectinstrumentscenario.cpp b/src/instrumentsscene/internal/selectinstrumentscenario.cpp index a70b18c72cc07..551c7c3a18e69 100644 --- a/src/instrumentsscene/internal/selectinstrumentscenario.cpp +++ b/src/instrumentsscene/internal/selectinstrumentscenario.cpp @@ -48,7 +48,7 @@ RetVal SelectInstrumentsScenario::selectInstrument(const InstrumentK return selectedInstruments.ret; } - const InstrumentTemplate& templ = selectedInstruments.val.instruments.first().instrumentTemplate; + const InstrumentTemplate& templ = selectedInstruments.val.instruments.front().instrumentTemplate; return RetVal::make_ok(Instrument::fromTemplate(&templ)); } @@ -82,7 +82,7 @@ RetVal SelectInstrumentsScenario::selectInstrument String instrumentId = String::fromStdString(map["instrumentId"].toString()); pi.instrumentTemplate = instrumentsRepository()->instrumentTemplate(instrumentId); - result.instruments << pi; + result.instruments.push_back(pi); } ValMap order = content["scoreOrder"].toMap(); diff --git a/src/instrumentsscene/view/staffsettingsmodel.cpp b/src/instrumentsscene/view/staffsettingsmodel.cpp index 38289fc64b9d4..802ac8fd11602 100644 --- a/src/instrumentsscene/view/staffsettingsmodel.cpp +++ b/src/instrumentsscene/view/staffsettingsmodel.cpp @@ -110,7 +110,7 @@ QVariantList StaffSettingsModel::allStaffTypes() const if (isTypeAllowed(type)) { QVariantMap obj; - obj["text"] = staffTypeToString(type.type()); + obj["text"] = staffTypeToString(type.type()).toQString(); obj["value"] = static_cast(type.type()); result << obj; diff --git a/src/notation/internal/masternotationparts.cpp b/src/notation/internal/masternotationparts.cpp index a2354df294004..9de4ec6064a65 100644 --- a/src/notation/internal/masternotationparts.cpp +++ b/src/notation/internal/masternotationparts.cpp @@ -86,7 +86,7 @@ void MasterNotationParts::setParts(const PartInstrumentList& partList, const Sco PartInstrument pi; pi.isExistingPart = true; pi.partId = part->id(); - excerptPartList << pi; + excerptPartList.push_back(pi); } impl->sortParts(excerptPartList); diff --git a/src/notation/internal/notationinteraction.cpp b/src/notation/internal/notationinteraction.cpp index aa1ce011c5b88..1716fb81d6d6b 100644 --- a/src/notation/internal/notationinteraction.cpp +++ b/src/notation/internal/notationinteraction.cpp @@ -701,16 +701,15 @@ void NotationInteraction::moveChordNoteSelection(MoveDirection d) EngravingItem* oldSingle = currentSingle; bool isRange = selection.isRange(); std::vector notes; - DirectionV dir = d == MoveDirection::Up ? DirectionV::UP : DirectionV::DOWN; // Single traverse: if (currentSingle && (currentSingle->isNote() || currentSingle->isRest())) { - EngravingItem* newSingle = _score.moveAlt(currentSingle, dir); + EngravingItem* newSingle = _score.moveAlt(currentSingle, d); if (newSingle == currentSingle) { return; } while (newSingle && newSingle->isRest() && toRest(newSingle)->isGap()) { - newSingle = _score.moveAlt(newSingle, dir); + newSingle = _score.moveAlt(newSingle, d); if (newSingle == oldSingle) { break; } @@ -732,7 +731,7 @@ void NotationInteraction::moveChordNoteSelection(MoveDirection d) : selectedNote->chord()->upNote(); notes.emplace_back(newSelection); } else { // List - auto newSelection = _score.moveAlt(selectedNote, dir); + auto newSelection = _score.moveAlt(selectedNote, d); bool keepSelection = !newSelection; if (newSelection) { if (newSelection->isNote()) { diff --git a/src/notation/internal/notationparts.cpp b/src/notation/internal/notationparts.cpp index 273070c58da8f..e1a7a6eebff29 100644 --- a/src/notation/internal/notationparts.cpp +++ b/src/notation/internal/notationparts.cpp @@ -706,7 +706,7 @@ void NotationParts::removeParts(const IDList& partsIds) PartInstrument pi; pi.isExistingPart = true; pi.partId = part->id(); - parts << pi; + parts.push_back(pi); } sortParts(parts); @@ -869,7 +869,7 @@ void NotationParts::moveParts(const IDList& sourcePartsIds, const ID& destinatio PartInstrument pi; pi.isExistingPart = true; pi.partId = partId; - parts << pi; + parts.push_back(pi); } endInteractionWithScore(); diff --git a/src/notation/internal/searchcommandsparser.cpp b/src/notation/internal/searchcommandsparser.cpp index 32fd002ea2641..fafdbedf3b4f3 100644 --- a/src/notation/internal/searchcommandsparser.cpp +++ b/src/notation/internal/searchcommandsparser.cpp @@ -37,8 +37,8 @@ static const std::string PAGE_CODE("p"); SearchCommands SearchCommandsParser::availableCommands() { SearchCommands commands; - commands << SearchCommand(ElementType::REHEARSAL_MARK, REHEARSAL_MARK_CODE, muse::trc("notation", "Rehearsal marks")) - << SearchCommand(ElementType::PAGE, PAGE_CODE, muse::trc("notation", "Pages")); + commands.push_back(SearchCommand(ElementType::REHEARSAL_MARK, REHEARSAL_MARK_CODE, muse::trc("notation", "Rehearsal marks"))); + commands.push_back(SearchCommand(ElementType::PAGE, PAGE_CODE, muse::trc("notation", "Pages"))); return commands; } diff --git a/src/notation/notationtypes.h b/src/notation/notationtypes.h index 073042dfd9dcb..0a05eab1aa340 100644 --- a/src/notation/notationtypes.h +++ b/src/notation/notationtypes.h @@ -22,8 +22,6 @@ #ifndef MU_NOTATION_NOTATIONTYPES_H #define MU_NOTATION_NOTATIONTYPES_H -#include -#include #include #include "translation.h" @@ -150,7 +148,7 @@ using engraving::LoopBoundaryType; using Pid = mu::engraving::Pid; using VoiceAssignment = mu::engraving::VoiceAssignment; -static const muse::String COMMON_GENRE_ID("common"); +static const muse::String COMMON_GENRE_ID(u"common"); enum class DragMode { @@ -305,57 +303,57 @@ inline bool isMainInstrumentForPart(const InstrumentKey& instrumentKey, const Pa return instrumentKey.instrumentId == part->instrumentId() && instrumentKey.tick == Part::MAIN_INSTRUMENT_TICK; } -inline QString formatInstrumentTitle(const QString& instrumentName, const InstrumentTrait& trait) +inline muse::String formatInstrumentTitle(const muse::String& instrumentName, const InstrumentTrait& trait) { // Comments for translators start with //: switch (trait.type) { case TraitType::Tuning: //: %1=tuning ("D"), %2=name ("Tin Whistle"). Example: "D Tin Whistle" - return muse::qtrc("notation", "%1 %2", "Tuned instrument displayed in the UI") + return muse::mtrc("notation", "%1 %2", "Tuned instrument displayed in the UI") .arg(trait.name, instrumentName); case TraitType::Transposition: //: %1=name ("Horn"), %2=transposition ("C alto"). Example: "Horn in C alto" - return muse::qtrc("notation", "%1 in %2", "Transposing instrument displayed in the UI") + return muse::mtrc("notation", "%1 in %2", "Transposing instrument displayed in the UI") .arg(instrumentName, trait.name); case TraitType::Course: //: %1=name ("Tenor Lute"), %2=course/strings ("7-course"). Example: "Tenor Lute (7-course)" - return muse::qtrc("notation", "%1 (%2)", "String instrument displayed in the UI") + return muse::mtrc("notation", "%1 (%2)", "String instrument displayed in the UI") .arg(instrumentName, trait.name); case TraitType::Unknown: + default: return instrumentName; // Example: "Flute" } - Q_UNREACHABLE(); } -inline QString formatInstrumentTitle(const QString& instrumentName, const InstrumentTrait& trait, int instrumentNumber) +inline muse::String formatInstrumentTitle(const muse::String& instrumentName, const InstrumentTrait& trait, int instrumentNumber) { if (instrumentNumber == 0) { // Only one instance of this instrument in the score return formatInstrumentTitle(instrumentName, trait); } - QString number = QString::number(instrumentNumber); + muse::String number = muse::String::number(instrumentNumber); // Comments for translators start with //: switch (trait.type) { case TraitType::Tuning: //: %1=tuning ("D"), %2=name ("Tin Whistle"), %3=number ("2"). Example: "D Tin Whistle 2" - return muse::qtrc("notation", "%1 %2 %3", "One of several tuned instruments displayed in the UI") + return muse::mtrc("notation", "%1 %2 %3", "One of several tuned instruments displayed in the UI") .arg(trait.name, instrumentName, number); case TraitType::Transposition: //: %1=name ("Horn"), %2=transposition ("C alto"), %3=number ("2"). Example: "Horn in C alto 2" - return muse::qtrc("notation", "%1 in %2 %3", "One of several transposing instruments displayed in the UI") + return muse::mtrc("notation", "%1 in %2 %3", "One of several transposing instruments displayed in the UI") .arg(instrumentName, trait.name, number); case TraitType::Course: //: %1=name ("Tenor Lute"), %2=course/strings ("7-course"), %3=number ("2"). Example: "Tenor Lute (7-course) 2" - return muse::qtrc("notation", "%1 (%2) %3", "One of several string instruments displayed in the UI") + return muse::mtrc("notation", "%1 (%2) %3", "One of several string instruments displayed in the UI") .arg(instrumentName, trait.name, number); case TraitType::Unknown: + default: //: %1=name ("Flute"), %2=number ("2"). Example: "Flute 2" - return muse::qtrc("notation", "%1 %2", "One of several instruments displayed in the UI") + return muse::mtrc("notation", "%1 %2", "One of several instruments displayed in the UI") .arg(instrumentName, number); } - Q_UNREACHABLE(); } struct PartInstrument @@ -367,7 +365,7 @@ struct PartInstrument bool isSoloist = false; }; -using PartInstrumentList = QList; +using PartInstrumentList = std::list; struct PartInstrumentListScoreOrder { @@ -384,7 +382,7 @@ struct SearchCommand SearchCommand(const ElementType& searchElementType, const std::string& code, const std::string& description) : searchElementType(searchElementType), code(code), description(description) {} }; -using SearchCommands = QList; +using SearchCommands = std::list; struct FilterElementsOptions { @@ -421,7 +419,7 @@ struct FilterNotesOptions : FilterElementsOptions struct StaffConfig { bool visible = false; - qreal userDistance = 0.0; + double userDistance = 0.0; bool cutaway = false; bool showIfEmpty = false; bool hideSystemBarline = false; @@ -527,10 +525,10 @@ struct ScoreConfig } }; -inline QString staffTypeToString(StaffTypeId type) +inline muse::String staffTypeToString(StaffTypeId type) { const StaffType* preset = StaffType::preset(type); - return preset ? preset->name().toQString() : QString(); + return preset ? preset->name() : muse::String(); } struct MeasureBeat @@ -571,7 +569,7 @@ struct ScoreCreateOptions inline const ScoreOrder& customOrder() { static ScoreOrder order; - order.id = "custom"; + order.id = u"custom"; order.name = muse::TranslatableString("engraving/scoreorder", "Custom"); return order; diff --git a/src/project/view/newscoremodel.cpp b/src/project/view/newscoremodel.cpp index 4e4d16674c516..6e653e426da74 100644 --- a/src/project/view/newscoremodel.cpp +++ b/src/project/view/newscoremodel.cpp @@ -112,7 +112,7 @@ ProjectCreateOptions NewScoreModel::parseOptions(const QVariantMap& info) const pi.isExistingPart = objMap["isExistingPart"].toBool(); pi.isSoloist = objMap["isSoloist"].toBool(); - scoreOptions.parts << pi; + scoreOptions.parts.push_back(pi); } QVariantMap orderMap = info["scoreOrder"].toMap();