Rename EngravingObject::name() to typeName() to disambiguate

This commit is contained in:
Casper Jeukendrup 2022-02-06 14:49:12 +01:00
parent 5c8125778a
commit 049ab28a7f
No known key found for this signature in database
GPG key ID: 6C571BEF59E722DD
49 changed files with 147 additions and 147 deletions

View file

@ -70,14 +70,14 @@ void EngravingElementsProvider::reg(const Ms::EngravingObject* e)
{
TRACEFUNC;
m_elements.insert(e);
m_statistics[e->name()].regCount++;
m_statistics[e->typeName()].regCount++;
}
void EngravingElementsProvider::unreg(const Ms::EngravingObject* e)
{
TRACEFUNC;
m_elements.erase(e);
m_statistics[e->name()].unregCount++;
m_statistics[e->typeName()].unregCount++;
}
const EngravingObjectList& EngravingElementsProvider::elements() const
@ -132,10 +132,10 @@ void EngravingElementsProvider::dumpTree(const Ms::EngravingItem* item, int& lev
++level;
QString gap;
gap.fill(' ', level);
LOGD() << gap << item->name();
LOGD() << gap << item->typeName();
for (const Ms::EngravingObject* ch : item->children()) {
if (!ch->isEngravingItem()) {
LOGD() << "[" << item->name() << ": not item ch: " << ch->name();
LOGD() << "[" << item->typeName() << ": not item ch: " << ch->typeName();
continue;
}
dumpTree(static_cast<const Ms::EngravingItem*>(ch), level);
@ -148,7 +148,7 @@ void EngravingElementsProvider::dumpTreeTree(const Ms::EngravingObject* obj, int
++level;
QString gap;
gap.fill(' ', level);
LOGD() << gap << obj->name();
LOGD() << gap << obj->typeName();
for (int i = 0; i < obj->scanChildCount(); ++i) {
const Ms::EngravingObject* ch = obj->scanChild(i);
dumpTreeTree(ch, level);
@ -161,24 +161,24 @@ void EngravingElementsProvider::checkObjectTree(const Ms::EngravingObject* obj)
Ms::EngravingObject* p1 = obj->parent();
Ms::EngravingObject* p2 = obj->scanParent();
if (p1 && p2 && p1 != p2) {
LOGD() << "obj: " << obj->name();
LOGD() << "parents is differens, p1: " << p1->name() << ", p2: " << p2->name();
LOGD() << "obj: " << obj->typeName();
LOGD() << "parents is differens, p1: " << p1->typeName() << ", p2: " << p2->typeName();
}
size_t ch1 = obj->children().size();
size_t ch2 = obj->scanChildCount();
if (ch1 != ch2) {
LOGD() << "obj: " << obj->name();
LOGD() << "obj: " << obj->typeName();
LOGD() << "chcount is differens, ch1: " << ch1 << ", ch2: " << ch2;
LOGD() << "children1:";
for (size_t i = 0; i < obj->children().size(); ++i) {
LOGD() << i << ": " << obj->children().at(i)->name();
LOGD() << i << ": " << obj->children().at(i)->typeName();
}
LOGD() << "children2:";
for (int i = 0; i < obj->scanChildCount(); ++i) {
LOGD() << i << ": " << obj->scanChild(i)->name();
LOGD() << i << ": " << obj->scanChild(i)->typeName();
}
}

View file

@ -183,7 +183,7 @@ QVariantMap EngravingElementsModel::makeData(const Ms::EngravingObject* el) cons
name = "Score: " + score->title();
}
} else {
name = el->name();
name = el->typeName();
}
QString info = name + ": ";
@ -339,7 +339,7 @@ void EngravingElementsModel::updateInfo()
const EngravingObjectList& elements = elementsProvider()->elements();
QHash<QString, int> els;
for (const Ms::EngravingObject* el : elements) {
els[el->name()] += 1;
els[el->typeName()] += 1;
}
{

View file

@ -1366,7 +1366,7 @@ Shape BarLine::shape() const
{
Shape shape;
#ifndef NDEBUG
shape.add(bbox(), name());
shape.add(bbox(), typeName());
#else
shape.add(bbox());
#endif
@ -1414,7 +1414,7 @@ void BarLine::add(EngravingItem* e)
setGenerated(false);
break;
default:
qDebug("BarLine::add() not impl. %s", e->name());
qDebug("BarLine::add() not impl. %s", e->typeName());
delete e;
break;
}
@ -1431,11 +1431,11 @@ void BarLine::remove(EngravingItem* e)
case ElementType::SYMBOL:
case ElementType::IMAGE:
if (!_el.remove(e)) {
qDebug("BarLine::remove(): cannot find %s", e->name());
qDebug("BarLine::remove(): cannot find %s", e->typeName());
}
break;
default:
qDebug("BarLine::remove() not impl. %s", e->name());
qDebug("BarLine::remove() not impl. %s", e->typeName());
break;
}
}

View file

@ -538,7 +538,7 @@ bool Box::acceptDrop(EditData& data) const
return false;
}
if (MScore::debugMode) {
qDebug("<%s>", data.dropElement->name());
qDebug("<%s>", data.dropElement->typeName());
}
ElementType t = data.dropElement->type();
switch (t) {
@ -579,7 +579,7 @@ EngravingItem* Box::drop(EditData& data)
return 0;
}
if (MScore::debugMode) {
qDebug("<%s>", e->name());
qDebug("<%s>", e->typeName());
}
switch (e->type()) {
case ElementType::LAYOUT_BREAK:

View file

@ -112,7 +112,7 @@ void BSymbol::add(EngravingItem* e)
_leafs.append(e);
toBSymbol(e)->setZ(z() - 1); // draw on top of parent
} else {
qDebug("BSymbol::add: unsupported type %s", e->name());
qDebug("BSymbol::add: unsupported type %s", e->typeName());
}
}
@ -124,10 +124,10 @@ void BSymbol::remove(EngravingItem* e)
{
if (e->isSymbol() || e->isImage()) {
if (!_leafs.removeOne(e)) {
qDebug("BSymbol::remove: element <%s> not found", e->name());
qDebug("BSymbol::remove: element <%s> not found", e->typeName());
}
} else {
qDebug("BSymbol::remove: unsupported type %s", e->name());
qDebug("BSymbol::remove: unsupported type %s", e->typeName());
}
}

View file

@ -86,13 +86,13 @@ void Score::checkScore()
Fraction timeStretch = st->timeStretch(lcr->tick());
Fraction f = cr->globalTicks() * timeStretch;
qDebug("Chord/Rest gap at tick %d(%s+%d)-%d(%s) staffIdx %d measure %d (len = %d)",
tick.ticks(), lcr->name(), f.ticks(),
s->tick().ticks(), cr->name(), staffIdx, cr->measure()->no(),
tick.ticks(), lcr->typeName(), f.ticks(),
s->tick().ticks(), cr->typeName(), staffIdx, cr->measure()->no(),
(cr->tick() - tick).ticks());
} else {
qDebug("Chord/Rest gap at tick %d-%d(%s) staffIdx %d measure %d (len = %d)",
tick.ticks(),
s->tick().ticks(), cr->name(), staffIdx, cr->measure()->no(),
s->tick().ticks(), cr->typeName(), staffIdx, cr->measure()->no(),
(cr->tick() - tick).ticks());
}
tick = s->tick();

View file

@ -609,7 +609,7 @@ EngravingItem* ChordRest::drop(EditData& data)
score()->undoAddElement(spanner);
return e;
}
qDebug("cannot drop %s", e->name());
qDebug("cannot drop %s", e->typeName());
delete e;
return 0;
}
@ -718,7 +718,7 @@ void ChordRest::add(EngravingItem* e)
e->setTrack(track());
switch (e->type()) {
case ElementType::ARTICULATION: // for backward compatibility
qDebug("ChordRest::add: unknown element %s", e->name());
qDebug("ChordRest::add: unknown element %s", e->typeName());
break;
case ElementType::LYRICS:
if (e->isStyled(Pid::OFFSET)) {
@ -727,7 +727,7 @@ void ChordRest::add(EngravingItem* e)
_lyrics.push_back(toLyrics(e));
break;
default:
qFatal("ChordRest::add: unknown element %s", e->name());
qFatal("ChordRest::add: unknown element %s", e->typeName());
break;
}
}
@ -745,12 +745,12 @@ void ChordRest::remove(EngravingItem* e)
if (i != _lyrics.end()) {
_lyrics.erase(i);
} else {
qDebug("ChordRest::remove: %s %p not found", e->name(), e);
qDebug("ChordRest::remove: %s %p not found", e->typeName(), e);
}
}
break;
default:
qFatal("ChordRest::remove: unknown element <%s>", e->name());
qFatal("ChordRest::remove: unknown element <%s>", e->typeName());
}
}

View file

@ -353,7 +353,7 @@ void ConnectorInfoWriter::write()
if (!xml.canWrite(_connector)) {
return;
}
xml.startObject(QString("%1 type=\"%2\"").arg(tagName(), _connector->name()));
xml.startObject(QString("%1 type=\"%2\"").arg(tagName(), _connector->typeName()));
if (isStart()) {
_connector->write(xml);
}

View file

@ -2216,7 +2216,7 @@ void Score::deleteItem(EngravingItem* el)
if (el->generated() && !(el->isBracket() || el->isBarLine() || el->isClef() || el->isMeasureNumber())) {
return;
}
// qDebug("%s", el->name());
// qDebug("%s", el->typeName());
switch (el->type()) {
case ElementType::INSTRUMENT_NAME: {
@ -2621,7 +2621,7 @@ void Score::deleteItem(EngravingItem* el)
case ElementType::STEM_SLASH: // cannot delete this elements
case ElementType::HOOK:
qDebug("cannot remove %s", el->name());
qDebug("cannot remove %s", el->typeName());
break;
case ElementType::TEXT:
@ -5648,7 +5648,7 @@ void Score::undoAddElement(EngravingItem* element, bool ctrlModifier)
nbreath->setParent(seg);
undo(new AddElement(nbreath));
} else {
qWarning("undoAddElement: unhandled: <%s>", element->name());
qWarning("undoAddElement: unhandled: <%s>", element->typeName());
}
}
}

View file

@ -679,7 +679,7 @@ PointF EngravingItem::pagePos() const
} else if (explicitParent()->isFretDiagram()) {
return p + parentItem()->pagePos();
} else {
qFatal("this %s parent %s\n", name(), explicitParent()->name());
qFatal("this %s parent %s\n", typeName(), explicitParent()->typeName());
}
if (measure) {
system = measure->system();
@ -687,7 +687,7 @@ PointF EngravingItem::pagePos() const
}
if (system) {
if (system->staves()->size() <= idx) {
qDebug("staffIdx out of bounds: %s", name());
qDebug("staffIdx out of bounds: %s", typeName());
}
p.ry() += system->staffYpage(idx);
}
@ -734,7 +734,7 @@ PointF EngravingItem::canvasPos() const
} else if (explicitParent()->isFretDiagram()) {
return p + parentItem()->canvasPos() + PointF(toFretDiagram(explicitParent())->centerX(), 0.0);
} else {
qFatal("this %s parent %s\n", name(), explicitParent()->name());
qFatal("this %s parent %s\n", typeName(), explicitParent()->typeName());
}
if (measure) {
const StaffLines* lines = measure->staffLines(idx);
@ -839,7 +839,7 @@ void EngravingItem::writeProperties(XmlWriter& xml) const
if (!s) {
s = score()->staff(xml.curTrack() / VOICES);
if (!s) {
qWarning("EngravingItem::writeProperties: linked element's staff not found (%s)", name());
qWarning("EngravingItem::writeProperties: linked element's staff not found (%s)", typeName());
}
}
Location loc = Location::positionForElement(this);
@ -859,7 +859,7 @@ void EngravingItem::writeProperties(XmlWriter& xml) const
} else {
qWarning(
"EngravingItem::writeProperties: linked elements belong to different scores but none of them is master score: (%s lid=%d)",
name(), _links->lid());
typeName(), _links->lid());
}
}
@ -929,7 +929,7 @@ bool EngravingItem::readProperties(XmlReader& e)
if (!s) {
s = score()->staff(e.track() / VOICES);
if (!s) {
qWarning("EngravingItem::readProperties: linked element's staff not found (%s)", name());
qWarning("EngravingItem::readProperties: linked element's staff not found (%s)", typeName());
e.skipCurrentElement();
return true;
}
@ -979,11 +979,11 @@ bool EngravingItem::readProperties(XmlReader& e)
linkTo(linked);
} else {
qWarning("EngravingItem::readProperties: linked elements have different types: %s, %s. Input file corrupted?",
name(), linked->name());
typeName(), linked->typeName());
}
}
if (!_links) {
qWarning("EngravingItem::readProperties: could not link %s at staff %d", name(), mainLoc.staff() + 1);
qWarning("EngravingItem::readProperties: could not link %s at staff %d", typeName(), mainLoc.staff() + 1);
}
}
} else if (tag == "lid") {
@ -1006,7 +1006,7 @@ bool EngravingItem::readProperties(XmlReader& e)
EngravingItem* ee = static_cast<EngravingItem*>(eee);
if (ee->type() != type()) {
qFatal("link %s(%d) type mismatch %s linked to %s",
ee->name(), id, ee->name(), name());
ee->typeName(), id, ee->typeName(), typeName());
}
}
}
@ -1213,7 +1213,7 @@ void EngravingItem::dump() const
"\n bbox(%g,%g,%g,%g)"
"\n abox(%g,%g,%g,%g)"
"\n parent: %p",
name(), ipos().x(), ipos().y(),
typeName(), ipos().x(), ipos().y(),
_bbox.x(), _bbox.y(), _bbox.width(), _bbox.height(),
abbox().x(), abbox().y(), abbox().width(), abbox().height(),
explicitParent());
@ -1302,7 +1302,7 @@ EngravingItem* EngravingItem::readMimeData(Score* score, const QByteArray& data,
void EngravingItem::add(EngravingItem* e)
{
qDebug("EngravingItem: cannot add %s to %s", e->name(), name());
qDebug("EngravingItem: cannot add %s to %s", e->typeName(), typeName());
}
//---------------------------------------------------------
@ -1311,7 +1311,7 @@ void EngravingItem::add(EngravingItem* e)
void EngravingItem::remove(EngravingItem* e)
{
qFatal("EngravingItem: cannot remove %s from %s", e->name(), name());
qFatal("EngravingItem: cannot remove %s from %s", e->typeName(), typeName());
}
//---------------------------------------------------------
@ -1455,7 +1455,7 @@ bool EngravingItem::setProperty(Pid propertyId, const PropertyValue& v)
return explicitParent()->setProperty(propertyId, v);
}
LOG_PROP() << name() << " unknown <" << propertyName(propertyId) << ">(" << int(propertyId) << "), data: " << v.toString();
LOG_PROP() << typeName() << " unknown <" << propertyName(propertyId) << ">(" << int(propertyId) << "), data: " << v.toString();
return false;
}
triggerLayout();

View file

@ -351,7 +351,7 @@ public:
bool contains(const mu::PointF& p) const;
bool intersects(const mu::RectF& r) const;
#ifndef NDEBUG
virtual Shape shape() const { return Shape(bbox(), name()); }
virtual Shape shape() const { return Shape(bbox(), typeName()); }
#else
virtual Shape shape() const { return Shape(bbox()); }
#endif
@ -449,7 +449,7 @@ public:
virtual Q_INVOKABLE QString subtypeName() const;
//@ Returns the human-readable name of the element type
//@ Returns the name of the element type
virtual Q_INVOKABLE QString _name() const { return QString(name()); }
virtual Q_INVOKABLE QString _name() const { return QString(typeName()); }
virtual mu::draw::Color color() const;
mu::draw::Color curColor() const;

View file

@ -325,7 +325,7 @@ PropertyValue EngravingObject::propertyDefault(Pid pid) const
if (sid != Sid::NOSTYLE) {
return styleValue(pid, sid);
}
// qDebug("<%s>(%d) not found in <%s>", propertyQmlName(pid), int(pid), name());
// qDebug("<%s>(%d) not found in <%s>", propertyQmlName(pid), int(pid), typeName());
return PropertyValue();
}
@ -537,7 +537,7 @@ void EngravingObject::writeProperty(XmlWriter& xml, Pid pid) const
}
PropertyValue p = getProperty(pid);
if (!p.isValid()) {
qDebug("%s invalid property %d <%s>", name(), int(pid), propertyName(pid));
qDebug("%s invalid property %d <%s>", typeName(), int(pid), propertyName(pid));
return;
}
PropertyFlags f = propertyFlags(pid);
@ -636,7 +636,7 @@ void EngravingObject::reset()
void EngravingObject::readAddConnector(ConnectorInfoReader* info, bool pasteMode)
{
Q_UNUSED(pasteMode);
qDebug("Cannot add connector %s to %s", info->connector()->name(), name());
qDebug("Cannot add connector %s to %s", info->connector()->typeName(), typeName());
}
//---------------------------------------------------------
@ -804,7 +804,7 @@ void EngravingObject::styleChanged()
}
}
const char* EngravingObject::name() const
const char* EngravingObject::typeName() const
{
return Factory::name(type());
}

View file

@ -211,7 +211,7 @@ public:
inline ElementType type() const { return m_type; }
inline bool isType(ElementType t) const { return t == m_type; }
const char* name() const;
const char* typeName() const;
virtual QString userName() const;
EngravingObject* parent() const;

View file

@ -112,7 +112,7 @@ bool Fermata::readProperties(XmlReader& e)
void Fermata::write(XmlWriter& xml) const
{
if (!xml.canWrite(this)) {
qDebug("%s not written", name());
qDebug("%s not written", typeName());
return;
}
xml.startObject(this);

View file

@ -1205,7 +1205,7 @@ void FretDiagram::add(EngravingItem* e)
_harmony->setProperty(Pid::ALIGN, Align(AlignH::HCENTER, AlignV::TOP));
_harmony->setPropertyFlags(Pid::ALIGN, PropertyFlags::UNSTYLED);
} else {
qWarning("FretDiagram: cannot add <%s>\n", e->name());
qWarning("FretDiagram: cannot add <%s>\n", e->typeName());
}
}
@ -1218,7 +1218,7 @@ void FretDiagram::remove(EngravingItem* e)
if (e == _harmony) {
_harmony = 0;
} else {
qWarning("FretDiagram: cannot remove <%s>\n", e->name());
qWarning("FretDiagram: cannot remove <%s>\n", e->typeName());
}
}
@ -1244,7 +1244,7 @@ EngravingItem* FretDiagram::drop(EditData& data)
h->setTrack(track());
score()->undoAddElement(h);
} else {
qWarning("FretDiagram: cannot drop <%s>\n", e->name());
qWarning("FretDiagram: cannot drop <%s>\n", e->typeName());
delete e;
e = 0;
}

View file

@ -2206,7 +2206,7 @@ EngravingItem* Harmony::drop(EditData& data)
layout1();
e = 0; // cannot select
} else {
qWarning("Harmony: cannot drop <%s>\n", e->name());
qWarning("Harmony: cannot drop <%s>\n", e->typeName());
delete e;
e = 0;
}

View file

@ -1062,7 +1062,7 @@ PointF SLine::linePos(Grip grip, System** sys) const
Note* n = toNote(e);
System* s = n->chord()->segment()->system();
if (s == 0) {
qDebug("no system: %s start %s chord parent %s\n", name(), n->name(), n->chord()->explicitParent()->name());
qDebug("no system: %s start %s chord parent %s\n", typeName(), n->typeName(), n->chord()->explicitParent()->typeName());
return PointF();
}
*sys = s;

View file

@ -231,7 +231,7 @@ int Location::measure(const EngravingItem* e)
if (m) {
return m->measureIndex();
}
qWarning("Location::measure: cannot find element's measure (%s)", e->name());
qWarning("Location::measure: cannot find element's measure (%s)", e->typeName());
return 0;
}

View file

@ -172,7 +172,7 @@ void Lyrics::add(EngravingItem* el)
// _separator.append((Line*)el); // ignore! Internally managed
// ;
// else
qDebug("Lyrics::add: unknown element %s", el->name());
qDebug("Lyrics::add: unknown element %s", el->typeName());
}
//---------------------------------------------------------
@ -192,7 +192,7 @@ void Lyrics::remove(EngravingItem* el)
separ->removeUnmanaged();
}
} else {
qDebug("Lyrics::remove: unknown element %s", el->name());
qDebug("Lyrics::remove: unknown element %s", el->typeName());
}
}

View file

@ -1092,7 +1092,7 @@ void Measure::remove(EngravingItem* e)
case ElementType::MARKER:
case ElementType::HBOX:
if (!el().remove(e)) {
qDebug("Measure(%p)::remove(%s,%p) not found", this, e->name(), e);
qDebug("Measure(%p)::remove(%s,%p) not found", this, e->typeName(), e);
}
break;
@ -1112,7 +1112,7 @@ void Measure::remove(EngravingItem* e)
}
}
}
qDebug("Measure::remove: %s %p not found", e->name(), e);
qDebug("Measure::remove: %s %p not found", e->typeName(), e);
break;
case ElementType::MEASURE:
@ -1846,7 +1846,7 @@ EngravingItem* Measure::drop(EditData& data)
break;
default:
qDebug("Measure: cannot drop %s here", e->name());
qDebug("Measure: cannot drop %s here", e->typeName());
delete e;
break;
}

View file

@ -182,7 +182,7 @@ void MeasureBase::remove(EngravingItem* el)
}
}
if (!_el.remove(el)) {
qDebug("MeasureBase(%p)::remove(%s,%p) not found", this, el->name(), el);
qDebug("MeasureBase(%p)::remove(%s,%p) not found", this, el->typeName(), el);
}
}

View file

@ -1098,7 +1098,7 @@ void Note::removeSpanner(Spanner* l)
Note* e = toNote(l->endElement());
if (e && e->isNote()) {
if (!e->removeSpannerBack(l)) {
qDebug("Note::removeSpanner(%p): cannot remove spannerBack %s %p", this, l->name(), l);
qDebug("Note::removeSpanner(%p): cannot remove spannerBack %s %p", this, l->typeName(), l);
// abort();
}
if (l->isGlissando()) {
@ -1106,7 +1106,7 @@ void Note::removeSpanner(Spanner* l)
}
}
if (!removeSpannerFor(l)) {
qDebug("Note(%p): cannot remove spannerFor %s %p", this, l->name(), l);
qDebug("Note(%p): cannot remove spannerFor %s %p", this, l->typeName(), l);
// abort();
}
}
@ -1152,7 +1152,7 @@ void Note::add(EngravingItem* e)
addSpanner(toSpanner(e));
break;
default:
qDebug("Note::add() not impl. %s", e->name());
qDebug("Note::add() not impl. %s", e->typeName());
break;
}
triggerLayout();
@ -1175,7 +1175,7 @@ void Note::remove(EngravingItem* e)
case ElementType::FINGERING:
case ElementType::BEND:
if (!_el.remove(e)) {
qDebug("Note::remove(): cannot find %s", e->name());
qDebug("Note::remove(): cannot find %s", e->typeName());
}
break;
case ElementType::TIE: {
@ -1197,7 +1197,7 @@ void Note::remove(EngravingItem* e)
break;
default:
qDebug("Note::remove() not impl. %s", e->name());
qDebug("Note::remove() not impl. %s", e->typeName());
break;
}
triggerLayout();
@ -3612,19 +3612,19 @@ Shape Note::shape() const
RectF r(bbox());
#ifndef NDEBUG
Shape shape(r, name());
Shape shape(r, typeName());
for (NoteDot* dot : _dots) {
shape.add(symBbox(SymId::augmentationDot).translated(dot->pos()), dot->name());
shape.add(symBbox(SymId::augmentationDot).translated(dot->pos()), dot->typeName());
}
if (_accidental && _accidental->addToSkyline()) {
shape.add(_accidental->bbox().translated(_accidental->pos()), _accidental->name());
shape.add(_accidental->bbox().translated(_accidental->pos()), _accidental->typeName());
}
for (auto e : _el) {
if (e->addToSkyline()) {
if (e->isFingering() && toFingering(e)->layoutType() != ElementType::NOTE) {
continue;
}
shape.add(e->bbox().translated(e->pos()), e->name());
shape.add(e->bbox().translated(e->pos()), e->typeName());
}
}
#else

View file

@ -160,7 +160,7 @@ Note* Score::addPitch(NoteVal& nval, bool addFlag, InputState* externalInputStat
ChordRest* c = toChordRest(is.lastSegment()->element(is.track()));
if (c == 0 || !c->isChord()) {
qDebug("Score::addPitch: cr %s", c ? c->name() : "zero");
qDebug("Score::addPitch: cr %s", c ? c->typeName() : "zero");
return 0;
}
Note* note = addNote(toChord(c), nval, /* forceAccidental */ false, is.articulationIds(), externalInputState);

View file

@ -606,7 +606,7 @@ void Score::readAddConnector(ConnectorInfoReader* info, bool pasteMode)
void Score::pasteChordRest(ChordRest* cr, const Fraction& t, const Interval& srcTranspose)
{
Fraction tick(t);
// qDebug("pasteChordRest %s at %d, len %d/%d", cr->name(), tick, cr->ticks().numerator(), cr->ticks().denominator() );
// qDebug("pasteChordRest %s at %d, len %d/%d", cr->typeName(), tick, cr->ticks().numerator(), cr->ticks().denominator() );
Measure* measure = tick2measure(tick);
if (!measure) {
@ -1157,7 +1157,7 @@ void Score::cmdPaste(const QMimeData* ms, MuseScoreView* view, Fraction scale)
} else if (_selection.isSingle()) {
EngravingItem* e = _selection.element();
if (!e->isNote() && !e->isChordRest()) {
qDebug("cannot paste to %s", e->name());
qDebug("cannot paste to %s", e->typeName());
MScore::setError(MsError::DEST_NO_CR);
return;
}
@ -1192,7 +1192,7 @@ void Score::cmdPaste(const QMimeData* ms, MuseScoreView* view, Fraction scale)
} else if (_selection.isSingle()) {
EngravingItem* e = _selection.element();
if (!e->isNote() && !e->isRest() && !e->isChord()) {
qDebug("cannot paste to %s", e->name());
qDebug("cannot paste to %s", e->typeName());
MScore::setError(MsError::DEST_NO_CR);
return;
}

View file

@ -830,9 +830,9 @@ void TrackList::dump() const
for (EngravingItem* e : *this) {
if (e->isDurationElement()) {
Fraction du = toDurationElement(e)->ticks();
qDebug(" %s %d/%d", e->name(), du.numerator(), du.denominator());
qDebug(" %s %d/%d", e->typeName(), du.numerator(), du.denominator());
} else {
qDebug(" %s", e->name());
qDebug(" %s", e->typeName());
}
}
}

View file

@ -893,7 +893,7 @@ void Rest::remove(EngravingItem* e)
case ElementType::SYMBOL:
case ElementType::IMAGE:
if (!el().remove(e)) {
qDebug("Rest::remove(): cannot find %s", e->name());
qDebug("Rest::remove(): cannot find %s", e->typeName());
}
break;
default:
@ -1090,7 +1090,7 @@ Shape Rest::shape() const
shape.add(ChordRest::shape());
#ifndef NDEBUG
{
shape.add(bbox(), name());
shape.add(bbox(), typeName());
}
#else
{

View file

@ -1477,7 +1477,7 @@ void Score::addElement(EngravingItem* element)
element->triggerLayout();
// qDebug("Score(%p) EngravingItem(%p)(%s) parent %p(%s)",
// this, element, element->name(), parent, parent ? parent->name() : "");
// this, element, element->typeName(), parent, parent ? parent->typeName() : "");
ElementType et = element->type();
if (et == ElementType::MEASURE
@ -1600,7 +1600,7 @@ void Score::removeElement(EngravingItem* element)
element->triggerLayout();
// qDebug("Score(%p) EngravingItem(%p)(%s) parent %p(%s)",
// this, element, element->name(), parent, parent ? parent->name() : "");
// this, element, element->typeName(), parent, parent ? parent->typeName() : "");
// special for MEASURE, HBOX, VBOX
// their parent is not static
@ -3249,7 +3249,7 @@ void Score::select(EngravingItem* e, SelectType type, int staffIdx)
if (MScore::debugMode) {
qDebug("select element <%s> type %d(state %d) staff %d",
e ? e->name() : "", int(type), int(selection().state()), e ? e->staffIdx() : -1);
e ? e->typeName() : "", int(type), int(selection().state()), e ? e->staffIdx() : -1);
}
switch (type) {

View file

@ -975,7 +975,7 @@ int TBox::scanChildCount() const
void _dumpScoreTree(EngravingObject* s, int depth)
{
qDebug() << qPrintable(QString(" ").repeated(4 * depth)) << s->name() << "at" << s;
qDebug() << qPrintable(QString(" ").repeated(4 * depth)) << s->typeName() << "at" << s;
for (int i = 0; i < s->scanChildCount(); ++i) {
EngravingObject* c = s->scanChild(i);
_dumpScoreTree(c, depth + 1);

View file

@ -533,8 +533,8 @@ void Segment::checkElement(EngravingItem* el, int track)
// generated elements can be overwritten
if (_elist[track] && !_elist[track]->generated()) {
qDebug("add(%s): there is already a %s at track %d tick %d",
el->name(),
_elist[track]->name(),
el->typeName(),
_elist[track]->typeName(),
track,
tick().ticks()
);
@ -548,7 +548,7 @@ void Segment::checkElement(EngravingItem* el, int track)
void Segment::add(EngravingItem* el)
{
// qDebug("%p segment %s add(%d, %d, %s)", this, subTypeName(), tick(), el->track(), el->name());
// qDebug("%p segment %s add(%d, %d, %s)", this, subTypeName(), tick(), el->track(), el->typeName());
if (el->explicitParent() != this) {
el->setParent(this);
@ -685,7 +685,7 @@ void Segment::add(EngravingItem* el)
break;
default:
qFatal("Segment::add() unknown %s", el->name());
qFatal("Segment::add() unknown %s", el->typeName());
}
}
@ -695,7 +695,7 @@ void Segment::add(EngravingItem* el)
void Segment::remove(EngravingItem* el)
{
// qDebug("%p Segment::remove %s %p", this, el->name(), el);
// qDebug("%p Segment::remove %s %p", this, el->typeName(), el);
int track = el->track();
@ -799,7 +799,7 @@ void Segment::remove(EngravingItem* el)
break;
default:
qFatal("Segment::remove() unknown %s", el->name());
qFatal("Segment::remove() unknown %s", el->typeName());
}
triggerLayout();
checkEmpty();
@ -2212,7 +2212,7 @@ void Segment::createShape(int staffIdx)
if (bl) {
RectF r = bl->layoutRect();
#ifndef NDEBUG
s.add(r.translated(bl->pos()), bl->name());
s.add(r.translated(bl->pos()), bl->typeName());
#else
s.add(r.translated(bl->pos()));
#endif

View file

@ -726,7 +726,7 @@ void Selection::dump()
break;
}
foreach (const EngravingItem* e, _el) {
qDebug(" %p %s", e, e->name());
qDebug(" %p %s", e, e->typeName());
}
}

View file

@ -721,7 +721,7 @@ void Spanner::computeEndElement()
Fraction tick = (l->ticks().ticks() == Lyrics::TEMP_MELISMA_TICKS) ? l->tick() : l->endTick();
Segment* s = score()->tick2segment(tick, true, SegmentType::ChordRest);
if (!s) {
qDebug("%s no end segment for tick %d", name(), tick.ticks());
qDebug("%s no end segment for tick %d", typeName(), tick.ticks());
return;
}
int t = trackZeroVoice(track2());
@ -738,7 +738,7 @@ void Spanner::computeEndElement()
_endElement = score()->findCRinStaff(tick2(), track2() / VOICES);
}
if (!_endElement) {
qDebug("%s no end element for tick %d", name(), tick2().ticks());
qDebug("%s no end element for tick %d", typeName(), tick2().ticks());
return;
}
@ -746,7 +746,7 @@ void Spanner::computeEndElement()
ChordRest* cr = endCR();
Fraction nticks = cr->tick() + cr->actualTicks() - _tick;
if ((_ticks - nticks).isNotZero()) {
qDebug("%s ticks changed, %d -> %d", name(), _ticks.ticks(), nticks.ticks());
qDebug("%s ticks changed, %d -> %d", typeName(), _ticks.ticks(), nticks.ticks());
setTicks(nticks);
if (isOttava()) {
staff()->updateOttava();
@ -1349,7 +1349,7 @@ void Spanner::eraseSpannerSegments()
SpannerSegment* Spanner::layoutSystem(System*)
{
qDebug(" %s", name());
qDebug(" %s", typeName());
return 0;
}
@ -1517,7 +1517,7 @@ SpannerWriter::SpannerWriter(XmlWriter& xml, const EngravingItem* current, const
{
const bool clipboardmode = xml.clipboardmode();
if (!sp->startElement() || !sp->endElement()) {
qWarning("SpannerWriter: spanner (%s) doesn't have an endpoint!", sp->name());
qWarning("SpannerWriter: spanner (%s) doesn't have an endpoint!", sp->typeName());
return;
}
if (current->isMeasure() || current->isSegment() || (sp->startElement()->type() != current->type())) {

View file

@ -102,7 +102,7 @@ bool SpannerMap::removeSpanner(Spanner* s)
return true;
}
}
qDebug("%s (%p) not found", s->name(), s);
qDebug("%s (%p) not found", s->typeName(), s);
return false;
}
@ -115,7 +115,7 @@ void SpannerMap::dump() const
{
qDebug("SpannerMap::dump");
for (auto i = begin(); i != end(); ++i) {
qDebug(" %5d: %s %p", i->first, i->second->name(), i->second);
qDebug(" %5d: %s %p", i->first, i->second->typeName(), i->second);
}
}

View file

@ -219,7 +219,7 @@ bool StaffTextBase::getAeolusStop(int group, int idx) const
Segment* StaffTextBase::segment() const
{
if (!explicitParent()->isSegment()) {
qDebug("parent %s", explicitParent()->name());
qDebug("parent %s", explicitParent()->typeName());
return 0;
}
Segment* s = toSegment(explicitParent());

View file

@ -462,7 +462,7 @@ void System::setMeasureHeight(qreal height)
} else if (m->isTBox()) {
toTBox(m)->layout();
} else {
qDebug("unhandled measure type %s", m->name());
qDebug("unhandled measure type %s", m->typeName());
}
}
}
@ -1076,7 +1076,7 @@ void System::add(EngravingItem* el)
if (!el) {
return;
}
// qDebug("%p System::add: %p %s", this, el, el->name());
// qDebug("%p System::add: %p %s", this, el, el->typeName());
el->setParent(this);
@ -1122,7 +1122,7 @@ void System::add(EngravingItem* el)
SpannerSegment* ss = toSpannerSegment(el);
#ifndef NDEBUG
if (_spannerSegments.contains(ss)) {
qDebug("System::add() %s %p already there", ss->name(), ss);
qDebug("System::add() %s %p already there", ss->typeName(), ss);
} else
#endif
_spannerSegments.append(ss);
@ -1141,7 +1141,7 @@ void System::add(EngravingItem* el)
break;
default:
qDebug("System::add(%s) not implemented", el->name());
qDebug("System::add(%s) not implemented", el->typeName());
break;
}
}
@ -1187,7 +1187,7 @@ void System::remove(EngravingItem* el)
case ElementType::LYRICSLINE_SEGMENT:
case ElementType::GLISSANDO_SEGMENT:
if (!_spannerSegments.removeOne(toSpannerSegment(el))) {
qDebug("System::remove: %p(%s) not found, score %p", el, el->name(), score());
qDebug("System::remove: %p(%s) not found, score %p", el, el->typeName(), score());
Q_ASSERT(score() == el->score());
}
break;
@ -1201,7 +1201,7 @@ void System::remove(EngravingItem* el)
break;
default:
qDebug("System::remove(%s) not implemented", el->name());
qDebug("System::remove(%s) not implemented", el->typeName());
break;
}
}

View file

@ -705,7 +705,7 @@ EngravingItem* TextBase::drop(EditData& ed)
break;
default:
qDebug("drop <%s> not handled", e->name());
qDebug("drop <%s> not handled", e->typeName());
break;
}
return 0;

View file

@ -905,7 +905,7 @@ void Tuplet::add(EngravingItem* e)
#ifndef NDEBUG
for (DurationElement* el : _elements) {
if (el == e) {
qDebug("%p: %p %s already there", this, e, e->name());
qDebug("%p: %p %s already there", this, e, e->typeName());
return;
}
}
@ -956,7 +956,7 @@ void Tuplet::remove(EngravingItem* e)
case ElementType::TUPLET: {
auto i = std::find(_elements.begin(), _elements.end(), toDurationElement(e));
if (i == _elements.end()) {
qDebug("Tuplet::remove: cannot find element <%s>", e->name());
qDebug("Tuplet::remove: cannot find element <%s>", e->typeName());
qDebug(" elements %zu", _elements.size());
} else {
_elements.erase(i);

View file

@ -838,12 +838,12 @@ const char* AddElement::name() const
{
static char buffer[64];
if (element->isTextBase()) {
snprintf(buffer, 64, "Add: %s <%s> %p", element->name(),
snprintf(buffer, 64, "Add: %s <%s> %p", element->typeName(),
qPrintable(toTextBase(element)->plainText()), element);
} else if (element->isSegment()) {
snprintf(buffer, 64, "Add: <%s-%s> %p", element->name(), toSegment(element)->subTypeName(), element);
snprintf(buffer, 64, "Add: <%s-%s> %p", element->typeName(), toSegment(element)->subTypeName(), element);
} else {
snprintf(buffer, 64, "Add: <%s> %p", element->name(), element);
snprintf(buffer, 64, "Add: <%s> %p", element->typeName(), element);
}
return buffer;
}
@ -990,12 +990,12 @@ const char* RemoveElement::name() const
{
static char buffer[64];
if (element->isTextBase()) {
snprintf(buffer, 64, "Remove: %s <%s> %p", element->name(),
snprintf(buffer, 64, "Remove: %s <%s> %p", element->typeName(),
qPrintable(toTextBase(element)->plainText()), element);
} else if (element->isSegment()) {
snprintf(buffer, 64, "Remove: <%s-%s> %p", element->name(), toSegment(element)->subTypeName(), element);
snprintf(buffer, 64, "Remove: <%s-%s> %p", element->typeName(), toSegment(element)->subTypeName(), element);
} else {
snprintf(buffer, 64, "Remove: %s %p", element->name(), element);
snprintf(buffer, 64, "Remove: %s %p", element->typeName(), element);
}
return buffer;
}
@ -2388,7 +2388,7 @@ void ChangeClefType::flip(EditData*)
void ChangeProperty::flip(EditData*)
{
LOG_UNDO() << element->name() << int(id) << "(" << propertyName(id) << ")" << element->getProperty(id) << "->" << property;
LOG_UNDO() << element->typeName() << int(id) << "(" << propertyName(id) << ")" << element->getProperty(id) << "->" << property;
PropertyValue v = element->getProperty(id);
PropertyFlags ps = element->propertyFlags(id);

View file

@ -2864,7 +2864,7 @@ Score::FileError Read114::read114(MasterScore* masterScore, XmlReader& e, ReadCo
s->setTrack2(s->track());
}
if (s->ticks().isZero()) {
qDebug("zero spanner %s ticks: %d", s->name(), s->ticks().ticks());
qDebug("zero spanner %s ticks: %d", s->typeName(), s->ticks().ticks());
delete s;
} else {
masterScore->addSpanner(s);

View file

@ -91,7 +91,7 @@ void XmlWriter::startObject(const QString& s)
void XmlWriter::startObject(const EngravingObject* se, const QString& attributes)
{
startObject(se->name(), se, attributes);
startObject(se->typeName(), se, attributes);
}
//---------------------------------------------------------

View file

@ -81,10 +81,10 @@ static void isLayoutDone(void* data, EngravingItem* e)
(*result) = false;
// Print some info about the element to make test more useful...
if (Measure* m = toMeasure(e->findMeasure())) {
qDebug("Layout of %s is not done (page %d, measure %d)", e->name(), m->system()->page()->no() + 1,
qDebug("Layout of %s is not done (page %d, measure %d)", e->typeName(), m->system()->page()->no() + 1,
m->no() + 1);
} else {
qDebug("Layout of %s is not done", e->name());
qDebug("Layout of %s is not done", e->typeName());
}
}
}

View file

@ -58,7 +58,7 @@ static void inStaff(void* staffCheckData, EngravingItem* e)
{
StaffCheckData* checkData = static_cast<StaffCheckData*>(staffCheckData);
if (e->staffIdx() == checkData->staffIdx) {
LOGE() << e->name() << "is in staff" << checkData->staffIdx;
LOGE() << e->typeName() << "is in staff" << checkData->staffIdx;
checkData->staffHasElements = true;
}
}
@ -68,13 +68,13 @@ static bool staffHasElements(Score* score, int staffIdx)
for (auto i = score->spannerMap().cbegin(); i != score->spannerMap().cend(); ++i) {
Spanner* s = i->second;
if (s->staffIdx() == staffIdx) {
LOGE() << s->name() << "is in staff" << staffIdx;
LOGE() << s->typeName() << "is in staff" << staffIdx;
return true;
}
}
for (Spanner* s : score->unmanagedSpanners()) {
if (s->staffIdx() == staffIdx) {
qDebug() << s->name() << "is in staff" << staffIdx;
qDebug() << s->typeName() << "is in staff" << staffIdx;
return true;
}
}

View file

@ -135,7 +135,7 @@ static QString getClass(const Ms::EngravingItem* e)
if (e == NULL) {
return eName; // e should never be null, this is extra-cautious
}
eName = e->name();
eName = e->typeName();
// Future sub-typing code goes here

View file

@ -2893,7 +2893,7 @@ static QString symIdToTechn(const SymId sid)
static void writeChordLines(const Chord* const chord, XmlWriter& xml, Notations& notations, Articulations& articulations)
{
for (EngravingItem* e : chord->el()) {
qDebug("writeChordLines: el %p type %d (%s)", e, int(e->type()), e->name());
qDebug("writeChordLines: el %p type %d (%s)", e, int(e->type()), e->typeName());
if (e->type() == ElementType::CHORDLINE) {
ChordLine const* const cl = static_cast<ChordLine*>(e);
QString subtype;
@ -3949,7 +3949,7 @@ static void directionTag(XmlWriter& xml, Attributes& attr, EngravingItem const*
el->spatium(),
el,
el->type(),
el->name(),
el->typeName(),
el->x(), el->y(),
el->x()/el->spatium(), el->y()/el->spatium(),
el->width(), el->height(),
@ -3992,14 +3992,14 @@ static void directionTag(XmlWriter& xml, Attributes& attr, EngravingItem const*
}
} else {
qDebug("directionTag() element %p tp=%d (%s) not supported",
el, int(el->type()), el->name());
el, int(el->type()), el->typeName());
}
/*
if (pel) {
qDebug("directionTag() prnt tp=%d (%s) x=%g y=%g w=%g h=%g userOff.y=%g",
pel->type(),
pel->name(),
pel->typeName(),
pel->x(), pel->y(),
pel->width(), pel->height(),
pel->offset().y());
@ -5377,7 +5377,7 @@ void ExportMusicXml::repeatAtMeasureStart(Attributes& attr, const Measure* const
break;
default:
qDebug("repeatAtMeasureStart: direction type %s at tick %d not implemented",
e->name(), m->tick().ticks());
e->typeName(), m->tick().ticks());
break;
}
}
@ -5428,7 +5428,7 @@ void ExportMusicXml::repeatAtMeasureStop(const Measure* const m, int strack, int
break;
default:
qDebug("repeatAtMeasureStop: direction type %s at tick %d not implemented",
e->name(), m->tick().ticks());
e->typeName(), m->tick().ticks());
break;
}
}
@ -5619,7 +5619,7 @@ static void annotations(ExportMusicXml* exp, int strack, int etrack, int track,
// handled separately by chordAttributes(), figuredBass(), findFretDiagram() or ignored
} else {
qDebug("direction type %s at tick %d not implemented",
e->name(), seg->tick().ticks());
e->typeName(), seg->tick().ticks());
}
}
}
@ -5757,7 +5757,7 @@ static void spannerStart(ExportMusicXml* exp, int strack, int etrack, int track,
break;
default:
qDebug("spannerStart: direction type %d ('%s') at tick %d not implemented",
int(e->type()), e->name(), seg->tick().ticks());
int(e->type()), e->typeName(), seg->tick().ticks());
break;
}
}
@ -5816,7 +5816,7 @@ static void spannerStop(ExportMusicXml* exp, int strack, int etrack, const Fract
break;
default:
qDebug("spannerStop: direction type %s at tick2 %d not implemented",
e->name(), tick2.ticks());
e->typeName(), tick2.ticks());
break;
}
}
@ -6599,7 +6599,7 @@ void ExportMusicXml::writeElement(EngravingItem* el, const Measure* m, int sstaf
} else if (el->isKeySig() || el->isTimeSig() || el->isBreath()) {
// handled elsewhere
} else {
qDebug("ExportMusicXml::write unknown segment type %s", el->name());
qDebug("ExportMusicXml::write unknown segment type %s", el->typeName());
}
}

View file

@ -111,7 +111,7 @@ Ret MasterNotationMidiData::triggerElementMidiData(const EngravingItem* element)
return playHarmonyMidiData(h);
}
NOT_SUPPORTED << element->name();
NOT_SUPPORTED << element->typeName();
return make_ret(Err::UnableToPlaybackElement);
}
@ -134,7 +134,7 @@ Events MasterNotationMidiData::retrieveEventsForElement(const EngravingItem* ele
return eventsFromHarmony(element, midiChannel);
}
NOT_SUPPORTED << element->name();
NOT_SUPPORTED << element->typeName();
return {};
}

View file

@ -1151,7 +1151,7 @@ bool NotationInteraction::drop(const PointF& pos, Qt::KeyboardModifiers modifier
score()->addRefresh(m_dropData.ed.dropElement->canvasBoundingRect());
if (!el->acceptDrop(m_dropData.ed)) {
qDebug("drop %s onto %s not accepted", m_dropData.ed.dropElement->name(), el->name());
qDebug("drop %s onto %s not accepted", m_dropData.ed.dropElement->typeName(), el->typeName());
break;
}
EngravingItem* dropElement = el->drop(m_dropData.ed);
@ -1210,7 +1210,7 @@ bool NotationInteraction::drop(const PointF& pos, Qt::KeyboardModifiers modifier
EngravingItem* el = dropTarget(m_dropData.ed);
if (!el) {
if (!dropCanvas(m_dropData.ed.dropElement)) {
qDebug("cannot drop %s(%p) to canvas", m_dropData.ed.dropElement->name(), m_dropData.ed.dropElement);
qDebug("cannot drop %s(%p) to canvas", m_dropData.ed.dropElement->typeName(), m_dropData.ed.dropElement);
resetDropElement();
}
break;
@ -4024,7 +4024,7 @@ void NotationInteraction::navigateToLyrics(bool back, bool moveOnly, bool end)
ChordRest* cr = toChordRest(nextSegment->element(track));
if (!cr) {
qDebug("no next lyrics list: %s", nextSegment->element(track)->name());
qDebug("no next lyrics list: %s", nextSegment->element(track)->typeName());
return;
}
Ms::Lyrics* nextLyrics = cr->lyrics(verse, placement);

View file

@ -590,7 +590,7 @@ QPixmap PaletteWidget::pixmapForCellAt(int paletteIdx) const
int h = lrint(r.height() * cellMag);
if (w * h == 0) {
qDebug("zero pixmap %d %d %s", w, h, element->name());
qDebug("zero pixmap %d %d %s", w, h, element->typeName());
return QPixmap();
}

View file

@ -154,7 +154,7 @@ void Note::addInternal(Ms::Note* note, Ms::EngravingItem* s)
// Create undo op and add the element.
toScore(note->score())->undoAddElement(s);
} else if (s) {
qDebug("Note::add() not impl. %s", s->name());
qDebug("Note::add() not impl. %s", s->typeName());
}
}
@ -173,7 +173,7 @@ void Note::remove(Ms::PluginAPI::EngravingItem* wrapped)
} else if (isChildAllowed(s->type())) {
note()->score()->deleteItem(s); // Create undo op and remove the element.
} else {
qDebug("Note::remove() not impl. %s", s->name());
qDebug("Note::remove() not impl. %s", s->typeName());
}
}

View file

@ -45,7 +45,7 @@ ScoreElement::~ScoreElement()
QString ScoreElement::name() const
{
return QString(e->name());
return QString(e->typeName());
}
int ScoreElement::type() const

View file

@ -83,7 +83,7 @@ bool Selection::select(EngravingItem* elWrapper, bool add)
// Check whether it's safe to select this element:
// use types list from UndoMacro for now
if (!Ms::UndoMacro::canRecordSelectedElement(e)) {
qWarning("Cannot select element of type %s", e->name());
qWarning("Cannot select element of type %s", e->typeName());
return false;
}