mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-06 03:04:13 +02:00
Warn with a pop-up, not a box, when a wires-per-terminal rule is turned on
Review of #1272: scorpio810 asked for a warning box for users; the inline
box added in 9a55939bb is replaced by a pop-up, as the element editor
gives for unnamed terminals. When OK in Settings > General or in Project
properties turns a rule on (a limit where there was none, or one wire
per folio report), a warning says the rules are experimental, may change
with settings to redo if wires and conductors become separate objects,
and can all be turned off in Settings > General. OK goes on. Changing a
limit that was already on, or turning rules off, shows nothing.
tst_wiringrules: when the warning is due (WiringRules::turnsRuleOn()).
Checked in the GUI from both pages, and that a plain OK shows nothing.
English for translators: "Warning"; "The wires-per-terminal rules are an
experimental feature. They count wires as QElectroTech represents them
today. They could change, and your settings need redoing, if wires and
conductors become separate objects in a future version. All these rules
can be turned off in Configure QElectroTech > General."
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015FPuYPS4T7QuEwjNu22rXD
This commit is contained in:
@@ -173,3 +173,15 @@ bool WiringRules::hasRoom(int limit, int wires)
|
||||
{
|
||||
return limit <= 0 || wires < limit;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief WiringRules::turnsRuleOn
|
||||
@param before, after : the rules in force before and after a change
|
||||
@return true if the change turns on a rule that was off: QElectroTech
|
||||
then warns that the rules are experimental (review of #1272).
|
||||
*/
|
||||
bool WiringRules::turnsRuleOn(const Settings &before, const Settings &after)
|
||||
{
|
||||
return (after.max_wires > 0 && before.max_wires <= 0)
|
||||
|| (after.one_wire_per_report && !before.one_wire_per_report);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user