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