Code review fix
This commit is contained in:
parent
2c2cd81102
commit
3f0c69baa5
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
{
|
||||
"familyOrInstrumentId": "guitars",
|
||||
"familyId": "guitars",
|
||||
"strings": [
|
||||
{
|
||||
"number": 5,
|
||||
|
@ -122,7 +122,7 @@
|
|||
"name": "Nashville",
|
||||
"value": [52, 57, 62, 67, 59, 64]
|
||||
}
|
||||
]
|
||||
]
|
||||
},{
|
||||
"number": 7,
|
||||
"presets": [
|
||||
|
@ -183,7 +183,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"familyOrInstrumentId": "shamisens",
|
||||
"familyId": "shamisens",
|
||||
"strings": [
|
||||
{
|
||||
"number": 3,
|
||||
|
@ -197,7 +197,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"familyOrInstrumentId": "banjos",
|
||||
"familytId": "banjos",
|
||||
"strings": [
|
||||
{
|
||||
"number": 4,
|
||||
|
@ -244,7 +244,7 @@
|
|||
}
|
||||
]
|
||||
},{
|
||||
"familyOrInstrumentId": "mandolins",
|
||||
"familyId": "mandolins",
|
||||
"strings": [
|
||||
{
|
||||
"number": 4,
|
||||
|
@ -257,7 +257,7 @@
|
|||
}
|
||||
]
|
||||
},{
|
||||
"familyOrInstrumentId": "ukuleles",
|
||||
"familyId": "ukuleles",
|
||||
"strings": [
|
||||
{
|
||||
"number": 4,
|
||||
|
@ -279,7 +279,7 @@
|
|||
}
|
||||
]
|
||||
},{
|
||||
"familyOrInstrumentId": "orchestral-strings",
|
||||
"familyId": "orchestral-strings",
|
||||
"strings": [
|
||||
{
|
||||
"number": 4,
|
||||
|
@ -292,7 +292,7 @@
|
|||
}
|
||||
]
|
||||
},{
|
||||
"familyOrInstrumentId": "contrabass",
|
||||
"instrumentId": "contrabass",
|
||||
"strings": [
|
||||
{
|
||||
"number": 4,
|
||||
|
|
|
@ -1599,19 +1599,20 @@ void Chord::cmdUpdateNotes(AccidentalState* as)
|
|||
const Staff* st = staff();
|
||||
StaffGroup staffGroup = st->staffTypeForElement(this)->group();
|
||||
if (staffGroup == StaffGroup::TAB) {
|
||||
for (Staff* _staff : st->staffList()) {
|
||||
Fraction tick = this->tick();
|
||||
for (const Staff* _staff : st->staffList()) {
|
||||
if (!_staff || _staff == st) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_staff->score() == st->score() && !_staff->isTabStaff(this->tick())) {
|
||||
if (_staff->score() == st->score() && !_staff->isTabStaff(tick)) {
|
||||
if (!_staff->reflectTranspositionInLinkedTab()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const StringData* stringData = part()->stringData(this->tick());
|
||||
const StringData* stringData = part()->stringData(tick);
|
||||
for (Chord* ch : graceNotes()) {
|
||||
stringData->fretChords(ch);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ using namespace mu;
|
|||
using namespace mu::engraving;
|
||||
|
||||
// STYLE
|
||||
static const ElementStyle stringTuningsStyle {
|
||||
static const ElementStyle STRING_TUNINGS_STYLE {
|
||||
{ Sid::staffTextPlacement, Pid::PLACEMENT },
|
||||
{ Sid::staffTextMinDistance, Pid::MIN_DISTANCE },
|
||||
};
|
||||
|
@ -45,7 +45,7 @@ static const ElementStyle stringTuningsStyle {
|
|||
StringTunings::StringTunings(Segment* parent, TextStyleType textStyleType)
|
||||
: StaffTextBase(ElementType::STRING_TUNINGS, parent, textStyleType, ElementFlag::MOVABLE | ElementFlag::ON_STAFF)
|
||||
{
|
||||
initElementStyle(&stringTuningsStyle);
|
||||
initElementStyle(&STRING_TUNINGS_STYLE);
|
||||
}
|
||||
|
||||
StringTunings::StringTunings(const StringTunings& s)
|
||||
|
@ -70,7 +70,7 @@ PropertyValue StringTunings::getProperty(Pid id) const
|
|||
if (staff()->isTabStaff(tick)) {
|
||||
return staff()->lines(tick);
|
||||
} else {
|
||||
for (Staff* _staff : staff()->staffList()) {
|
||||
for (const Staff* _staff : staff()->staffList()) {
|
||||
if (_staff == staff()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ PropertyValue StringTunings::getProperty(Pid id) const
|
|||
} else if (id == Pid::STRINGTUNINGS_VISIBLE_STRINGS) {
|
||||
std::vector<int> visibleStrings;
|
||||
for (string_idx_t string : m_visibleStrings) {
|
||||
visibleStrings.push_back(static_cast<int>(string));
|
||||
visibleStrings.emplace_back(static_cast<int>(string));
|
||||
}
|
||||
|
||||
return visibleStrings;
|
||||
|
@ -99,7 +99,7 @@ PropertyValue StringTunings::getProperty(Pid id) const
|
|||
PropertyValue StringTunings::propertyDefault(Pid id) const
|
||||
{
|
||||
if (id == Pid::STRINGTUNINGS_STRINGS_COUNT) {
|
||||
return stringData()->strings(); // todo
|
||||
return stringData()->strings();
|
||||
} else if (id == Pid::STRINGTUNINGS_PRESET) {
|
||||
return String();
|
||||
} else if (id == Pid::STRINGTUNINGS_VISIBLE_STRINGS) {
|
||||
|
@ -132,7 +132,7 @@ bool StringTunings::setProperty(Pid id, const PropertyValue& val)
|
|||
m_visibleStrings.clear();
|
||||
std::vector<int> ignoredStrings = val.value<std::vector<int> >();
|
||||
for (int string : ignoredStrings) {
|
||||
m_visibleStrings.push_back(static_cast<string_idx_t>(string));
|
||||
m_visibleStrings.emplace_back(static_cast<string_idx_t>(string));
|
||||
}
|
||||
} else {
|
||||
return StaffTextBase::setProperty(id, val);
|
||||
|
@ -151,7 +151,7 @@ String StringTunings::accessibleInfo() const
|
|||
|
||||
String info;
|
||||
|
||||
std::vector<instrString> stringList = stringData->stringList();
|
||||
const std::vector<instrString>& stringList = stringData->stringList();
|
||||
for (string_idx_t i = 0; i < stringList.size(); ++i) {
|
||||
if (mu::contains(m_visibleStrings, i)) {
|
||||
String pitchStr = pitch2string(stringList[i].pitch);
|
||||
|
@ -190,7 +190,7 @@ void StringTunings::undoStringData(const StringData& stringData)
|
|||
triggerLayout();
|
||||
}
|
||||
|
||||
String StringTunings::preset() const
|
||||
const String& StringTunings::preset() const
|
||||
{
|
||||
return m_preset;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ void StringTunings::setPreset(const String& preset)
|
|||
m_preset = preset;
|
||||
}
|
||||
|
||||
std::vector<string_idx_t> StringTunings::visibleStrings() const
|
||||
const std::vector<string_idx_t>& StringTunings::visibleStrings() const
|
||||
{
|
||||
return m_visibleStrings;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ String StringTunings::generateText() const
|
|||
return String();
|
||||
}
|
||||
|
||||
std::vector<instrString> stringList = stringData->stringList();
|
||||
const std::vector<instrString>& stringList = stringData->stringList();
|
||||
std::vector<String> visibleStringList;
|
||||
for (string_idx_t i = 0; i < stringList.size(); ++i) {
|
||||
if (mu::contains(m_visibleStrings, i)) {
|
||||
|
@ -232,8 +232,8 @@ String StringTunings::generateText() const
|
|||
continue;
|
||||
}
|
||||
|
||||
visibleStringList.push_back(String(u"<sym>guitarString%1</sym> - %2").arg(String::number(i + 1),
|
||||
String(pitchStr[0]).toUpper()));
|
||||
visibleStringList.emplace_back(String(u"<sym>guitarString%1</sym> - %2").arg(String::number(i + 1),
|
||||
String(pitchStr[0]).toUpper()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,10 @@ public:
|
|||
void setStringData(const StringData& stringData);
|
||||
void undoStringData(const StringData& stringData);
|
||||
|
||||
String preset() const;
|
||||
const String& preset() const;
|
||||
void setPreset(const String& preset);
|
||||
|
||||
std::vector<string_idx_t> visibleStrings() const;
|
||||
const std::vector<string_idx_t>& visibleStrings() const;
|
||||
void setVisibleStrings(const std::vector<string_idx_t>& visibleStrings);
|
||||
|
||||
void updateText();
|
||||
|
|
|
@ -3023,7 +3023,7 @@ void ChangeStringData::flip(EditData*)
|
|||
{
|
||||
const StringData* stringData = m_stringTunings ? m_stringTunings->stringData() : m_instrument->stringData();
|
||||
int frets = stringData->frets();
|
||||
std::vector<mu::engraving::instrString> stringList = stringData->stringList();
|
||||
std::vector<instrString> stringList = stringData->stringList();
|
||||
|
||||
if (m_stringTunings) {
|
||||
m_stringTunings->setStringData(m_stringData);
|
||||
|
|
|
@ -530,10 +530,10 @@ String pitch2string(int v)
|
|||
if (v < 0 || v > 127) {
|
||||
return String(u"----");
|
||||
}
|
||||
int octave = (v / 12) - 1;
|
||||
int octave = (v / PITCH_DELTA_OCTAVE) - 1;
|
||||
String o;
|
||||
o = String::number(octave);
|
||||
int i = v % 12;
|
||||
int i = v % PITCH_DELTA_OCTAVE;
|
||||
return (octave < 0 ? valu[i] : vall[i]) + o;
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ int string2pitch(const String& s)
|
|||
origin = origin.mid(0, origin.size() - (negative ? 2 : 1));
|
||||
|
||||
int pitchIndex = -1;
|
||||
for (int i = 0; i < 12; ++i) {
|
||||
for (int i = 0; i < PITCH_DELTA_OCTAVE; ++i) {
|
||||
if (origin.toLower() == String(octave < 0 ? valu[i] : vall[i]).toLower()) {
|
||||
pitchIndex = i;
|
||||
break;
|
||||
|
@ -574,7 +574,7 @@ int string2pitch(const String& s)
|
|||
return -1;
|
||||
}
|
||||
|
||||
return (octave + 1) * 12 + pitchIndex;
|
||||
return (octave + 1) * PITCH_DELTA_OCTAVE + pitchIndex;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -47,7 +47,6 @@ Column {
|
|||
id: editStringsButton
|
||||
|
||||
width: parent.width
|
||||
height: 30
|
||||
|
||||
text: qsTrc("inspector", "Edit strings")
|
||||
|
||||
|
|
|
@ -135,13 +135,15 @@ void InstrumentsRepository::load()
|
|||
}
|
||||
|
||||
io::path_t stringTuningsPresetsPath = configuration()->stringTuningsPresetsPath();
|
||||
if (!loadStringTuningsPresets(stringTuningsPresetsPath)) { // todo
|
||||
if (!loadStringTuningsPresets(stringTuningsPresetsPath)) {
|
||||
LOGE() << "Could not load string tunings presets from " << stringTuningsPresetsPath << "!";
|
||||
}
|
||||
}
|
||||
|
||||
bool InstrumentsRepository::loadStringTuningsPresets(const io::path_t& path)
|
||||
{
|
||||
TRACEFUNC;
|
||||
|
||||
Ret ret = fileSystem()->exists(path);
|
||||
if (!ret) {
|
||||
LOGE() << ret.toString();
|
||||
|
@ -162,12 +164,12 @@ bool InstrumentsRepository::loadStringTuningsPresets(const io::path_t& path)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < arr.size(); ++i) {
|
||||
const JsonValue& familyOrInstrumentVal = arr.at(i);
|
||||
JsonObject familyOrInstrumentObj = familyOrInstrumentVal.toObject();
|
||||
const JsonValue& presetInfoVal = arr.at(i);
|
||||
JsonObject presetInfoObj = presetInfoVal.toObject();
|
||||
|
||||
std::vector<StringTuningsInfo> strings;
|
||||
|
||||
JsonArray stringsArr = familyOrInstrumentObj.value("strings").toArray();
|
||||
JsonArray stringsArr = presetInfoObj.value("strings").toArray();
|
||||
for (size_t j = 0; j < stringsArr.size(); ++j) {
|
||||
StringTuningsInfo info;
|
||||
|
||||
|
@ -195,13 +197,16 @@ bool InstrumentsRepository::loadStringTuningsPresets(const io::path_t& path)
|
|||
continue;
|
||||
}
|
||||
|
||||
info.presets.push_back(preset);
|
||||
info.presets.emplace_back(std::move(preset));
|
||||
}
|
||||
|
||||
strings.push_back(info);
|
||||
strings.emplace_back(std::move(info));
|
||||
}
|
||||
|
||||
m_stringTuningsPresets.emplace(familyOrInstrumentObj.value("familyOrInstrumentId").toStdString(), strings);
|
||||
std::string id = presetInfoObj.contains("familyId") ? presetInfoObj.value("familyId").toStdString()
|
||||
: presetInfoObj.value("instrumentId").toStdString();
|
||||
|
||||
m_stringTuningsPresets.emplace(id, strings);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -92,7 +92,7 @@ StyledPopupView {
|
|||
navigation.name: "Presets"
|
||||
navigation.panel: navPanel
|
||||
navigation.row: 1
|
||||
navigation.accessible: titleLabel.text + " " + currentText
|
||||
navigation.accessible.name: titleLabel.text + " " + currentText
|
||||
|
||||
model: stringTuningsModel.presets
|
||||
|
||||
|
|
|
@ -76,14 +76,14 @@ void StringTuningsSettingsModel::init()
|
|||
}
|
||||
|
||||
const std::vector<engraving::instrString>& stringList = stringData->stringList();
|
||||
std::vector<engraving::string_idx_t> visibleStrings = stringTunings->visibleStrings();
|
||||
const std::vector<engraving::string_idx_t>& visibleStrings = stringTunings->visibleStrings();
|
||||
for (engraving::string_idx_t i = 0; i < stringList.size(); ++i) {
|
||||
const engraving::instrString& string = stringList[i];
|
||||
StringTuningsItem* item = new StringTuningsItem(this);
|
||||
|
||||
item->blockSignals(true);
|
||||
item->setShow(contains(visibleStrings, i));
|
||||
item->setNumber(QString::number(i + 1)); // todo
|
||||
item->setNumber(QString::number(i + 1));
|
||||
item->setValue(string.pitch);
|
||||
item->blockSignals(false);
|
||||
|
||||
|
@ -312,7 +312,7 @@ void StringTuningsSettingsModel::updateStrings()
|
|||
|
||||
item->blockSignals(true);
|
||||
item->setShow(true);
|
||||
item->setNumber(QString::number(i + 1)); // todo
|
||||
item->setNumber(QString::number(i + 1));
|
||||
item->setValue(valueList[i].toInt());
|
||||
item->blockSignals(false);
|
||||
|
||||
|
@ -336,7 +336,6 @@ void StringTuningsSettingsModel::saveStrings()
|
|||
stringList.resize(m_strings.size());
|
||||
|
||||
for (int i = 0; i < m_strings.size(); ++i) {
|
||||
stringList[i].open = false;
|
||||
stringList[i].pitch = m_strings[i]->value();
|
||||
}
|
||||
|
||||
|
|
|
@ -1868,7 +1868,7 @@ PalettePtr PaletteCreator::newGuitarPalette(bool defaultPalette)
|
|||
sp->appendElement(capo, QT_TRANSLATE_NOOP("palette", "Capo"))->setElementTranslated(true);
|
||||
|
||||
auto stringTunings = makeElement<StringTunings>(gpaletteScore);
|
||||
stringTunings->setXmlText(u"<sym>guitarString6</sym> - D"); // todo
|
||||
stringTunings->setXmlText(u"<sym>guitarString6</sym> - D");
|
||||
sp->appendElement(stringTunings, QT_TRANSLATE_NOOP("palette", "String tunings"))->setElementTranslated(true);
|
||||
|
||||
const char* finger = "pimac";
|
||||
|
|
Loading…
Reference in a new issue