Set the wires-per-terminal limits for the application, a project can override

The limits were per project only. They are now set once in Settings >
General, under the master switch: the most wires per terminal and "one
wire per folio report". Every project follows them.

Project properties > "Conducteurs par borne" gets "Utiliser les réglages
de l'application", ticked by default, showing the application's values
greyed. Unticked, the project keeps its own values, saved in the project
as before, so a drawing that needs its own limit carries it to any
computer. A project's own "no limit" overrides an application limit too.

QETProject::wiringRules() now returns the rules in force (the project's
own, or the application's), so the code that checks a wire is unchanged;
projectWiringRules() returns what the project itself stores. A project
that follows the application still writes nothing, so it saves exactly as
before.

tst_wiringrules: which rules win, the save round trip of a project's own
"no rule", and through the real binary that the application's limit
refuses a wire unless the project overrides it or the master switch is
off (checked to fail with the application's rules ignored). ctest 55/55.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015FPuYPS4T7QuEwjNu22rXD
This commit is contained in:
ispyisail
2026-10-03 23:16:43 +13:00
parent 20e134f2bd
commit 7ba820f8f0
9 changed files with 268 additions and 26 deletions
+14 -3
View File
@@ -1260,16 +1260,27 @@ void QETProject::setWireHops(WireHops::Mode mode)
/**
@brief QETProject::wiringRules
@return how many wires a terminal of this project may take
(discussion #1158); the default when the project sets no rule.
(discussion #1158): the project's own rules when it sets them,
otherwise the application's (Settings > General).
*/
WiringRules::Settings QETProject::wiringRules() const {
return WiringRules::effective(m_wiring_rules, WiringRules::applicationSettings());
}
/**
@brief QETProject::projectWiringRules
@return the rules as the project stores them: Settings::own false when
it follows the application's.
*/
WiringRules::Settings QETProject::projectWiringRules() const {
return m_wiring_rules;
}
/**
@brief QETProject::setWiringRules
Set how many wires a terminal of this project may take. Only wires
drawn from now on are affected: none already drawn is removed.
Set the project's own wiring rules, or (Settings::own false) make it
follow the application's. Only wires drawn from now on are affected:
none already drawn is removed.
@param rules
*/
void QETProject::setWiringRules(const WiringRules::Settings &rules)