Build folios only when needed, by default (stage D6)

Every project now opens without building its folios; a folio is built
when it is shown or something needs its items (QETProject::lazyFolios()).
QET_LAZY_FOLIOS is gone; QET_EAGER_FOLIOS=1 builds every folio on
opening, as before, for comparisons and troubleshooting. Comments that
named the old variable now say "lazy folios"; the tests switch modes
with the new one.

The first save of a .qet as .qetz still builds every folio: a .qet does
not say which program wrote it, so its folios are written again rather
than copied. A .qetz opens and saves without building.

ctest 96/96 by default and with QET_EAGER_FOLIOS=1; 342 corpus projects
save the same in all four arms and export the same. In the GUI
(qet-gui-dialog): a 136-folio .qetz opens with no folio built, shows
folios 1 to 4, saves building none, the save = the original but the time
spent in it; a .qet opens lazily, saves as a .qetz beside it after the
notice, the .qet unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-12 19:27:22 +13:00
parent b151f52428
commit 5c4fa8fadf
24 changed files with 104 additions and 87 deletions
+4 -4
View File
@@ -1116,7 +1116,7 @@ bool Element::fromXml(QDomElement &e,
dc.fromXml(e.firstChildElement(QStringLiteral("elementInformations")),
QStringLiteral("elementInformation"));
//Changed through the project database while its folio was not
//built (QET_LAZY_FOLIOS): the change, not what the file says
//built (lazy folios): the change, not what the file says
if (diagram() && diagram()->project())
if (const auto edited = diagram()->project()->dataBase()->takeUnbuiltEdit(m_uuid))
dc = *edited;
@@ -1255,7 +1255,7 @@ QDomElement Element::toXml(
//if this element is linked to other elements,
//save the uuid of each other elements
//A partner on a folio not built yet (QET_LAZY_FOLIOS), which this
//A partner on a folio not built yet (lazy folios), which this
//symbol will be linked to, is saved too, in the order the symbol was
//saved with: saving needs no partner built (stage D5a)
QList<std::pair<QUuid, int>> links;
@@ -1661,7 +1661,7 @@ void Element::initLink(QETProject *prj)
//The symbols built: on the folios built, and those built alone as
//partners on folios not built (Diagram::buildSymbols()). A partner
//not built yet (QET_LAZY_FOLIOS) is linked when it is, and the
//not built yet (lazy folios) is linked when it is, and the
//saved list is kept until then, for the order it gives
ElementProvider ep(prj->folios());
QList<QUuid> uuids;
@@ -1689,7 +1689,7 @@ void Element::initLink(QETProject *prj)
/**
@brief Element::pendingLinks
@return the uuids of the partners this symbol was saved linked to and
is not linked to yet: those on a folio not built yet (QET_LAZY_FOLIOS),
is not linked to yet: those on a folio not built yet (lazy folios),
until initLink() runs again once it is
*/
QSet<QUuid> Element::pendingLinks() const