mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-03 18:49:59 +02:00
Merge branch 'master' into master
This commit is contained in:
@@ -15,10 +15,10 @@ The main goal of the developers is to provide a libre, easy to use and effective
|
|||||||
|
|
||||||
### Version
|
### Version
|
||||||
|
|
||||||
The current stable version is 0.90 and was released on 2023.01.06.
|
The current stable version is 0.100 and was released on 2026.01.25.
|
||||||
Once it has been officially released, the stable version is always frozen and is no longer developed.
|
Once it has been officially released, the stable version is always frozen and is no longer developed.
|
||||||
|
|
||||||
New functionalities, bug and issue fixings are further made in the development version (currently 0.100), which can also be [downloaded](https://qelectrotech.org/download.php).
|
New functionalities, bug and issue fixings are further made in the development version (currently 0.100.1 or 0.200.0 if based on new Qt6 port), which can also be [downloaded](https://qelectrotech.org/download.php).
|
||||||
|
|
||||||
Users who want to test and take benefits from the last software implementations should use the development version. But... use it at your own risk, since things are sometimes broken or only partially implemented until they are done!
|
Users who want to test and take benefits from the last software implementations should use the development version. But... use it at your own risk, since things are sometimes broken or only partially implemented until they are done!
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006-2026 The QElectroTech Team
|
Copyright 2006-2026 The QElectroTech Team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
@@ -96,18 +96,8 @@ void ElementPropertiesEditorWidget::upDateInterface()
|
|||||||
}
|
}
|
||||||
else if (m_data.m_type == ElementData::Master) {
|
else if (m_data.m_type == ElementData::Master) {
|
||||||
ui->m_master_type_cb->setCurrentIndex(
|
ui->m_master_type_cb->setCurrentIndex(
|
||||||
ui->m_master_type_cb->findData (
|
ui->m_master_type_cb->findData (
|
||||||
m_data.m_master_type));
|
m_data.m_master_type));
|
||||||
|
|
||||||
// NEU: Checkbox und Zahlenbox für max_slaves einstellen
|
|
||||||
if (m_data.m_max_slaves == -1) {
|
|
||||||
ui->max_slaves_checkbox->setChecked(false);
|
|
||||||
ui->max_slaves_spinbox->setEnabled(false);
|
|
||||||
} else {
|
|
||||||
ui->max_slaves_checkbox->setChecked(true);
|
|
||||||
ui->max_slaves_spinbox->setEnabled(true);
|
|
||||||
ui->max_slaves_spinbox->setValue(m_data.m_max_slaves);
|
|
||||||
}
|
|
||||||
} else if (m_data.m_type == ElementData::Terminal) {
|
} else if (m_data.m_type == ElementData::Terminal) {
|
||||||
ui->m_terminal_type_cb->setCurrentIndex(
|
ui->m_terminal_type_cb->setCurrentIndex(
|
||||||
ui->m_terminal_type_cb->findData(
|
ui->m_terminal_type_cb->findData(
|
||||||
@@ -161,14 +151,17 @@ void ElementPropertiesEditorWidget::setUpInterface()
|
|||||||
ui->m_terminal_func_cb->addItem(tr("Phase"), ElementData::TFPhase);
|
ui->m_terminal_func_cb->addItem(tr("Phase"), ElementData::TFPhase);
|
||||||
ui->m_terminal_func_cb->addItem(tr("Neutre"), ElementData::TFNeutral);
|
ui->m_terminal_func_cb->addItem(tr("Neutre"), ElementData::TFNeutral);
|
||||||
|
|
||||||
//Disable the edition of the first column of the information tree
|
//Disable the edition of the first column of the information tree
|
||||||
//by this little workaround
|
//by this little workaround
|
||||||
ui->m_tree->setItemDelegate(new EditorDelegate(this));
|
//Disable the edition of the first column of the information tree
|
||||||
|
//by this little workaround
|
||||||
|
ui->m_tree->setItemDelegate(new EditorDelegate(this));
|
||||||
|
ui->m_tree->header()->resizeSection(0, 150);
|
||||||
|
|
||||||
// NEU: Checkbox mit der Zahlenbox verbinden (Aktivieren/Deaktivieren)
|
// NEU: Checkbox mit der Zahlenbox verbinden (Aktivieren/Deaktivieren)
|
||||||
connect(ui->max_slaves_checkbox, SIGNAL(toggled(bool)), ui->max_slaves_spinbox, SLOT(setEnabled(bool)));
|
connect(ui->max_slaves_checkbox, SIGNAL(toggled(bool)), ui->max_slaves_spinbox, SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
populateTree();
|
populateTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementPropertiesEditorWidget::updateTree()
|
void ElementPropertiesEditorWidget::updateTree()
|
||||||
@@ -239,13 +232,6 @@ void ElementPropertiesEditorWidget::on_m_buttonBox_accepted()
|
|||||||
}
|
}
|
||||||
else if (m_data.m_type == ElementData::Master) {
|
else if (m_data.m_type == ElementData::Master) {
|
||||||
m_data.m_master_type = ui->m_master_type_cb->currentData().value<ElementData::MasterType>();
|
m_data.m_master_type = ui->m_master_type_cb->currentData().value<ElementData::MasterType>();
|
||||||
|
|
||||||
// NEU: Wenn Häkchen gesetzt, speichere die Zahl, ansonsten -1 (unendlich)
|
|
||||||
if (ui->max_slaves_checkbox->isChecked()) {
|
|
||||||
m_data.m_max_slaves = ui->max_slaves_spinbox->value();
|
|
||||||
} else {
|
|
||||||
m_data.m_max_slaves = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (m_data.m_type == ElementData::Terminal)
|
else if (m_data.m_type == ElementData::Terminal)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>527</width>
|
<width>527</width>
|
||||||
<height>492</height>
|
<height>442</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -104,23 +104,6 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="m_master_type_cb"/>
|
<widget class="QComboBox" name="m_master_type_cb"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="max_slaves_checkbox">
|
|
||||||
<property name="text">
|
|
||||||
<string>max. Slaves definieren</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QSpinBox" name="max_slaves_spinbox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -568,12 +568,9 @@ void ElementData::kindInfoFromXml(const QDomElement &xml_element)
|
|||||||
}
|
}
|
||||||
auto name = dom_elmt.attribute(QStringLiteral("name"));
|
auto name = dom_elmt.attribute(QStringLiteral("name"));
|
||||||
|
|
||||||
if (m_type == ElementData::Master) {
|
if (m_type == ElementData::Master &&
|
||||||
if (name == QLatin1String("type")) {
|
name == QLatin1String("type")) {
|
||||||
m_master_type = masterTypeFromString(dom_elmt.text());
|
m_master_type = masterTypeFromString(dom_elmt.text());
|
||||||
} else if (name == QLatin1String("max_slaves")) {
|
|
||||||
m_max_slaves = dom_elmt.text().toInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (m_type == ElementData::Slave ) {
|
else if (m_type == ElementData::Slave ) {
|
||||||
if (name == QLatin1String("type")) {
|
if (name == QLatin1String("type")) {
|
||||||
|
|||||||
@@ -134,7 +134,10 @@ class ElementData : public PropertiesInterface
|
|||||||
ElementData::Type m_type = ElementData::Simple;
|
ElementData::Type m_type = ElementData::Simple;
|
||||||
|
|
||||||
ElementData::MasterType m_master_type = ElementData::Coil;
|
ElementData::MasterType m_master_type = ElementData::Coil;
|
||||||
|
<<<<<<< master
|
||||||
int m_max_slaves{-1};
|
int m_max_slaves{-1};
|
||||||
|
=======
|
||||||
|
>>>>>>> master
|
||||||
|
|
||||||
ElementData::SlaveType m_slave_type = ElementData::SSimple;
|
ElementData::SlaveType m_slave_type = ElementData::SSimple;
|
||||||
ElementData::SlaveState m_slave_state = ElementData::NO;
|
ElementData::SlaveState m_slave_state = ElementData::NO;
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ void MasterElement::aboutDeleteXref()
|
|||||||
delete m_Xref_item;
|
delete m_Xref_item;
|
||||||
m_Xref_item = nullptr;
|
m_Xref_item = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,20 +190,20 @@ void MasterElement::aboutDeleteXref()
|
|||||||
*/
|
*/
|
||||||
bool MasterElement::isFull() const
|
bool MasterElement::isFull() const
|
||||||
{
|
{
|
||||||
// Set default value to -1 (unlimited slaves)
|
// Set default value to -1 (unlimited slaves)
|
||||||
int max_slaves = -1;
|
int max_slaves = -1;
|
||||||
QVariant max_slaves_variant = kindInformations().value("max_slaves");
|
QVariant max_slaves_variant = kindInformations().value("max_slaves");
|
||||||
|
|
||||||
// Overwrite default if a valid limit is defined in the element's XML
|
// Overwrite default if a valid limit is defined in the element's XML
|
||||||
if (max_slaves_variant.isValid() && !max_slaves_variant.toString().isEmpty()) {
|
if (max_slaves_variant.isValid() && !max_slaves_variant.toString().isEmpty()) {
|
||||||
max_slaves = max_slaves_variant.toInt();
|
max_slaves = max_slaves_variant.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no limit is set (-1), the master is never full
|
// If no limit is set (-1), the master is never full
|
||||||
if (max_slaves == -1) {
|
if (max_slaves == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if current connected elements reached or exceeded the limit
|
// Return true if current connected elements reached or exceeded the limit
|
||||||
return connected_elements.size() >= max_slaves;
|
return connected_elements.size() >= max_slaves;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ class MasterElement : public Element
|
|||||||
void unlinkElement (Element *elmt) override;
|
void unlinkElement (Element *elmt) override;
|
||||||
void initLink (QETProject *project) override;
|
void initLink (QETProject *project) override;
|
||||||
QRectF XrefBoundingRect() const;
|
QRectF XrefBoundingRect() const;
|
||||||
|
|
||||||
bool isFull() const; // NEU: Prüft, ob das Slave-Limit erreicht ist
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVariant itemChange(
|
QVariant itemChange(
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "linksingleelementwidget.h"
|
#include "linksingleelementwidget.h"
|
||||||
#include "../qetgraphicsitem/masterelement.h"
|
|
||||||
#include "../qetgraphicsitem/conductor.h"
|
#include "../qetgraphicsitem/conductor.h"
|
||||||
#include "../diagram.h"
|
#include "../diagram.h"
|
||||||
#include "../diagramposition.h"
|
#include "../diagramposition.h"
|
||||||
@@ -386,22 +386,7 @@ QVector <QPointer<Element>> LinkSingleElementWidget::availableElements()
|
|||||||
|
|
||||||
//If element is linked, remove is parent from the list
|
//If element is linked, remove is parent from the list
|
||||||
if(!m_element->isFree()) elmt_vector.removeAll(m_element->linkedElements().first());
|
if(!m_element->isFree()) elmt_vector.removeAll(m_element->linkedElements().first());
|
||||||
// NEU: Filtere volle Master-Elemente aus der Liste heraus
|
|
||||||
for (int i = elmt_vector.size() - 1; i >= 0; --i) {
|
|
||||||
Element *elmt = elmt_vector.at(i);
|
|
||||||
|
|
||||||
// Wenn das Element in der Liste ein Master ist
|
|
||||||
if (elmt->linkType() == Element::Master) {
|
|
||||||
|
|
||||||
// Wir wandeln den generischen Element-Pointer in einen MasterElement-Pointer um
|
|
||||||
MasterElement *master = static_cast<MasterElement*>(elmt);
|
|
||||||
|
|
||||||
// Wenn der Master voll ist, werfen wir ihn aus der Liste!
|
|
||||||
if (master->isFull()) {
|
|
||||||
elmt_vector.removeAt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return elmt_vector;
|
return elmt_vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ void MasterPropertiesWidget::headerCustomContextMenuRequested(const QPoint &pos)
|
|||||||
{
|
{
|
||||||
m_context_menu->clear();
|
m_context_menu->clear();
|
||||||
m_context_menu->addAction(m_save_header_state);
|
m_context_menu->addAction(m_save_header_state);
|
||||||
m_context_menu->popup(ui->m_free_tree_widget->header()->mapToGlobal(pos));
|
m_context_menu->popup(ui->m_free_tree_widget->header()->mapToGlobal(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -352,33 +352,33 @@ void MasterPropertiesWidget::headerCustomContextMenuRequested(const QPoint &pos)
|
|||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::on_link_button_clicked()
|
void MasterPropertiesWidget::on_link_button_clicked()
|
||||||
{
|
{
|
||||||
// Get the maximum number of allowed slaves from the element's information
|
// Get the maximum number of allowed slaves from the element's information
|
||||||
QVariant max_slaves_variant = m_element->kindInformations().value("max_slaves");
|
QVariant max_slaves_variant = m_element->kindInformations().value("max_slaves");
|
||||||
|
|
||||||
if (max_slaves_variant.isValid() && !max_slaves_variant.toString().isEmpty()) {
|
if (max_slaves_variant.isValid() && !max_slaves_variant.toString().isEmpty()) {
|
||||||
int max_slaves = max_slaves_variant.toInt();
|
int max_slaves = max_slaves_variant.toInt();
|
||||||
int current_slaves = ui->m_link_tree_widget->topLevelItemCount();
|
int current_slaves = ui->m_link_tree_widget->topLevelItemCount();
|
||||||
|
|
||||||
// If a limit is set and reached
|
// If a limit is set and reached
|
||||||
if (max_slaves != -1 && current_slaves >= max_slaves) {
|
if (max_slaves != -1 && current_slaves >= max_slaves) {
|
||||||
|
|
||||||
|
|
||||||
// Show a message box with the actual window as parent to ensure it's on top
|
// Show a message box with the actual window as parent to ensure it's on top
|
||||||
QMessageBox::warning(this->window(),
|
QMessageBox::warning(this->window(),
|
||||||
tr("Maximum Slaves Reached"),
|
tr("Maximum Slaves Reached"),
|
||||||
tr("This master element cannot accept any new slaves because it is full (Limit: %1).").arg(max_slaves));
|
tr("This master element cannot accept any new slaves because it is full (Limit: %1).").arg(max_slaves));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move current item from free_list to linked_list
|
// Move current item from free_list to linked_list
|
||||||
QTreeWidgetItem *qtwi = ui->m_free_tree_widget->currentItem();
|
QTreeWidgetItem *qtwi = ui->m_free_tree_widget->currentItem();
|
||||||
if (qtwi)
|
if (qtwi)
|
||||||
{
|
{
|
||||||
ui->m_free_tree_widget->takeTopLevelItem(
|
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);
|
ui->m_link_tree_widget->insertTopLevelItem(0, qtwi);
|
||||||
|
|
||||||
if(m_live_edit)
|
if(m_live_edit)
|
||||||
apply();
|
apply();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user