mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-25 07:24:21 +01:00
Add a terminal name check when saving an element
Discussion #1157. IEC 61666 §4.1 requires each terminal to be identified unambiguously within its object, so two terminals of one element must not share a name. On save, the element editor now: - refuses to save when two terminals share a name, lists the names ("N ×3") and selects those terminals; - warns, and still saves, when a terminal has no name. Folio reports, conductor definitions and thumbnails are skipped. Names are compared after trimming surrounding spaces, case sensitive. Settings > General > Editor has a new checkbox, on by default, that turns both checks off (elementeditor/check-terminal-names). --check-elements applies the same rule: repeated names are a FAIL, missing names a WARN. It ignores the setting, since it is an explicit check. On the shipped collection this reports 82 FAILs, the elements that repeat a terminal name today. The rule lives in the header-only editor/terminalnamecheck.h, shared by both, and is unit tested by tst_terminalnamecheck. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "../../utils/qetutils.h"
|
||||
#include "../../qetmessagebox.h"
|
||||
#include "../../textgrid.h"
|
||||
#include "../../editor/terminalnamecheck.h"
|
||||
#include "../nokde/kcolorbutton.h"
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
@@ -174,6 +175,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt());
|
||||
ui->ElementEditor_Grid_PointSize_min_sb->setValue(settings.value("elementeditor/grid_pointsize_min", 1).toInt());
|
||||
ui->ElementEditor_Grid_PointSize_max_sb->setValue(settings.value("elementeditor/grid_pointsize_max", 1).toInt());
|
||||
ui->m_check_terminal_names_cb->setChecked(settings.value(TerminalNameCheck::settings_key, true).toBool());
|
||||
|
||||
QString path = settings.value("elements-collections/common-collection-path", "default").toString();
|
||||
if (path != "default")
|
||||
@@ -286,6 +288,7 @@ void GeneralConfigurationPage::applyConf()
|
||||
settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value());
|
||||
settings.setValue("elementeditor/grid_pointsize_min", ui->ElementEditor_Grid_PointSize_min_sb->value());
|
||||
settings.setValue("elementeditor/grid_pointsize_max", ui->ElementEditor_Grid_PointSize_max_sb->value());
|
||||
settings.setValue(TerminalNameCheck::settings_key, ui->m_check_terminal_names_cb->isChecked());
|
||||
|
||||
//DIAGRAM VIEW
|
||||
settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked());
|
||||
|
||||
@@ -1240,6 +1240,19 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_check_terminal_names_cb">
|
||||
<property name="toolTip">
|
||||
<string>À l'enregistrement d'un élément : refuser deux bornes portant le même nom, et signaler les bornes sans nom (IEC 61666).</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Vérifier les noms des bornes à l'enregistrement</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
@@ -1275,6 +1288,7 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
|
||||
<tabstop>m_custom_tbt_path_cb</tabstop>
|
||||
<tabstop>m_highlight_integrated_elements</tabstop>
|
||||
<tabstop>m_default_elements_info</tabstop>
|
||||
<tabstop>m_check_terminal_names_cb</tabstop>
|
||||
<tabstop>m_lang_cb</tabstop>
|
||||
<tabstop>m_dyn_text_font_pb</tabstop>
|
||||
<tabstop>m_dyn_text_rotation_sb</tabstop>
|
||||
|
||||
Reference in New Issue
Block a user