mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-15 10:04:13 +02:00
Export the wiring list without building every folio (stage D5)
The wiring list export read the project as QETProject::toXml() writes it, which builds every folio. It now reads a document made without building: a built folio written as saving writes it (QETProject::folioXml(), which keeps its symbols' links to partners not built), a folio not built copied from its XML, and what QElectroTech computes for a wire's ends -- its symbols' labels, their last partner's label, the terminals' names -- filled in from the symbols built and from the project database. A symbol still waiting for a partner not built takes its partners from the database, saved order. 136-folio .qetz, wiring list from the command line: 30.1 s with every folio built, 4.5 s lazily, same file. tst_lazyfolios: the wiring list of a .qet and of a .qetz as when built, building no folio. New corpus gate (it fails on all 6 projects tried with terminal names broken): --export-cables and --export-wires lazily from the .qet and the .qetz = eager on 342 projects; one (forum f3386) differed until waiting symbols took their partners from the database. ctest 96/96 eager and lazy (one earlier run had modal_quit_regression and tst_resaveunchanged fail once each, both passing on rerun in both modes); 342 corpus projects save the same in all four arms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1289,6 +1289,34 @@ QList<projectDataBase::FolioWire> projectDataBase::wiresOnFolios(const QList<QUu
|
||||
return wires;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::elementLabel
|
||||
@return the label the symbol @p element shows, read from the element
|
||||
info table as it is (see elementTypesOnFolios())
|
||||
*/
|
||||
QString projectDataBase::elementLabel(const QUuid &element) const
|
||||
{
|
||||
QSqlQuery query(m_data_base);
|
||||
query.prepare(QStringLiteral("SELECT label FROM element_info WHERE element_uuid = :uuid"));
|
||||
query.bindValue(QStringLiteral(":uuid"), element.toString());
|
||||
return query.exec() && query.next() ? query.value(0).toString() : QString();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::terminalName
|
||||
@return the name of the terminal @p terminal of the symbol @p element,
|
||||
read from the terminal table as it is (see elementTypesOnFolios()): a
|
||||
terminal a wire ends on has a row
|
||||
*/
|
||||
QString projectDataBase::terminalName(const QUuid &terminal, const QUuid &element) const
|
||||
{
|
||||
QSqlQuery query(m_data_base);
|
||||
query.prepare(QStringLiteral("SELECT name FROM terminal WHERE uuid = :uuid AND element_uuid = :element"));
|
||||
query.bindValue(QStringLiteral(":uuid"), terminal.toString());
|
||||
query.bindValue(QStringLiteral(":element"), element.toString());
|
||||
return query.exec() && query.next() ? query.value(0).toString() : QString();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::linkedSymbols
|
||||
@return the symbols @p element is linked to, read from the link table
|
||||
|
||||
@@ -195,6 +195,8 @@ class projectDataBase : public QObject
|
||||
/// symbols at its ends (ElementData::typeToString())
|
||||
struct FolioWire { QString text; QString kind1; QString kind2; };
|
||||
QList<FolioWire> wiresOnFolios(const QList<QUuid> &folios) const;
|
||||
QString elementLabel(const QUuid &element) const;
|
||||
QString terminalName(const QUuid &terminal, const QUuid &element) const;
|
||||
static QVariant sequenceValue(const autonum::sequentialNumbers &sequence);
|
||||
static autonum::sequentialNumbers sequenceFromValue(const QVariant &value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user