mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-21 22:04:13 +02:00
Merge pull request #1574 from ispyisail/refactor/autonum-save-from-db
Save the project's numbering schemes from the project database
This commit is contained in:
@@ -2697,8 +2697,9 @@ bool projectDataBase::createDataBase()
|
||||
|
||||
//The numbering tables (QETZ-DB-FIRST stage 2b): the project's
|
||||
//schemes, one row per part of each in its order, and the settings
|
||||
//saved with them. Not filled from the folios: QETProject writes
|
||||
//them when it reads its file and whenever its numbering changes.
|
||||
//saved with them; the save writes the numbering from them. Not
|
||||
//filled from the folios: QETProject writes them when it reads its
|
||||
//file and whenever its numbering changes.
|
||||
for (const char *table : {
|
||||
"CREATE TABLE numbering_scheme ("
|
||||
"kind VARCHAR(20) NOT NULL, title TEXT NOT NULL, uuid VARCHAR(50), "
|
||||
|
||||
@@ -4247,10 +4247,13 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element)
|
||||
}
|
||||
xml_element.appendChild(xrefs_elmt);
|
||||
|
||||
writeNumberingXml(numberingOfProject(), xml_element);
|
||||
//The numbering is written from the project database's rows
|
||||
//(QETZ-DB-FIRST stage 2b-2), which the project keeps in step
|
||||
//(writeNumberingRows())
|
||||
writeNumberingXml(m_data_base.numbering(), xml_element);
|
||||
//QET_CHECK_NUMBERING_ROWS=1: say whether the project database's
|
||||
//numbering rows write what the project writes (QETZ-DB-FIRST stage
|
||||
//2b-1). A test and debugging aid; it changes nothing.
|
||||
//numbering rows write what the project holds. A test and
|
||||
//debugging aid; it changes nothing.
|
||||
if (qEnvironmentVariableIntValue("QET_CHECK_NUMBERING_ROWS") == 1) {
|
||||
QDomDocument from_project, from_rows;
|
||||
QDomElement project_root = from_project.createElement(QStringLiteral("numbering"));
|
||||
@@ -4308,8 +4311,9 @@ projectDataBase::Numbering QETProject::numberingOfProject() const
|
||||
@brief QETProject::writeNumberingRows
|
||||
Write the project's numbering into the project database's numbering
|
||||
tables (QETZ-DB-FIRST stage 2b-1): after reading the file and after
|
||||
each change of the numbering, so the rows are always what the save
|
||||
writes (QET_CHECK_NUMBERING_ROWS checks it)
|
||||
each change of the numbering. The save writes the numbering from
|
||||
them (2b-2); QET_CHECK_NUMBERING_ROWS says whether they hold what
|
||||
the project does
|
||||
*/
|
||||
void QETProject::writeNumberingRows()
|
||||
{
|
||||
|
||||
@@ -786,6 +786,14 @@ qet.log('PROBE ' + JSON.stringify({saves: saves}));
|
||||
QVERIFY(xml.contains("title=\"Rows renamed folio\""));
|
||||
QCOMPARE(diagramAttributes(xml, QStringLiteral("conductorAutonum")).value(0),
|
||||
QStringLiteral("Rows renamed conductor"));
|
||||
// and the save, which writes the numbering from the rows (2b-2),
|
||||
// has every scheme and the ones made current
|
||||
const Saved numbering = parse(xml);
|
||||
QCOMPARE(numbering.current, QStringLiteral("Rows renamed element"));
|
||||
QCOMPARE(numbering.scheme_formula.value(QStringLiteral("Rows renamed element")),
|
||||
QStringLiteral("R-%sequ_1"));
|
||||
QCOMPARE(QUuid(numbering.current_id), numbering.scheme_id.value(QStringLiteral("Rows renamed element")));
|
||||
QVERIFY(xml.contains("current_autonum=\"Rows renamed conductor\""));
|
||||
}
|
||||
|
||||
void conductorNumberings()
|
||||
|
||||
Reference in New Issue
Block a user