Terminal: rename potential separation to function separation

The checkbox of a terminal element was an all-or-nothing switch: while
it was unticked every conductor property (function, wire colour,
section, number...) crossed to the other side of the terminal, and
once it was ticked nothing did at all.

Rename it to "Function separation" and let one property still cross:
the voltage / protocol, which describes the electrical node itself
rather than one side of it. Conductor::functionSeparatedConductors()
returns the conductors reachable only by crossing such a terminal --
the potential computed with the separations ignored, minus the one
that respects them -- and
ConductorProperties::applyTensionProtocolChange() gives them that one
property, in the conductor properties dialog, the selection panel
multi-edit, the script API and search/replace.

The stored element information stays "potential_isolating", so
existing symbols and projects keep their setting, and the existing
sub-case of terminals sharing a potential-group identifier is
untouched. The German translation of the new label is deliberately
left out of this commit and belongs with the other .ts updates.
This commit is contained in:
Kellermorph
2026-10-11 14:57:42 +02:00
parent 1f70ddb666
commit 561ddc29bf
15 changed files with 275 additions and 26 deletions
+63
View File
@@ -29,6 +29,10 @@ class FakeWire : public QObject
ConductorProperties properties() const { return m_properties; }
void setProperties(const ConductorProperties &p) { m_properties = p; }
QSet<FakeWire *> relatedPotentialConductors() const { return m_potential; }
// The wires of the other side of a function separated terminal
// element: same electrical node, but only the voltage /
// protocol crosses.
QSet<FakeWire *> functionSeparatedConductors() const { return m_separated; }
QPointF pos() const { return m_pos; }
// Joins wires into one potential; like the real one, a wire's
@@ -41,10 +45,24 @@ class FakeWire : public QObject
w->m_potential.insert(o);
}
// Marks two groups as separated by a function separated
// terminal element, without joining their potentials.
static void separate(const QList<FakeWire *> &one,
const QList<FakeWire *> &other)
{
for (FakeWire *w : one)
for (FakeWire *o : other)
{
w->m_separated.insert(o);
o->m_separated.insert(w);
}
}
ConductorProperties m_properties;
private:
QSet<FakeWire *> m_potential;
QSet<FakeWire *> m_separated;
QPointF m_pos;
};
@@ -102,6 +120,51 @@ class tst_conductormultiedit : public QObject
(QSet<FakeWire *> {&a, &b, &c, &d}));
}
// A function separated terminal element: the other side of the
// terminal is reached too, but only the voltage / protocol
// crosses it -- not the function, not the number.
void functionSeparatedGetsVoltageProtocolOnly()
{
FakeWire a("1", "fnA", "", {}), b("2", "fnB", "", {}),
c("3", "fnC", "", {});
FakeWire::join({&a, &b});
FakeWire::separate({&a}, {&c});
QSet<FakeWire *> separated;
const Wires t = ConductorMultiEdit::targets(Wires {&a}, true,
&separated);
QCOMPARE(QSet<FakeWire *>(t.begin(), t.end()),
(QSet<FakeWire *> {&a, &b, &c}));
QCOMPARE(separated, (QSet<FakeWire *> {&c}));
// A caller that does not know about the rule gets the
// separated side left out, as before
QCOMPARE(ConductorMultiEdit::targets(Wires {&a}, true),
(Wires {&a, &b}));
const ConductorProperties shown = a.properties();
ConductorProperties after = edited(shown,
&ConductorProperties::m_function, "PWR");
after.m_tension_protocol = "24V";
QUndoStack stack;
stack.push(ConductorMultiEdit::undo(t, shown, after, separated));
QCOMPARE(stack.count(), 1);
for (FakeWire *w : {&a, &b})
{
QCOMPARE(w->m_properties.m_function, QStringLiteral("PWR"));
QCOMPARE(w->m_properties.m_tension_protocol,
QStringLiteral("24V"));
}
QCOMPARE(c.m_properties.m_function, QStringLiteral("fnC"));
QCOMPARE(c.m_properties.text, QStringLiteral("3"));
QCOMPARE(c.m_properties.m_tension_protocol, QStringLiteral("24V"));
stack.undo();
QVERIFY(c.properties().m_tension_protocol.isEmpty());
QCOMPARE(c.m_properties.m_function, QStringLiteral("fnC"));
}
// One edit of three wires: each takes the function, keeps its
// own number and cable; one undo restores all three exactly
void undoRedoThreeWires()