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:
ispyisail
2026-10-04 01:43:21 +13:00
parent 9a55939bb4
commit 3150b42087
8 changed files with 60 additions and 42 deletions
@@ -118,7 +118,6 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
ui->m_wiring_rules_cb->setChecked(WiringRules::masterEnabled());
{
//The rules every project follows unless it sets its own (#1158)
ui->m_wiring_rules_warning_layout->addWidget(WiringRulesWarning::create(this));
const WiringRules::Settings rules = WiringRules::applicationSettings();
ui->m_wiring_max_wires_sb->setValue(rules.max_wires);
ui->m_wiring_one_wire_per_report_cb->setChecked(rules.one_wire_per_report);
@@ -353,10 +352,14 @@ void GeneralConfigurationPage::applyConf()
settings.setValue("diagrameditor/conductor_properties_panel", ui->m_conductor_properties_panel->isChecked());
WiringRules::setMasterEnabled(ui->m_wiring_rules_cb->isChecked());
{
WiringRules::Settings rules = WiringRules::applicationSettings();
const WiringRules::Settings before = WiringRules::applicationSettings();
WiringRules::Settings rules = before;
rules.max_wires = ui->m_wiring_max_wires_sb->value();
rules.one_wire_per_report = ui->m_wiring_one_wire_per_report_cb->isChecked();
WiringRules::setApplicationSettings(rules);
if (WiringRules::masterEnabled() && WiringRules::turnsRuleOn(before, rules)) {
WiringRulesWarning::show(this);
}
}
settings.setValue("diagrameditor/autosave-interval", ui->m_autosave_sb->value());