mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-05-06 07:19:58 +02:00
Merge branch 'master' into qt6_cmake_joshua
This commit is contained in:
@@ -131,6 +131,7 @@ void AboutQETDialog::setTranslators()
|
||||
addAuthor(ui->m_translators_label, "Yaroslav", "", tr("Traduction en ukrainien"));
|
||||
addAuthor(ui->m_translators_label, "JoelAs", "", tr("Traduction en norvégien"));
|
||||
addAuthor(ui->m_translators_label, "Yuki", "yuki.atoh@gmail.com", tr("Traduction en japonais"));
|
||||
addAuthor(ui->m_translators_label, "Jung Kwang-Ho", "jkh2rokmc@daum.net", tr("Traduction en coréen"));
|
||||
addAuthor(ui->m_translators_label, "Nathalie", "nathalie.roussier@giz.de", tr("Traduction en mongol"));
|
||||
addAuthor(ui->m_translators_label, "Uroš Platiše", "uros.platise@energycon.eu", tr("Traduction en slovène"));
|
||||
}
|
||||
|
||||
@@ -173,6 +173,15 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
ui->m_custom_tbt_path_cb->blockSignals(false);
|
||||
}
|
||||
|
||||
path = settings.value("elements-collections/macros-path", "default").toString();
|
||||
if (path != "default")
|
||||
{
|
||||
ui->m_user_macros_path_cb->blockSignals(true);
|
||||
ui->m_user_macros_path_cb->setCurrentIndex(1);
|
||||
ui->m_user_macros_path_cb->setItemData(1, path, Qt::DisplayRole);
|
||||
ui->m_user_macros_path_cb->blockSignals(false);
|
||||
}
|
||||
|
||||
fillLang();
|
||||
}
|
||||
|
||||
@@ -315,6 +324,21 @@ void GeneralConfigurationPage::applyConf()
|
||||
if (path != settings.value("elements-collections/custom-tbt-path").toString()) {
|
||||
QETApp::resetCollectionsPath();
|
||||
}
|
||||
|
||||
path = settings.value("elements-collections/macros-path").toString();
|
||||
if (ui->m_user_macros_path_cb->currentIndex() == 1)
|
||||
{
|
||||
QString path = ui->m_user_macros_path_cb->currentText();
|
||||
QDir dir(path);
|
||||
settings.setValue("elements-collections/macros-path",
|
||||
dir.exists() ? path : "default");
|
||||
}
|
||||
else {
|
||||
settings.setValue("elements-collections/macros-path", "default");
|
||||
}
|
||||
if (path != settings.value("elements-collections/macros-path").toString()) {
|
||||
QETApp::resetCollectionsPath();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -358,6 +382,7 @@ void GeneralConfigurationPage::fillLang()
|
||||
ui->m_lang_cb->addItem(QET::Icons::hr, tr("Croate"), "hr");
|
||||
ui->m_lang_cb->addItem(QET::Icons::it, tr("Italien"), "it");
|
||||
ui->m_lang_cb->addItem(QET::Icons::jp, tr("Japonais"), "ja");
|
||||
ui->m_lang_cb->addItem(QET::Icons::ko, tr("Coréen"), "ko");
|
||||
ui->m_lang_cb->addItem(QET::Icons::pl, tr("Polonais"), "pl");
|
||||
ui->m_lang_cb->addItem(QET::Icons::pt, tr("Portugais"), "pt");
|
||||
ui->m_lang_cb->addItem(QET::Icons::ro, tr("Roumains"), "ro");
|
||||
@@ -505,6 +530,19 @@ void GeneralConfigurationPage::on_m_custom_tbt_path_cb_currentIndexChanged(int i
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralConfigurationPage::on_m_user_macros_path_cb_currentIndexChanged(int index)
|
||||
{
|
||||
if (index == 1)
|
||||
{
|
||||
QString path = QFileDialog::getExistingDirectory(this, tr("Chemin des macros utilisateur"), QETApp::documentDir());
|
||||
if (!path.isEmpty()) {
|
||||
ui->m_user_macros_path_cb->setItemData(1, path, Qt::DisplayRole);
|
||||
}
|
||||
else {
|
||||
ui->m_user_macros_path_cb->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralConfigurationPage::on_m_indi_text_font_pb_clicked()
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ class GeneralConfigurationPage : public ConfigPage
|
||||
void on_m_custom_elmt_path_cb_currentIndexChanged(int index);
|
||||
void on_m_company_tbt_path_cb_currentIndexChanged(int index);
|
||||
void on_m_custom_tbt_path_cb_currentIndexChanged(int index);
|
||||
void on_m_user_macros_path_cb_currentIndexChanged(int index);
|
||||
void on_m_indi_text_font_pb_clicked();
|
||||
void on_MaxPartsElementEditorList_sb_valueChanged(int value);
|
||||
void on_DiagramEditor_Grid_PointSize_min_sb_valueChanged(int value);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
@@ -349,6 +349,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Répertoire des Macros utilisateur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="m_user_macros_path_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Par defaut</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Parcourir...</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -160,6 +160,7 @@ void ElementInfoWidget::enableLiveEdit()
|
||||
{
|
||||
for (ElementInfoPartWidget *eipw : m_eipw_list)
|
||||
connect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
|
||||
connect(ui->m_auto_num_locked_cb, &QCheckBox::clicked, this, &ElementInfoWidget::apply);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,6 +171,7 @@ void ElementInfoWidget::disableLiveEdit()
|
||||
{
|
||||
for (ElementInfoPartWidget *eipw : m_eipw_list)
|
||||
disconnect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
|
||||
disconnect(ui->m_auto_num_locked_cb, &QCheckBox::clicked, this, &ElementInfoWidget::apply);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,6 +195,12 @@ void ElementInfoWidget::buildInterface()
|
||||
}
|
||||
|
||||
ui->scroll_vlayout->addStretch();
|
||||
// Show checkbox only if the element is a terminal
|
||||
if (m_element.data()->elementData().m_type == ElementData::Terminal) {
|
||||
ui->m_auto_num_locked_cb->setVisible(true);
|
||||
} else {
|
||||
ui->m_auto_num_locked_cb->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,6 +239,11 @@ void ElementInfoWidget::updateUi()
|
||||
for (ElementInfoPartWidget *eipw : m_eipw_list) {
|
||||
eipw -> setText (element_info[eipw->key()].toString());
|
||||
}
|
||||
// Load the lock status for auto numbering
|
||||
if (m_element->elementData().m_type == ElementData::Terminal) {
|
||||
QString lock_value = element_info.value(QStringLiteral("auto_num_locked")).toString();
|
||||
ui->m_auto_num_locked_cb->setChecked(lock_value == QLatin1String("true"));
|
||||
}
|
||||
|
||||
if (m_live_edit) {
|
||||
enableLiveEdit();
|
||||
@@ -259,6 +272,10 @@ DiagramContext ElementInfoWidget::currentInfo() const
|
||||
}
|
||||
}
|
||||
|
||||
// Save the auto numbering lock status
|
||||
if (m_element->elementData().m_type == ElementData::Terminal) {
|
||||
info_.addValue(QStringLiteral("auto_num_locked"), ui->m_auto_num_locked_cb->isChecked() ? QStringLiteral("true") : QStringLiteral("false"));
|
||||
}
|
||||
return info_;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,19 @@
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_auto_num_locked_cb">
|
||||
<property name="text">
|
||||
<string>Exclure de la numérotation auto</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">margin: 5px; font-weight: bold;</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -372,6 +372,10 @@ QWidget *ElementPropertiesWidget::generalWidget()
|
||||
description_string += QString(tr("Rotation : %1°\n")).arg(m_element.data()->rotation());
|
||||
description_string += QString(tr("Dimensions : %1*%2\n")).arg(m_element -> size().width()).arg(m_element -> size().height());
|
||||
description_string += QString(tr("Bornes : %1\n")).arg(m_element -> terminals().count());
|
||||
if (m_element->linkType() == Element::Master){
|
||||
description_string += QString(tr("Nombre maximum de contacts esclaves définis : %1\n")).arg(m_element -> elementData().m_max_slaves);
|
||||
description_string += QString(tr("Nombre de contacts esclaves utilisés : %1\n")).arg(m_element ->linkedElements().count());
|
||||
}
|
||||
description_string += QString(tr("Emplacement : %1\n")).arg(m_element.data()->location().toString());
|
||||
|
||||
// widget himself
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "linksingleelementwidget.h"
|
||||
|
||||
#include "../qetgraphicsitem/masterelement.h"
|
||||
#include "../qetgraphicsitem/conductor.h"
|
||||
#include "../diagram.h"
|
||||
#include "../diagramposition.h"
|
||||
@@ -386,7 +386,22 @@ QVector <QPointer<Element>> LinkSingleElementWidget::availableElements()
|
||||
|
||||
//If element is linked, remove is parent from the list
|
||||
if(!m_element->isFree()) elmt_vector.removeAll(m_element->linkedElements().first());
|
||||
|
||||
// Filter out all master elements from the list
|
||||
for (int i = elmt_vector.size() - 1; i >= 0; --i) {
|
||||
Element *elmt = elmt_vector.at(i);
|
||||
|
||||
// If the item in the list is a master
|
||||
if (elmt->linkType() == Element::Master) {
|
||||
|
||||
// We convert the generic element pointer into a MasterElement pointer
|
||||
MasterElement *master = static_cast<MasterElement*>(elmt);
|
||||
|
||||
// If the master is full, we'll remove it from the list!
|
||||
if (master->isFull()) {
|
||||
elmt_vector.removeAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return elmt_vector;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>389</width>
|
||||
<height>442</height>
|
||||
<height>460</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -64,6 +64,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QLabel" name="m_hidden_masters_label">
|
||||
<property name="text">
|
||||
<string>Remarque : les éléments maîtres ayant atteint leur nombre maximal d'esclaves sont masqués.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
* 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/>.
|
||||
*/
|
||||
#include "masterpropertieswidget.h"
|
||||
|
||||
#include "../diagram.h"
|
||||
@@ -25,64 +25,65 @@
|
||||
#include "ui_masterpropertieswidget.h"
|
||||
|
||||
#include <QListWidgetItem>
|
||||
#include <QMessageBox>
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::MasterPropertiesWidget
|
||||
Default constructor
|
||||
@param elmt
|
||||
@param parent
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::MasterPropertiesWidget
|
||||
* Default constructor
|
||||
* @param elmt
|
||||
* @param parent
|
||||
*/
|
||||
MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
|
||||
AbstractElementPropertiesEditorWidget(parent),
|
||||
ui(new Ui::MasterPropertiesWidget),
|
||||
m_project(nullptr)
|
||||
AbstractElementPropertiesEditorWidget(parent),
|
||||
ui(new Ui::MasterPropertiesWidget),
|
||||
m_project(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
||||
ui->m_free_tree_widget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ui->m_link_tree_widget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
|
||||
QStringList list;
|
||||
QSettings settings;
|
||||
if (settings.value("genericpanel/folio", false).toBool()) {
|
||||
list << tr("Vignette")
|
||||
<< tr("Label de folio")
|
||||
<< tr("Titre de folio")
|
||||
<< tr("Position");
|
||||
<< tr("Label de folio")
|
||||
<< tr("Titre de folio")
|
||||
<< tr("Position");
|
||||
}
|
||||
else {
|
||||
list << tr("Vignette")
|
||||
<< tr("N° de folio")
|
||||
<< tr("Titre de folio")
|
||||
<< tr("Position");
|
||||
<< tr("N° de folio")
|
||||
<< tr("Titre de folio")
|
||||
<< tr("Position");
|
||||
}
|
||||
ui->m_free_tree_widget->setHeaderLabels(list);
|
||||
ui->m_link_tree_widget->setHeaderLabels(list);
|
||||
|
||||
|
||||
m_context_menu = new QMenu(this);
|
||||
m_link_action = new QAction(tr("Lier l'élément"), this);
|
||||
m_unlink_action = new QAction(tr("Délier l'élément"), this);
|
||||
m_show_qtwi = new QAction(tr("Montrer l'élément"), this);
|
||||
m_show_element = new QAction(tr("Montrer l'élément maître"), this);
|
||||
m_save_header_state = new QAction(tr("Enregistrer la disposition"), this);
|
||||
|
||||
|
||||
connect(ui->m_free_tree_widget, &QTreeWidget::itemDoubleClicked,
|
||||
this, &MasterPropertiesWidget::showElementFromTWI);
|
||||
this, &MasterPropertiesWidget::showElementFromTWI);
|
||||
connect(ui->m_link_tree_widget, &QTreeWidget::itemDoubleClicked,
|
||||
this, &MasterPropertiesWidget::showElementFromTWI);
|
||||
|
||||
this, &MasterPropertiesWidget::showElementFromTWI);
|
||||
|
||||
connect(ui->m_free_tree_widget, &QTreeWidget::customContextMenuRequested,
|
||||
[this](QPoint point) {this->customContextMenu(point, 1);});
|
||||
[this](QPoint point) {this->customContextMenu(point, 1);});
|
||||
connect(ui->m_link_tree_widget, &QTreeWidget::customContextMenuRequested,
|
||||
[this](QPoint point) {this->customContextMenu(point, 2);});
|
||||
|
||||
[this](QPoint point) {this->customContextMenu(point, 2);});
|
||||
|
||||
connect(m_link_action, &QAction::triggered,
|
||||
this, &MasterPropertiesWidget::on_link_button_clicked);
|
||||
this, &MasterPropertiesWidget::on_link_button_clicked);
|
||||
connect(m_unlink_action, &QAction::triggered,
|
||||
this, &MasterPropertiesWidget::on_unlink_button_clicked);
|
||||
this, &MasterPropertiesWidget::on_unlink_button_clicked);
|
||||
connect(m_show_qtwi, &QAction::triggered,
|
||||
[this]() {this->showElementFromTWI(this->m_qtwi_at_context_menu,0);});
|
||||
|
||||
[this]() {this->showElementFromTWI(this->m_qtwi_at_context_menu,0);});
|
||||
|
||||
connect(m_show_element, &QAction::triggered, [this]()
|
||||
{
|
||||
this->m_element->diagram()->showMe();
|
||||
@@ -90,46 +91,46 @@ MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
|
||||
if(this->m_showed_element)
|
||||
m_showed_element->setHighlighted(false);
|
||||
});
|
||||
|
||||
|
||||
QHeaderView *qhv = ui->m_free_tree_widget->header();
|
||||
qhv->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(qhv, &QHeaderView::customContextMenuRequested,
|
||||
this, &MasterPropertiesWidget::headerCustomContextMenuRequested);
|
||||
this, &MasterPropertiesWidget::headerCustomContextMenuRequested);
|
||||
connect(m_save_header_state, &QAction::triggered, [qhv]()
|
||||
{
|
||||
QByteArray qba = qhv->saveState();
|
||||
QSettings settings;
|
||||
settings.setValue("link-element-widget/master-state", qba);
|
||||
});
|
||||
|
||||
|
||||
setElement(elmt);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::~MasterPropertiesWidget
|
||||
Destructor
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::~MasterPropertiesWidget
|
||||
* Destructor
|
||||
*/
|
||||
MasterPropertiesWidget::~MasterPropertiesWidget()
|
||||
{
|
||||
if (m_showed_element)
|
||||
m_showed_element->setHighlighted(false);
|
||||
|
||||
|
||||
if(m_element)
|
||||
m_element->setHighlighted(false);
|
||||
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::setElement
|
||||
Set the element to be edited
|
||||
@param element
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::setElement
|
||||
* Set the element to be edited
|
||||
* @param element
|
||||
*/
|
||||
void MasterPropertiesWidget::setElement(Element *element)
|
||||
{
|
||||
if (m_element == element)
|
||||
return;
|
||||
|
||||
|
||||
if (m_showed_element)
|
||||
{
|
||||
m_showed_element->setHighlighted(false);
|
||||
@@ -137,40 +138,40 @@ void MasterPropertiesWidget::setElement(Element *element)
|
||||
}
|
||||
if (m_element)
|
||||
m_element->setHighlighted(false);
|
||||
|
||||
|
||||
if (m_project)
|
||||
disconnect(m_project, SIGNAL(diagramRemoved(QETProject*,Diagram*)),
|
||||
this, SLOT(diagramWasdeletedFromProject()));
|
||||
this, SLOT(diagramWasdeletedFromProject()));
|
||||
|
||||
if(Q_LIKELY(element->diagram() && element->diagram()->project()))
|
||||
{
|
||||
m_project = element->diagram()->project();
|
||||
connect(m_project, SIGNAL(diagramRemoved(QETProject*,Diagram*)),
|
||||
this, SLOT(diagramWasdeletedFromProject()));
|
||||
}
|
||||
else
|
||||
m_project = nullptr;
|
||||
if(Q_LIKELY(element->diagram() && element->diagram()->project()))
|
||||
{
|
||||
m_project = element->diagram()->project();
|
||||
connect(m_project, SIGNAL(diagramRemoved(QETProject*,Diagram*)),
|
||||
this, SLOT(diagramWasdeletedFromProject()));
|
||||
}
|
||||
else
|
||||
m_project = nullptr;
|
||||
|
||||
//Keep up to date this widget when the linked elements of m_element change
|
||||
if (m_element)
|
||||
disconnect(m_element.data(), &Element::linkedElementChanged,
|
||||
this, &MasterPropertiesWidget::updateUi);
|
||||
|
||||
m_element = element;
|
||||
this, &MasterPropertiesWidget::updateUi);
|
||||
|
||||
m_element = element;
|
||||
connect(m_element.data(), &Element::linkedElementChanged,
|
||||
this, &MasterPropertiesWidget::updateUi);
|
||||
this, &MasterPropertiesWidget::updateUi);
|
||||
|
||||
updateUi();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::apply
|
||||
If link between edited element and other change,
|
||||
apply the change with a QUndoCommand (got with method associatedUndo)
|
||||
pushed to the stack of element project.
|
||||
Return true if link change, else false
|
||||
@note is void no Return ???
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::apply
|
||||
* If link between edited element and other change,
|
||||
* apply the change with a QUndoCommand (got with method associatedUndo)
|
||||
* pushed to the stack of element project.
|
||||
* Return true if link change, else false
|
||||
* @note is void no Return ???
|
||||
*/
|
||||
void MasterPropertiesWidget::apply()
|
||||
{
|
||||
if (QUndoCommand *undo = associatedUndo())
|
||||
@@ -178,25 +179,25 @@ void MasterPropertiesWidget::apply()
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::reset
|
||||
Reset current widget, clear eveything and rebuild widget.
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::reset
|
||||
* Reset current widget, clear eveything and rebuild widget.
|
||||
*/
|
||||
void MasterPropertiesWidget::reset()
|
||||
{
|
||||
foreach (QTreeWidgetItem *qtwi, m_qtwi_hash.keys())
|
||||
delete qtwi;
|
||||
|
||||
|
||||
m_qtwi_hash.clear();
|
||||
updateUi();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::associatedUndo
|
||||
If link between the edited element and other change,
|
||||
return a QUndoCommand with this change.
|
||||
If no change return nullptr.
|
||||
@return
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::associatedUndo
|
||||
* If link between the edited element and other change,
|
||||
* return a QUndoCommand with this change.
|
||||
* If no change return nullptr.
|
||||
* @return
|
||||
*/
|
||||
QUndoCommand* MasterPropertiesWidget::associatedUndo() const
|
||||
{
|
||||
QList <Element *> to_link;
|
||||
@@ -205,7 +206,7 @@ QUndoCommand* MasterPropertiesWidget::associatedUndo() const
|
||||
for (int i=0; i<ui->m_link_tree_widget->topLevelItemCount(); i++)
|
||||
to_link << m_qtwi_hash[ui->m_link_tree_widget->topLevelItem(i)];
|
||||
|
||||
//The two list contain the same element, there is no change
|
||||
//The two list contain the same element, there is no change
|
||||
if (to_link.size() == linked_.size())
|
||||
{
|
||||
bool equal = true;
|
||||
@@ -229,11 +230,11 @@ QUndoCommand* MasterPropertiesWidget::associatedUndo() const
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::setLiveEdit
|
||||
@param live_edit = true : live edit is enable
|
||||
else false : live edit is disable.
|
||||
@return always true because live edit is handled by this editor widget
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::setLiveEdit
|
||||
* @param live_edit = true : live edit is enable
|
||||
* else false : live edit is disable.
|
||||
* @return always true because live edit is handled by this editor widget
|
||||
*/
|
||||
bool MasterPropertiesWidget::setLiveEdit(bool live_edit)
|
||||
{
|
||||
m_live_edit = live_edit;
|
||||
@@ -241,9 +242,9 @@ bool MasterPropertiesWidget::setLiveEdit(bool live_edit)
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::updateUi
|
||||
Build the interface of the widget
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::updateUi
|
||||
* Build the interface of the widget
|
||||
*/
|
||||
void MasterPropertiesWidget::updateUi()
|
||||
{
|
||||
ui->m_free_tree_widget->clear();
|
||||
@@ -256,75 +257,75 @@ void MasterPropertiesWidget::updateUi()
|
||||
ElementProvider elmt_prov(m_project);
|
||||
QSettings settings;
|
||||
|
||||
//Build the list of free available element
|
||||
//Build the list of free available element
|
||||
QList <QTreeWidgetItem *> items_list;
|
||||
for(const auto &elmt : elmt_prov.freeElement(ElementData::Slave))
|
||||
{
|
||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_free_tree_widget);
|
||||
qtwi->setIcon(0, elmt->pixmap());
|
||||
|
||||
|
||||
if(settings.value("genericpanel/folio", false).toBool())
|
||||
{
|
||||
autonum::sequentialNumbers seq;
|
||||
QString F =autonum::AssignVariables::formulaToLabel(
|
||||
elmt->diagram()->border_and_titleblock.folio(),
|
||||
seq,
|
||||
elmt->diagram(),
|
||||
elmt);
|
||||
elmt->diagram()->border_and_titleblock.folio(),
|
||||
seq,
|
||||
elmt->diagram(),
|
||||
elmt);
|
||||
qtwi->setText(1, F);
|
||||
}
|
||||
else
|
||||
{
|
||||
qtwi->setText(1, QString::number(
|
||||
elmt->diagram()->folioIndex()
|
||||
+ 1));
|
||||
elmt->diagram()->folioIndex()
|
||||
+ 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
qtwi->setText(2, elmt->diagram()->title());
|
||||
qtwi->setText(4, elmt->diagram()->convertPosition(
|
||||
elmt->scenePos()).toString());
|
||||
elmt->scenePos()).toString());
|
||||
items_list.append(qtwi);
|
||||
m_qtwi_hash.insert(qtwi, elmt);
|
||||
}
|
||||
|
||||
|
||||
ui->m_free_tree_widget->addTopLevelItems(items_list);
|
||||
items_list.clear();
|
||||
|
||||
//Build the list of already linked element
|
||||
//Build the list of already linked element
|
||||
const QList<Element *> link_list = m_element->linkedElements();
|
||||
for(Element *elmt : link_list)
|
||||
{
|
||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_link_tree_widget);
|
||||
qtwi->setIcon(0, elmt->pixmap());
|
||||
|
||||
|
||||
if(settings.value("genericpanel/folio", false).toBool())
|
||||
{
|
||||
autonum::sequentialNumbers seq;
|
||||
QString F =autonum::AssignVariables::formulaToLabel(
|
||||
elmt->diagram()->border_and_titleblock.folio(),
|
||||
seq,
|
||||
elmt->diagram(),
|
||||
elmt);
|
||||
elmt->diagram()->border_and_titleblock.folio(),
|
||||
seq,
|
||||
elmt->diagram(),
|
||||
elmt);
|
||||
qtwi->setText(1, F);
|
||||
}
|
||||
else
|
||||
{
|
||||
qtwi->setText(1, QString::number(
|
||||
elmt->diagram()->folioIndex()
|
||||
+ 1));
|
||||
elmt->diagram()->folioIndex()
|
||||
+ 1));
|
||||
}
|
||||
|
||||
qtwi->setText(2, elmt->diagram()->title());
|
||||
qtwi->setText(3, elmt->diagram()->convertPosition(
|
||||
elmt->scenePos()).toString());
|
||||
elmt->scenePos()).toString());
|
||||
items_list.append(qtwi);
|
||||
m_qtwi_hash.insert(qtwi, elmt);
|
||||
}
|
||||
|
||||
|
||||
if(items_list.count())
|
||||
ui->m_link_tree_widget->addTopLevelItems(items_list);
|
||||
|
||||
|
||||
QVariant v = settings.value("link-element-widget/master-state");
|
||||
if(!v.isNull())
|
||||
{
|
||||
@@ -334,9 +335,9 @@ void MasterPropertiesWidget::updateUi()
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::headerCustomContextMenuRequested
|
||||
@param pos
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::headerCustomContextMenuRequested
|
||||
* @param pos
|
||||
*/
|
||||
void MasterPropertiesWidget::headerCustomContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
m_context_menu->clear();
|
||||
@@ -345,36 +346,57 @@ void MasterPropertiesWidget::headerCustomContextMenuRequested(const QPoint &pos)
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::on_link_button_clicked
|
||||
move current item in the free_list to linked_list
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::on_link_button_clicked
|
||||
* Moves the current item from the free_list to the linked_list,
|
||||
* provided the master's slave limit has not been reached.
|
||||
*/
|
||||
void MasterPropertiesWidget::on_link_button_clicked()
|
||||
{
|
||||
//take the current item from free_list and push it to linked_list
|
||||
// Get the maximum number of allowed slaves from the element's information
|
||||
QVariant max_slaves_variant = m_element->kindInformations().value("max_slaves");
|
||||
|
||||
if (max_slaves_variant.isValid() && !max_slaves_variant.toString().isEmpty()) {
|
||||
int max_slaves = max_slaves_variant.toInt();
|
||||
int current_slaves = ui->m_link_tree_widget->topLevelItemCount();
|
||||
|
||||
// If a limit is set and reached
|
||||
if (max_slaves != -1 && current_slaves >= max_slaves) {
|
||||
|
||||
|
||||
// Show a message box with the actual window as parent to ensure it's on top
|
||||
QMessageBox::warning(this->window(),
|
||||
tr("Nombre maximal d'esclaves atteint."),
|
||||
tr("Cet élément maître ne peut plus accepter aucun nouveau contact esclave, la limite fixée a été atteinte (Limite: %1).").arg(max_slaves));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Move current item from free_list to linked_list
|
||||
QTreeWidgetItem *qtwi = ui->m_free_tree_widget->currentItem();
|
||||
if (qtwi)
|
||||
{
|
||||
ui->m_free_tree_widget->takeTopLevelItem(
|
||||
ui->m_free_tree_widget->indexOfTopLevelItem(qtwi));
|
||||
ui->m_free_tree_widget->indexOfTopLevelItem(qtwi));
|
||||
ui->m_link_tree_widget->insertTopLevelItem(0, qtwi);
|
||||
|
||||
|
||||
if(m_live_edit)
|
||||
apply();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::on_unlink_button_clicked
|
||||
move current item in linked_list to free_list
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::on_unlink_button_clicked
|
||||
* move current item in linked_list to free_list
|
||||
*/
|
||||
void MasterPropertiesWidget::on_unlink_button_clicked()
|
||||
{
|
||||
//take the current item from linked_list and push it to free_list
|
||||
//take the current item from linked_list and push it to free_list
|
||||
QTreeWidgetItem *qtwi = ui->m_link_tree_widget->currentItem();
|
||||
if(qtwi)
|
||||
{
|
||||
ui->m_link_tree_widget->takeTopLevelItem(
|
||||
ui->m_link_tree_widget->indexOfTopLevelItem(qtwi));
|
||||
ui->m_link_tree_widget->indexOfTopLevelItem(qtwi));
|
||||
ui->m_free_tree_widget->insertTopLevelItem(0, qtwi);
|
||||
|
||||
if(m_live_edit)
|
||||
@@ -383,18 +405,18 @@ void MasterPropertiesWidget::on_unlink_button_clicked()
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::showElementFromTWI
|
||||
Show the element corresponding to the given QTreeWidgetItem
|
||||
@param qtwi
|
||||
@param column
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::showElementFromTWI
|
||||
* Show the element corresponding to the given QTreeWidgetItem
|
||||
* @param qtwi
|
||||
* @param column
|
||||
*/
|
||||
void MasterPropertiesWidget::showElementFromTWI(QTreeWidgetItem *qtwi, int column)
|
||||
{
|
||||
Q_UNUSED(column);
|
||||
if (m_showed_element)
|
||||
{
|
||||
disconnect(m_showed_element, SIGNAL(destroyed()),
|
||||
this, SLOT(showedElementWasDeleted()));
|
||||
this, SLOT(showedElementWasDeleted()));
|
||||
m_showed_element -> setHighlighted(false);
|
||||
}
|
||||
if (m_element)
|
||||
@@ -404,23 +426,23 @@ void MasterPropertiesWidget::showElementFromTWI(QTreeWidgetItem *qtwi, int colum
|
||||
m_showed_element->diagram()->showMe();
|
||||
m_showed_element->setHighlighted(true);
|
||||
connect(m_showed_element, SIGNAL(destroyed()),
|
||||
this, SLOT(showedElementWasDeleted()));
|
||||
this, SLOT(showedElementWasDeleted()));
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::showedElementWasDeleted
|
||||
Set to nullptr the current showed element when he was deleted
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::showedElementWasDeleted
|
||||
* Set to nullptr the current showed element when he was deleted
|
||||
*/
|
||||
void MasterPropertiesWidget::showedElementWasDeleted()
|
||||
{
|
||||
m_showed_element = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::diagramWasdeletedFromProject
|
||||
This slot is called when a diagram is removed from the parent project
|
||||
of edited element to update the content of this widget
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::diagramWasdeletedFromProject
|
||||
* This slot is called when a diagram is removed from the parent project
|
||||
* of edited element to update the content of this widget
|
||||
*/
|
||||
void MasterPropertiesWidget::diagramWasdeletedFromProject()
|
||||
{
|
||||
// We use a timer because if the removed diagram
|
||||
@@ -431,11 +453,11 @@ void MasterPropertiesWidget::diagramWasdeletedFromProject()
|
||||
}
|
||||
|
||||
/**
|
||||
@brief MasterPropertiesWidget::customContextMenu
|
||||
Display a context menu
|
||||
@param pos
|
||||
@param i : the tree widget where the context menu was requested.
|
||||
*/
|
||||
* @brief MasterPropertiesWidget::customContextMenu
|
||||
* Display a context menu
|
||||
* @param pos
|
||||
* @param i : the tree widget where the context menu was requested.
|
||||
*/
|
||||
void MasterPropertiesWidget::customContextMenu(const QPoint &pos, int i)
|
||||
{
|
||||
// add the size of the header to display the topleft of the QMenu
|
||||
@@ -444,14 +466,14 @@ void MasterPropertiesWidget::customContextMenu(const QPoint &pos, int i)
|
||||
// section related to QAbstractScrollArea
|
||||
QPoint point = pos;
|
||||
point.ry()+=ui->m_free_tree_widget->header()->height();
|
||||
|
||||
|
||||
m_context_menu->clear();
|
||||
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
point = ui->m_free_tree_widget->mapToGlobal(point);
|
||||
|
||||
//Context at for free tree widget
|
||||
|
||||
//Context at for free tree widget
|
||||
if (ui->m_free_tree_widget->currentItem())
|
||||
{
|
||||
m_qtwi_at_context_menu = ui->m_free_tree_widget->currentItem();
|
||||
@@ -462,8 +484,8 @@ void MasterPropertiesWidget::customContextMenu(const QPoint &pos, int i)
|
||||
else
|
||||
{
|
||||
point = ui->m_link_tree_widget->mapToGlobal(point);
|
||||
|
||||
//context at for link tre widget
|
||||
|
||||
//context at for link tre widget
|
||||
if (ui->m_link_tree_widget->currentItem())
|
||||
{
|
||||
m_qtwi_at_context_menu = ui->m_link_tree_widget->currentItem();
|
||||
@@ -471,7 +493,7 @@ void MasterPropertiesWidget::customContextMenu(const QPoint &pos, int i)
|
||||
m_context_menu->addAction(m_show_qtwi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_context_menu->addAction(m_show_element);
|
||||
m_context_menu->popup(point);
|
||||
}
|
||||
|
||||
178
sources/ui/terminalnumberingdialog.cpp
Normal file
178
sources/ui/terminalnumberingdialog.cpp
Normal file
@@ -0,0 +1,178 @@
|
||||
#include "terminalnumberingdialog.h"
|
||||
#include "ui_terminalnumberingdialog.h"
|
||||
#include "../qetproject.h"
|
||||
#include "../diagram.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
#include "../undocommand/changeelementinformationcommand.h"
|
||||
#include <QUndoCommand>
|
||||
#include <algorithm>
|
||||
|
||||
/**
|
||||
* @brief TerminalNumberingDialog::TerminalNumberingDialog
|
||||
* Constructor
|
||||
* @param parent
|
||||
*/
|
||||
TerminalNumberingDialog::TerminalNumberingDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::TerminalNumberingDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalNumberingDialog::~TerminalNumberingDialog
|
||||
* Destructor
|
||||
*/
|
||||
TerminalNumberingDialog::~TerminalNumberingDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalNumberingDialog::isXAxisPriority
|
||||
* @return true if X axis has priority, false if Y axis has priority
|
||||
*/
|
||||
bool TerminalNumberingDialog::isXAxisPriority() const
|
||||
{
|
||||
return ui->rb_priority_x->isChecked();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalNumberingDialog::isAlphanumeric
|
||||
* @return true if alphanumeric sorting is enabled, false if numeric only
|
||||
*/
|
||||
bool TerminalNumberingDialog::isAlphanumeric() const
|
||||
{
|
||||
return ui->rb_type_alpha->isChecked();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalNumberingDialog::getUndoCommand
|
||||
* Scans the given project for terminals, sorts them according to user preferences
|
||||
* (X/Y axis, alphanumeric rules), and generates an undo command containing all label changes.
|
||||
* * @param project Pointer to the current QETProject
|
||||
* @return QUndoCommand* containing the modifications, or nullptr if no changes are needed.
|
||||
*/
|
||||
QUndoCommand* TerminalNumberingDialog::getUndoCommand(QETProject *project) const {
|
||||
if (!project) return nullptr;
|
||||
|
||||
bool axisX = isXAxisPriority();
|
||||
bool alpha = isAlphanumeric();
|
||||
|
||||
// 1. Helper structure to store and sort terminal data
|
||||
struct TermInfo {
|
||||
Element *elmt;
|
||||
QString prefix;
|
||||
QString suffix;
|
||||
int folioIndex;
|
||||
qreal x;
|
||||
qreal y;
|
||||
};
|
||||
QList<TermInfo> termList;
|
||||
|
||||
// 2. Collect all terminals from all folios in the project
|
||||
foreach (Diagram *diagram, project->diagrams()) {
|
||||
int fIndex = diagram->folioIndex();
|
||||
foreach (QGraphicsItem *qgi, diagram->items()) {
|
||||
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
||||
|
||||
// Check if the element is actually a terminal
|
||||
if (elmt->elementData().m_type == ElementData::Terminal) {
|
||||
DiagramContext info = elmt->elementInformations();
|
||||
|
||||
// Ignore locked terminals (if the user checked a 'lock' property)
|
||||
if (info.value(QStringLiteral("auto_num_locked")).toString() == QLatin1String("true")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString label = elmt->actualLabel();
|
||||
if (label.isEmpty()) continue;
|
||||
|
||||
// Split prefix (e.g., "-X1") and suffix (e.g., "1" or "A")
|
||||
QString prefix = label;
|
||||
QString suffix = "";
|
||||
int colonIndex = label.lastIndexOf(':');
|
||||
if (colonIndex != -1) {
|
||||
prefix = label.left(colonIndex);
|
||||
suffix = label.mid(colonIndex + 1);
|
||||
}
|
||||
|
||||
// If user chose purely numeric, skip terminals with alphabetical suffixes
|
||||
if (!alpha && !suffix.isEmpty()) {
|
||||
bool isNum;
|
||||
suffix.toInt(&isNum);
|
||||
if (!isNum) continue;
|
||||
}
|
||||
|
||||
TermInfo ti;
|
||||
ti.elmt = elmt;
|
||||
ti.prefix = prefix;
|
||||
ti.suffix = suffix;
|
||||
ti.folioIndex = fIndex;
|
||||
ti.x = elmt->pos().x();
|
||||
ti.y = elmt->pos().y();
|
||||
termList.append(ti);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Sort terminals based on user selection (X or Y axis priority)
|
||||
std::sort(termList.begin(), termList.end(), [axisX](const TermInfo &a, const TermInfo &b) {
|
||||
// First sort by BMK Prefix alphabetically (case insensitive)
|
||||
int prefixCmp = a.prefix.compare(b.prefix, Qt::CaseInsensitive);
|
||||
if (prefixCmp != 0) return prefixCmp < 0;
|
||||
|
||||
// Then sort by folio (page) index
|
||||
if (a.folioIndex != b.folioIndex) return a.folioIndex < b.folioIndex;
|
||||
|
||||
// Finally sort by coordinates (with a 1.0px tolerance to handle slight misalignments)
|
||||
if (axisX) {
|
||||
if (qAbs(a.x - b.x) > 1.0) return a.x < b.x;
|
||||
return a.y < b.y;
|
||||
} else {
|
||||
if (qAbs(a.y - b.y) > 1.0) return a.y < b.y;
|
||||
return a.x < b.x;
|
||||
}
|
||||
});
|
||||
|
||||
// 4. Generate new numbering and create the undo command macro
|
||||
QUndoCommand *macro = new QUndoCommand(QObject::tr("Automatic terminal numbering"));
|
||||
QMap<QString, int> counters;
|
||||
|
||||
foreach (const TermInfo &ti, termList) {
|
||||
// Increment the counter for this terminal block (e.g., "-X3")
|
||||
counters[ti.prefix]++;
|
||||
int newNum = counters[ti.prefix];
|
||||
|
||||
// Determine if the original suffix was a pure number
|
||||
QString newLabel;
|
||||
bool isNum;
|
||||
ti.suffix.toInt(&isNum);
|
||||
|
||||
if (isNum || ti.suffix.isEmpty()) {
|
||||
// If it was a number (e.g., "1") or empty, update it with the new counter
|
||||
newLabel = ti.prefix + ":" + QString::number(newNum);
|
||||
} else {
|
||||
// If it was alphabetical (e.g., "N", "PE"), keep the original text but consume the count!
|
||||
newLabel = ti.prefix + ":" + ti.suffix;
|
||||
}
|
||||
|
||||
DiagramContext oldInfo = ti.elmt->elementInformations();
|
||||
DiagramContext newInfo = oldInfo;
|
||||
newInfo.addValue(QStringLiteral("label"), newLabel);
|
||||
|
||||
// Create an undo command only if the label actually changes
|
||||
if (oldInfo != newInfo) {
|
||||
new ChangeElementInformationCommand(ti.elmt, oldInfo, newInfo, macro);
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Return the macro if it contains changes, otherwise delete and return null
|
||||
if (macro->childCount() > 0) {
|
||||
return macro;
|
||||
} else {
|
||||
delete macro;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
35
sources/ui/terminalnumberingdialog.h
Normal file
35
sources/ui/terminalnumberingdialog.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef TERMINALNUMBERINGDIALOG_H
|
||||
#define TERMINALNUMBERINGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QETProject;
|
||||
class QUndoCommand;
|
||||
|
||||
namespace Ui {
|
||||
class TerminalNumberingDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The TerminalNumberingDialog class
|
||||
* Dialog to configure the automatic numbering of terminals.
|
||||
*/
|
||||
class TerminalNumberingDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TerminalNumberingDialog(QWidget *parent = nullptr);
|
||||
~TerminalNumberingDialog();
|
||||
|
||||
// Getters for the user's choices
|
||||
bool isXAxisPriority() const;
|
||||
bool isAlphanumeric() const;
|
||||
|
||||
QUndoCommand* getUndoCommand(QETProject *project) const;
|
||||
|
||||
private:
|
||||
Ui::TerminalNumberingDialog *ui;
|
||||
};
|
||||
|
||||
#endif // TERMINALNUMBERINGDIALOG_H
|
||||
139
sources/ui/terminalnumberingdialog.ui
Normal file
139
sources/ui/terminalnumberingdialog.ui
Normal file
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TerminalNumberingDialog</class>
|
||||
<widget class="QDialog" name="TerminalNumberingDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Numérotation automatique des bornes</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_description">
|
||||
<property name="text">
|
||||
<string>Cette fonction numérote les bornes du projet selon leur position. Les bornes vides ou verrouillées sont ignorées.Le marquage des bornes doit être configuré au préalable comme suit : '-X:AB'. La partie avant les deux-points (le bornier) peut être nommée au choix. 'AB' peut être composé de chiffres ou de lettres."</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_axis">
|
||||
<property name="title">
|
||||
<string>Priorité des axes</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_priority_x">
|
||||
<property name="text">
|
||||
<string>Priorité à l'axe X (horizontal)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_priority_y">
|
||||
<property name="text">
|
||||
<string>Priorité à l'axe Y (vertical)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_type">
|
||||
<property name="title">
|
||||
<string>Type de numérotation</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_type_num">
|
||||
<property name="text">
|
||||
<string>Numérique uniquement (1, 2, 3...)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_type_alpha">
|
||||
<property name="text">
|
||||
<string>Alphanumérique (A, B, C... 1, 2...)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>TerminalNumberingDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>TerminalNumberingDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user