From 9a55939bb40e5fd1fc6750f19b1728bf7c4d9bf9 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sun, 4 Oct 2026 01:13:09 +1300 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_015FPuYPS4T7QuEwjNu22rXD --- cmake/qet_compilation_vars.cmake | 2 + .../configpage/generalconfigurationpage.cpp | 2 + .../ui/configpage/generalconfigurationpage.ui | 7 +++ sources/ui/configpage/projectconfigpages.cpp | 2 + sources/ui/wiringruleswarning.cpp | 59 +++++++++++++++++++ sources/ui/wiringruleswarning.h | 29 +++++++++ 6 files changed, 101 insertions(+) create mode 100644 sources/ui/wiringruleswarning.cpp create mode 100644 sources/ui/wiringruleswarning.h diff --git a/cmake/qet_compilation_vars.cmake b/cmake/qet_compilation_vars.cmake index 9d6e2ef3d..98902040f 100644 --- a/cmake/qet_compilation_vars.cmake +++ b/cmake/qet_compilation_vars.cmake @@ -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 diff --git a/sources/ui/configpage/generalconfigurationpage.cpp b/sources/ui/configpage/generalconfigurationpage.cpp index aa6e63989..7d66a34b7 100644 --- a/sources/ui/configpage/generalconfigurationpage.cpp +++ b/sources/ui/configpage/generalconfigurationpage.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); diff --git a/sources/ui/configpage/generalconfigurationpage.ui b/sources/ui/configpage/generalconfigurationpage.ui index 427c9fc7b..6c91701b4 100644 --- a/sources/ui/configpage/generalconfigurationpage.ui +++ b/sources/ui/configpage/generalconfigurationpage.ui @@ -83,6 +83,13 @@ + + + + 20 + + + diff --git a/sources/ui/configpage/projectconfigpages.cpp b/sources/ui/configpage/projectconfigpages.cpp index 4531ffcea..43fd863b8 100644 --- a/sources/ui/configpage/projectconfigpages.cpp +++ b/sources/ui/configpage/projectconfigpages.cpp @@ -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_); diff --git a/sources/ui/wiringruleswarning.cpp b/sources/ui/wiringruleswarning.cpp new file mode 100644 index 000000000..2024ad633 --- /dev/null +++ b/sources/ui/wiringruleswarning.cpp @@ -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 . +*/ +// SPDX-License-Identifier: GPL-2.0-or-later +#include "wiringruleswarning.h" + +#include +#include +#include +#include +#include + +/** + @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; +} diff --git a/sources/ui/wiringruleswarning.h b/sources/ui/wiringruleswarning.h new file mode 100644 index 000000000..4d7d690a1 --- /dev/null +++ b/sources/ui/wiringruleswarning.h @@ -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 . +*/ +// 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