Fixed ordering of instruments

This commit is contained in:
Eism 2021-06-29 18:33:50 +02:00 committed by Roman Pudashkin
parent 0923ad06bd
commit b00648a2d5
7 changed files with 39 additions and 22 deletions

View file

@ -39,6 +39,8 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/internal/selectinstrumentscenario.h
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsuiactions.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsuiactions.h
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsconverter.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsconverter.h
${CMAKE_CURRENT_LIST_DIR}/view/instrumentlistmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/view/instrumentlistmodel.h
${CMAKE_CURRENT_LIST_DIR}/view/abstractinstrumentspaneltreeitem.cpp

View file

@ -23,11 +23,13 @@
#include "instrumentsconverter.h"
#include "libmscore/instrument.h"
#include "libmscore/instrtemplate.h"
#include "midi/midievent.h"
using namespace mu::notation;
using namespace mu::instruments;
Ms::Instrument InstrumentsConverter::convertInstrument(const mu::instruments::Instrument& instrument)
Ms::Instrument InstrumentsConverter::convertInstrument(const Instrument& instrument)
{
Ms::Instrument result;
result.setAmateurPitchRange(instrument.amateurPitchRange.min, instrument.amateurPitchRange.max);
@ -70,9 +72,9 @@ Ms::Instrument InstrumentsConverter::convertInstrument(const mu::instruments::In
return result;
}
mu::instruments::Instrument InstrumentsConverter::convertInstrument(const Ms::Instrument& instrument)
Instrument InstrumentsConverter::convertInstrument(const Ms::Instrument& instrument)
{
mu::instruments::Instrument result;
Instrument result;
result.amateurPitchRange = PitchRange(instrument.minPitchA(), instrument.maxPitchA());
result.professionalPitchRange = PitchRange(instrument.minPitchP(), instrument.maxPitchP());
@ -109,7 +111,7 @@ mu::instruments::Instrument InstrumentsConverter::convertInstrument(const Ms::In
return result;
}
mu::instruments::Instrument InstrumentsConverter::convertInstrument(const Ms::InstrumentTemplate& templ)
Instrument InstrumentsConverter::convertInstrument(const Ms::InstrumentTemplate& templ)
{
Ms::Instrument msInstrument = Ms::Instrument::fromTemplate(&templ);
Instrument result = convertInstrument(msInstrument);

View file

@ -20,10 +20,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_NOTATION_INSTRUMENTSCONVERTER_H
#define MU_NOTATION_INSTRUMENTSCONVERTER_H
#ifndef MU_INSTRUMENTS_INSTRUMENTSCONVERTER_H
#define MU_INSTRUMENTS_INSTRUMENTSCONVERTER_H
#include "instruments/instrumentstypes.h"
#include "../instrumentstypes.h"
namespace Ms {
class Instrument;
@ -31,18 +31,18 @@ class InstrumentTemplate;
struct NamedEventList;
}
namespace mu::notation {
namespace mu::instruments {
class InstrumentsConverter
{
public:
static Ms::Instrument convertInstrument(const instruments::Instrument& instrument);
static instruments::Instrument convertInstrument(const Ms::Instrument& insturment);
static instruments::Instrument convertInstrument(const Ms::InstrumentTemplate& templ);
static Ms::Instrument convertInstrument(const Instrument& instrument);
static Instrument convertInstrument(const Ms::Instrument& insturment);
static Instrument convertInstrument(const Ms::InstrumentTemplate& templ);
private:
static instruments::MidiActionList convertMidiActions(const QList<Ms::NamedEventList>& midiActions);
static QList<Ms::NamedEventList> convertMidiActions(const instruments::MidiActionList& midiActions);
static MidiActionList convertMidiActions(const QList<Ms::NamedEventList>& midiActions);
static QList<Ms::NamedEventList> convertMidiActions(const MidiActionList& midiActions);
};
}
#endif // MU_NOTATION_INSTRUMENTSCONVERTER_H
#endif // MU_INSTRUMENTS_INSTRUMENTSCONVERTER_H

View file

@ -27,7 +27,7 @@
#include "libmscore/instrtemplate.h"
#include "libmscore/articulation.h"
#include "notation/internal/instrumentsconverter.h"
#include "instrumentsconverter.h"
using namespace mu;
using namespace mu::instruments;
@ -114,7 +114,7 @@ void InstrumentsRepository::fillInstrumentsMeta(InstrumentsMeta& meta)
continue;
}
Instrument templ = notation::InstrumentsConverter::convertInstrument(*msTemplate);
Instrument templ = InstrumentsConverter::convertInstrument(*msTemplate);
templ.groupId = msGroup->id;
meta.instrumentTemplates << templ;
@ -127,6 +127,20 @@ void InstrumentsRepository::fillInstrumentsMeta(InstrumentsMeta& meta)
order.name = msOrder.name;
order.instrumentMap = msOrder.instrumentMap;
for (const Ms::ScoreGroup& msGroup : msOrder.groups) {
ScoreOrderGroup group;
group.family = msGroup.family;
group.section = msGroup.section;
group.unsorted = msGroup.unsorted;
group.bracket = msGroup.bracket;
group.showSystemMarkings = msGroup.showSystemMarkings;
group.barLineSpan = msGroup.barLineSpan;
group.thinBracket = msGroup.thinBracket;
order.groups << group;
}
meta.scoreOrders << order;
}

View file

@ -113,8 +113,6 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/internal/searchcommandsparser.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/searchcommandsparser.h
${CMAKE_CURRENT_LIST_DIR}/internal/inotationselectionrange.h
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsconverter.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsconverter.h
${CMAKE_CURRENT_LIST_DIR}/internal/scoreorderconverter.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/scoreorderconverter.h
${CMAKE_CURRENT_LIST_DIR}/internal/inotationmidievents.h
@ -180,6 +178,7 @@ set(MODULE_LINK
qzip
${Z_LIB}
engraving
instruments
commonscene
uicomponents
ui

View file

@ -58,7 +58,7 @@
#include "notationnoteinput.h"
#include "notationselection.h"
#include "instrumentsconverter.h"
#include "instruments/internal/instrumentsconverter.h"
#include "draw/pen.h"
@ -1051,7 +1051,7 @@ void NotationInteraction::selectInstrument(Ms::InstrumentChange* instrumentChang
return;
}
Ms::Instrument instrument = InstrumentsConverter::convertInstrument(selectedIstrument);
Ms::Instrument instrument = instruments::InstrumentsConverter::convertInstrument(selectedIstrument);
instrumentChange->setInit(true);
instrumentChange->setupInstrument(&instrument);

View file

@ -28,7 +28,7 @@
#include "libmscore/instrchange.h"
#include "libmscore/page.h"
#include "instrumentsconverter.h"
#include "instruments/internal/instrumentsconverter.h"
#include "scoreorderconverter.h"
#include "igetscore.h"