#include "configdialog.h"
-#include "configpages.h"
+#include "ui/configpage/configpages.h"
#include "qetapp.h"
#include "machine_info.h"
diff --git a/sources/editor/ui/elementpropertieseditorwidget.cpp b/sources/editor/ui/elementpropertieseditorwidget.cpp
index 3cac32494..83a0cffb4 100644
--- a/sources/editor/ui/elementpropertieseditorwidget.cpp
+++ b/sources/editor/ui/elementpropertieseditorwidget.cpp
@@ -115,7 +115,7 @@ void ElementPropertiesEditorWidget::upDateInterface()
*/
void ElementPropertiesEditorWidget::setUpInterface()
{
- // Type combo box
+ // Type combo box
ui->m_base_type_cb->addItem (tr("Simple"), ElementData::Simple);
ui->m_base_type_cb->addItem (tr("Maître"), ElementData::Master);
ui->m_base_type_cb->addItem (tr("Esclave"), ElementData::Slave);
@@ -123,7 +123,7 @@ void ElementPropertiesEditorWidget::setUpInterface()
ui->m_base_type_cb->addItem (tr("Renvoi de folio précédent"), ElementData::PreviousReport);
ui->m_base_type_cb->addItem (tr("Bornier"), ElementData::Terminale);
- // Slave option
+ // Slave option
ui->m_state_cb->addItem(tr("Normalement ouvert"), ElementData::NO);
ui->m_state_cb->addItem(tr("Normalement fermé"), ElementData::NC);
ui->m_state_cb->addItem(tr("Inverseur"), ElementData::SW);
@@ -133,24 +133,24 @@ void ElementPropertiesEditorWidget::setUpInterface()
ui->m_type_cb->addItem(tr("Temporisé repos"), ElementData::DelayOff);
ui->m_type_cb->addItem(tr("Temporisé travail & repos"), ElementData::delayOnOff);
- //Master option
+ //Master option
ui->m_master_type_cb->addItem(tr("Bobine"), ElementData::Coil);
ui->m_master_type_cb->addItem(tr("Organe de protection"), ElementData::Protection);
ui->m_master_type_cb->addItem(tr("Commutateur / bouton"), ElementData::Commutator);
- //Terminal option
+ //Terminal option
ui->m_terminal_type_cb->addItem(tr("Générique"), ElementData::TTGeneric);
- ui->m_terminal_type_cb->addItem(tr("Fusible"), ElementData::Fuse);
- ui->m_terminal_type_cb->addItem(tr("Séctionnable"), ElementData::Sectional);
- ui->m_terminal_type_cb->addItem(tr("Diode"), ElementData::Diode);
+ ui->m_terminal_type_cb->addItem(tr("Fusible"), ElementData::TTFuse);
+ ui->m_terminal_type_cb->addItem(tr("Séctionnable"), ElementData::TTSectional);
+ ui->m_terminal_type_cb->addItem(tr("Diode"), ElementData::TTDiode);
+ ui->m_terminal_type_cb->addItem(tr("Terre"), ElementData::TTGround);
ui->m_terminal_func_cb->addItem(tr("Générique"), ElementData::TFGeneric);
- ui->m_terminal_func_cb->addItem(tr("Phase"), ElementData::Phase);
- ui->m_terminal_func_cb->addItem(tr("Neutre"), ElementData::Neutral);
- ui->m_terminal_func_cb->addItem(tr("Terre"), ElementData::PE);
+ ui->m_terminal_func_cb->addItem(tr("Phase"), ElementData::TFPhase);
+ ui->m_terminal_func_cb->addItem(tr("Neutre"), ElementData::TFNeutral);
- //Disable the edition of the first column of the information tree
- //by this little workaround
+ //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);
populateTree();
diff --git a/sources/factory/elementpicturefactory.cpp b/sources/factory/elementpicturefactory.cpp
index eda6b4201..dbfeeebef 100644
--- a/sources/factory/elementpicturefactory.cpp
+++ b/sources/factory/elementpicturefactory.cpp
@@ -237,14 +237,16 @@ bool ElementPictureFactory::build(const ElementsLocation &location,
painter.end();
low_painter.end();
+ const auto uuid_ = location.uuid();
if (!picture) {
- m_pictures_H.insert(location.uuid(), pic);
- m_primitives_H.insert(location.uuid(), primitives_);
+ m_pictures_H.insert(uuid_, pic);
+ m_primitives_H.insert(uuid_, primitives_);
}
if (!low_picture) {
- m_low_pictures_H.insert(location.uuid(), low_pic);
- m_primitives_H.insert(location.uuid(), primitives_);
+ m_low_pictures_H.insert(uuid_, low_pic);
+ m_primitives_H.insert(uuid_, primitives_);
}
+
return true;
}
diff --git a/sources/projectview.cpp b/sources/projectview.cpp
index f5420dbfa..7edbb67e7 100644
--- a/sources/projectview.cpp
+++ b/sources/projectview.cpp
@@ -810,30 +810,39 @@ void ProjectView::loadDiagrams()
setDisplayFallbackWidget(m_project -> diagrams().isEmpty());
- DialogWaiting *dialog = nullptr;
- if(DialogWaiting::hasInstance())
+ auto dialog = DialogWaiting::instance();
+ if(dialog)
{
- dialog = DialogWaiting::instance();
dialog->setTitle( tr(""
"Ouverture du projet en cours...
"
"Création des onglets de folio :"
"
"));
}
- for(Diagram *diagram : m_project->diagrams())
+
+ for(auto diagram : m_project->diagrams())
{
if(dialog)
{
dialog->setDetail(diagram->title());
dialog->setProgressBar(dialog->progressBarValue()+1);
}
- diagramAdded(diagram);
+
+ auto dv = new DiagramView(diagram);
+ dv->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
+
+ auto index = m_project->folioIndex(diagram);
+ m_tab->insertTab(index, dv, QET::Icons::Diagram, dv->title());
+ m_diagram_view_list.insert(index, dv);
+
+ connect(dv, &DiagramView::showDiagram, this, QOverload::of(&ProjectView::showDiagram));
+ connect(dv, &DiagramView::titleChanged, this, &ProjectView::updateTabTitle);
+ connect(dv, &DiagramView::findElementRequired, this, &ProjectView::findElementRequired);
+ connect(&dv->diagram()->border_and_titleblock , &BorderTitleBlock::titleBlockFolioChanged, [this, dv]() {this->updateTabTitle(dv);});
}
- if (DiagramView *dv = currentDiagram())
- {
- dv->diagram()->loadElmtFolioSeq();
- dv->diagram()->loadCndFolioSeq();
- }
+ rebuildDiagramsMap();
+ updateAllTabsTitle();
+
m_tab->setCurrentWidget(firstDiagram());
}
diff --git a/sources/projectview.h b/sources/projectview.h
index ba037761b..01f312e2a 100644
--- a/sources/projectview.h
+++ b/sources/projectview.h
@@ -87,10 +87,14 @@ class ProjectView : public QWidget
private:
ProjectView(const ProjectView &);
+ //Method related to construction of this class
+ void setProject(QETProject *project);
+
+
+
// methods
public:
QETProject *project();
- void setProject(QETProject *);
QList diagram_views() const;
DiagramView *currentDiagram() const;
void closeEvent(QCloseEvent *) override;
diff --git a/sources/properties/elementdata.cpp b/sources/properties/elementdata.cpp
index 9cab02db4..f8ed284f6 100644
--- a/sources/properties/elementdata.cpp
+++ b/sources/properties/elementdata.cpp
@@ -307,26 +307,30 @@ QString ElementData::terminalTypeToString(ElementData::TerminalType type)
{
switch (type) {
case ElementData::TTGeneric :
- return QString("generic");
- case ElementData::Fuse :
- return QString("fuse");
- case ElementData::Sectional:
- return QString("sectional");
- case ElementData::Diode:
- return QString("diode");
+ return QStringLiteral("generic");
+ case ElementData::TTFuse :
+ return QStringLiteral("fuse");
+ case ElementData::TTSectional:
+ return QStringLiteral("sectional");
+ case ElementData::TTDiode:
+ return QStringLiteral("diode");
+ case ElementData::TTGround:
+ return QStringLiteral("ground");
}
}
ElementData::TerminalType ElementData::terminalTypeFromString(const QString &string)
{
- if (string == "generic") {
+ if (string == QLatin1String("generic")) {
return ElementData::TTGeneric;
- } else if (string == "fuse") {
- return ElementData::Fuse;
- } else if (string == "sectional") {
- return ElementData::Sectional;
- } else if (string == "diode") {
- return ElementData::Diode;
+ } else if (string == QLatin1String("fuse")) {
+ return ElementData::TTFuse;
+ } else if (string == QLatin1String("sectional")) {
+ return ElementData::TTSectional;
+ } else if (string == QLatin1String("diode")) {
+ return ElementData::TTDiode;
+ } else if (string == QLatin1String("ground")) {
+ return ElementData::TTGround;
}
qDebug() << "ElementData::terminalTypeFromString : string : "
@@ -340,12 +344,10 @@ QString ElementData::terminalFunctionToString(ElementData::TerminalFunction func
switch (function) {
case ElementData::TFGeneric:
return QString("generic");
- case ElementData::Phase:
+ case ElementData::TFPhase:
return QString ("phase");
- case ElementData::Neutral:
+ case ElementData::TFNeutral:
return QString("neutral");
- case ElementData::PE:
- return QString("pe");
}
}
@@ -354,11 +356,9 @@ ElementData::TerminalFunction ElementData::terminalFunctionFromString(const QStr
if (string == "generic") {
return ElementData::TFGeneric;
} else if (string == "phase") {
- return ElementData::Phase;
+ return ElementData::TFPhase;
} else if (string == "neutral") {
- return ElementData::Neutral;
- } else if (string == "pe") {
- return ElementData::PE;
+ return ElementData::TFNeutral;
}
qDebug() << "ElementData::terminalFunctionFromString : string : "
diff --git a/sources/properties/elementdata.h b/sources/properties/elementdata.h
index e7e3d740d..d2f034990 100644
--- a/sources/properties/elementdata.h
+++ b/sources/properties/elementdata.h
@@ -68,17 +68,17 @@ class ElementData : public PropertiesInterface
enum TerminalType {
TTGeneric,
- Fuse,
- Sectional,
- Diode
+ TTFuse,
+ TTSectional,
+ TTDiode,
+ TTGround
};
Q_ENUM(TerminalType)
enum TerminalFunction {
TFGeneric,
- Phase,
- Neutral,
- PE
+ TFPhase,
+ TFNeutral,
};
Q_ENUM(TerminalFunction)
diff --git a/sources/properties/terminaldata.cpp b/sources/properties/terminaldata.cpp
index 791cec88b..3420b1e92 100644
--- a/sources/properties/terminaldata.cpp
+++ b/sources/properties/terminaldata.cpp
@@ -182,7 +182,8 @@ QString TerminalData::typeToString(TerminalData::Type type)
*/
TerminalData::Type TerminalData::typeFromString(const QString &string)
{
- if (string == "Generic") {
+ if (string.isEmpty() ||
+ string == "Generic") {
return TerminalData::Generic;
} else if (string == "Inner") {
return TerminalData::Inner;
diff --git a/sources/properties/xrefproperties.cpp b/sources/properties/xrefproperties.cpp
index 06c513c19..15e142ead 100644
--- a/sources/properties/xrefproperties.cpp
+++ b/sources/properties/xrefproperties.cpp
@@ -187,13 +187,14 @@ QHash XRefProperties::defaultProperties()
}
bool XRefProperties::operator ==(const XRefProperties &xrp) const{
- return (m_show_power_ctc == xrp.m_show_power_ctc &&
- m_display == xrp.m_display &&
- m_snap_to == xrp.m_snap_to &&
- m_prefix == xrp.m_prefix &&
- m_master_label == xrp.m_master_label &&
- m_offset == xrp.m_offset &&
- m_xref_pos == xrp.m_xref_pos );
+ return (m_show_power_ctc == xrp.m_show_power_ctc
+ && m_display == xrp.m_display
+ && m_snap_to == xrp.m_snap_to
+ && m_prefix == xrp.m_prefix
+ && m_master_label== xrp.m_master_label
+ && m_offset == xrp.m_offset
+ && m_xref_pos == xrp.m_xref_pos
+ && m_slave_label == xrp.m_slave_label);
}
bool XRefProperties::operator !=(const XRefProperties &xrp) const
diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp
index 217066f56..7c90c0a05 100644
--- a/sources/qetapp.cpp
+++ b/sources/qetapp.cpp
@@ -18,7 +18,7 @@
#include "qetapp.h"
#include "configdialog.h"
-#include "configpages.h"
+#include "ui/configpage/configpages.h"
#include "editor/ui/qetelementeditor.h"
#include "elementscollectioncache.h"
#include "factory/elementfactory.h"
diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp
index 85d5519c5..ee187509b 100644
--- a/sources/qetproject.cpp
+++ b/sources/qetproject.cpp
@@ -1420,15 +1420,13 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
QDomElement diagram_xml_element = diagram_nodes
.at(i)
.toElement();
- Diagram *diagram = new Diagram(this);
+ auto diagram = new Diagram(this);
+ m_diagrams_list << diagram;
- int diagram_order = -1;
- if (!QET::attributeIsAnInteger(diagram_xml_element,
- QStringLiteral("order"),
- &diagram_order))
- diagram_order = 500000;
-
- addDiagram(diagram, diagram_order-1);
+ connect(&diagram->border_and_titleblock, &BorderTitleBlock::needFolioData,
+ this, &QETProject::updateDiagramsFolioData);
+ connect(diagram, &Diagram::usedTitleBlockTemplateChanged,
+ this, &QETProject::usedTitleBlockTemplateChanged);
diagram->initFromXml(diagram_xml_element);
if(dlgWaiting)
@@ -1436,6 +1434,8 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
}
}
+ updateDiagramsFolioData();
+
//Initialise links between elements in this project
//and refresh the text of conductor
if(dlgWaiting)
diff --git a/sources/configpage.h b/sources/ui/configpage/configpage.h
similarity index 100%
rename from sources/configpage.h
rename to sources/ui/configpage/configpage.h
diff --git a/sources/configpages.cpp b/sources/ui/configpage/configpages.cpp
similarity index 95%
rename from sources/configpages.cpp
rename to sources/ui/configpage/configpages.cpp
index 2ecde2345..6efd69193 100644
--- a/sources/configpages.cpp
+++ b/sources/ui/configpage/configpages.cpp
@@ -18,18 +18,18 @@
#include "configpages.h"
-#include "NameList/nameslist.h"
-#include "bordertitleblock.h"
-#include "exportpropertieswidget.h"
-#include "properties/reportproperties.h"
-#include "qetapp.h"
-#include "qeticons.h"
-#include "qetproject.h"
-#include "ui/borderpropertieswidget.h"
-#include "ui/conductorpropertieswidget.h"
-#include "ui/reportpropertiewidget.h"
-#include "ui/titleblockpropertieswidget.h"
-#include "ui/xrefpropertieswidget.h"
+#include "../NameList/nameslist.h"
+#include "../bordertitleblock.h"
+#include "../exportpropertieswidget.h"
+#include "../properties/reportproperties.h"
+#include "../qetapp.h"
+#include "../qeticons.h"
+#include "../qetproject.h"
+#include "../borderpropertieswidget.h"
+#include "../conductorpropertieswidget.h"
+#include "../reportpropertiewidget.h"
+#include "../titleblockpropertieswidget.h"
+#include "../xrefpropertieswidget.h"
#include
#include
diff --git a/sources/configpages.h b/sources/ui/configpage/configpages.h
similarity index 97%
rename from sources/configpages.h
rename to sources/ui/configpage/configpages.h
index df8ce991d..20c71b6ba 100644
--- a/sources/configpages.h
+++ b/sources/ui/configpage/configpages.h
@@ -18,8 +18,8 @@
#ifndef CONFIG_PAGES_H
#define CONFIG_PAGES_H
#include "configpage.h"
-#include "ui/projectpropertiesdialog.h"
-#include "ui/titleblockpropertieswidget.h"
+#include "../projectpropertiesdialog.h"
+#include "../titleblockpropertieswidget.h"
#include
#include
diff --git a/sources/ui/configpage/generalconfigurationpage.h b/sources/ui/configpage/generalconfigurationpage.h
index 492ef8f68..a932fc71d 100644
--- a/sources/ui/configpage/generalconfigurationpage.h
+++ b/sources/ui/configpage/generalconfigurationpage.h
@@ -18,7 +18,7 @@
#ifndef GENERALCONFIGURATIONPAGE_H
#define GENERALCONFIGURATIONPAGE_H
-#include "../../configpage.h"
+#include "configpage.h"
#include
diff --git a/sources/projectconfigpages.cpp b/sources/ui/configpage/projectconfigpages.cpp
similarity index 97%
rename from sources/projectconfigpages.cpp
rename to sources/ui/configpage/projectconfigpages.cpp
index 547b6b9d5..b8aa4eb93 100644
--- a/sources/projectconfigpages.cpp
+++ b/sources/ui/configpage/projectconfigpages.cpp
@@ -17,19 +17,19 @@
*/
#include "projectconfigpages.h"
-#include "autoNum/numerotationcontext.h"
-#include "autoNum/ui/autonumberingmanagementw.h"
-#include "autoNum/ui/folioautonumbering.h"
-#include "autoNum/ui/formulaautonumberingw.h"
-#include "autoNum/ui/selectautonumw.h"
-#include "qeticons.h"
-#include "qetproject.h"
-#include "ui/borderpropertieswidget.h"
-#include "ui/conductorpropertieswidget.h"
-#include "ui/diagramcontextwidget.h"
-#include "ui/reportpropertiewidget.h"
-#include "ui/titleblockpropertieswidget.h"
-#include "ui/xrefpropertieswidget.h"
+#include "../autoNum/numerotationcontext.h"
+#include "../autoNum/ui/autonumberingmanagementw.h"
+#include "../autoNum/ui/folioautonumbering.h"
+#include "../autoNum/ui/formulaautonumberingw.h"
+#include "../autoNum/ui/selectautonumw.h"
+#include "../qeticons.h"
+#include "../qetproject.h"
+#include "../borderpropertieswidget.h"
+#include "../conductorpropertieswidget.h"
+#include "../diagramcontextwidget.h"
+#include "../reportpropertiewidget.h"
+#include "../titleblockpropertieswidget.h"
+#include "../xrefpropertieswidget.h"
//#include "ui_autonumberingmanagementw.h"
diff --git a/sources/projectconfigpages.h b/sources/ui/configpage/projectconfigpages.h
similarity index 100%
rename from sources/projectconfigpages.h
rename to sources/ui/configpage/projectconfigpages.h
diff --git a/sources/ui/projectpropertiesdialog.cpp b/sources/ui/projectpropertiesdialog.cpp
index b0cd2093d..5ee49b892 100644
--- a/sources/ui/projectpropertiesdialog.cpp
+++ b/sources/ui/projectpropertiesdialog.cpp
@@ -18,8 +18,8 @@
#include "projectpropertiesdialog.h"
#include "../configdialog.h"
-#include "../configpages.h"
-#include "../projectconfigpages.h"
+#include "configpage/configpages.h"
+#include "configpage/projectconfigpages.h"
#include