diff --git a/sources/dataBase/projectdatabase.cpp b/sources/dataBase/projectdatabase.cpp index a63ea6e1a..5c39d3b5a 100644 --- a/sources/dataBase/projectdatabase.cpp +++ b/sources/dataBase/projectdatabase.cpp @@ -113,14 +113,17 @@ QSqlQuery projectDataBase::newQuery(const QString &query) { /** @brief projectDataBase::excludedConductorCount - @return how many conductors of the project are deliberately absent from - the conductor table because at least one of their terminals has no uuid. + @return how many conductors of the project are absent from the conductor + table because an endpoint has no parent element to key on. Counted from the live scene rather than from the database, precisely - because the database is where these conductors are *not*. See - addConductor() for why they are omitted: a terminal uuid comes from the - catalog .elmt definition, so an element whose definition predates that - field yields terminals with no stable identity to key on. + because the database is where these conductors are *not*. + + This used to count conductors whose terminals had no uuid, which was most + of them on most projects. Terminal::stableUuid() now derives an identity + from the terminal's geometry when the definition provides no uuid, so that + is no longer a reason to exclude anything, and this counts only the case + that remains genuinely unkeyable. This is what lets a caller tell the user "N wires are missing and here is why", instead of silently presenting a short list as if it were @@ -138,8 +141,10 @@ int projectDataBase::excludedConductorCount() const const auto conductor_list = diagram->conductors(); for (auto *conductor : conductor_list) { - if (conductor->terminal1->uuid().isNull() - || conductor->terminal2->uuid().isNull()) { + //Must match addConductor()'s guard exactly, or this reports + //wires as missing that the list is in fact showing. + if (!conductor->terminal1->parentElement() + || !conductor->terminal2->parentElement()) { ++count; } } diff --git a/sources/ui/wiringlistdialog.cpp b/sources/ui/wiringlistdialog.cpp index 581b7426b..cf80a6025 100644 --- a/sources/ui/wiringlistdialog.cpp +++ b/sources/ui/wiringlistdialog.cpp @@ -77,14 +77,14 @@ WiringListDialog::WiringListDialog(QETProject *project, QWidget *parent) : summary->setWordWrap(true); if (excluded > 0) { - //The count matters more than it looks: a project whose elements - //all predate terminal uuids yields an entirely empty list, and - //without this line that is indistinguishable from a project with - //no wires in it. + //Rare now that Terminal::stableUuid() gives every terminal an + //identity: what is left is a conductor whose endpoint has no + //parent element at all. Still worth saying out loud rather than + //presenting a short list as if it were complete. summary->setText(tr("%n conducteur(s) listé(s).", "wiring list summary", listed) % QStringLiteral(" ") - % tr("%n conducteur(s) exclu(s) : leurs éléments ne définissent pas" - " d'identifiant de borne (définition d'élément trop ancienne).", + % tr("%n conducteur(s) exclu(s) : une extrémité n'est rattachée" + " à aucun élément.", "wiring list exclusion warning", excluded)); } else {