mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-15 01:54:14 +02:00
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:
@@ -1187,6 +1187,10 @@ QString QetScriptApi::conductorProperty(int folioIndex, const QString &elementUu
|
||||
describes a potential and not one drawn segment. Setting it on one
|
||||
conductor and leaving the rest of the potential disagreeing would
|
||||
produce a file no GUI action could have produced.
|
||||
|
||||
One thing stops at a terminal element with its function separation
|
||||
enabled: every property but the voltage / protocol, which still
|
||||
crosses it (@see Conductor::functionSeparatedConductors).
|
||||
@return true if anything was changed, or if it already held that value
|
||||
*/
|
||||
bool QetScriptApi::setConductorProperty(int folioIndex, const QString &elementUuid,
|
||||
@@ -1225,6 +1229,21 @@ bool QetScriptApi::setConductorProperty(int folioIndex, const QString &elementUu
|
||||
old_value.setValue(c->properties());
|
||||
new_value.setValue(properties);
|
||||
m_project->undoStack()->push(new QPropertyUndoCommand(c, "properties", old_value, new_value));
|
||||
}
|
||||
//The other side of a function separated terminal element gets the
|
||||
//voltage / protocol only: it is the one property that still
|
||||
//describes the electrical node rather than one side of it.
|
||||
for (Conductor *c : conductor->functionSeparatedConductors(true))
|
||||
{
|
||||
ConductorProperties separated_properties = c->properties();
|
||||
separated_properties.applyTensionProtocolChange(c->properties(), properties);
|
||||
if (separated_properties == c->properties())
|
||||
continue;
|
||||
|
||||
QVariant old_value, new_value;
|
||||
old_value.setValue(c->properties());
|
||||
new_value.setValue(separated_properties);
|
||||
m_project->undoStack()->push(new QPropertyUndoCommand(c, "properties", old_value, new_value));
|
||||
}
|
||||
m_project->undoStack()->endMacro();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user