Save a new title, author or revision without building the folio (stage D5)

A folio not built whose own data changed was built to save, with the
folios its links reach. When what changed is only title block fields
nothing on a folio is computed from -- its title, author, date,
revision index, version, file name, template; a formula reads the
folio's label, plant, location, extra fields and grid -- its items as
read are what building it would write: it is saved from them with its
own data as it is now (Diagram::deferredXmlWithHeader()), .qet and
.qetz alike, with the information of its symbols changed through the
project database (or built, when one of those needs it). Any other
change still builds it.

136-folio .qetz, revision index and author set on every folio by a
script: 0.8 s, saved in 6.8 s, no folio built; with every folio built,
the same file. tst_lazyfolios: a new revision on every folio of a .qet
and of a .qetz saved as when built, building only the folios holding a
table (fails, 47 built, when every change counts); a folio whose label
changed is built (fails when none counts). ctest 96/96 eager and lazy;
342 corpus projects save the same in all four arms and export the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-12 17:54:37 +13:00
parent 244de05421
commit b151f52428
4 changed files with 154 additions and 2 deletions
+28 -2
View File
@@ -2374,9 +2374,17 @@ QDomDocument QETProject::toXml(QHash<int, QByteArray> *kept_folios, QStringList
changed << diagram;
}
buildFolios(changed);
for (Diagram *diagram : std::as_const(m_diagrams_list))
if (diagram->headerChanged())
//-- unless it changed only in what nothing is computed from (its
//title, date, revision...): written from its items as read
//(Diagram::deferredXmlWithHeader())
for (Diagram *diagram : std::as_const(m_diagrams_list)) {
if (!diagram->headerChanged()) continue;
bool edits_need_build = false;
if (!diagram->isLoaded())
m_data_base.unbuiltEditsOnFolio(diagram->uuid(), &edits_need_build);
if (diagram->isLoaded() || !diagram->headerChangeShowsOnly() || edits_need_build)
buildFolioToShow(diagram);
}
//A table filled from the database saves the size its rows
//give it, which any edit can change
if (m_edited_since_open)
@@ -2490,6 +2498,24 @@ QDomDocument QETProject::toXml(QHash<int, QByteArray> *kept_folios, QStringList
<< "["
<< diagram
<< "]";
if (keep && !diagram->isLoaded() && diagram->headerChanged()) {
QDomElement xml_diagram = diagram->deferredXmlWithHeader(xml_doc);
//Its symbols whose information changed while it was not built
const QHash<QUuid, DiagramContext> edits = m_data_base.unbuiltEditsOnFolio(diagram->uuid());
for (const QDomElement &list : QET::findInDomElement(xml_diagram, QStringLiteral("elements")))
for (QDomElement element = list.firstChildElement(QStringLiteral("element")) ; !element.isNull() ;
element = element.nextSiblingElement(QStringLiteral("element"))) {
const auto edit = edits.constFind(QUuid(element.attribute(QStringLiteral("uuid"))));
if (edit == edits.constEnd()) continue;
QDomElement information = xml_doc.createElement(QStringLiteral("elementInformations"));
edit->toXml(information, QStringLiteral("elementInformation"));
const QDomElement old_information = element.firstChildElement(QStringLiteral("elementInformations"));
element.replaceChild(information, old_information); //it has one (unbuiltEditsOnFolio())
}
xml_diagram.setAttribute("order", order_num ++);
project_root.appendChild(xml_diagram);
continue;
}
if (keep && !diagram->isLoaded() && kept_parts) {
auto placeholder = xml_doc.createElement(QStringLiteral("diagram"));
placeholder.setAttribute(QStringLiteral("qetz-kept-part"), diagram->deferredPart());