fixed cycled dependency between instruments and notation modules
This commit is contained in:
parent
831b87e8df
commit
59301f6593
47 changed files with 613 additions and 816 deletions
|
@ -153,7 +153,7 @@ void ScorePreferencesModel::savePath(ScorePreferencesModel::DefaultFileType file
|
|||
|
||||
QString ScorePreferencesModel::firstInstrumentListPath() const
|
||||
{
|
||||
io::paths instrumentListPaths = instrumentsConfiguration()->userInstrumentListPaths();
|
||||
io::paths instrumentListPaths = notationConfiguration()->userInstrumentListPaths();
|
||||
if (instrumentListPaths.empty()) {
|
||||
return QString();
|
||||
}
|
||||
|
@ -163,18 +163,18 @@ QString ScorePreferencesModel::firstInstrumentListPath() const
|
|||
|
||||
void ScorePreferencesModel::setFirstInstrumentListPath(const QString& path)
|
||||
{
|
||||
io::paths instrumentListPaths = instrumentsConfiguration()->userInstrumentListPaths();
|
||||
io::paths instrumentListPaths = notationConfiguration()->userInstrumentListPaths();
|
||||
if (instrumentListPaths.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
instrumentListPaths[0] = path.toStdString();
|
||||
instrumentsConfiguration()->setUserInstrumentListPaths(instrumentListPaths);
|
||||
notationConfiguration()->setUserInstrumentListPaths(instrumentListPaths);
|
||||
}
|
||||
|
||||
QString ScorePreferencesModel::secondInstrumentListPath() const
|
||||
{
|
||||
io::paths instrumentListPaths = instrumentsConfiguration()->userInstrumentListPaths();
|
||||
io::paths instrumentListPaths = notationConfiguration()->userInstrumentListPaths();
|
||||
if (instrumentListPaths.size() < 1) {
|
||||
return QString();
|
||||
}
|
||||
|
@ -184,18 +184,18 @@ QString ScorePreferencesModel::secondInstrumentListPath() const
|
|||
|
||||
void ScorePreferencesModel::setSecondInstrumentListPath(const QString& path)
|
||||
{
|
||||
io::paths instrumentListPaths = instrumentsConfiguration()->userInstrumentListPaths();
|
||||
io::paths instrumentListPaths = notationConfiguration()->userInstrumentListPaths();
|
||||
if (instrumentListPaths.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
instrumentListPaths[1] = path.toStdString();
|
||||
instrumentsConfiguration()->setUserInstrumentListPaths(instrumentListPaths);
|
||||
notationConfiguration()->setUserInstrumentListPaths(instrumentListPaths);
|
||||
}
|
||||
|
||||
QString ScorePreferencesModel::firstScoreOrderListPath() const
|
||||
{
|
||||
io::paths scoreOrderListPaths = instrumentsConfiguration()->userScoreOrderListPaths();
|
||||
io::paths scoreOrderListPaths = notationConfiguration()->userScoreOrderListPaths();
|
||||
if (scoreOrderListPaths.empty()) {
|
||||
return QString();
|
||||
}
|
||||
|
@ -205,18 +205,18 @@ QString ScorePreferencesModel::firstScoreOrderListPath() const
|
|||
|
||||
void ScorePreferencesModel::setFirstScoreOrderListPath(const QString& path)
|
||||
{
|
||||
io::paths scoreOrderListPaths = instrumentsConfiguration()->userScoreOrderListPaths();
|
||||
io::paths scoreOrderListPaths = notationConfiguration()->userScoreOrderListPaths();
|
||||
if (scoreOrderListPaths.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
scoreOrderListPaths[0] = path.toStdString();
|
||||
instrumentsConfiguration()->setUserScoreOrderListPaths(scoreOrderListPaths);
|
||||
notationConfiguration()->setUserScoreOrderListPaths(scoreOrderListPaths);
|
||||
}
|
||||
|
||||
QString ScorePreferencesModel::secondScoreOrderListPath() const
|
||||
{
|
||||
io::paths scoreOrderListPaths = instrumentsConfiguration()->userScoreOrderListPaths();
|
||||
io::paths scoreOrderListPaths = notationConfiguration()->userScoreOrderListPaths();
|
||||
if (scoreOrderListPaths.size() < 1) {
|
||||
return QString();
|
||||
}
|
||||
|
@ -226,13 +226,13 @@ QString ScorePreferencesModel::secondScoreOrderListPath() const
|
|||
|
||||
void ScorePreferencesModel::setSecondScoreOrderListPath(const QString& path)
|
||||
{
|
||||
io::paths scoreOrderListPaths = instrumentsConfiguration()->userScoreOrderListPaths();
|
||||
io::paths scoreOrderListPaths = notationConfiguration()->userScoreOrderListPaths();
|
||||
if (scoreOrderListPaths.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
scoreOrderListPaths[1] = path.toStdString();
|
||||
instrumentsConfiguration()->setUserScoreOrderListPaths(scoreOrderListPaths);
|
||||
notationConfiguration()->setUserScoreOrderListPaths(scoreOrderListPaths);
|
||||
}
|
||||
|
||||
QString ScorePreferencesModel::stylePath() const
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "modularity/ioc.h"
|
||||
#include "async/asyncable.h"
|
||||
|
||||
#include "instruments/iinstrumentsconfiguration.h"
|
||||
#include "notation/inotationconfiguration.h"
|
||||
#include "audio/iaudioconfiguration.h"
|
||||
|
||||
|
@ -36,7 +35,6 @@ class ScorePreferencesModel : public QAbstractListModel, public async::Asyncable
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
INJECT(appshell, instruments::IInstrumentsConfiguration, instrumentsConfiguration)
|
||||
INJECT(appshell, notation::INotationConfiguration, notationConfiguration)
|
||||
INJECT(appshell, audio::IAudioConfiguration, audioConfiguration)
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ QList<InstrumentGroup*> instrumentGroups;
|
|||
QList<MidiArticulation> articulation; // global articulations
|
||||
QList<InstrumentGenre*> instrumentGenres;
|
||||
QList<InstrumentFamily*> instrumentFamilies;
|
||||
QList<ScoreOrder> instrumentOrders;
|
||||
QList<ScoreOrder*> instrumentOrders;
|
||||
|
||||
//---------------------------------------------------------
|
||||
// searchInstrumentGenre
|
||||
|
@ -254,6 +254,7 @@ void InstrumentTemplate::init(const InstrumentTemplate& t)
|
|||
family = t.family;
|
||||
singleNoteDynamics = t.singleNoteDynamics;
|
||||
|
||||
sequenceOrder = t.sequenceOrder;
|
||||
trait = t.trait;
|
||||
}
|
||||
|
||||
|
@ -635,6 +636,8 @@ void clearInstrumentTemplates()
|
|||
qDeleteAll(instrumentFamilies);
|
||||
instrumentFamilies.clear();
|
||||
articulation.clear();
|
||||
qDeleteAll(instrumentOrders);
|
||||
instrumentOrders.clear();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -685,8 +688,8 @@ bool loadInstrumentTemplates(const QString& instrTemplates)
|
|||
}
|
||||
fam->read(e);
|
||||
} else if (tag == "Order") {
|
||||
ScoreOrder order;
|
||||
order.read(e);
|
||||
ScoreOrder* order = new ScoreOrder;
|
||||
order->read(e);
|
||||
instrumentOrders.append(order);
|
||||
} else {
|
||||
e.unknown();
|
||||
|
|
|
@ -169,7 +169,7 @@ extern QList<InstrumentGenre*> instrumentGenres;
|
|||
extern QList<InstrumentFamily*> instrumentFamilies;
|
||||
extern QList<MidiArticulation> articulation;
|
||||
extern QList<InstrumentGroup*> instrumentGroups;
|
||||
extern QList<ScoreOrder> instrumentOrders;
|
||||
extern QList<ScoreOrder*> instrumentOrders;
|
||||
extern void clearInstrumentTemplates();
|
||||
extern bool loadInstrumentTemplates(const QString& instrTemplates);
|
||||
extern InstrumentTemplate* searchTemplate(const QString& name);
|
||||
|
|
|
@ -28,19 +28,10 @@ set(MODULE_SRC
|
|||
${CMAKE_CURRENT_LIST_DIR}/instrumentsmodule.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/instrumentsmodule.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/instrumentstypes.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/iinstrumentsconfiguration.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/iinstrumentsrepository.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/iselectinstrumentscenario.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsrepository.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsrepository.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsconfiguration.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsconfiguration.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/selectinstrumentscenario.cpp
|
||||
${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
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
* MuseScore-CLA-applies
|
||||
*
|
||||
* MuseScore
|
||||
* Music Composition & Notation
|
||||
*
|
||||
* Copyright (C) 2021 MuseScore BVBA and others
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MU_INSTRUMENTS_IINSTRUMENTSCONFIGURATION_H
|
||||
#define MU_INSTRUMENTS_IINSTRUMENTSCONFIGURATION_H
|
||||
|
||||
#include "modularity/imoduleexport.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "io/path.h"
|
||||
#include "async/notification.h"
|
||||
|
||||
namespace mu::instruments {
|
||||
class IInstrumentsConfiguration : MODULE_EXPORT_INTERFACE
|
||||
{
|
||||
INTERFACE_ID(IInstrumentsConfiguration)
|
||||
|
||||
public:
|
||||
virtual ~IInstrumentsConfiguration() = default;
|
||||
|
||||
virtual io::paths instrumentListPaths() const = 0;
|
||||
virtual async::Notification instrumentListPathsChanged() const = 0;
|
||||
|
||||
virtual io::paths userInstrumentListPaths() const = 0;
|
||||
virtual void setUserInstrumentListPaths(const io::paths& paths) = 0;
|
||||
|
||||
virtual io::paths scoreOrderListPaths() const = 0;
|
||||
virtual async::Notification scoreOrderListPathsChanged() const = 0;
|
||||
|
||||
virtual io::paths userScoreOrderListPaths() const = 0;
|
||||
virtual void setUserScoreOrderListPaths(const io::paths& paths) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MU_INSTRUMENTS_IINSTRUMENTSSCONFIGURATION_H
|
|
@ -26,8 +26,6 @@
|
|||
#include "modularity/ioc.h"
|
||||
#include "ui/iuiengine.h"
|
||||
|
||||
#include "internal/instrumentsrepository.h"
|
||||
#include "internal/instrumentsconfiguration.h"
|
||||
#include "internal/selectinstrumentscenario.h"
|
||||
#include "internal/instrumentsuiactions.h"
|
||||
|
||||
|
@ -37,17 +35,13 @@
|
|||
#include "view/staffsettingsmodel.h"
|
||||
#include "ui/iinteractiveuriregister.h"
|
||||
#include "ui/iuiactionsregister.h"
|
||||
#include "instrumentstypes.h"
|
||||
|
||||
#include "diagnostics/idiagnosticspathsregister.h"
|
||||
#include "instrumentstypes.h"
|
||||
|
||||
using namespace mu::instruments;
|
||||
using namespace mu::modularity;
|
||||
using namespace mu::ui;
|
||||
|
||||
static std::shared_ptr<InstrumentsRepository> s_instrumentsRepository = std::make_shared<InstrumentsRepository>();
|
||||
static std::shared_ptr<InstrumentsConfiguration> s_configuration = std::make_shared<InstrumentsConfiguration>();
|
||||
|
||||
static void instruments_init_qrc()
|
||||
{
|
||||
Q_INIT_RESOURCE(instruments);
|
||||
|
@ -60,9 +54,7 @@ std::string InstrumentsModule::moduleName() const
|
|||
|
||||
void InstrumentsModule::registerExports()
|
||||
{
|
||||
ioc()->registerExport<IInstrumentsConfiguration>(moduleName(), s_configuration);
|
||||
ioc()->registerExport<IInstrumentsRepository>(moduleName(), s_instrumentsRepository);
|
||||
ioc()->registerExport<ISelectInstrumentsScenario>(moduleName(), new SelectInstrumentsScenario());
|
||||
ioc()->registerExport<notation::ISelectInstrumentsScenario>(moduleName(), new SelectInstrumentsScenario());
|
||||
}
|
||||
|
||||
void InstrumentsModule::resolveImports()
|
||||
|
@ -98,32 +90,3 @@ void InstrumentsModule::registerUiTypes()
|
|||
uiengine->addSourceImportPath(instruments_QML_IMPORT);
|
||||
}
|
||||
}
|
||||
|
||||
void InstrumentsModule::onInit(const framework::IApplication::RunMode&)
|
||||
{
|
||||
s_configuration->init();
|
||||
s_instrumentsRepository->init();
|
||||
|
||||
auto pr = modularity::ioc()->resolve<diagnostics::IDiagnosticsPathsRegister>(moduleName());
|
||||
if (pr) {
|
||||
io::paths instrPaths = s_configuration->instrumentListPaths();
|
||||
for (const io::path& p : instrPaths) {
|
||||
pr->reg("instruments", p);
|
||||
}
|
||||
|
||||
io::paths uinstrPaths = s_configuration->userInstrumentListPaths();
|
||||
for (const io::path& p : uinstrPaths) {
|
||||
pr->reg("user instruments", p);
|
||||
}
|
||||
|
||||
io::paths scoreOrderPaths = s_configuration->scoreOrderListPaths();
|
||||
for (const io::path& p : scoreOrderPaths) {
|
||||
pr->reg("scoreOrder", p);
|
||||
}
|
||||
|
||||
io::paths uscoreOrderPaths = s_configuration->userScoreOrderListPaths();
|
||||
for (const io::path& p : uscoreOrderPaths) {
|
||||
pr->reg("user scoreOrder", p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ public:
|
|||
void resolveImports() override;
|
||||
void registerResources() override;
|
||||
void registerUiTypes() override;
|
||||
void onInit(const framework::IApplication::RunMode& mode) override;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -22,208 +22,9 @@
|
|||
#ifndef MU_INSTRUMENTS_INSTRUMENTSTYPES_H
|
||||
#define MU_INSTRUMENTS_INSTRUMENTSTYPES_H
|
||||
|
||||
#include <QVariant>
|
||||
#include <vector>
|
||||
#include "qobjectdefs.h"
|
||||
|
||||
#include "libmscore/interval.h"
|
||||
#include "libmscore/drumset.h"
|
||||
#include "libmscore/stringdata.h"
|
||||
#include "libmscore/clef.h"
|
||||
#include "libmscore/instrument.h"
|
||||
#include "libmscore/scoreorder.h"
|
||||
#include "framework/midi/miditypes.h"
|
||||
#include <QObject>
|
||||
|
||||
namespace mu::instruments {
|
||||
static constexpr int MAX_STAVES = 4;
|
||||
|
||||
using Interval = Ms::Interval;
|
||||
using Drumset = Ms::Drumset;
|
||||
using StringData = Ms::StringData;
|
||||
using Clef = Ms::Clef;
|
||||
using ClefType = Ms::ClefType;
|
||||
using ClefTypeList = Ms::ClefTypeList;
|
||||
using BracketType = Ms::BracketType;
|
||||
using StaffGroup = Ms::StaffGroup;
|
||||
using StaffType = Ms::StaffType;
|
||||
using Channel = Ms::Channel;
|
||||
using StaffName = Ms::StaffName;
|
||||
using StaffNameList = Ms::StaffNameList;
|
||||
using MidiArticulation = Ms::MidiArticulation;
|
||||
using Trait = Ms::Trait;
|
||||
using TraitType = Ms::TraitType;
|
||||
|
||||
using ChannelList = QList<Channel>;
|
||||
|
||||
struct ClefPair
|
||||
{
|
||||
ClefType concertClef = ClefType::G;
|
||||
ClefType transposingClef = ClefType::G;
|
||||
};
|
||||
|
||||
struct PitchRange
|
||||
{
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
|
||||
PitchRange() = default;
|
||||
PitchRange(int min, int max)
|
||||
: min(min), max(max) {}
|
||||
|
||||
bool operator ==(const PitchRange& other) const
|
||||
{
|
||||
return min == other.min && max == other.max;
|
||||
}
|
||||
|
||||
bool operator !=(const PitchRange& other) const
|
||||
{
|
||||
return !operator ==(other);
|
||||
}
|
||||
};
|
||||
|
||||
struct MidiAction
|
||||
{
|
||||
QString name;
|
||||
QString description;
|
||||
std::vector<midi::Event> events;
|
||||
};
|
||||
using MidiActionList = QList<MidiAction>;
|
||||
|
||||
using MidiArticulations = QList<Ms::MidiArticulation>;
|
||||
|
||||
struct InstrumentGroup
|
||||
{
|
||||
QString id;
|
||||
QString name;
|
||||
bool extended = false;
|
||||
int sequenceOrder = 0;
|
||||
};
|
||||
|
||||
using InstrumentGroups = QList<InstrumentGroup>;
|
||||
|
||||
struct InstrumentGenre
|
||||
{
|
||||
QString id;
|
||||
QString name;
|
||||
};
|
||||
using InstrumentGenres = QList<InstrumentGenre>;
|
||||
|
||||
static const QString COMMON_GENRE_ID("common");
|
||||
|
||||
struct Instrument
|
||||
{
|
||||
QString id;
|
||||
StaffNameList longNames;
|
||||
StaffNameList shortNames;
|
||||
QString name;
|
||||
QString musicXMLid;
|
||||
QString templateId;
|
||||
QString description;
|
||||
int sequenceOrder = 0;
|
||||
|
||||
bool extended = false;
|
||||
int staves = 1;
|
||||
|
||||
QString groupId;
|
||||
QStringList genreIds;
|
||||
QString familyId;
|
||||
|
||||
PitchRange amateurPitchRange;
|
||||
PitchRange professionalPitchRange;
|
||||
|
||||
ClefTypeList clefs[MAX_STAVES];
|
||||
int staffLines[MAX_STAVES] = { 0 };
|
||||
BracketType bracket[MAX_STAVES] = { BracketType::NO_BRACKET };
|
||||
int bracketSpan[MAX_STAVES] = { 0 };
|
||||
int barlineSpan[MAX_STAVES] = { 0 };
|
||||
bool smallStaff[MAX_STAVES] = { false };
|
||||
|
||||
Interval transpose;
|
||||
|
||||
StaffGroup staffGroup = StaffGroup::STANDARD;
|
||||
const StaffType* staffTypePreset = nullptr;
|
||||
|
||||
bool useDrumset = false;
|
||||
const Drumset* drumset = nullptr;
|
||||
|
||||
StringData stringData;
|
||||
|
||||
bool singleNoteDynamics = false;
|
||||
|
||||
MidiActionList midiActions;
|
||||
QList<MidiArticulation> midiArticulations;
|
||||
|
||||
ChannelList channels;
|
||||
|
||||
Trait trait;
|
||||
|
||||
bool isValid() const { return !id.isEmpty(); }
|
||||
QString abbreviature() const { return !shortNames.isEmpty() ? shortNames.first().name() : QString(); }
|
||||
};
|
||||
|
||||
using Instruments = QList<Instrument>;
|
||||
|
||||
struct PartInstrument
|
||||
{
|
||||
QString partId;
|
||||
Instrument instrument;
|
||||
|
||||
bool isExistingPart = false;
|
||||
bool isSoloist = false;
|
||||
};
|
||||
|
||||
using PartInstrumentList = QList<PartInstrument>;
|
||||
|
||||
struct ScoreOrderGroup
|
||||
{
|
||||
QString family;
|
||||
QString section;
|
||||
QString unsorted;
|
||||
|
||||
bool bracket = false;
|
||||
bool showSystemMarkings = false;
|
||||
bool barLineSpan = false;
|
||||
bool thinBracket = false;
|
||||
};
|
||||
|
||||
using InstrumentOverwrite = Ms::InstrumentOverwrite;
|
||||
|
||||
struct ScoreOrder
|
||||
{
|
||||
QString id;
|
||||
QString name;
|
||||
QMap<QString, InstrumentOverwrite> instrumentMap;
|
||||
QList<ScoreOrderGroup> groups;
|
||||
|
||||
bool isValid() { return !groups.empty(); }
|
||||
};
|
||||
|
||||
using ScoreOrders = QList<ScoreOrder>;
|
||||
|
||||
struct PartInstrumentListScoreOrder
|
||||
{
|
||||
PartInstrumentList instruments;
|
||||
ScoreOrder scoreOrder;
|
||||
};
|
||||
|
||||
struct InstrumentsMeta
|
||||
{
|
||||
Instruments instrumentTemplates;
|
||||
InstrumentGroups groups;
|
||||
InstrumentGenres genres;
|
||||
MidiArticulations articulations;
|
||||
ScoreOrders scoreOrders;
|
||||
|
||||
void clear()
|
||||
{
|
||||
instrumentTemplates.clear();
|
||||
groups.clear();
|
||||
genres.clear();
|
||||
articulations.clear();
|
||||
scoreOrders.clear();
|
||||
}
|
||||
};
|
||||
|
||||
class InstrumentsTreeItemType
|
||||
{
|
||||
Q_GADGET
|
||||
|
@ -243,7 +44,4 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(mu::instruments::Instrument)
|
||||
Q_DECLARE_METATYPE(mu::instruments::ScoreOrder)
|
||||
|
||||
#endif // MU_INSTRUMENTS_INSTRUMENTSTYPES_H
|
||||
|
|
|
@ -1,219 +0,0 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
* MuseScore-CLA-applies
|
||||
*
|
||||
* MuseScore
|
||||
* Music Composition & Notation
|
||||
*
|
||||
* Copyright (C) 2021 MuseScore BVBA and others
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "instrumentsconfiguration.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "settings.h"
|
||||
|
||||
using namespace mu;
|
||||
using namespace mu::instruments;
|
||||
using namespace mu::framework;
|
||||
|
||||
static const std::string module_name("instruments");
|
||||
static const Settings::Key FIRST_INSTRUMENT_LIST_KEY(module_name, "application/paths/instrumentList1");
|
||||
static const Settings::Key SECOND_INSTRUMENT_LIST_KEY(module_name, "application/paths/instrumentList2");
|
||||
static const Settings::Key FIRST_SCORE_ORDER_LIST_KEY(module_name, "application/paths/scoreOrderList1");
|
||||
static const Settings::Key SECOND_SCORE_ORDER_LIST_KEY(module_name, "application/paths/scoreOrderList2");
|
||||
|
||||
void InstrumentsConfiguration::init()
|
||||
{
|
||||
settings()->setDefaultValue(FIRST_INSTRUMENT_LIST_KEY,
|
||||
Val(globalConfiguration()->appDataPath().toStdString() + "instruments/instruments.xml"));
|
||||
settings()->valueChanged(FIRST_INSTRUMENT_LIST_KEY).onReceive(nullptr, [this](const Val&) {
|
||||
m_instrumentListPathsChanged.notify();
|
||||
});
|
||||
|
||||
settings()->setDefaultValue(SECOND_INSTRUMENT_LIST_KEY, Val(""));
|
||||
settings()->valueChanged(SECOND_INSTRUMENT_LIST_KEY).onReceive(nullptr, [this](const Val&) {
|
||||
m_instrumentListPathsChanged.notify();
|
||||
});
|
||||
|
||||
settings()->setDefaultValue(FIRST_SCORE_ORDER_LIST_KEY,
|
||||
Val(globalConfiguration()->appDataPath().toStdString() + "instruments/orders.xml"));
|
||||
settings()->valueChanged(FIRST_SCORE_ORDER_LIST_KEY).onReceive(nullptr, [this](const Val&) {
|
||||
m_scoreOrderListPathsChanged.notify();
|
||||
});
|
||||
|
||||
settings()->setDefaultValue(SECOND_SCORE_ORDER_LIST_KEY, Val(""));
|
||||
settings()->valueChanged(SECOND_SCORE_ORDER_LIST_KEY).onReceive(nullptr, [this](const Val&) {
|
||||
m_scoreOrderListPathsChanged.notify();
|
||||
});
|
||||
}
|
||||
|
||||
io::paths InstrumentsConfiguration::instrumentListPaths() const
|
||||
{
|
||||
io::paths paths;
|
||||
|
||||
io::path firstInstrumentListPath = this->firstInstrumentListPath();
|
||||
paths.push_back(firstInstrumentListPath);
|
||||
|
||||
io::path secondInstrumentListPath = this->secondInstrumentListPath();
|
||||
if (!secondInstrumentListPath.empty()) {
|
||||
paths.push_back(secondInstrumentListPath);
|
||||
}
|
||||
|
||||
io::path firstScoreOrderListPath = this->firstScoreOrderListPath();
|
||||
paths.push_back(firstScoreOrderListPath);
|
||||
|
||||
io::path secondScoreOrderListPath = this->secondScoreOrderListPath();
|
||||
if (!secondScoreOrderListPath.empty()) {
|
||||
paths.push_back(secondScoreOrderListPath);
|
||||
}
|
||||
|
||||
io::paths extensionsPath = this->extensionsPaths();
|
||||
paths.insert(paths.end(), extensionsPath.begin(), extensionsPath.end());
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
async::Notification InstrumentsConfiguration::instrumentListPathsChanged() const
|
||||
{
|
||||
return m_instrumentListPathsChanged;
|
||||
}
|
||||
|
||||
io::paths InstrumentsConfiguration::userInstrumentListPaths() const
|
||||
{
|
||||
io::paths paths = {
|
||||
firstInstrumentListPath(),
|
||||
secondInstrumentListPath()
|
||||
};
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
void InstrumentsConfiguration::setUserInstrumentListPaths(const io::paths& paths)
|
||||
{
|
||||
if (paths.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setFirstInstrumentListPath(paths[0]);
|
||||
if (paths.size() > 1) {
|
||||
setSecondInstrumentListPath(paths[1]);
|
||||
}
|
||||
}
|
||||
|
||||
io::path InstrumentsConfiguration::firstInstrumentListPath() const
|
||||
{
|
||||
return settings()->value(FIRST_INSTRUMENT_LIST_KEY).toString();
|
||||
}
|
||||
|
||||
void InstrumentsConfiguration::setFirstInstrumentListPath(const io::path& path)
|
||||
{
|
||||
settings()->setSharedValue(FIRST_INSTRUMENT_LIST_KEY, Val(path.toStdString()));
|
||||
}
|
||||
|
||||
io::path InstrumentsConfiguration::secondInstrumentListPath() const
|
||||
{
|
||||
return settings()->value(SECOND_INSTRUMENT_LIST_KEY).toString();
|
||||
}
|
||||
|
||||
void InstrumentsConfiguration::setSecondInstrumentListPath(const io::path& path)
|
||||
{
|
||||
settings()->setSharedValue(SECOND_INSTRUMENT_LIST_KEY, Val(path.toStdString()));
|
||||
}
|
||||
|
||||
io::paths InstrumentsConfiguration::scoreOrderListPaths() const
|
||||
{
|
||||
io::paths paths;
|
||||
|
||||
io::path firstScoreOrderListPath = this->firstScoreOrderListPath();
|
||||
paths.push_back(firstScoreOrderListPath);
|
||||
|
||||
io::path secondScoreOrderListPath = this->secondScoreOrderListPath();
|
||||
if (!secondScoreOrderListPath.empty()) {
|
||||
paths.push_back(secondScoreOrderListPath);
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
async::Notification InstrumentsConfiguration::scoreOrderListPathsChanged() const
|
||||
{
|
||||
return m_scoreOrderListPathsChanged;
|
||||
}
|
||||
|
||||
io::paths InstrumentsConfiguration::userScoreOrderListPaths() const
|
||||
{
|
||||
io::paths paths = {
|
||||
firstScoreOrderListPath(),
|
||||
secondScoreOrderListPath()
|
||||
};
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
void InstrumentsConfiguration::setUserScoreOrderListPaths(const io::paths& paths)
|
||||
{
|
||||
if (paths.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setFirstScoreOrderListPath(paths[0]);
|
||||
if (paths.size() > 1) {
|
||||
setSecondScoreOrderListPath(paths[1]);
|
||||
}
|
||||
}
|
||||
|
||||
io::path InstrumentsConfiguration::firstScoreOrderListPath() const
|
||||
{
|
||||
return settings()->value(FIRST_SCORE_ORDER_LIST_KEY).toString();
|
||||
}
|
||||
|
||||
void InstrumentsConfiguration::setFirstScoreOrderListPath(const io::path& path)
|
||||
{
|
||||
settings()->setSharedValue(FIRST_SCORE_ORDER_LIST_KEY, Val(path.toStdString()));
|
||||
}
|
||||
|
||||
io::path InstrumentsConfiguration::secondScoreOrderListPath() const
|
||||
{
|
||||
return settings()->value(SECOND_SCORE_ORDER_LIST_KEY).toString();
|
||||
}
|
||||
|
||||
void InstrumentsConfiguration::setSecondScoreOrderListPath(const io::path& path)
|
||||
{
|
||||
settings()->setSharedValue(SECOND_SCORE_ORDER_LIST_KEY, Val(path.toStdString()));
|
||||
}
|
||||
|
||||
io::paths InstrumentsConfiguration::extensionsPaths() const
|
||||
{
|
||||
if (!extensionsConfigurator()) {
|
||||
return io::paths();
|
||||
}
|
||||
|
||||
io::paths extensionsInstrumentsPaths = extensionsConfigurator()->instrumentsPaths();
|
||||
io::paths paths;
|
||||
|
||||
for (const io::path& path: extensionsInstrumentsPaths) {
|
||||
RetVal<io::paths> files = fileSystem()->scanFiles(path, { QString("*.xml") });
|
||||
if (!files.ret) {
|
||||
LOGE() << files.ret.toString();
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const io::path& file: files.val) {
|
||||
paths.push_back(file);
|
||||
}
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
* MuseScore-CLA-applies
|
||||
*
|
||||
* MuseScore
|
||||
* Music Composition & Notation
|
||||
*
|
||||
* Copyright (C) 2021 MuseScore BVBA and others
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MU_INSTRUMENTS_INSTRUMENTSCONFIGURATION_H
|
||||
#define MU_INSTRUMENTS_INSTRUMENTSCONFIGURATION_H
|
||||
|
||||
#include "modularity/ioc.h"
|
||||
#include "iglobalconfiguration.h"
|
||||
#include "extensions/iextensionsconfiguration.h"
|
||||
#include "system/ifilesystem.h"
|
||||
|
||||
#include "iinstrumentsconfiguration.h"
|
||||
|
||||
namespace mu::instruments {
|
||||
class InstrumentsConfiguration : public IInstrumentsConfiguration
|
||||
{
|
||||
INJECT(instruments, framework::IGlobalConfiguration, globalConfiguration)
|
||||
INJECT(instruments, extensions::IExtensionsConfiguration, extensionsConfigurator)
|
||||
INJECT(instruments, system::IFileSystem, fileSystem)
|
||||
|
||||
public:
|
||||
void init();
|
||||
|
||||
io::paths instrumentListPaths() const override;
|
||||
async::Notification instrumentListPathsChanged() const override;
|
||||
|
||||
io::paths userInstrumentListPaths() const override;
|
||||
void setUserInstrumentListPaths(const io::paths& paths) override;
|
||||
|
||||
io::paths scoreOrderListPaths() const override;
|
||||
async::Notification scoreOrderListPathsChanged() const override;
|
||||
|
||||
io::paths userScoreOrderListPaths() const override;
|
||||
void setUserScoreOrderListPaths(const io::paths& paths) override;
|
||||
|
||||
private:
|
||||
io::paths extensionsPaths() const;
|
||||
|
||||
io::path firstInstrumentListPath() const;
|
||||
void setFirstInstrumentListPath(const io::path& path);
|
||||
|
||||
io::path secondInstrumentListPath() const;
|
||||
void setSecondInstrumentListPath(const io::path& path);
|
||||
|
||||
io::path firstScoreOrderListPath() const;
|
||||
void setFirstScoreOrderListPath(const io::path& path);
|
||||
|
||||
io::path secondScoreOrderListPath() const;
|
||||
void setSecondScoreOrderListPath(const io::path& path);
|
||||
|
||||
async::Notification m_instrumentListPathsChanged;
|
||||
async::Notification m_scoreOrderListPathsChanged;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MU_INSTRUMENTS_INSTRUMENTSCONFIGURATION_H
|
|
@ -74,7 +74,8 @@ mu::RetVal<PartInstrumentListScoreOrder> SelectInstrumentsScenario::selectInstru
|
|||
result.ret = make_ret(Ret::Code::Ok);
|
||||
|
||||
QVariantMap info = instruments.val.toQVariant().toMap();
|
||||
result.val.scoreOrder = info["scoreOrder"].value<instruments::ScoreOrder>();
|
||||
result.val.scoreOrder = info["scoreOrder"].value<ScoreOrder>();
|
||||
|
||||
for (const QVariant& obj: info["instrumentList"].toList()) {
|
||||
QVariantMap map = obj.toMap();
|
||||
PartInstrument pi;
|
||||
|
|
|
@ -22,28 +22,28 @@
|
|||
#ifndef MU_INSTRUMENTS_SELECTINSTRUMENTSSCENARIO_H
|
||||
#define MU_INSTRUMENTS_SELECTINSTRUMENTSSCENARIO_H
|
||||
|
||||
#include "iselectinstrumentscenario.h"
|
||||
#include "notation/iselectinstrumentscenario.h"
|
||||
#include "modularity/ioc.h"
|
||||
#include "context/iglobalcontext.h"
|
||||
#include "iinteractive.h"
|
||||
|
||||
namespace mu::instruments {
|
||||
class SelectInstrumentsScenario : public ISelectInstrumentsScenario
|
||||
class SelectInstrumentsScenario : public notation::ISelectInstrumentsScenario
|
||||
{
|
||||
INJECT(instruments, context::IGlobalContext, globalContext)
|
||||
INJECT(instruments, framework::IInteractive, interactive)
|
||||
|
||||
public:
|
||||
RetVal<PartInstrumentListScoreOrder> selectInstruments(SelectInstrumentsMode mode = SelectInstrumentsMode::None) const override;
|
||||
RetVal<Instrument> selectInstrument(const std::string& currentInstrumentId = "") const override;
|
||||
RetVal<notation::PartInstrumentListScoreOrder> selectInstruments(SelectInstrumentsMode mode = SelectInstrumentsMode::None) const
|
||||
override;
|
||||
RetVal<notation::Instrument> selectInstrument(const std::string& currentInstrumentId = "") const override;
|
||||
|
||||
private:
|
||||
RetVal<PartInstrumentListScoreOrder> selectInstruments(const QStringList& params) const;
|
||||
RetVal<notation::PartInstrumentListScoreOrder> selectInstruments(const QStringList& params) const;
|
||||
|
||||
notation::INotationPartsPtr notationParts() const;
|
||||
notation::IDList partsIds() const;
|
||||
|
||||
ScoreOrder scoreOrder() const;
|
||||
notation::ScoreOrder scoreOrder() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -26,14 +26,14 @@
|
|||
|
||||
#include "modularity/ioc.h"
|
||||
#include "notation/inotationparts.h"
|
||||
#include "iselectinstrumentscenario.h"
|
||||
#include "notation/iselectinstrumentscenario.h"
|
||||
|
||||
namespace mu::instruments {
|
||||
class InstrumentControlTreeItem : public AbstractInstrumentsPanelTreeItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
INJECT(instruments, ISelectInstrumentsScenario, selectInstrumentsScenario)
|
||||
INJECT(instruments, notation::ISelectInstrumentsScenario, selectInstrumentsScenario)
|
||||
|
||||
public:
|
||||
explicit InstrumentControlTreeItem(notation::INotationPartsPtr notationParts, QObject* parent = nullptr);
|
||||
|
|
|
@ -43,9 +43,9 @@ static QString formatSelectedInstrumentTitle(const Instrument& instrument)
|
|||
const QString& instrumentName = instrument.name;
|
||||
|
||||
switch (instrument.trait.type) {
|
||||
case TraitType::Tuning: return qtrc("instruments", "%1 %2").arg(traitName).arg(instrumentName);
|
||||
case TraitType::Course: return qtrc("instruments", "%1 (%2)").arg(instrumentName).arg(traitName);
|
||||
case TraitType::Transposition: return qtrc("instruments", "%1 in %2").arg(instrumentName).arg(traitName);
|
||||
case TraitType::Tuning: return mu::qtrc("instruments", "%1 %2").arg(traitName).arg(instrumentName);
|
||||
case TraitType::Course: return mu::qtrc("instruments", "%1 (%2)").arg(instrumentName).arg(traitName);
|
||||
case TraitType::Transposition: return mu::qtrc("instruments", "%1 in %2").arg(instrumentName).arg(traitName);
|
||||
case TraitType::Unknown: break;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "modularity/ioc.h"
|
||||
#include "async/asyncable.h"
|
||||
#include "iinstrumentsrepository.h"
|
||||
#include "notation/iinstrumentsrepository.h"
|
||||
#include "context/iglobalcontext.h"
|
||||
|
||||
namespace mu::instruments {
|
||||
|
@ -34,7 +34,7 @@ class InstrumentListModel : public QObject, public async::Asyncable
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
INJECT(instruments, IInstrumentsRepository, repository)
|
||||
INJECT(instruments, notation::IInstrumentsRepository, repository)
|
||||
INJECT(instruments, context::IGlobalContext, globalContext)
|
||||
|
||||
Q_PROPERTY(QVariantList families READ families NOTIFY dataChanged)
|
||||
|
@ -93,7 +93,7 @@ private:
|
|||
QString familyId;
|
||||
bool isSoloist = false;
|
||||
bool isExistingPart = false;
|
||||
Instrument config;
|
||||
notation::Instrument config;
|
||||
|
||||
bool operator==(const SelectedInstrumentInfo& info) const { return id == info.id; }
|
||||
};
|
||||
|
@ -102,7 +102,7 @@ private:
|
|||
{
|
||||
QString id;
|
||||
bool customized = false;
|
||||
ScoreOrder info;
|
||||
notation::ScoreOrder info;
|
||||
|
||||
bool operator==(const ScoreOrderInfo& info) const { return id == info.id; }
|
||||
};
|
||||
|
@ -115,14 +115,14 @@ private:
|
|||
|
||||
bool isSearching() const;
|
||||
|
||||
void setInstrumentsMeta(const InstrumentsMeta& meta);
|
||||
void setInstrumentsMeta(const notation::InstrumentsMeta& meta);
|
||||
QVariantMap allInstrumentsItem() const;
|
||||
|
||||
void updateFamilyStateBySearch();
|
||||
|
||||
bool isInstrumentAccepted(const Instrument& instrument, bool compareWithSelectedGroup = true) const;
|
||||
bool isInstrumentAccepted(const notation::Instrument& instrument, bool compareWithSelectedGroup = true) const;
|
||||
|
||||
Instrument instrumentById(const QString& instrumentId) const;
|
||||
notation::Instrument instrumentById(const QString& instrumentId) const;
|
||||
|
||||
int indexOfScoreOrderId(const QString& id) const;
|
||||
void sortSelectedInstruments();
|
||||
|
@ -143,7 +143,7 @@ private:
|
|||
QString m_savedFamilyId;
|
||||
int m_selectedScoreOrderIndex = -1;
|
||||
|
||||
InstrumentsMeta m_instrumentsMeta;
|
||||
notation::InstrumentsMeta m_instrumentsMeta;
|
||||
QString m_searchText;
|
||||
|
||||
QList<SelectedInstrumentInfo> m_selectedInstruments;
|
||||
|
|
|
@ -28,14 +28,14 @@
|
|||
#include "async/asyncable.h"
|
||||
#include "context/iglobalcontext.h"
|
||||
#include "notation/notationtypes.h"
|
||||
#include "iselectinstrumentscenario.h"
|
||||
#include "notation/iselectinstrumentscenario.h"
|
||||
|
||||
namespace mu::instruments {
|
||||
class InstrumentSettingsModel : public QObject, public async::Asyncable
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
INJECT(instruments, ISelectInstrumentsScenario, selectInstrumentsScenario)
|
||||
INJECT(instruments, notation::ISelectInstrumentsScenario, selectInstrumentsScenario)
|
||||
INJECT(instruments, context::IGlobalContext, context)
|
||||
|
||||
Q_PROPERTY(QString instrumentName READ instrumentName WRITE setInstrumentName NOTIFY dataChanged)
|
||||
|
|
|
@ -28,12 +28,11 @@
|
|||
#include "abstractinstrumentspaneltreeitem.h"
|
||||
#include "modularity/ioc.h"
|
||||
#include "notation/inotationparts.h"
|
||||
#include "notation/iselectinstrumentscenario.h"
|
||||
#include "context/iglobalcontext.h"
|
||||
#include "async/asyncable.h"
|
||||
#include "actions/iactionsdispatcher.h"
|
||||
#include "actions/actionable.h"
|
||||
#include "instrumentstypes.h"
|
||||
#include "iselectinstrumentscenario.h"
|
||||
|
||||
namespace mu::uicomponents {
|
||||
class ItemMultiSelectionModel;
|
||||
|
@ -49,7 +48,7 @@ class InstrumentsPanelTreeModel : public QAbstractItemModel, public async::Async
|
|||
Q_OBJECT
|
||||
|
||||
INJECT(instruments, context::IGlobalContext, context)
|
||||
INJECT(instruments, ISelectInstrumentsScenario, selectInstrumentsScenario)
|
||||
INJECT(instruments, notation::ISelectInstrumentsScenario, selectInstrumentsScenario)
|
||||
INJECT(instruments, actions::IActionsDispatcher, dispatcher)
|
||||
|
||||
Q_PROPERTY(QItemSelectionModel * selectionModel READ selectionModel NOTIFY selectionChanged)
|
||||
|
|
|
@ -69,7 +69,7 @@ QString StaffSettingsModel::staffType() const
|
|||
|
||||
void StaffSettingsModel::setStaffType(int type)
|
||||
{
|
||||
auto type_ = static_cast<notation::StaffType>(type);
|
||||
auto type_ = static_cast<StaffType>(type);
|
||||
|
||||
if (m_type == type_ || !parts()) {
|
||||
return;
|
||||
|
|
|
@ -55,7 +55,8 @@ set(MODULE_SRC
|
|||
${CMAKE_CURRENT_LIST_DIR}/inotationplayback.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/inotationelements.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/inotationparts.h
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/iinstrumentsrepository.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/iselectinstrumentscenario.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/notationuiactions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/notationuiactions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/igetscore.h
|
||||
|
@ -118,6 +119,10 @@ set(MODULE_SRC
|
|||
${CMAKE_CURRENT_LIST_DIR}/internal/inotationmidievents.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/notationmidievents.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/notationmidievents.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsconverter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsconverter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsrepository.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/instrumentsrepository.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/view/inotationcontextmenu.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/view/notationpaintview.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/view/notationpaintview.h
|
||||
|
@ -178,7 +183,6 @@ set(MODULE_LINK
|
|||
qzip
|
||||
${Z_LIB}
|
||||
engraving
|
||||
instruments
|
||||
commonscene
|
||||
uicomponents
|
||||
ui
|
||||
|
|
|
@ -19,15 +19,15 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MU_INSTRUMENTS_IINSTRUMENTSREPOSITORY_H
|
||||
#define MU_INSTRUMENTS_IINSTRUMENTSREPOSITORY_H
|
||||
#ifndef MU_NOTATION_IINSTRUMENTSREPOSITORY_H
|
||||
#define MU_NOTATION_IINSTRUMENTSREPOSITORY_H
|
||||
|
||||
#include "modularity/imoduleexport.h"
|
||||
|
||||
#include "retval.h"
|
||||
#include "instrumentstypes.h"
|
||||
#include "notationtypes.h"
|
||||
|
||||
namespace mu::instruments {
|
||||
namespace mu::notation {
|
||||
class IInstrumentsRepository : MODULE_EXPORT_INTERFACE
|
||||
{
|
||||
INTERFACE_ID(IInstrumentsRepository)
|
||||
|
@ -39,4 +39,4 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
#endif // MU_INSTRUMENTS_IINSTRUMENTSREPOSITORY_H
|
||||
#endif // MU_NOTATION_IINSTRUMENTSREPOSITORY_H
|
|
@ -50,7 +50,7 @@ public:
|
|||
virtual Meta metaInfo() const = 0;
|
||||
virtual void setMetaInfo(const Meta& meta) = 0;
|
||||
|
||||
virtual instruments::ScoreOrder scoreOrder() const = 0;
|
||||
virtual ScoreOrder scoreOrder() const = 0;
|
||||
|
||||
virtual INotationPtr clone() const = 0;
|
||||
|
||||
|
|
|
@ -144,6 +144,18 @@ public:
|
|||
|
||||
virtual void setTemplateModeEnalbed(bool enabled) = 0;
|
||||
virtual void setTestModeEnabled(bool enabled) = 0;
|
||||
|
||||
virtual io::paths instrumentListPaths() const = 0;
|
||||
virtual async::Notification instrumentListPathsChanged() const = 0;
|
||||
|
||||
virtual io::paths userInstrumentListPaths() const = 0;
|
||||
virtual void setUserInstrumentListPaths(const io::paths& paths) = 0;
|
||||
|
||||
virtual io::paths scoreOrderListPaths() const = 0;
|
||||
virtual async::Notification scoreOrderListPathsChanged() const = 0;
|
||||
|
||||
virtual io::paths userScoreOrderListPaths() const = 0;
|
||||
virtual void setUserScoreOrderListPaths(const io::paths& paths) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#define MU_NOTATION_INOTATIONPARTS_H
|
||||
|
||||
#include "notationtypes.h"
|
||||
#include "instruments/instrumentstypes.h"
|
||||
#include "async/notification.h"
|
||||
#include "async/channel.h"
|
||||
#include "async/notifylist.h"
|
||||
|
@ -39,14 +38,14 @@ public:
|
|||
virtual ~INotationParts() = default;
|
||||
|
||||
virtual async::NotifyList<const Part*> partList() const = 0;
|
||||
virtual async::NotifyList<instruments::Instrument> instrumentList(const ID& partId) const = 0;
|
||||
virtual async::NotifyList<Instrument> instrumentList(const ID& partId) const = 0;
|
||||
virtual async::NotifyList<const Staff*> staffList(const ID& partId, const ID& instrumentId) const = 0;
|
||||
|
||||
virtual ValCh<bool> canChangeInstrumentVisibility(const ID& instrumentId, const ID& fromPartId) const = 0;
|
||||
virtual bool voiceVisible(int voiceIndex) const = 0;
|
||||
|
||||
virtual void setParts(const instruments::PartInstrumentList& instruments) = 0;
|
||||
virtual void setScoreOrder(const instruments::ScoreOrder& order) = 0;
|
||||
virtual void setParts(const PartInstrumentList& instruments) = 0;
|
||||
virtual void setScoreOrder(const ScoreOrder& order) = 0;
|
||||
virtual void setPartVisible(const ID& partId, bool visible) = 0;
|
||||
virtual void setInstrumentVisible(const ID& instrumentId, const ID& fromPartId, bool visible) = 0;
|
||||
virtual void setStaffVisible(const ID& staffId, bool visible) = 0;
|
||||
|
@ -54,7 +53,7 @@ public:
|
|||
virtual void setVoiceVisible(const ID& staffId, int voiceIndex, bool visible) = 0;
|
||||
virtual void setPartName(const ID& partId, const QString& name) = 0;
|
||||
virtual void setPartSharpFlat(const ID& partId, const SharpFlat& sharpFlat) = 0;
|
||||
virtual void setPartTransposition(const ID& partId, const instruments::Interval& transpose) = 0;
|
||||
virtual void setPartTransposition(const ID& partId, const Interval& transpose) = 0;
|
||||
virtual void setInstrumentName(const ID& instrumentId, const ID& fromPartId, const QString& name) = 0;
|
||||
virtual void setInstrumentAbbreviature(const ID& instrumentId, const ID& fromPartId, const QString& abbreviature) = 0;
|
||||
virtual void setStaffType(const ID& staffId, StaffType type) = 0;
|
||||
|
@ -77,12 +76,12 @@ public:
|
|||
const ID& destinationInstrumentId, InsertMode mode = InsertMode::Before) = 0;
|
||||
virtual void moveStaves(const IDList& sourceStavesIds, const ID& destinationStaffId, InsertMode mode = InsertMode::Before) = 0;
|
||||
|
||||
virtual void appendDoublingInstrument(const instruments::Instrument& instrument, const ID& destinationPartId) = 0;
|
||||
virtual void appendDoublingInstrument(const Instrument& instrument, const ID& destinationPartId) = 0;
|
||||
virtual void appendStaff(Staff* staff, const ID& destinationPartId) = 0;
|
||||
|
||||
virtual void cloneStaff(const ID& sourceStaffId, const ID& destinationStaffId) = 0;
|
||||
|
||||
virtual void replaceInstrument(const ID& instrumentId, const ID& fromPartId, const instruments::Instrument& newInstrument) = 0;
|
||||
virtual void replaceInstrument(const ID& instrumentId, const ID& fromPartId, const Instrument& newInstrument) = 0;
|
||||
|
||||
virtual async::Notification partsChanged() const = 0;
|
||||
};
|
||||
|
|
|
@ -24,10 +24,9 @@
|
|||
|
||||
#include "libmscore/instrument.h"
|
||||
#include "libmscore/instrtemplate.h"
|
||||
#include "libmscore/drumset.h"
|
||||
|
||||
#include "midi/midievent.h"
|
||||
|
||||
using namespace mu::instruments;
|
||||
using namespace mu::notation;
|
||||
|
||||
Ms::Instrument InstrumentsConverter::convertInstrument(const Instrument& instrument)
|
||||
{
|
||||
|
@ -61,8 +60,8 @@ Ms::Instrument InstrumentsConverter::convertInstrument(const Instrument& instrum
|
|||
|
||||
result.clearChannels();
|
||||
|
||||
for (const instruments::Channel& channel : instrument.channels) {
|
||||
result.appendChannel(new instruments::Channel(channel));
|
||||
for (const InstrumentChannel& channel : instrument.channels) {
|
||||
result.appendChannel(new InstrumentChannel(channel));
|
||||
}
|
||||
|
||||
result.setStringData(instrument.stringData);
|
||||
|
@ -101,7 +100,7 @@ Instrument InstrumentsConverter::convertInstrument(const Ms::Instrument& instrum
|
|||
result.midiActions = convertMidiActions(instrument.midiActions());
|
||||
result.midiArticulations = instrument.articulation();
|
||||
|
||||
for (const instruments::Channel* channel : instrument.channel()) {
|
||||
for (const InstrumentChannel* channel : instrument.channel()) {
|
||||
result.channels.append(*channel);
|
||||
}
|
||||
|
|
@ -20,10 +20,10 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MU_INSTRUMENTS_INSTRUMENTSCONVERTER_H
|
||||
#define MU_INSTRUMENTS_INSTRUMENTSCONVERTER_H
|
||||
#ifndef MU_NOTATION_INSTRUMENTSCONVERTER_H
|
||||
#define MU_NOTATION_INSTRUMENTSCONVERTER_H
|
||||
|
||||
#include "../instrumentstypes.h"
|
||||
#include "notation/notationtypes.h"
|
||||
|
||||
namespace Ms {
|
||||
class Instrument;
|
||||
|
@ -31,12 +31,12 @@ class InstrumentTemplate;
|
|||
struct NamedEventList;
|
||||
}
|
||||
|
||||
namespace mu::instruments {
|
||||
namespace mu::notation {
|
||||
class InstrumentsConverter
|
||||
{
|
||||
public:
|
||||
static Ms::Instrument convertInstrument(const Instrument& instrument);
|
||||
static Instrument convertInstrument(const Ms::Instrument& insturment);
|
||||
static Instrument convertInstrument(const Ms::Instrument& instrument);
|
||||
static Instrument convertInstrument(const Ms::InstrumentTemplate& templ);
|
||||
|
||||
private:
|
||||
|
@ -45,4 +45,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
#endif // MU_INSTRUMENTS_INSTRUMENTSCONVERTER_H
|
||||
#endif // MU_NOTATION_INSTRUMENTSCONVERTER_H
|
|
@ -29,24 +29,10 @@
|
|||
|
||||
#include "instrumentsconverter.h"
|
||||
|
||||
using namespace mu;
|
||||
using namespace mu::instruments;
|
||||
using namespace mu::extensions;
|
||||
using namespace mu::framework;
|
||||
using namespace mu::notation;
|
||||
|
||||
void InstrumentsRepository::init()
|
||||
{
|
||||
if (extensionsService()) {
|
||||
RetCh<Extension> extensionChanged = extensionsService()->extensionChanged();
|
||||
if (extensionChanged.ret) {
|
||||
extensionChanged.ch.onReceive(this, [this](const Extension& newExtension) {
|
||||
if (newExtension.types.testFlag(Extension::Instruments)) {
|
||||
load();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
configuration()->instrumentListPathsChanged().onNotify(this, [this]() {
|
||||
load();
|
||||
});
|
||||
|
@ -58,9 +44,8 @@ void InstrumentsRepository::init()
|
|||
load();
|
||||
}
|
||||
|
||||
RetValCh<InstrumentsMeta> InstrumentsRepository::instrumentsMeta()
|
||||
mu::RetValCh<InstrumentsMeta> InstrumentsRepository::instrumentsMeta()
|
||||
{
|
||||
QMutexLocker locker(&m_instrumentsMutex);
|
||||
RetValCh<InstrumentsMeta> result;
|
||||
result.ret = make_ret(Ret::Code::Ok);
|
||||
result.val = m_instrumentsMeta;
|
||||
|
@ -73,8 +58,8 @@ void InstrumentsRepository::load()
|
|||
{
|
||||
TRACEFUNC;
|
||||
|
||||
QMutexLocker locker(&m_instrumentsMutex);
|
||||
Ms::clearInstrumentTemplates();
|
||||
m_instrumentsMeta.clear();
|
||||
|
||||
for (const io::path& filePath: configuration()->instrumentListPaths()) {
|
||||
if (!Ms::loadInstrumentTemplates(filePath.toQString())) {
|
||||
|
@ -90,7 +75,6 @@ void InstrumentsRepository::fillInstrumentsMeta(InstrumentsMeta& meta)
|
|||
{
|
||||
TRACEFUNC;
|
||||
|
||||
meta.clear();
|
||||
meta.articulations = Ms::articulation;
|
||||
|
||||
for (const Ms::InstrumentGenre* msGenre : Ms::instrumentGenres) {
|
||||
|
@ -114,20 +98,20 @@ void InstrumentsRepository::fillInstrumentsMeta(InstrumentsMeta& meta)
|
|||
continue;
|
||||
}
|
||||
|
||||
Instrument templ = InstrumentsConverter::convertInstrument(*msTemplate);
|
||||
Instrument templ = notation::InstrumentsConverter::convertInstrument(*msTemplate);
|
||||
templ.groupId = msGroup->id;
|
||||
|
||||
meta.instrumentTemplates << templ;
|
||||
}
|
||||
}
|
||||
|
||||
for (const Ms::ScoreOrder& msOrder : Ms::instrumentOrders) {
|
||||
for (const Ms::ScoreOrder* msOrder : Ms::instrumentOrders) {
|
||||
ScoreOrder order;
|
||||
order.id = msOrder.id;
|
||||
order.name = msOrder.name;
|
||||
order.instrumentMap = msOrder.instrumentMap;
|
||||
order.id = msOrder->id;
|
||||
order.name = msOrder->name;
|
||||
order.instrumentMap = msOrder->instrumentMap;
|
||||
|
||||
for (const Ms::ScoreGroup& msGroup : msOrder.groups) {
|
||||
for (const Ms::ScoreGroup& msGroup : msOrder->groups) {
|
||||
ScoreOrderGroup group;
|
||||
group.family = msGroup.family;
|
||||
group.section = msGroup.section;
|
|
@ -19,27 +19,21 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MU_INSTRUMENTS_INSTRUMENTSREPOSITORY_H
|
||||
#define MU_INSTRUMENTS_INSTRUMENTSREPOSITORY_H
|
||||
|
||||
#include <QMutex>
|
||||
#ifndef MU_NOTATION_INSTRUMENTSREPOSITORY_H
|
||||
#define MU_NOTATION_INSTRUMENTSREPOSITORY_H
|
||||
|
||||
#include "modularity/ioc.h"
|
||||
|
||||
#include "retval.h"
|
||||
#include "async/channel.h"
|
||||
#include "async/asyncable.h"
|
||||
#include "extensions/iextensionsservice.h"
|
||||
|
||||
#include "instrumentstypes.h"
|
||||
#include "iinstrumentsrepository.h"
|
||||
#include "iinstrumentsconfiguration.h"
|
||||
#include "inotationconfiguration.h"
|
||||
|
||||
namespace mu::instruments {
|
||||
namespace mu::notation {
|
||||
class InstrumentsRepository : public IInstrumentsRepository, public async::Asyncable
|
||||
{
|
||||
INJECT(instruments, IInstrumentsConfiguration, configuration)
|
||||
INJECT(instruments, extensions::IExtensionsService, extensionsService)
|
||||
INJECT(notation, INotationConfiguration, configuration)
|
||||
|
||||
public:
|
||||
void init();
|
||||
|
@ -52,9 +46,8 @@ private:
|
|||
void fillInstrumentsMeta(InstrumentsMeta& meta);
|
||||
|
||||
InstrumentsMeta m_instrumentsMeta;
|
||||
QMutex m_instrumentsMutex;
|
||||
async::Channel<InstrumentsMeta> m_instrumentsMetaChannel;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MU_INSTRUMENTS_INSTRUMENTSREPOSITORY_H
|
||||
#endif // MU_NOTATION_INSTRUMENTSREPOSITORY_H
|
|
@ -45,14 +45,14 @@ void MasterNotationParts::apply()
|
|||
partsChanged().notify();
|
||||
}
|
||||
|
||||
void MasterNotationParts::setParts(const instruments::PartInstrumentList& instruments)
|
||||
void MasterNotationParts::setParts(const PartInstrumentList& instruments)
|
||||
{
|
||||
startEdit();
|
||||
NotationParts::setParts(instruments);
|
||||
apply();
|
||||
}
|
||||
|
||||
void MasterNotationParts::setScoreOrder(const instruments::ScoreOrder& order)
|
||||
void MasterNotationParts::setScoreOrder(const ScoreOrder& order)
|
||||
{
|
||||
startEdit();
|
||||
NotationParts::setScoreOrder(order);
|
||||
|
@ -98,7 +98,7 @@ void MasterNotationParts::setPartSharpFlat(const ID& partId, const SharpFlat& sh
|
|||
apply();
|
||||
}
|
||||
|
||||
void MasterNotationParts::setPartTransposition(const ID& partId, const instruments::Interval& transpose)
|
||||
void MasterNotationParts::setPartTransposition(const ID& partId, const Interval& transpose)
|
||||
{
|
||||
startEdit();
|
||||
|
||||
|
@ -247,7 +247,7 @@ void MasterNotationParts::moveStaves(const IDList& sourceStavesIds, const ID& de
|
|||
apply();
|
||||
}
|
||||
|
||||
void MasterNotationParts::appendDoublingInstrument(const instruments::Instrument& instrument, const ID& destinationPartId)
|
||||
void MasterNotationParts::appendDoublingInstrument(const Instrument& instrument, const ID& destinationPartId)
|
||||
{
|
||||
startEdit();
|
||||
|
||||
|
@ -286,7 +286,7 @@ void MasterNotationParts::cloneStaff(const ID& sourceStaffId, const ID& destinat
|
|||
apply();
|
||||
}
|
||||
|
||||
void MasterNotationParts::replaceInstrument(const ID& instrumentId, const ID& fromPartId, const instruments::Instrument& newInstrument)
|
||||
void MasterNotationParts::replaceInstrument(const ID& instrumentId, const ID& fromPartId, const Instrument& newInstrument)
|
||||
{
|
||||
startEdit();
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ public:
|
|||
|
||||
void setExcerpts(ExcerptNotationList excerpts);
|
||||
|
||||
void setParts(const instruments::PartInstrumentList& instruments) override;
|
||||
void setScoreOrder(const instruments::ScoreOrder& order) override;
|
||||
void setParts(const PartInstrumentList& instruments) override;
|
||||
void setScoreOrder(const ScoreOrder& order) override;
|
||||
void setInstrumentName(const ID& instrumentId, const ID& fromPartId, const QString& name) override;
|
||||
void setPartName(const ID& partId, const QString& name) override;
|
||||
void setPartSharpFlat(const ID& partId, const SharpFlat& sharpFlat) override;
|
||||
void setPartTransposition(const ID& partId, const instruments::Interval& transpose) override;
|
||||
void setPartTransposition(const ID& partId, const Interval& transpose) override;
|
||||
void setInstrumentAbbreviature(const ID& instrumentId, const ID& fromPartId, const QString& abbreviature) override;
|
||||
void setStaffType(const ID& staffId, StaffType type) override;
|
||||
void setCutawayEnabled(const ID& staffId, bool enabled) override;
|
||||
|
@ -56,12 +56,12 @@ public:
|
|||
const ID& destinationInstrumentId, InsertMode mode = InsertMode::Before) override;
|
||||
void moveStaves(const IDList& sourceStavesIds, const ID& destinationStaffId, InsertMode mode = InsertMode::Before) override;
|
||||
|
||||
void appendDoublingInstrument(const instruments::Instrument& instrument, const ID& destinationPartId) override;
|
||||
void appendDoublingInstrument(const Instrument& instrument, const ID& destinationPartId) override;
|
||||
void appendStaff(Staff* staff, const ID& destinationPartId) override;
|
||||
|
||||
void cloneStaff(const ID& sourceStaffId, const ID& destinationStaffId) override;
|
||||
|
||||
void replaceInstrument(const ID& instrumentId, const ID& fromPartId, const instruments::Instrument& newInstrument) override;
|
||||
void replaceInstrument(const ID& instrumentId, const ID& fromPartId, const Instrument& newInstrument) override;
|
||||
|
||||
private:
|
||||
void startEdit();
|
||||
|
|
|
@ -244,12 +244,9 @@ void Notation::setMetaInfo(const Meta& meta)
|
|||
score()->setMetaTags(tags);
|
||||
}
|
||||
|
||||
mu::instruments::ScoreOrder Notation::scoreOrder() const
|
||||
ScoreOrder Notation::scoreOrder() const
|
||||
{
|
||||
if (!m_score) {
|
||||
return mu::instruments::ScoreOrder();
|
||||
}
|
||||
return ScoreOrderConverter::convertScoreOrder(m_score->scoreOrder());
|
||||
return m_score ? ScoreOrderConverter::convertScoreOrder(m_score->scoreOrder()) : ScoreOrder();
|
||||
}
|
||||
|
||||
INotationPtr Notation::clone() const
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
Meta metaInfo() const override;
|
||||
void setMetaInfo(const Meta& meta) override;
|
||||
|
||||
instruments::ScoreOrder scoreOrder() const override;
|
||||
ScoreOrder scoreOrder() const override;
|
||||
|
||||
INotationPtr clone() const override;
|
||||
|
||||
|
|
|
@ -84,6 +84,11 @@ static const Settings::Key VOICE2_COLOR_KEY(module_name, "ui/score/voice2/color"
|
|||
static const Settings::Key VOICE3_COLOR_KEY(module_name, "ui/score/voice3/color");
|
||||
static const Settings::Key VOICE4_COLOR_KEY(module_name, "ui/score/voice4/color");
|
||||
|
||||
static const Settings::Key FIRST_INSTRUMENT_LIST_KEY(module_name, "application/paths/instrumentList1");
|
||||
static const Settings::Key SECOND_INSTRUMENT_LIST_KEY(module_name, "application/paths/instrumentList2");
|
||||
static const Settings::Key FIRST_SCORE_ORDER_LIST_KEY(module_name, "application/paths/scoreOrderList1");
|
||||
static const Settings::Key SECOND_SCORE_ORDER_LIST_KEY(module_name, "application/paths/scoreOrderList2");
|
||||
|
||||
static std::map<int, Settings::Key> voicesKeys {
|
||||
{ 0, VOICE1_COLOR_KEY },
|
||||
{ 1, VOICE2_COLOR_KEY },
|
||||
|
@ -174,6 +179,28 @@ void NotationConfiguration::init()
|
|||
});
|
||||
}
|
||||
|
||||
settings()->setDefaultValue(FIRST_INSTRUMENT_LIST_KEY,
|
||||
Val(globalConfiguration()->appDataPath().toStdString() + "instruments/instruments.xml"));
|
||||
settings()->valueChanged(FIRST_INSTRUMENT_LIST_KEY).onReceive(nullptr, [this](const Val&) {
|
||||
m_instrumentListPathsChanged.notify();
|
||||
});
|
||||
|
||||
settings()->setDefaultValue(SECOND_INSTRUMENT_LIST_KEY, Val(""));
|
||||
settings()->valueChanged(SECOND_INSTRUMENT_LIST_KEY).onReceive(nullptr, [this](const Val&) {
|
||||
m_instrumentListPathsChanged.notify();
|
||||
});
|
||||
|
||||
settings()->setDefaultValue(FIRST_SCORE_ORDER_LIST_KEY,
|
||||
Val(globalConfiguration()->appDataPath().toStdString() + "instruments/orders.xml"));
|
||||
settings()->valueChanged(FIRST_SCORE_ORDER_LIST_KEY).onReceive(nullptr, [this](const Val&) {
|
||||
m_scoreOrderListPathsChanged.notify();
|
||||
});
|
||||
|
||||
settings()->setDefaultValue(SECOND_SCORE_ORDER_LIST_KEY, Val(""));
|
||||
settings()->valueChanged(SECOND_SCORE_ORDER_LIST_KEY).onReceive(nullptr, [this](const Val&) {
|
||||
m_scoreOrderListPathsChanged.notify();
|
||||
});
|
||||
|
||||
// libmscore
|
||||
preferences().setBackupDirPath(globalConfiguration()->userBackupPath().toQString());
|
||||
preferences().setDefaultStyleFilePath(defaultStyleFilePath().toQString());
|
||||
|
@ -563,3 +590,135 @@ void NotationConfiguration::setTestModeEnabled(bool enabled)
|
|||
{
|
||||
Ms::MScore::testMode = enabled;
|
||||
}
|
||||
|
||||
io::paths NotationConfiguration::instrumentListPaths() const
|
||||
{
|
||||
io::paths paths;
|
||||
|
||||
io::path firstInstrumentListPath = this->firstInstrumentListPath();
|
||||
paths.push_back(firstInstrumentListPath);
|
||||
|
||||
io::path secondInstrumentListPath = this->secondInstrumentListPath();
|
||||
if (!secondInstrumentListPath.empty()) {
|
||||
paths.push_back(secondInstrumentListPath);
|
||||
}
|
||||
|
||||
io::path firstScoreOrderListPath = this->firstScoreOrderListPath();
|
||||
paths.push_back(firstScoreOrderListPath);
|
||||
|
||||
io::path secondScoreOrderListPath = this->secondScoreOrderListPath();
|
||||
if (!secondScoreOrderListPath.empty()) {
|
||||
paths.push_back(secondScoreOrderListPath);
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
async::Notification NotationConfiguration::instrumentListPathsChanged() const
|
||||
{
|
||||
return m_instrumentListPathsChanged;
|
||||
}
|
||||
|
||||
io::paths NotationConfiguration::userInstrumentListPaths() const
|
||||
{
|
||||
io::paths paths = {
|
||||
firstInstrumentListPath(),
|
||||
secondInstrumentListPath()
|
||||
};
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
void NotationConfiguration::setUserInstrumentListPaths(const io::paths& paths)
|
||||
{
|
||||
if (paths.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setFirstInstrumentListPath(paths[0]);
|
||||
if (paths.size() > 1) {
|
||||
setSecondInstrumentListPath(paths[1]);
|
||||
}
|
||||
}
|
||||
|
||||
io::path NotationConfiguration::firstInstrumentListPath() const
|
||||
{
|
||||
return settings()->value(FIRST_INSTRUMENT_LIST_KEY).toString();
|
||||
}
|
||||
|
||||
void NotationConfiguration::setFirstInstrumentListPath(const io::path& path)
|
||||
{
|
||||
settings()->setSharedValue(FIRST_INSTRUMENT_LIST_KEY, Val(path.toStdString()));
|
||||
}
|
||||
|
||||
io::path NotationConfiguration::secondInstrumentListPath() const
|
||||
{
|
||||
return settings()->value(SECOND_INSTRUMENT_LIST_KEY).toString();
|
||||
}
|
||||
|
||||
void NotationConfiguration::setSecondInstrumentListPath(const io::path& path)
|
||||
{
|
||||
settings()->setSharedValue(SECOND_INSTRUMENT_LIST_KEY, Val(path.toStdString()));
|
||||
}
|
||||
|
||||
io::paths NotationConfiguration::scoreOrderListPaths() const
|
||||
{
|
||||
io::paths paths;
|
||||
|
||||
io::path firstScoreOrderListPath = this->firstScoreOrderListPath();
|
||||
paths.push_back(firstScoreOrderListPath);
|
||||
|
||||
io::path secondScoreOrderListPath = this->secondScoreOrderListPath();
|
||||
if (!secondScoreOrderListPath.empty()) {
|
||||
paths.push_back(secondScoreOrderListPath);
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
async::Notification NotationConfiguration::scoreOrderListPathsChanged() const
|
||||
{
|
||||
return m_scoreOrderListPathsChanged;
|
||||
}
|
||||
|
||||
io::paths NotationConfiguration::userScoreOrderListPaths() const
|
||||
{
|
||||
io::paths paths = {
|
||||
firstScoreOrderListPath(),
|
||||
secondScoreOrderListPath()
|
||||
};
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
void NotationConfiguration::setUserScoreOrderListPaths(const io::paths& paths)
|
||||
{
|
||||
if (paths.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setFirstScoreOrderListPath(paths[0]);
|
||||
if (paths.size() > 1) {
|
||||
setSecondScoreOrderListPath(paths[1]);
|
||||
}
|
||||
}
|
||||
|
||||
io::path NotationConfiguration::firstScoreOrderListPath() const
|
||||
{
|
||||
return settings()->value(FIRST_SCORE_ORDER_LIST_KEY).toString();
|
||||
}
|
||||
|
||||
void NotationConfiguration::setFirstScoreOrderListPath(const io::path& path)
|
||||
{
|
||||
settings()->setSharedValue(FIRST_SCORE_ORDER_LIST_KEY, Val(path.toStdString()));
|
||||
}
|
||||
|
||||
io::path NotationConfiguration::secondScoreOrderListPath() const
|
||||
{
|
||||
return settings()->value(SECOND_SCORE_ORDER_LIST_KEY).toString();
|
||||
}
|
||||
|
||||
void NotationConfiguration::setSecondScoreOrderListPath(const io::path& path)
|
||||
{
|
||||
settings()->setSharedValue(SECOND_SCORE_ORDER_LIST_KEY, Val(path.toStdString()));
|
||||
}
|
||||
|
|
|
@ -148,7 +148,30 @@ public:
|
|||
void setTemplateModeEnalbed(bool enabled) override;
|
||||
void setTestModeEnabled(bool enabled) override;
|
||||
|
||||
io::paths instrumentListPaths() const override;
|
||||
async::Notification instrumentListPathsChanged() const override;
|
||||
|
||||
io::paths userInstrumentListPaths() const override;
|
||||
void setUserInstrumentListPaths(const io::paths& paths) override;
|
||||
|
||||
io::paths scoreOrderListPaths() const override;
|
||||
async::Notification scoreOrderListPathsChanged() const override;
|
||||
|
||||
io::paths userScoreOrderListPaths() const override;
|
||||
void setUserScoreOrderListPaths(const io::paths& paths) override;
|
||||
|
||||
private:
|
||||
io::path firstInstrumentListPath() const;
|
||||
void setFirstInstrumentListPath(const io::path& path);
|
||||
|
||||
io::path secondInstrumentListPath() const;
|
||||
void setSecondInstrumentListPath(const io::path& path);
|
||||
|
||||
io::path firstScoreOrderListPath() const;
|
||||
void setFirstScoreOrderListPath(const io::path& path);
|
||||
|
||||
io::path secondScoreOrderListPath() const;
|
||||
void setSecondScoreOrderListPath(const io::path& path);
|
||||
|
||||
async::Notification m_backgroundChanged;
|
||||
async::Notification m_foregroundChanged;
|
||||
|
@ -156,6 +179,8 @@ private:
|
|||
async::Channel<framework::Orientation> m_canvasOrientationChanged;
|
||||
async::Channel<io::path> m_userStylesPathChanged;
|
||||
async::Channel<int> m_selectionColorChanged;
|
||||
async::Notification m_instrumentListPathsChanged;
|
||||
async::Notification m_scoreOrderListPathsChanged;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#include "notationnoteinput.h"
|
||||
#include "notationselection.h"
|
||||
|
||||
#include "instruments/internal/instrumentsconverter.h"
|
||||
#include "instrumentsconverter.h"
|
||||
|
||||
#include "draw/pen.h"
|
||||
|
||||
|
@ -1046,12 +1046,12 @@ void NotationInteraction::selectInstrument(Ms::InstrumentChange* instrumentChang
|
|||
return;
|
||||
}
|
||||
|
||||
instruments::Instrument selectedIstrument = retVal.val.toQVariant().value<instruments::Instrument>();
|
||||
Instrument selectedIstrument = retVal.val.toQVariant().value<Instrument>();
|
||||
if (!selectedIstrument.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ms::Instrument instrument = instruments::InstrumentsConverter::convertInstrument(selectedIstrument);
|
||||
Ms::Instrument instrument = InstrumentsConverter::convertInstrument(selectedIstrument);
|
||||
|
||||
instrumentChange->setInit(true);
|
||||
instrumentChange->setupInstrument(&instrument);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "libmscore/instrchange.h"
|
||||
#include "libmscore/page.h"
|
||||
|
||||
#include "instruments/internal/instrumentsconverter.h"
|
||||
#include "instrumentsconverter.h"
|
||||
#include "scoreorderconverter.h"
|
||||
|
||||
#include "igetscore.h"
|
||||
|
@ -36,7 +36,6 @@
|
|||
#include "log.h"
|
||||
|
||||
using namespace mu::async;
|
||||
using namespace mu::instruments;
|
||||
using namespace mu::notation;
|
||||
|
||||
static const Ms::Fraction DEFAULT_TICK = Ms::Fraction(0, 1);
|
||||
|
@ -49,7 +48,7 @@ static QString formatInstrumentName(const QString& instrumentName, const Trait&
|
|||
return instrumentName + numberPart;
|
||||
}
|
||||
|
||||
return qtrc("instruments", "%1 in %2 %3").arg(instrumentName).arg(trait.name).arg(numberPart);
|
||||
return qtrc("instruments", "%1 in %2%3").arg(instrumentName).arg(trait.name).arg(numberPart);
|
||||
}
|
||||
|
||||
NotationParts::NotationParts(IGetScore* getScore, INotationInteractionPtr interaction, INotationUndoStackPtr undoStack)
|
||||
|
@ -113,20 +112,20 @@ NotifyList<const Part*> NotationParts::partList() const
|
|||
return result;
|
||||
}
|
||||
|
||||
NotifyList<mu::instruments::Instrument> NotationParts::instrumentList(const ID& partId) const
|
||||
NotifyList<Instrument> NotationParts::instrumentList(const ID& partId) const
|
||||
{
|
||||
Part* part = this->part(partId);
|
||||
if (!part) {
|
||||
return NotifyList<mu::instruments::Instrument>();
|
||||
return NotifyList<Instrument>();
|
||||
}
|
||||
|
||||
NotifyList<mu::instruments::Instrument> result;
|
||||
NotifyList<Instrument> result;
|
||||
|
||||
for (const Ms::Instrument* instrument: instruments(part).values()) {
|
||||
result.push_back(InstrumentsConverter::convertInstrument(*instrument));
|
||||
}
|
||||
|
||||
ChangedNotifier<mu::instruments::Instrument>* notifier = partNotifier(partId);
|
||||
ChangedNotifier<Instrument>* notifier = partNotifier(partId);
|
||||
result.setNotify(notifier->notify());
|
||||
return result;
|
||||
}
|
||||
|
@ -149,7 +148,7 @@ NotifyList<const Staff*> NotationParts::staffList(const ID& partId, const ID& in
|
|||
return result;
|
||||
}
|
||||
|
||||
void NotationParts::setParts(const mu::instruments::PartInstrumentList& parts)
|
||||
void NotationParts::setParts(const PartInstrumentList& parts)
|
||||
{
|
||||
TRACEFUNC;
|
||||
|
||||
|
@ -168,7 +167,7 @@ void NotationParts::setParts(const mu::instruments::PartInstrumentList& parts)
|
|||
m_partsNotifier->changed();
|
||||
}
|
||||
|
||||
void NotationParts::setScoreOrder(const instruments::ScoreOrder& order)
|
||||
void NotationParts::setScoreOrder(const ScoreOrder& order)
|
||||
{
|
||||
TRACEFUNC;
|
||||
|
||||
|
@ -237,7 +236,7 @@ void NotationParts::setPartSharpFlat(const ID& partId, const SharpFlat& sharpFla
|
|||
notifyAboutPartChanged(partId);
|
||||
}
|
||||
|
||||
void NotationParts::setPartTransposition(const ID& partId, const instruments::Interval& transpose)
|
||||
void NotationParts::setPartTransposition(const ID& partId, const Interval& transpose)
|
||||
{
|
||||
TRACEFUNC;
|
||||
|
||||
|
@ -283,7 +282,7 @@ void NotationParts::setInstrumentVisible(const ID& instrumentId, const ID& fromP
|
|||
|
||||
updateScore();
|
||||
|
||||
ChangedNotifier<mu::instruments::Instrument>* notifier = partNotifier(fromPartId);
|
||||
ChangedNotifier<Instrument>* notifier = partNotifier(fromPartId);
|
||||
notifier->itemChanged(InstrumentsConverter::convertInstrument(*instrumentInfo.instrument));
|
||||
}
|
||||
|
||||
|
@ -361,7 +360,7 @@ void NotationParts::assignIstrumentToSelectedChord(Ms::Instrument* instrument)
|
|||
score()->undoAddElement(instrumentChange);
|
||||
updateScore();
|
||||
|
||||
ChangedNotifier<mu::instruments::Instrument>* notifier = partNotifier(part->id());
|
||||
ChangedNotifier<Instrument>* notifier = partNotifier(part->id());
|
||||
notifier->itemChanged(InstrumentsConverter::convertInstrument(*instrument));
|
||||
}
|
||||
|
||||
|
@ -587,7 +586,7 @@ void NotationParts::setStaffConfig(const ID& staffId, const StaffConfig& config)
|
|||
staff->setHideSystemBarLine(config.hideSystemBarline);
|
||||
staff->setMergeMatchingRests(config.mergeMatchingRests);
|
||||
staff->setHideWhenEmpty(config.hideMode);
|
||||
staff->setDefaultClefType(config.clefType);
|
||||
staff->setDefaultClefType(config.clefTypeList);
|
||||
staff->setCutaway(config.cutaway);
|
||||
staff->undoChangeProperty(Ms::Pid::SMALL, config.small);
|
||||
|
||||
|
@ -683,7 +682,7 @@ void NotationParts::doSetStaffVoiceVisible(Staff* staff, int voiceIndex, bool vi
|
|||
staff->setVoiceVisible(voiceIndex, visible);
|
||||
}
|
||||
|
||||
void NotationParts::appendDoublingInstrument(const mu::instruments::Instrument& instrument, const ID& destinationPartId)
|
||||
void NotationParts::appendDoublingInstrument(const Instrument& instrument, const ID& destinationPartId)
|
||||
{
|
||||
TRACEFUNC;
|
||||
|
||||
|
@ -701,7 +700,7 @@ void NotationParts::appendDoublingInstrument(const mu::instruments::Instrument&
|
|||
doSetPartName(part, formatPartName(part));
|
||||
updateScore();
|
||||
|
||||
ChangedNotifier<mu::instruments::Instrument>* notifier = partNotifier(destinationPartId);
|
||||
ChangedNotifier<Instrument>* notifier = partNotifier(destinationPartId);
|
||||
notifier->itemAdded(instrument);
|
||||
notifyAboutPartChanged(destinationPartId);
|
||||
}
|
||||
|
@ -753,7 +752,7 @@ void NotationParts::cloneStaff(const ID& sourceStaffId, const ID& destinationSta
|
|||
updateScore();
|
||||
}
|
||||
|
||||
void NotationParts::replaceInstrument(const ID& instrumentId, const ID& fromPartId, const mu::instruments::Instrument& newInstrument)
|
||||
void NotationParts::replaceInstrument(const ID& instrumentId, const ID& fromPartId, const Instrument& newInstrument)
|
||||
{
|
||||
TRACEFUNC;
|
||||
|
||||
|
@ -771,7 +770,7 @@ void NotationParts::replaceInstrument(const ID& instrumentId, const ID& fromPart
|
|||
doSetPartName(part, formatPartName(part));
|
||||
updateScore();
|
||||
|
||||
ChangedNotifier<mu::instruments::Instrument>* notifier = partNotifier(part->id());
|
||||
ChangedNotifier<Instrument>* notifier = partNotifier(part->id());
|
||||
notifier->itemReplaced(InstrumentsConverter::convertInstrument(*oldInstrumentInfo.instrument), newInstrument);
|
||||
|
||||
notifyAboutPartChanged(fromPartId);
|
||||
|
@ -1364,7 +1363,7 @@ int NotationParts::resolvePartIndex(Part* part) const
|
|||
return scoreParts.size();
|
||||
}
|
||||
|
||||
void NotationParts::appendStaves(Part* part, const mu::instruments::Instrument& instrument)
|
||||
void NotationParts::appendStaves(Part* part, const Instrument& instrument)
|
||||
{
|
||||
TRACEFUNC;
|
||||
|
||||
|
@ -1495,8 +1494,8 @@ void NotationParts::sortParts(const PartInstrumentList& parts, const Ms::Score*
|
|||
score->masterScore()->undo(new Ms::MapExcerptTracks(score->masterScore(), trackMapping));
|
||||
}
|
||||
|
||||
int NotationParts::resolveInstrumentNumber(const instruments::Instruments& newInstruments,
|
||||
const instruments::Instrument& currentInstrument) const
|
||||
int NotationParts::resolveInstrumentNumber(const Instruments& newInstruments,
|
||||
const Instrument& currentInstrument) const
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
|
@ -1543,7 +1542,7 @@ int NotationParts::lastStaffIndex() const
|
|||
return !score()->staves().isEmpty() ? score()->staves().last()->idx() : 0;
|
||||
}
|
||||
|
||||
void NotationParts::initStaff(Staff* staff, const mu::instruments::Instrument& instrument, const Ms::StaffType* staffType, int cleffIndex)
|
||||
void NotationParts::initStaff(Staff* staff, const Instrument& instrument, const Ms::StaffType* staffType, int cleffIndex)
|
||||
{
|
||||
TRACEFUNC;
|
||||
|
||||
|
@ -1553,7 +1552,7 @@ void NotationParts::initStaff(Staff* staff, const mu::instruments::Instrument& i
|
|||
}
|
||||
|
||||
Ms::StaffType* stt = staff->setStaffType(DEFAULT_TICK, *staffTypePreset);
|
||||
if (cleffIndex >= mu::instruments::MAX_STAVES) {
|
||||
if (cleffIndex >= MAX_STAVES) {
|
||||
stt->setSmall(false);
|
||||
} else {
|
||||
stt->setSmall(instrument.smallStaff[cleffIndex]);
|
||||
|
@ -1589,20 +1588,20 @@ void NotationParts::notifyAboutStaffChanged(const ID& staffId) const
|
|||
void NotationParts::notifyAboutInstrumentsChanged(const ID& partId) const
|
||||
{
|
||||
auto instruments = instrumentList(partId);
|
||||
ChangedNotifier<mu::instruments::Instrument>* notifier = partNotifier(partId);
|
||||
for (const mu::instruments::Instrument& instrument: instruments) {
|
||||
ChangedNotifier<Instrument>* notifier = partNotifier(partId);
|
||||
for (const Instrument& instrument: instruments) {
|
||||
notifier->itemChanged(instrument);
|
||||
}
|
||||
}
|
||||
|
||||
ChangedNotifier<mu::instruments::Instrument>* NotationParts::partNotifier(const ID& partId) const
|
||||
ChangedNotifier<Instrument>* NotationParts::partNotifier(const ID& partId) const
|
||||
{
|
||||
if (m_partsNotifiersMap.find(partId) != m_partsNotifiersMap.end()) {
|
||||
return m_partsNotifiersMap[partId];
|
||||
}
|
||||
|
||||
ChangedNotifier<mu::instruments::Instrument>* notifier = new ChangedNotifier<mu::instruments::Instrument>();
|
||||
auto value = std::pair<ID, ChangedNotifier<mu::instruments::Instrument>*>(partId, notifier);
|
||||
ChangedNotifier<Instrument>* notifier = new ChangedNotifier<Instrument>();
|
||||
auto value = std::pair<ID, ChangedNotifier<Instrument>*>(partId, notifier);
|
||||
m_partsNotifiersMap.insert(value);
|
||||
return notifier;
|
||||
}
|
||||
|
|
|
@ -36,14 +36,14 @@ public:
|
|||
~NotationParts() override;
|
||||
|
||||
async::NotifyList<const Part*> partList() const override;
|
||||
async::NotifyList<instruments::Instrument> instrumentList(const ID& partId) const override;
|
||||
async::NotifyList<Instrument> instrumentList(const ID& partId) const override;
|
||||
async::NotifyList<const Staff*> staffList(const ID& partId, const ID& instrumentId) const override;
|
||||
|
||||
ValCh<bool> canChangeInstrumentVisibility(const ID& instrumentId, const ID& fromPartId) const override;
|
||||
bool voiceVisible(int voiceIndex) const override;
|
||||
|
||||
void setParts(const instruments::PartInstrumentList& parts) override;
|
||||
void setScoreOrder(const instruments::ScoreOrder& order) override;
|
||||
void setParts(const PartInstrumentList& parts) override;
|
||||
void setScoreOrder(const ScoreOrder& order) override;
|
||||
void setPartVisible(const ID& partId, bool visible) override;
|
||||
void setInstrumentVisible(const ID& instrumentId, const ID& fromPartId, bool visible) override;
|
||||
void setStaffVisible(const ID& staffId, bool visible) override;
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
void setVoiceVisible(const ID& staffId, int voiceIndex, bool visible) override;
|
||||
void setPartName(const ID& partId, const QString& name) override;
|
||||
void setPartSharpFlat(const ID& partId, const SharpFlat& sharpFlat) override;
|
||||
void setPartTransposition(const ID& partId, const instruments::Interval& transpose) override;
|
||||
void setPartTransposition(const ID& partId, const Interval& transpose) override;
|
||||
void setInstrumentName(const ID& instrumentId, const ID& fromPartId, const QString& name) override;
|
||||
void setInstrumentAbbreviature(const ID& instrumentId, const ID& fromPartId, const QString& abbreviature) override;
|
||||
void setStaffType(const ID& staffId, StaffType type) override;
|
||||
|
@ -69,12 +69,12 @@ public:
|
|||
const ID& destinationInstrumentId, InsertMode mode = InsertMode::Before) override;
|
||||
void moveStaves(const IDList& sourceStavesIds, const ID& destinationStaffId, InsertMode mode = InsertMode::Before) override;
|
||||
|
||||
void appendDoublingInstrument(const instruments::Instrument& instrument, const ID& destinationPartId) override;
|
||||
void appendDoublingInstrument(const Instrument& instrument, const ID& destinationPartId) override;
|
||||
void appendStaff(Staff* staff, const ID& destinationPartId) override;
|
||||
|
||||
void cloneStaff(const ID& sourceStaffId, const ID& destinationStaffId) override;
|
||||
|
||||
void replaceInstrument(const ID& instrumentId, const ID& fromPartId, const instruments::Instrument& newInstrument) override;
|
||||
void replaceInstrument(const ID& instrumentId, const ID& fromPartId, const Instrument& newInstrument) override;
|
||||
|
||||
async::Notification partsChanged() const override;
|
||||
|
||||
|
@ -148,25 +148,25 @@ private:
|
|||
void appendPart(Part* part);
|
||||
int resolvePartIndex(Part* part) const;
|
||||
|
||||
void appendStaves(Part* part, const instruments::Instrument& instrument);
|
||||
void appendStaves(Part* part, const Instrument& instrument);
|
||||
|
||||
void removeMissingParts(const instruments::PartInstrumentList& parts);
|
||||
void appendNewParts(const instruments::PartInstrumentList& parts);
|
||||
void updateSoloist(const instruments::PartInstrumentList& parts);
|
||||
void sortParts(const instruments::PartInstrumentList& parts, const Ms::Score* score, const QList<Ms::Staff*>& originalStaves);
|
||||
void removeMissingParts(const PartInstrumentList& parts);
|
||||
void appendNewParts(const PartInstrumentList& parts);
|
||||
void updateSoloist(const PartInstrumentList& parts);
|
||||
void sortParts(const PartInstrumentList& parts, const Ms::Score* score, const QList<Ms::Staff*>& originalStaves);
|
||||
|
||||
int resolveInstrumentNumber(const instruments::Instruments& newInstruments, const instruments::Instrument& currentInstrument) const;
|
||||
int resolveInstrumentNumber(const Instruments& newInstruments, const Instrument& currentInstrument) const;
|
||||
|
||||
IDList allInstrumentsIds() const;
|
||||
int lastStaffIndex() const;
|
||||
|
||||
void initStaff(Staff* staff, const instruments::Instrument& instrument, const Ms::StaffType* staffType, int cleffIndex);
|
||||
void initStaff(Staff* staff, const Instrument& instrument, const Ms::StaffType* staffType, int cleffIndex);
|
||||
|
||||
void notifyAboutPartChanged(const ID& partId) const;
|
||||
void notifyAboutStaffChanged(const ID& staffId) const;
|
||||
void notifyAboutInstrumentsChanged(const ID& partId) const;
|
||||
|
||||
async::ChangedNotifier<instruments::Instrument>* partNotifier(const ID& partId) const;
|
||||
async::ChangedNotifier<Instrument>* partNotifier(const ID& partId) const;
|
||||
async::ChangedNotifier<const Staff*>* instrumentNotifier(const ID& instrumentId, const ID& fromPartId) const;
|
||||
|
||||
QString formatPartName(const Part* part) const;
|
||||
|
@ -182,7 +182,7 @@ private:
|
|||
async::Notification m_partsChanged;
|
||||
|
||||
mutable async::ChangedNotifier<const Part*>* m_partsNotifier = nullptr;
|
||||
mutable std::map<ID, async::ChangedNotifier<instruments::Instrument>*> m_partsNotifiersMap;
|
||||
mutable std::map<ID, async::ChangedNotifier<Instrument>*> m_partsNotifiersMap;
|
||||
mutable QHash<InstrumentKey, async::ChangedNotifier<const Staff*>*> m_instrumentsNotifiersHash;
|
||||
mutable QHash<InstrumentKey, ValCh<bool> > m_canChangeInstrumentsVisibilityHash;
|
||||
};
|
||||
|
|
|
@ -20,15 +20,13 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "scoreorderconverter.h"
|
||||
|
||||
#include "libmscore/scoreorder.h"
|
||||
#include "libmscore/score.h"
|
||||
#include "libmscore/xml.h"
|
||||
#include <QBuffer>
|
||||
#include "notation/notationtypes.h"
|
||||
|
||||
using namespace mu::notation;
|
||||
using namespace mu::instruments;
|
||||
|
||||
Ms::ScoreOrder ScoreOrderConverter::convertScoreOrder(const mu::instruments::ScoreOrder& order)
|
||||
Ms::ScoreOrder ScoreOrderConverter::convertScoreOrder(const ScoreOrder& order)
|
||||
{
|
||||
Ms::ScoreOrder result;
|
||||
|
||||
|
@ -59,7 +57,7 @@ Ms::ScoreOrder ScoreOrderConverter::convertScoreOrder(const mu::instruments::Sco
|
|||
return result;
|
||||
}
|
||||
|
||||
mu::instruments::ScoreOrder ScoreOrderConverter::convertScoreOrder(const Ms::ScoreOrder& order)
|
||||
ScoreOrder ScoreOrderConverter::convertScoreOrder(const Ms::ScoreOrder& order)
|
||||
{
|
||||
ScoreOrder result;
|
||||
|
||||
|
|
|
@ -22,15 +22,17 @@
|
|||
#ifndef MU_NOTATION_SCOREORDERCONVERTER_H
|
||||
#define MU_NOTATION_SCOREORDERCONVERTER_H
|
||||
|
||||
#include "instruments/instrumentstypes.h"
|
||||
#include "libmscore/scoreorder.h"
|
||||
namespace Ms {
|
||||
struct ScoreOrder;
|
||||
}
|
||||
|
||||
namespace mu::notation {
|
||||
struct ScoreOrder;
|
||||
class ScoreOrderConverter
|
||||
{
|
||||
public:
|
||||
static Ms::ScoreOrder convertScoreOrder(const instruments::ScoreOrder& order);
|
||||
static instruments::ScoreOrder convertScoreOrder(const Ms::ScoreOrder& order);
|
||||
static Ms::ScoreOrder convertScoreOrder(const ScoreOrder& order);
|
||||
static ScoreOrder convertScoreOrder(const Ms::ScoreOrder& order);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MU_INSTRUMENTS_ISELECTINSTRUMENTSSCENARIO_H
|
||||
#define MU_INSTRUMENTS_ISELECTINSTRUMENTSSCENARIO_H
|
||||
#ifndef MU_NOTATION_ISELECTINSTRUMENTSSCENARIO_H
|
||||
#define MU_NOTATION_ISELECTINSTRUMENTSSCENARIO_H
|
||||
|
||||
#include "modularity/imoduleexport.h"
|
||||
#include "instrumentstypes.h"
|
||||
#include "notation/notationtypes.h"
|
||||
#include "retval.h"
|
||||
|
||||
namespace mu::instruments {
|
||||
namespace mu::notation {
|
||||
class ISelectInstrumentsScenario : MODULE_EXPORT_INTERFACE
|
||||
{
|
||||
INTERFACE_ID(ISelectInstrumentsScenario)
|
||||
|
@ -39,9 +39,10 @@ public:
|
|||
ShowCurrentInstruments
|
||||
};
|
||||
|
||||
virtual RetVal<PartInstrumentListScoreOrder> selectInstruments(SelectInstrumentsMode mode = SelectInstrumentsMode::None) const = 0;
|
||||
virtual RetVal<Instrument> selectInstrument(const std::string& currentInstrumentId = "") const = 0;
|
||||
virtual RetVal<notation::PartInstrumentListScoreOrder> selectInstruments(SelectInstrumentsMode mode = SelectInstrumentsMode::None) const
|
||||
= 0;
|
||||
virtual RetVal<notation::Instrument> selectInstrument(const std::string& currentInstrumentId = "") const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MU_INSTRUMENTS_ISELECTINSTRUMENTSSCENARIO_H
|
||||
#endif // MU_NOTATION_ISELECTINSTRUMENTSSCENARIO_H
|
|
@ -38,6 +38,7 @@
|
|||
#include "internal/mscznotationreader.h"
|
||||
#include "internal/msczmetareader.h"
|
||||
#include "internal/positionswriter.h"
|
||||
#include "internal/instrumentsrepository.h"
|
||||
|
||||
#include "view/notationpaintview.h"
|
||||
#include "view/notationswitchlistmodel.h"
|
||||
|
@ -65,6 +66,8 @@
|
|||
#include "view/notationcontextmenu.h"
|
||||
#include "view/internal/undoredomodel.h"
|
||||
|
||||
#include "diagnostics/idiagnosticspathsregister.h"
|
||||
|
||||
using namespace mu::notation;
|
||||
using namespace mu::modularity;
|
||||
using namespace mu::ui;
|
||||
|
@ -75,6 +78,7 @@ static std::shared_ptr<NotationConfiguration> s_configuration = std::make_shared
|
|||
static std::shared_ptr<NotationActionController> s_actionController = std::make_shared<NotationActionController>();
|
||||
static std::shared_ptr<NotationUiActions> s_notationUiActions = std::make_shared<NotationUiActions>(s_actionController);
|
||||
static std::shared_ptr<MidiInputController> s_midiInputController = std::make_shared<MidiInputController>();
|
||||
static std::shared_ptr<InstrumentsRepository> s_instrumentsRepository = std::make_shared<InstrumentsRepository>();
|
||||
|
||||
static void notationscene_init_qrc()
|
||||
{
|
||||
|
@ -90,6 +94,7 @@ void NotationModule::registerExports()
|
|||
{
|
||||
ioc()->registerExport<INotationCreator>(moduleName(), new NotationCreator());
|
||||
ioc()->registerExport<INotationConfiguration>(moduleName(), s_configuration);
|
||||
ioc()->registerExport<IInstrumentsRepository>(moduleName(), s_instrumentsRepository);
|
||||
ioc()->registerExport<IMsczMetaReader>(moduleName(), new MsczMetaReader());
|
||||
ioc()->registerExport<INotationContextMenu>(moduleName(), new NotationContextMenu());
|
||||
|
||||
|
@ -186,9 +191,33 @@ void NotationModule::registerUiTypes()
|
|||
void NotationModule::onInit(const framework::IApplication::RunMode&)
|
||||
{
|
||||
s_configuration->init();
|
||||
s_instrumentsRepository->init();
|
||||
s_actionController->init();
|
||||
s_notationUiActions->init();
|
||||
s_midiInputController->init();
|
||||
|
||||
Notation::init();
|
||||
|
||||
auto pr = modularity::ioc()->resolve<diagnostics::IDiagnosticsPathsRegister>(moduleName());
|
||||
if (pr) {
|
||||
io::paths instrPaths = s_configuration->instrumentListPaths();
|
||||
for (const io::path& p : instrPaths) {
|
||||
pr->reg("instruments", p);
|
||||
}
|
||||
|
||||
io::paths uinstrPaths = s_configuration->userInstrumentListPaths();
|
||||
for (const io::path& p : uinstrPaths) {
|
||||
pr->reg("user instruments", p);
|
||||
}
|
||||
|
||||
io::paths scoreOrderPaths = s_configuration->scoreOrderListPaths();
|
||||
for (const io::path& p : scoreOrderPaths) {
|
||||
pr->reg("scoreOrder", p);
|
||||
}
|
||||
|
||||
io::paths uscoreOrderPaths = s_configuration->userScoreOrderListPaths();
|
||||
for (const io::path& p : uscoreOrderPaths) {
|
||||
pr->reg("user scoreOrder", p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "io/path.h"
|
||||
#include "translation.h"
|
||||
#include "midi/midievent.h"
|
||||
|
||||
#include "libmscore/element.h"
|
||||
#include "libmscore/page.h"
|
||||
|
@ -52,8 +53,6 @@
|
|||
#include "libmscore/realizedharmony.h"
|
||||
#include "libmscore/instrument.h"
|
||||
|
||||
#include "instruments/instrumentstypes.h"
|
||||
|
||||
namespace mu::notation {
|
||||
using Page = Ms::Page;
|
||||
using Element = Ms::Element;
|
||||
|
@ -64,7 +63,7 @@ using DurationType = Ms::TDuration::DurationType;
|
|||
using Duration = Ms::TDuration;
|
||||
using SelectType = Ms::SelectType;
|
||||
using Pad = Ms::Pad;
|
||||
using ViewMode = Ms::LayoutMode; // Accomodate inconsistent convention from v3
|
||||
using ViewMode = Ms::LayoutMode;
|
||||
using PitchMode = Ms::UpDownMode;
|
||||
using StyleId = Ms::Sid;
|
||||
using SymbolId = Ms::SymId;
|
||||
|
@ -73,7 +72,6 @@ using KeyMode = Ms::KeyMode;
|
|||
using TimeSigType = Ms::TimeSigType;
|
||||
using Part = Ms::Part;
|
||||
using Staff = Ms::Staff;
|
||||
using StaffType = Ms::StaffTypes;
|
||||
using NoteHead = Ms::NoteHead;
|
||||
using SharpFlat = Ms::PreferSharpFlat;
|
||||
using TransposeMode = Ms::TransposeMode;
|
||||
|
@ -100,8 +98,24 @@ using TupletBracketType = Ms::TupletBracketType;
|
|||
using GraceNoteType = Ms::NoteType;
|
||||
using BeamMode = Ms::Beam::Mode;
|
||||
using LayoutBreakType = Ms::LayoutBreak::Type;
|
||||
using Interval = Ms::Interval;
|
||||
using Drumset = Ms::Drumset;
|
||||
using StringData = Ms::StringData;
|
||||
using Clef = Ms::Clef;
|
||||
using ClefType = Ms::ClefType;
|
||||
using ClefTypeList = Ms::ClefTypeList;
|
||||
using BracketType = Ms::BracketType;
|
||||
using StaffGroup = Ms::StaffGroup;
|
||||
using StaffType = Ms::StaffTypes;
|
||||
using StaffTypePreset = Ms::StaffType;
|
||||
using StaffName = Ms::StaffName;
|
||||
using StaffNameList = Ms::StaffNameList;
|
||||
using MidiArticulation = Ms::MidiArticulation;
|
||||
using Trait = Ms::Trait;
|
||||
using TraitType = Ms::TraitType;
|
||||
using InstrumentChannel = Ms::Channel;
|
||||
|
||||
using InstrumentChannelList = QList<InstrumentChannel>;
|
||||
using PageList = std::vector<const Page*>;
|
||||
using StaffList = QList<const Staff*>;
|
||||
using PartList = QList<const Part*>;
|
||||
|
@ -282,6 +296,177 @@ struct Tempo
|
|||
}
|
||||
};
|
||||
|
||||
static constexpr int MAX_STAVES = 4;
|
||||
|
||||
struct ClefPair
|
||||
{
|
||||
ClefType concertClef = ClefType::G;
|
||||
ClefType transposingClef = ClefType::G;
|
||||
};
|
||||
|
||||
struct PitchRange
|
||||
{
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
|
||||
PitchRange() = default;
|
||||
PitchRange(int min, int max)
|
||||
: min(min), max(max) {}
|
||||
|
||||
bool operator ==(const PitchRange& other) const
|
||||
{
|
||||
return min == other.min && max == other.max;
|
||||
}
|
||||
|
||||
bool operator !=(const PitchRange& other) const
|
||||
{
|
||||
return !operator ==(other);
|
||||
}
|
||||
};
|
||||
|
||||
struct MidiAction
|
||||
{
|
||||
QString name;
|
||||
QString description;
|
||||
std::vector<midi::Event> events;
|
||||
};
|
||||
using MidiActionList = QList<MidiAction>;
|
||||
|
||||
using MidiArticulations = QList<Ms::MidiArticulation>;
|
||||
|
||||
struct InstrumentGroup
|
||||
{
|
||||
QString id;
|
||||
QString name;
|
||||
bool extended = false;
|
||||
int sequenceOrder = 0;
|
||||
};
|
||||
|
||||
using InstrumentGroups = QList<InstrumentGroup>;
|
||||
|
||||
struct InstrumentGenre
|
||||
{
|
||||
QString id;
|
||||
QString name;
|
||||
};
|
||||
using InstrumentGenres = QList<InstrumentGenre>;
|
||||
|
||||
static const QString COMMON_GENRE_ID("common");
|
||||
|
||||
struct Instrument
|
||||
{
|
||||
QString id;
|
||||
StaffNameList longNames;
|
||||
StaffNameList shortNames;
|
||||
QString name;
|
||||
QString musicXMLid;
|
||||
QString templateId;
|
||||
QString description;
|
||||
int sequenceOrder = 0;
|
||||
|
||||
bool extended = false;
|
||||
int staves = 1;
|
||||
|
||||
QString groupId;
|
||||
QStringList genreIds;
|
||||
QString familyId;
|
||||
|
||||
PitchRange amateurPitchRange;
|
||||
PitchRange professionalPitchRange;
|
||||
|
||||
ClefTypeList clefs[MAX_STAVES];
|
||||
int staffLines[MAX_STAVES] = { 0 };
|
||||
BracketType bracket[MAX_STAVES] = { BracketType::NO_BRACKET };
|
||||
int bracketSpan[MAX_STAVES] = { 0 };
|
||||
int barlineSpan[MAX_STAVES] = { 0 };
|
||||
bool smallStaff[MAX_STAVES] = { false };
|
||||
|
||||
Interval transpose;
|
||||
|
||||
StaffGroup staffGroup = StaffGroup::STANDARD;
|
||||
const StaffTypePreset* staffTypePreset = nullptr;
|
||||
|
||||
bool useDrumset = false;
|
||||
const Drumset* drumset = nullptr;
|
||||
|
||||
StringData stringData;
|
||||
|
||||
bool singleNoteDynamics = false;
|
||||
|
||||
MidiActionList midiActions;
|
||||
QList<MidiArticulation> midiArticulations;
|
||||
|
||||
InstrumentChannelList channels;
|
||||
|
||||
Trait trait;
|
||||
|
||||
bool isValid() const { return !id.isEmpty(); }
|
||||
QString abbreviature() const { return !shortNames.isEmpty() ? shortNames.first().name() : QString(); }
|
||||
};
|
||||
|
||||
using Instruments = QList<Instrument>;
|
||||
|
||||
struct PartInstrument
|
||||
{
|
||||
QString partId;
|
||||
Instrument instrument;
|
||||
|
||||
bool isExistingPart = false;
|
||||
bool isSoloist = false;
|
||||
};
|
||||
|
||||
using PartInstrumentList = QList<PartInstrument>;
|
||||
|
||||
struct ScoreOrderGroup
|
||||
{
|
||||
QString family;
|
||||
QString section;
|
||||
QString unsorted;
|
||||
|
||||
bool bracket = false;
|
||||
bool showSystemMarkings = false;
|
||||
bool barLineSpan = false;
|
||||
bool thinBracket = false;
|
||||
};
|
||||
|
||||
using InstrumentOverwrite = Ms::InstrumentOverwrite;
|
||||
|
||||
struct ScoreOrder
|
||||
{
|
||||
QString id;
|
||||
QString name;
|
||||
QMap<QString, InstrumentOverwrite> instrumentMap;
|
||||
QList<ScoreOrderGroup> groups;
|
||||
|
||||
bool isValid() { return !groups.empty(); }
|
||||
};
|
||||
|
||||
using ScoreOrders = QList<ScoreOrder>;
|
||||
|
||||
struct PartInstrumentListScoreOrder
|
||||
{
|
||||
PartInstrumentList instruments;
|
||||
ScoreOrder scoreOrder;
|
||||
};
|
||||
|
||||
struct InstrumentsMeta
|
||||
{
|
||||
Instruments instrumentTemplates;
|
||||
InstrumentGroups groups;
|
||||
InstrumentGenres genres;
|
||||
MidiArticulations articulations;
|
||||
ScoreOrders scoreOrders;
|
||||
|
||||
void clear()
|
||||
{
|
||||
instrumentTemplates.clear();
|
||||
groups.clear();
|
||||
genres.clear();
|
||||
articulations.clear();
|
||||
scoreOrders.clear();
|
||||
}
|
||||
};
|
||||
|
||||
struct ScoreCreateOptions
|
||||
{
|
||||
QString title;
|
||||
|
@ -307,8 +492,8 @@ struct ScoreCreateOptions
|
|||
|
||||
io::path templatePath;
|
||||
|
||||
instruments::PartInstrumentList parts;
|
||||
instruments::ScoreOrder order;
|
||||
PartInstrumentList parts;
|
||||
ScoreOrder order;
|
||||
};
|
||||
|
||||
struct SearchCommand
|
||||
|
@ -381,7 +566,7 @@ struct StaffConfig
|
|||
bool mergeMatchingRests = false;
|
||||
Staff::HideMode hideMode = Staff::HideMode::AUTO;
|
||||
NoteHead::Scheme noteheadScheme = NoteHead::Scheme::HEAD_AUTO;
|
||||
Ms::ClefTypeList clefType;
|
||||
ClefTypeList clefTypeList;
|
||||
};
|
||||
|
||||
struct TransposeOptions
|
||||
|
@ -463,15 +648,16 @@ struct ScoreConfig
|
|||
|
||||
inline QString staffTypeToString(StaffType type)
|
||||
{
|
||||
return Ms::StaffType::preset(type)->name();
|
||||
const Ms::StaffType* preset = Ms::StaffType::preset(type);
|
||||
return preset ? preset->name() : QString();
|
||||
}
|
||||
|
||||
inline QList<StaffType> allStaffTypes()
|
||||
{
|
||||
QList<StaffType> result;
|
||||
|
||||
for (const Ms::StaffType& staffType: Ms::StaffType::presets()) {
|
||||
result << staffType.type();
|
||||
for (const Ms::StaffType& preset: Ms::StaffType::presets()) {
|
||||
result << preset.type();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -514,4 +700,7 @@ inline bool isFretIndexValid(int fretIndex)
|
|||
}
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(mu::notation::Instrument)
|
||||
Q_DECLARE_METATYPE(mu::notation::ScoreOrder)
|
||||
|
||||
#endif // MU_NOTATION_NOTATIONTYPES_H
|
||||
|
|
|
@ -435,9 +435,11 @@ Staff* EditStaff::staff(int staffIndex) const
|
|||
|
||||
async::NotifyList<const Part*> parts = notationParts->partList();
|
||||
for (const Part* part: parts) {
|
||||
async::NotifyList<mu::instruments::Instrument> instruments = notationParts->instrumentList(part->id());
|
||||
for (mu::instruments::Instrument instrument: instruments) {
|
||||
async::NotifyList<Instrument> instruments = notationParts->instrumentList(part->id());
|
||||
|
||||
for (const Instrument& instrument: instruments) {
|
||||
async::NotifyList<const Staff*> staves = notationParts->staffList(part->id(), instrument.id);
|
||||
|
||||
for (const Staff* staff: staves) {
|
||||
if (staff->idx() == staffIndex) {
|
||||
return const_cast<Staff*>(staff);
|
||||
|
@ -449,18 +451,19 @@ Staff* EditStaff::staff(int staffIndex) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
mu::instruments::Instrument EditStaff::instrument() const
|
||||
Instrument EditStaff::instrument() const
|
||||
{
|
||||
INotationPartsPtr notationParts = this->notationParts();
|
||||
if (!notationParts) {
|
||||
return mu::instruments::Instrument();
|
||||
return Instrument();
|
||||
}
|
||||
|
||||
async::NotifyList<const Part*> parts = notationParts->partList();
|
||||
for (const Part* part: parts) {
|
||||
if (part->id() == m_partId) {
|
||||
async::NotifyList<mu::instruments::Instrument> instruments = notationParts->instrumentList(part->id());
|
||||
for (mu::instruments::Instrument instrument: instruments) {
|
||||
async::NotifyList<Instrument> instruments = notationParts->instrumentList(part->id());
|
||||
|
||||
for (const Instrument& instrument: instruments) {
|
||||
if (instrument.id == m_instrumentId) {
|
||||
return instrument;
|
||||
}
|
||||
|
@ -468,7 +471,7 @@ mu::instruments::Instrument EditStaff::instrument() const
|
|||
}
|
||||
}
|
||||
|
||||
return mu::instruments::Instrument();
|
||||
return Instrument();
|
||||
}
|
||||
|
||||
void EditStaff::applyStaffProperties()
|
||||
|
@ -493,7 +496,7 @@ void EditStaff::applyStaffProperties()
|
|||
config.hideSystemBarline = hideSystemBarLine->isChecked();
|
||||
config.mergeMatchingRests = mergeMatchingRests->isChecked();
|
||||
config.hideMode = Staff::HideMode(hideMode->currentIndex());
|
||||
config.clefType = m_instrument.clefs[m_orgStaff->rstaff()];
|
||||
config.clefTypeList = m_instrument.clefs[m_orgStaff->rstaff()];
|
||||
|
||||
notationParts()->setStaffConfig(m_orgStaff->id(), config);
|
||||
|
||||
|
@ -583,7 +586,7 @@ bool EditStaff::isInstrumentChanged()
|
|||
|
||||
void EditStaff::showReplaceInstrumentDialog()
|
||||
{
|
||||
RetVal<instruments::Instrument> selectedInstrument = selectInstrumentsScenario()->selectInstrument(m_instrumentId.toStdString());
|
||||
RetVal<Instrument> selectedInstrument = selectInstrumentsScenario()->selectInstrument(m_instrumentId.toStdString());
|
||||
if (!selectedInstrument.ret) {
|
||||
LOGE() << selectedInstrument.ret.toString();
|
||||
return;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "modularity/ioc.h"
|
||||
#include "context/iglobalcontext.h"
|
||||
#include "global/iinteractive.h"
|
||||
#include "instruments/iselectinstrumentscenario.h"
|
||||
#include "iselectinstrumentscenario.h"
|
||||
|
||||
namespace mu::notation {
|
||||
class EditStaffType;
|
||||
|
@ -42,7 +42,7 @@ class EditStaff : public QDialog, private Ui::EditStaffBase
|
|||
|
||||
INJECT(notation, context::IGlobalContext, globalContext)
|
||||
INJECT(notation, framework::IInteractive, interactive)
|
||||
INJECT(notation, instruments::ISelectInstrumentsScenario, selectInstrumentsScenario)
|
||||
INJECT(notation, ISelectInstrumentsScenario, selectInstrumentsScenario)
|
||||
|
||||
Q_PROPERTY(int staffIdx READ staffIdx WRITE setStaffIdx NOTIFY staffIdxChanged)
|
||||
|
||||
|
@ -92,7 +92,7 @@ private:
|
|||
void updateCurrentStaff();
|
||||
|
||||
Staff* staff(int staffIndex) const;
|
||||
instruments::Instrument instrument() const;
|
||||
Instrument instrument() const;
|
||||
|
||||
void applyStaffProperties();
|
||||
void applyPartProperties();
|
||||
|
@ -106,8 +106,8 @@ private:
|
|||
Ms::Staff* m_orgStaff = nullptr;
|
||||
ID m_partId;
|
||||
ID m_instrumentId;
|
||||
instruments::Instrument m_instrument;
|
||||
instruments::Instrument m_orgInstrument;
|
||||
Instrument m_instrument;
|
||||
Instrument m_orgInstrument;
|
||||
int m_minPitchA, m_maxPitchA, m_minPitchP, m_maxPitchP;
|
||||
Ms::Fraction m_tickStart, m_tickEnd;
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ void EditStaffType::setStaffType(const Ms::StaffType* stafftype)
|
|||
setValues();
|
||||
}
|
||||
|
||||
void EditStaffType::setInstrument(const instruments::Instrument instrument)
|
||||
void EditStaffType::setInstrument(const Instrument& instrument)
|
||||
{
|
||||
// template combo
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "libmscore/mscore.h"
|
||||
#include "libmscore/stafftype.h"
|
||||
|
||||
#include "instruments/instrumentstypes.h"
|
||||
#include "notation/notationtypes.h"
|
||||
|
||||
namespace mu::notation {
|
||||
class ScoreView;
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
void setStaffType(const Ms::StaffType* staffType);
|
||||
Ms::StaffType getStaffType() const { return staffType; }
|
||||
|
||||
void setInstrument(const instruments::Instrument instrument);
|
||||
void setInstrument(const Instrument& instrument);
|
||||
|
||||
private:
|
||||
mu::Ret loadScore(Ms::MasterScore* score, const io::path& path);
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
using namespace mu::userscores;
|
||||
using namespace mu::notation;
|
||||
using namespace mu::instruments;
|
||||
using namespace mu::ui;
|
||||
|
||||
using PreferredScoreCreationMode = IUserScoresConfiguration::PreferredScoreCreationMode;
|
||||
|
@ -120,7 +119,7 @@ ScoreCreateOptions NewScoreModel::parseOptions(const QVariantMap& info) const
|
|||
options.parts << pi;
|
||||
}
|
||||
|
||||
options.order = info["scoreOrder"].value<instruments::ScoreOrder>();
|
||||
options.order = info["scoreOrder"].value<ScoreOrder>();
|
||||
|
||||
return options;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue