Warn that the wires-per-terminal rules are experimental

Review of #1272 (scorpio810, after arummler's note that the rules would
need redesigning if wires and conductors become separate objects): a
warning box, with the standard warning icon, at the top of the rules in
Settings > General and in Project properties. It says the feature is
experimental, counts wires as QElectroTech models them today, and that
the rules, and the user's settings, could change if wires and conductors
are separated.

English for translators: "Experimental feature. These rules 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."

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:13:09 +13:00
parent 5db92384a5
commit 9a55939bb4
6 changed files with 101 additions and 0 deletions
+2
View File
@@ -797,6 +797,8 @@ set(QET_SRC_FILES
${QET_DIR}/sources/ui/importelementtextpatterndialog.h
${QET_DIR}/sources/ui/jumptoelementdialog.cpp
${QET_DIR}/sources/ui/jumptoelementdialog.h
${QET_DIR}/sources/ui/wiringruleswarning.cpp
${QET_DIR}/sources/ui/wiringruleswarning.h
${QET_DIR}/sources/ui/inditextpropertieswidget.cpp
${QET_DIR}/sources/ui/inditextpropertieswidget.h
${QET_DIR}/sources/ui/linksingleelementwidget.cpp
@@ -28,6 +28,7 @@
#include "../../qetmessagebox.h"
#include "../../textgrid.h"
#include "../../wiringrules.h"
#include "../wiringruleswarning.h"
#include "../../editor/terminalnamecheck.h"
#include "../../ElementsCollection/qetlabelsfile.h"
#include "../prefixconfigurationdialog.h"
@@ -117,6 +118,7 @@ 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);
@@ -83,6 +83,13 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="m_wiring_rules_warning_layout">
<property name="leftMargin">
<number>20</number>
</property>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="m_wiring_max_wires_layout">
<property name="leftMargin">
@@ -27,6 +27,7 @@
#include "../qeticons.h"
#include "../qetproject.h"
#include "../wiringrules.h"
#include "../wiringruleswarning.h"
#include "../borderpropertieswidget.h"
#include "../conductorpropertieswidget.h"
#include "../diagramcontextwidget.h"
@@ -306,6 +307,7 @@ void ProjectMainConfigPage::initLayout()
main_layout0 -> addSpacing(10);
QVBoxLayout *wiring_rules_layout = new QVBoxLayout(wiring_rules_gb_);
wiring_rules_layout -> addWidget(WiringRulesWarning::create(wiring_rules_gb_));
wiring_rules_layout -> addWidget(use_application_rules_cb_);
QHBoxLayout *max_wires_layout = new QHBoxLayout();
max_wires_layout -> addWidget(max_wires_label_);
+59
View File
@@ -0,0 +1,59 @@
/*
Copyright 2006-2026 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include "wiringruleswarning.h"
#include <QApplication>
#include <QFrame>
#include <QHBoxLayout>
#include <QLabel>
#include <QStyle>
/**
@brief WiringRulesWarning::create
A warning box shown wherever the wires-per-terminal rules are set
(discussion #1158, review of #1272): the rules count wires on a terminal
as QElectroTech models them today, and would have to be redesigned if
wires and conductors become separate objects, so they are experimental.
@param parent
@return the box, a framed icon and text
*/
QWidget *WiringRulesWarning::create(QWidget *parent)
{
auto frame = new QFrame(parent);
frame->setFrameShape(QFrame::StyledPanel);
auto icon = new QLabel(frame);
const int size = frame->style()->pixelMetric(QStyle::PM_SmallIconSize);
icon->setPixmap(frame->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(size, size));
icon->setAlignment(Qt::AlignTop);
auto text = new QLabel(QApplication::translate(
"WiringRulesWarning",
"Fonction expérimentale. Ces règles comptent les conducteurs tels "
"que QElectroTech les représente aujourd'hui ; elles pourraient "
"changer, et vos réglages devoir être refaits, si les fils et les "
"conducteurs deviennent des objets distincts dans une version future."),
frame);
text->setWordWrap(true);
auto layout = new QHBoxLayout(frame);
layout->addWidget(icon);
layout->addWidget(text, 1);
return frame;
}
+29
View File
@@ -0,0 +1,29 @@
/*
Copyright 2006-2026 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef WIRINGRULESWARNING_H
#define WIRINGRULESWARNING_H
class QWidget;
namespace WiringRulesWarning
{
QWidget *create(QWidget *parent = nullptr);
}
#endif // WIRINGRULESWARNING_H