mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-01 23:54:13 +02:00
Add a Cable column to the wiring list export
Each wire already carries a cable name (Conductor properties -> Cable), saved in the project, but no export showed it. The wiring list CSV (Project menu, and --export-cables) now writes it as a last column, so the list can be sorted or filtered by cable in a spreadsheet. It goes last so existing columns keep their positions for anyone reading the file by column number. When the two halves of a wire drawn through a folio report are joined into one row, their cable names are merged the same way as colour and section: written once if equal, both if not. Asked for in issue #405. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -145,6 +145,7 @@ QList<ConductorData> WiringListExport::collectConductors(const QDomElement &root
|
||||
data.conductor_color = cond.attribute("conductor_color");
|
||||
data.conductor_section = cond.attribute("conductor_section");
|
||||
data.function = cond.attribute("function");
|
||||
data.cable = cond.attribute("cable");
|
||||
|
||||
QDomElement diag = climbToDiagram(cond);
|
||||
data.folio = findDiagramFolio(diag);
|
||||
@@ -331,6 +332,7 @@ QString WiringListExport::toCsvString() const
|
||||
merged.conductor_color = mergeField(otherHalf.conductor_color, normC.conductor_color);
|
||||
merged.conductor_section = mergeField(otherHalf.conductor_section, normC.conductor_section);
|
||||
merged.function = mergeField(otherHalf.function, normC.function);
|
||||
merged.cable = mergeField(otherHalf.cable, normC.cable);
|
||||
|
||||
uniqueConductors.append(merged);
|
||||
}
|
||||
@@ -370,7 +372,8 @@ QString WiringListExport::toCsvString() const
|
||||
<< tr("Tension / Protocole", "Wiring list CSV header") << ";"
|
||||
<< tr("Couleur du fil", "Wiring list CSV header") << ";"
|
||||
<< tr("Section du fil", "Wiring list CSV header") << ";"
|
||||
<< tr("Fonction", "Wiring list CSV header") << "\n";
|
||||
<< tr("Fonction", "Wiring list CSV header") << ";"
|
||||
<< tr("Câble", "Wiring list CSV header") << "\n";
|
||||
|
||||
for (const ConductorData &c : uniqueConductors) {
|
||||
out << c.folio << ";"
|
||||
@@ -381,7 +384,8 @@ QString WiringListExport::toCsvString() const
|
||||
<< c.tension_protocol << ";"
|
||||
<< c.conductor_color << ";"
|
||||
<< c.conductor_section << ";"
|
||||
<< c.function << "\n";
|
||||
<< c.function << ";"
|
||||
<< c.cable << "\n";
|
||||
}
|
||||
|
||||
return csv;
|
||||
|
||||
@@ -32,6 +32,7 @@ struct ConductorData {
|
||||
QString conductor_color;
|
||||
QString conductor_section;
|
||||
QString function;
|
||||
QString cable;
|
||||
QString folio;
|
||||
int folio_index = 0; // position of the folio in the project, from 1
|
||||
};
|
||||
|
||||
@@ -280,7 +280,7 @@
|
||||
</element>
|
||||
</elements>
|
||||
<conductors>
|
||||
<conductor bicolor="false" bus="" cable="" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{9dafa64c-b032-4170-9477-cef28498f621}" element1_label="PA" element1_name="Siren" element2="{1f305ff0-207f-4e56-856e-3d1987d9ce7c}" element2_label="" element2_linked="" element2_name="Going arrow" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="1" tension_protocol="" terminal1="{95da3481-88c4-4a1e-9419-7033b26f198f}" terminal2="{975add6f-4ba5-44af-a4c0-e1f1c2024601}" terminalname1="A1" terminalname2="1" text_color="#000000" type="multi" uuid="{9712b002-7e13-49f3-88be-bab32f3afd47}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
|
||||
<conductor bicolor="false" bus="" cable="W1" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{9dafa64c-b032-4170-9477-cef28498f621}" element1_label="PA" element1_name="Siren" element2="{1f305ff0-207f-4e56-856e-3d1987d9ce7c}" element2_label="" element2_linked="" element2_name="Going arrow" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="1" tension_protocol="" terminal1="{95da3481-88c4-4a1e-9419-7033b26f198f}" terminal2="{975add6f-4ba5-44af-a4c0-e1f1c2024601}" terminalname1="A1" terminalname2="1" text_color="#000000" type="multi" uuid="{9712b002-7e13-49f3-88be-bab32f3afd47}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
|
||||
<sequentialNumbers/>
|
||||
</conductor>
|
||||
</conductors>
|
||||
@@ -323,7 +323,7 @@
|
||||
</element>
|
||||
</elements>
|
||||
<conductors>
|
||||
<conductor bicolor="false" bus="" cable="" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{58834c97-a236-44e9-abe8-26cf8e7864f8}" element1_label="" element1_linked="" element1_name="Coming arrow" element2="{c595e215-ba4d-42a1-909c-c57d7b3aa043}" element2_label="PB" element2_name="Siren" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="1" tension_protocol="" terminal1="{d7fd0bec-9f05-4651-a50b-29d7ffabeb41}" terminal2="{95da3481-88c4-4a1e-9419-7033b26f198f}" terminalname1="1" terminalname2="A1" text_color="#000000" type="multi" uuid="{2e88cd90-387f-4b21-a690-79d0e79880b7}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
|
||||
<conductor bicolor="false" bus="" cable="W1" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{58834c97-a236-44e9-abe8-26cf8e7864f8}" element1_label="" element1_linked="" element1_name="Coming arrow" element2="{c595e215-ba4d-42a1-909c-c57d7b3aa043}" element2_label="PB" element2_name="Siren" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="1" tension_protocol="" terminal1="{d7fd0bec-9f05-4651-a50b-29d7ffabeb41}" terminal2="{95da3481-88c4-4a1e-9419-7033b26f198f}" terminalname1="1" terminalname2="A1" text_color="#000000" type="multi" uuid="{2e88cd90-387f-4b21-a690-79d0e79880b7}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
|
||||
<sequentialNumbers/>
|
||||
</conductor>
|
||||
</conductors>
|
||||
@@ -383,7 +383,7 @@
|
||||
</element>
|
||||
</elements>
|
||||
<conductors>
|
||||
<conductor bicolor="false" bus="" cable="" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{479b12ca-3279-4563-9e85-7965f156bafa}" element1_label="EA" element1_name="Siren" element2="{3cea8881-25c7-4aef-89f3-8fa9f397f536}" element2_label="" element2_linked="" element2_name="Going arrow" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="1" tension_protocol="" terminal1="{95da3481-88c4-4a1e-9419-7033b26f198f}" terminal2="{975add6f-4ba5-44af-a4c0-e1f1c2024601}" terminalname1="A1" terminalname2="1" text_color="#000000" type="multi" uuid="{960b77b9-328b-4a1f-b8d2-02859ca9a92e}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
|
||||
<conductor bicolor="false" bus="" cable="W2" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{479b12ca-3279-4563-9e85-7965f156bafa}" element1_label="EA" element1_name="Siren" element2="{3cea8881-25c7-4aef-89f3-8fa9f397f536}" element2_label="" element2_linked="" element2_name="Going arrow" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="1" tension_protocol="" terminal1="{95da3481-88c4-4a1e-9419-7033b26f198f}" terminal2="{975add6f-4ba5-44af-a4c0-e1f1c2024601}" terminalname1="A1" terminalname2="1" text_color="#000000" type="multi" uuid="{960b77b9-328b-4a1f-b8d2-02859ca9a92e}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
|
||||
<sequentialNumbers/>
|
||||
</conductor>
|
||||
<conductor bicolor="false" bus="" cable="" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{8226560b-85fc-4097-97ef-3f460ede188c}" element1_label="EA2" element1_name="Siren" element2="{3cea8881-25c7-4aef-89f3-8fa9f397f536}" element2_label="" element2_linked="" element2_name="Going arrow" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="1" tension_protocol="" terminal1="{95da3481-88c4-4a1e-9419-7033b26f198f}" terminal2="{975add6f-4ba5-44af-a4c0-e1f1c2024601}" terminalname1="A1" terminalname2="1" text_color="#000000" type="multi" uuid="{ed1c6376-9f6c-4ace-9906-e92b1f2dd3d9}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
// With several wires on a side the diagram does not say which terminal is
|
||||
// wired to which, so those wires are not joined. The Page column is the
|
||||
// folio number as the folio shows it, not its "%id/%total" template, and
|
||||
// rows come in folio order.
|
||||
// rows come in folio order. The last column is the wire's cable; the two
|
||||
// halves of P both say W1, which is written once.
|
||||
class tst_wiringlistexport : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -73,13 +74,13 @@ private slots:
|
||||
QVERIFY2(!fixture.isEmpty(), "fixture project not found");
|
||||
|
||||
const QStringList expected {
|
||||
QStringLiteral("1/6, 2/6;PA;A1;PB;A1;;;;"),
|
||||
QStringLiteral("3/6;EA;A1;;1;;;;"),
|
||||
QStringLiteral("3/6;EA2;A1;;1;;;;"),
|
||||
QStringLiteral("4/6;EB;A1;;1;;;;"),
|
||||
QStringLiteral("5/6;LA;A1;;1;;;;"),
|
||||
QStringLiteral("6/6;LB;A1;;1;;;;"),
|
||||
QStringLiteral("6/6;LD;A1;;1;;;;"),
|
||||
QStringLiteral("1/6, 2/6;PA;A1;PB;A1;;;;;W1"),
|
||||
QStringLiteral("3/6;EA;A1;;1;;;;;W2"),
|
||||
QStringLiteral("3/6;EA2;A1;;1;;;;;"),
|
||||
QStringLiteral("4/6;EB;A1;;1;;;;;"),
|
||||
QStringLiteral("5/6;LA;A1;;1;;;;;"),
|
||||
QStringLiteral("6/6;LB;A1;;1;;;;;"),
|
||||
QStringLiteral("6/6;LD;A1;;1;;;;;"),
|
||||
};
|
||||
bool ok;
|
||||
QCOMPARE(exportCables(fixture, &ok), expected);
|
||||
|
||||
Reference in New Issue
Block a user