mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
-add class for store Xref properties
-add widget for edit it -make link betwen QET -> QETproject -> Diagram, for transmit the xrefproperties -xrefpropertie can save/load to xml and setting. -XRefItem don't use the properties yet git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2983 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -61,12 +61,16 @@ DEFINES += QET_ALLOW_OVERRIDE_CD_OPTION
|
||||
|
||||
TEMPLATE = app
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += sources sources/editor sources/titleblock sources/ui sources/qetgraphicsitem sources/richtext sources/factory
|
||||
INCLUDEPATH += sources sources/editor sources/titleblock sources/ui sources/qetgraphicsitem sources/richtext sources/factory sources/properties
|
||||
|
||||
# Fichiers sources
|
||||
HEADERS += sources/*.h sources/ui/*.h sources/editor/*.h sources/titleblock/*.h sources/richtext/*.h sources/qetgraphicsitem/*.h sources/factory/*.cpp
|
||||
HEADERS += sources/*.h sources/ui/*.h sources/editor/*.h sources/titleblock/*.h sources/richtext/*.h sources/qetgraphicsitem/*.h sources/factory/*.cpp \
|
||||
sources/properties/propertiesinterface.h \
|
||||
sources/properties/xrefproperties.h
|
||||
|
||||
SOURCES += sources/*.cpp sources/editor/*.cpp sources/titleblock/*.cpp sources/richtext/*.cpp sources/ui/*.cpp sources/qetgraphicsitem/*.cpp sources/factory/*.cpp
|
||||
SOURCES += sources/*.cpp sources/editor/*.cpp sources/titleblock/*.cpp sources/richtext/*.cpp sources/ui/*.cpp sources/qetgraphicsitem/*.cpp sources/factory/*.cpp \
|
||||
sources/properties/propertiesinterface.cpp \
|
||||
sources/properties/xrefproperties.cpp
|
||||
|
||||
# Liste des fichiers qui seront incorpores au binaire en tant que ressources Qt
|
||||
RESOURCES += qelectrotech.qrc
|
||||
@@ -82,7 +86,8 @@ QT += xml svg network sql
|
||||
|
||||
# UI DESIGNER FILES AND GENERATION SOURCES FILES
|
||||
FORMS += sources/richtext/addlinkdialog.ui sources/ui/*.ui \
|
||||
sources/ui/linksingleelementwidget.ui
|
||||
sources/ui/linksingleelementwidget.ui \
|
||||
sources/ui/xrefpropertieswidget.ui
|
||||
UI_SOURCES_DIR = sources/ui/
|
||||
UI_HEADERS_DIR = sources/ui/
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "qeticons.h"
|
||||
#include "exportpropertieswidget.h"
|
||||
#include "ui/reportpropertiewidget.h"
|
||||
#include "ui/xrefpropertieswidget.h"
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
@@ -53,6 +54,10 @@ NewDiagramPage::NewDiagramPage(QWidget *parent) : ConfigPage(parent) {
|
||||
rpw = new ReportPropertieWidget(QETDiagramEditor::defaultReportProperties());
|
||||
tab_widget->addTab(rpw, tr("Report de folio"));
|
||||
|
||||
// default properties of xref
|
||||
xrefpw = new XRefPropertiesWidget(QETDiagramEditor::defaultXRefProperties(), this);
|
||||
tab_widget->addTab(xrefpw, tr("R\351f\351rence crois\351es"));
|
||||
|
||||
QVBoxLayout *vlayout1 = new QVBoxLayout();
|
||||
vlayout1->addWidget(tab_widget);
|
||||
|
||||
@@ -80,6 +85,9 @@ void NewDiagramPage::applyConf() {
|
||||
|
||||
// default report propertie
|
||||
rpw->toSettings(settings, "diagrameditor/defaultreport");
|
||||
|
||||
// default xref properties
|
||||
xrefpw -> properties().toSettings(settings, "diagrameditor/defaultxref");
|
||||
}
|
||||
|
||||
/// @return l'icone de cette page
|
||||
|
||||
@@ -24,6 +24,7 @@ class ConductorPropertiesWidget;
|
||||
class TitleBlockPropertiesWidget;
|
||||
class ExportPropertiesWidget;
|
||||
class ReportPropertieWidget;
|
||||
class XRefPropertiesWidget;
|
||||
|
||||
/**
|
||||
This configuration page enables users to define the properties of new
|
||||
@@ -49,7 +50,9 @@ class NewDiagramPage : public ConfigPage {
|
||||
BorderPropertiesWidget *bpw; ///< Widget to edit default diagram dimensions
|
||||
TitleBlockPropertiesWidget *ipw; ///< Widget to edit default title block properties
|
||||
ConductorPropertiesWidget *cpw; ///< Widget to edit default conductor properties
|
||||
ReportPropertieWidget *rpw;///< Widget to edit default report label
|
||||
ReportPropertieWidget *rpw; ///< Widget to edit default report label
|
||||
XRefPropertiesWidget *xrefpw; ///< Widget to edit default xref properties
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1187,12 +1187,19 @@ QETProject *Diagram::project() const {
|
||||
}
|
||||
|
||||
/**
|
||||
@param project le nouveau projet auquel ce schema appartient ou 0 s'il
|
||||
s'agit d'un schema independant. Indiquer 0 pour rendre ce schema independant.
|
||||
*/
|
||||
* @brief Diagram::setProject
|
||||
* @param project: set parent project of this diagram or 0 if this diagram haven't got a parent project
|
||||
*/
|
||||
void Diagram::setProject(QETProject *project) {
|
||||
if (project_) {
|
||||
disconnect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
|
||||
disconnect (project_, SIGNAL(XRefPropertiesChanged(XRefProperties)), this, SIGNAL(XRefPropertiesChanged(XRefProperties)));
|
||||
}
|
||||
project_ = project;
|
||||
connect(project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
|
||||
if (project_) {
|
||||
connect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
|
||||
connect (project_, SIGNAL(XRefPropertiesChanged(XRefProperties)), this, SIGNAL(XRefPropertiesChanged(XRefProperties)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "qgimanager.h"
|
||||
#include "numerotationcontext.h"
|
||||
#include "qetproject.h"
|
||||
#include "properties/xrefproperties.h"
|
||||
|
||||
class Conductor;
|
||||
class CustomElement;
|
||||
@@ -102,7 +103,8 @@ class Diagram : public QGraphicsScene {
|
||||
virtual void keyReleaseEvent(QKeyEvent *);
|
||||
|
||||
public:
|
||||
QString defaultReportProperties () const {return project_->defaultReportProperties();}
|
||||
QString defaultReportProperties () const {return project_ -> defaultReportProperties();}
|
||||
XRefProperties defaultXRefProperties () const {return project_ -> defaultXrefProperties();}
|
||||
static bool clipboardMayContainDiagram();
|
||||
bool setNumerotation (NumerotationType, NumerotationContext);
|
||||
NumerotationContext getNumerotation (NumerotationType) const;
|
||||
@@ -210,6 +212,7 @@ class Diagram : public QGraphicsScene {
|
||||
/// Signal emitted when users wish to edit an element from the diagram
|
||||
void editElementRequired(const ElementsLocation &);
|
||||
void reportPropertiesChanged(QString);
|
||||
void XRefPropertiesChanged(XRefProperties);
|
||||
};
|
||||
Q_DECLARE_METATYPE(Diagram *)
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "titleblockpropertieswidget.h"
|
||||
#include <QtGui>
|
||||
#include "ui/reportpropertiewidget.h"
|
||||
#include "ui/xrefpropertieswidget.h"
|
||||
|
||||
/**
|
||||
Constructor
|
||||
@@ -261,6 +262,12 @@ void ProjectNewDiagramConfigPage::applyProjectConf() {
|
||||
modified_project = true;
|
||||
}
|
||||
|
||||
XRefProperties new_xref_properties = xref_ -> properties();
|
||||
if (project_ -> defaultXrefProperties() != new_xref_properties) {
|
||||
project_ -> setDefaultXRefProperties(new_xref_properties);
|
||||
modified_project = true;
|
||||
}
|
||||
|
||||
if (modified_project) {
|
||||
project_ -> setModified(modified_project);
|
||||
}
|
||||
@@ -281,6 +288,7 @@ void ProjectNewDiagramConfigPage::initWidgets() {
|
||||
conductor_ = new ConductorPropertiesWidget();
|
||||
conductor_ -> setContentsMargins(0, 0, 0, 0);
|
||||
report_ = new ReportPropertieWidget("_");
|
||||
xref_ = new XRefPropertiesWidget();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,11 +302,11 @@ void ProjectNewDiagramConfigPage::initLayout() {
|
||||
QVBoxLayout *diagram_layout = new QVBoxLayout(diagram_widget);
|
||||
diagram_layout -> addWidget(border_);
|
||||
diagram_layout -> addWidget(titleblock_);
|
||||
tab_widget->addTab(diagram_widget, tr("Sch\351ma"));
|
||||
|
||||
tab_widget->addTab(conductor_, tr("Conducteur"));
|
||||
|
||||
tab_widget->addTab(report_, tr("Report de folio"));
|
||||
tab_widget -> addTab (diagram_widget, tr("Sch\351ma"));
|
||||
tab_widget -> addTab (conductor_, tr("Conducteur"));
|
||||
tab_widget -> addTab (report_, tr("Report de folio"));
|
||||
tab_widget -> addTab (xref_, tr("R\351f\351rence crois\351es"));
|
||||
|
||||
QVBoxLayout *vlayout1 = new QVBoxLayout();
|
||||
vlayout1->addWidget(tab_widget);
|
||||
@@ -310,14 +318,14 @@ void ProjectNewDiagramConfigPage::initLayout() {
|
||||
Read properties from the edited project then fill widgets with them.
|
||||
*/
|
||||
void ProjectNewDiagramConfigPage::readValuesFromProject() {
|
||||
border_ -> setEditedBorder(project_ -> defaultBorderProperties());
|
||||
conductor_ -> setConductorProperties(project_ -> defaultConductorProperties());
|
||||
titleblock_ -> setTitleBlockProperties(project_ -> defaultTitleBlockProperties());
|
||||
report_->setReportProperties(project_->defaultReportProperties());
|
||||
border_ -> setEditedBorder (project_ -> defaultBorderProperties());
|
||||
conductor_ -> setConductorProperties (project_ -> defaultConductorProperties());
|
||||
titleblock_ -> setTitleBlockProperties (project_ -> defaultTitleBlockProperties());
|
||||
report_ -> setReportProperties (project_ -> defaultReportProperties());
|
||||
xref_ -> setProperties (project_ -> defaultXrefProperties());
|
||||
}
|
||||
|
||||
/**
|
||||
Set the content of this page read only if the project is read only,
|
||||
editable if the project is editable.
|
||||
*/
|
||||
void ProjectNewDiagramConfigPage::adjustReadOnly() {
|
||||
@@ -325,4 +333,5 @@ void ProjectNewDiagramConfigPage::adjustReadOnly() {
|
||||
border_ -> setReadOnly(is_read_only);
|
||||
titleblock_ -> setReadOnly(is_read_only);
|
||||
conductor_ -> setReadOnly(is_read_only);
|
||||
xref_ -> setReadOnly(is_read_only);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ class TitleBlockPropertiesWidget;
|
||||
class ConductorPropertiesWidget;
|
||||
class DiagramContextWidget;
|
||||
class ReportPropertieWidget;
|
||||
class XRefPropertiesWidget;
|
||||
|
||||
/**
|
||||
This class, derived from ConfigPage, aims at providing the basic skeleton
|
||||
@@ -144,6 +145,7 @@ class ProjectNewDiagramConfigPage : public ProjectConfigPage {
|
||||
TitleBlockPropertiesWidget *titleblock_;
|
||||
ConductorPropertiesWidget *conductor_;
|
||||
ReportPropertieWidget *report_;
|
||||
XRefPropertiesWidget *xref_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
22
sources/properties/propertiesinterface.cpp
Normal file
22
sources/properties/propertiesinterface.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Copyright 2006-2014 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 "propertiesinterface.h"
|
||||
|
||||
PropertiesInterface::PropertiesInterface()
|
||||
{
|
||||
}
|
||||
41
sources/properties/propertiesinterface.h
Normal file
41
sources/properties/propertiesinterface.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2006-2014 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/>.
|
||||
*/
|
||||
#ifndef PROPERTIESINTERFACE_H
|
||||
#define PROPERTIESINTERFACE_H
|
||||
|
||||
#include <QString>
|
||||
#include <QSettings>
|
||||
#include <QDomElement>
|
||||
|
||||
/**
|
||||
* @brief The PropertiesInterface class
|
||||
* This class is an interface for have common way to use properties in QElectroTech
|
||||
*/
|
||||
class PropertiesInterface
|
||||
{
|
||||
public:
|
||||
PropertiesInterface();
|
||||
// Save/load properties to setting file. QString is use for prefix a word befor the name of each paramètre
|
||||
virtual void toSettings (QSettings &settings, const QString = QString()) const =0;
|
||||
virtual void fromSettings (const QSettings &settings, const QString = QString()) =0;
|
||||
// Save/load properties to xml element
|
||||
virtual void toXml (QDomElement &xml_element) const =0;
|
||||
virtual void fromXml (const QDomElement &xml_element) =0;
|
||||
};
|
||||
|
||||
#endif // PROPERTIESINTERFACE_H
|
||||
74
sources/properties/xrefproperties.cpp
Normal file
74
sources/properties/xrefproperties.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright 2006-2014 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 "xrefproperties.h"
|
||||
|
||||
/**
|
||||
* @brief XRefProperties::XRefProperties
|
||||
* Default Constructor
|
||||
*/
|
||||
XRefProperties::XRefProperties()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XRefProperties::toSettings
|
||||
* Save to settings
|
||||
* @param settings: QSettings to use
|
||||
* @param prefix: prefix before properties name
|
||||
*/
|
||||
void XRefProperties::toSettings(QSettings &settings, const QString prefix) const {
|
||||
settings.setValue(prefix + "showpowerctc", m_show_power_ctc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XRefProperties::fromSettings
|
||||
* load from settings
|
||||
* @param settings: QSettings to use
|
||||
* @param prefix: prefix before properties name
|
||||
*/
|
||||
void XRefProperties::fromSettings(const QSettings &settings, const QString prefix) {
|
||||
m_show_power_ctc = settings.value(prefix + "showpowerctc", false).toBool();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XRefProperties::toXml
|
||||
* Save to xml
|
||||
* @param xml_element: QDomElement to use for saving
|
||||
*/
|
||||
void XRefProperties::toXml(QDomElement &xml_element) const {
|
||||
xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "fasle");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XRefProperties::fromXml
|
||||
* Load from xml
|
||||
* @param xml_element: QDomElement to use for load
|
||||
*/
|
||||
void XRefProperties::fromXml(const QDomElement &xml_element) {
|
||||
m_show_power_ctc = xml_element.attribute("showpowerctc") == "true";
|
||||
}
|
||||
|
||||
bool XRefProperties::operator ==(const XRefProperties &xrp) const{
|
||||
return (m_show_power_ctc == xrp.m_show_power_ctc);
|
||||
}
|
||||
|
||||
bool XRefProperties::operator !=(const XRefProperties &xrp) const {
|
||||
return (! (*this == xrp));
|
||||
}
|
||||
|
||||
|
||||
47
sources/properties/xrefproperties.h
Normal file
47
sources/properties/xrefproperties.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright 2006-2014 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/>.
|
||||
*/
|
||||
#ifndef XREFPROPERTIES_H
|
||||
#define XREFPROPERTIES_H
|
||||
|
||||
#include "propertiesinterface.h"
|
||||
|
||||
/**
|
||||
* @brief The XRefProperties class
|
||||
* this class store properties used by XrefItem
|
||||
*/
|
||||
class XRefProperties : public PropertiesInterface
|
||||
{
|
||||
public:
|
||||
XRefProperties();
|
||||
|
||||
virtual void toSettings (QSettings &settings, const QString = QString()) const;
|
||||
virtual void fromSettings (const QSettings &settings, const QString = QString());
|
||||
virtual void toXml (QDomElement &xml_element) const;
|
||||
virtual void fromXml (const QDomElement &xml_element);
|
||||
|
||||
bool operator == (const XRefProperties &xrp) const;
|
||||
bool operator != (const XRefProperties &xrp) const;
|
||||
|
||||
void setShowPowerContac (const bool a) {m_show_power_ctc = a;}
|
||||
bool showPowerContact () const {return m_show_power_ctc;}
|
||||
|
||||
private:
|
||||
bool m_show_power_ctc;
|
||||
};
|
||||
|
||||
#endif // XREFPROPERTIES_H
|
||||
@@ -651,17 +651,20 @@ void QETDiagramEditor::saveCurrentDiagram() {
|
||||
}
|
||||
|
||||
/**
|
||||
Cree un nouveau projet vide
|
||||
*/
|
||||
* @brief QETDiagramEditor::newProject
|
||||
* Create an empty project
|
||||
* @return
|
||||
*/
|
||||
bool QETDiagramEditor::newProject() {
|
||||
// cree un nouveau projet sans schema
|
||||
// create new project without diagram
|
||||
QETProject *new_project = new QETProject(0);
|
||||
|
||||
// transmet les proprietes par defaut des nouveaux schemas
|
||||
new_project -> setDefaultBorderProperties(defaultBorderProperties());
|
||||
new_project -> setDefaultConductorProperties(defaultConductorProperties());
|
||||
new_project -> setDefaultTitleBlockProperties(defaultTitleBlockProperties());
|
||||
new_project -> setDefaultReportProperties(defaultReportProperties());
|
||||
// Set default properties for new diagram
|
||||
new_project -> setDefaultBorderProperties (defaultBorderProperties());
|
||||
new_project -> setDefaultConductorProperties (defaultConductorProperties());
|
||||
new_project -> setDefaultTitleBlockProperties (defaultTitleBlockProperties());
|
||||
new_project -> setDefaultReportProperties (defaultReportProperties());
|
||||
new_project -> setDefaultXRefProperties (defaultXRefProperties());
|
||||
|
||||
// add new diagram
|
||||
new_project -> addNewDiagram();
|
||||
@@ -2084,3 +2087,13 @@ QString QETDiagramEditor::defaultReportProperties() {
|
||||
QSettings &settings= QETApp::settings();
|
||||
return(settings.value("diagrameditor/defaultreportlabel", "%f-%l%c").toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETDiagramEditor::defaultXRefProperties
|
||||
* @return the default setting for Xref
|
||||
*/
|
||||
XRefProperties QETDiagramEditor::defaultXRefProperties() {
|
||||
XRefProperties properties;
|
||||
properties.fromSettings(QETApp::settings(), "diagrameditor/defaultxref");
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "conductorproperties.h"
|
||||
#include "titleblockproperties.h"
|
||||
#include "exportproperties.h"
|
||||
#include "properties/xrefproperties.h"
|
||||
|
||||
class QETProject;
|
||||
class QETResult;
|
||||
class ProjectView;
|
||||
@@ -63,6 +65,7 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
static ExportProperties defaultExportProperties();
|
||||
static ExportProperties defaultPrintProperties();
|
||||
static QString defaultReportProperties();
|
||||
static XRefProperties defaultXRefProperties();
|
||||
|
||||
protected:
|
||||
void actions();
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "basicmoveelementshandler.h"
|
||||
#include "qetmessagebox.h"
|
||||
#include "titleblocktemplate.h"
|
||||
|
||||
#include "ui/dialogwaiting.h"
|
||||
|
||||
QString QETProject::integration_category_name = "import";
|
||||
@@ -452,6 +451,15 @@ void QETProject::setDefaultReportProperties(const QString &properties) {
|
||||
emit reportPropertiesChanged(properties);
|
||||
}
|
||||
|
||||
XRefProperties QETProject::defaultXrefProperties() const{
|
||||
return m_default_xref_properties;
|
||||
}
|
||||
|
||||
void QETProject::setDefaultXRefProperties(const XRefProperties &properties) {
|
||||
m_default_xref_properties = properties;
|
||||
emit XRefPropertiesChanged(properties);
|
||||
}
|
||||
|
||||
/**
|
||||
@return un document XML representant le projet
|
||||
*/
|
||||
@@ -481,7 +489,7 @@ QDomDocument QETProject::toXml() {
|
||||
writeProjectPropertiesXml(project_properties);
|
||||
project_root.appendChild(project_properties);
|
||||
|
||||
// proprietes pour les nouveaux schemas
|
||||
// Properties for news diagrams
|
||||
QDomElement new_diagrams_properties = xml_doc.createElement("newdiagrams");
|
||||
writeDefaultPropertiesXml(new_diagrams_properties);
|
||||
project_root.appendChild(new_diagrams_properties);
|
||||
@@ -1139,29 +1147,27 @@ void QETProject::writeProjectPropertiesXml(QDomElement &xml_element) {
|
||||
}
|
||||
|
||||
/**
|
||||
Charge les proprietes par defaut des nouveaux schemas depuis la description
|
||||
XML du projet :
|
||||
* dimensions
|
||||
* contenu du cartouche
|
||||
* conducteurs par defaut
|
||||
*/
|
||||
* @brief QETProject::readDefaultPropertiesXml
|
||||
* load default properties for new diagram, found in the xml of this project
|
||||
* or by default find in the QElectroTech global conf
|
||||
*/
|
||||
void QETProject::readDefaultPropertiesXml() {
|
||||
// repere l'element XML decrivant les proprietes des nouveaux schemas
|
||||
// Find xml element where is stored properties for new diagram
|
||||
QDomNodeList newdiagrams_nodes = document_root_.elementsByTagName("newdiagrams");
|
||||
if (newdiagrams_nodes.isEmpty()) return;
|
||||
|
||||
QDomElement newdiagrams_elmt = newdiagrams_nodes.at(0).toElement();
|
||||
|
||||
// par defaut, les valeurs sont celles de la configuration QElectroTech
|
||||
// By default, use value find in the global conf of QElectroTech
|
||||
default_border_properties_ = QETDiagramEditor::defaultBorderProperties();
|
||||
default_titleblock_properties_ = QETDiagramEditor::defaultTitleBlockProperties();
|
||||
default_conductor_properties_ = QETDiagramEditor::defaultConductorProperties();
|
||||
default_report_properties_ = QETDiagramEditor::defaultReportProperties();
|
||||
m_default_xref_properties = QETDiagramEditor::defaultXRefProperties();
|
||||
|
||||
// lecture des valeurs indiquees dans le projet
|
||||
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt;
|
||||
//Read values indicate in project
|
||||
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt;
|
||||
|
||||
// recherche des elements XML concernant les dimensions, le cartouche et les conducteurs
|
||||
for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling()) {
|
||||
QDomElement child_elmt = child.toElement();
|
||||
if (child_elmt.isNull()) continue;
|
||||
@@ -1173,6 +1179,8 @@ void QETProject::readDefaultPropertiesXml() {
|
||||
conductors_elmt = child_elmt;
|
||||
} else if (child_elmt.tagName() == "report") {
|
||||
report_elmt = child_elmt;
|
||||
} else if (child_elmt.tagName() == "xref") {
|
||||
xref_elmt = child_elmt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1181,30 +1189,34 @@ void QETProject::readDefaultPropertiesXml() {
|
||||
if (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_elmt);
|
||||
if (!conductors_elmt.isNull()) default_conductor_properties_.fromXml(conductors_elmt);
|
||||
if (!report_elmt.isNull()) setDefaultReportProperties(report_elmt.attribute("label"));
|
||||
if (!xref_elmt.isNull()) m_default_xref_properties.fromXml(xref_elmt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Exporte les proprietes par defaut des nouveaux schemas dans l'element XML :
|
||||
* dimensions
|
||||
* contenu du cartouche
|
||||
* conducteurs par defaut
|
||||
@param xml_element Element XML sous lequel seront exportes les proprietes
|
||||
par defaut des nouveaux schemas
|
||||
*/
|
||||
* @brief QETProject::writeDefaultPropertiesXml
|
||||
* Export all defaults properties used by a new diagram and his content
|
||||
* #size of border
|
||||
* #content of titleblock
|
||||
* #default conductor
|
||||
* #defaut folio report
|
||||
* #default Xref
|
||||
* @param xml_element xml element to use for store default propertie.
|
||||
*/
|
||||
void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
||||
QDomDocument xml_document = xml_element.ownerDocument();
|
||||
|
||||
// exporte les dimensions
|
||||
// export size of border
|
||||
QDomElement border_elmt = xml_document.createElement("border");
|
||||
default_border_properties_.toXml(border_elmt);
|
||||
xml_element.appendChild(border_elmt);
|
||||
|
||||
// exporte le contenu du cartouche
|
||||
// export content of titleblock
|
||||
QDomElement titleblock_elmt = xml_document.createElement("inset");
|
||||
default_titleblock_properties_.toXml(titleblock_elmt);
|
||||
xml_element.appendChild(titleblock_elmt);
|
||||
|
||||
// exporte le type de conducteur par defaut
|
||||
// exporte default conductor
|
||||
QDomElement conductor_elmt = xml_document.createElement("conductors");
|
||||
default_conductor_properties_.toXml(conductor_elmt);
|
||||
xml_element.appendChild(conductor_elmt);
|
||||
@@ -1213,6 +1225,11 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
||||
QDomElement report_elmt = xml_document.createElement("report");
|
||||
report_elmt.setAttribute("label", defaultReportProperties());
|
||||
xml_element.appendChild(report_elmt);
|
||||
|
||||
// export default XRef properties
|
||||
QDomElement xref_elmt = xml_document.createElement("xref");
|
||||
defaultXrefProperties().toXml(xref_elmt);
|
||||
xml_element.appendChild(xref_elmt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "conductorproperties.h"
|
||||
#include "titleblockproperties.h"
|
||||
#include "templatescollection.h"
|
||||
#include "properties/xrefproperties.h"
|
||||
|
||||
class Diagram;
|
||||
class ElementsCollection;
|
||||
@@ -99,6 +100,8 @@ class QETProject : public QObject {
|
||||
void setDefaultConductorProperties(const ConductorProperties &);
|
||||
QString defaultReportProperties() const;
|
||||
void setDefaultReportProperties (const QString &properties);
|
||||
XRefProperties defaultXrefProperties () const;
|
||||
void setDefaultXRefProperties(const XRefProperties &properties);
|
||||
QDomDocument toXml();
|
||||
bool close();
|
||||
QETResult write();
|
||||
@@ -144,6 +147,7 @@ class QETProject : public QObject {
|
||||
void diagramUsedTemplate(TitleBlockTemplatesCollection *, const QString &);
|
||||
void readOnlyChanged(QETProject *, bool);
|
||||
void reportPropertiesChanged(QString);
|
||||
void XRefPropertiesChanged (XRefProperties);
|
||||
|
||||
private slots:
|
||||
void updateDiagramsFolioData();
|
||||
@@ -201,6 +205,8 @@ class QETProject : public QObject {
|
||||
TitleBlockProperties default_titleblock_properties_;
|
||||
/// Default report properties
|
||||
QString default_report_properties_;
|
||||
/// Default xref properties
|
||||
XRefProperties m_default_xref_properties;
|
||||
/// Embedded title block templates collection
|
||||
TitleBlockTemplatesProjectCollection titleblocks_;
|
||||
/// project-wide variables that will be made available to child diagrams
|
||||
|
||||
80
sources/ui/xrefpropertieswidget.cpp
Normal file
80
sources/ui/xrefpropertieswidget.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright 2006-2014 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 "xrefpropertieswidget.h"
|
||||
#include "ui_xrefpropertieswidget.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
/**
|
||||
* @brief XRefPropertiesWidget::XRefPropertiesWidget
|
||||
* Default constructor
|
||||
* @param properties: properties to use
|
||||
* @param parent: parent widget
|
||||
*/
|
||||
XRefPropertiesWidget::XRefPropertiesWidget(XRefProperties properties, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::XRefPropertiesWidget),
|
||||
m_properties(properties)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XRefPropertiesWidget::~XRefPropertiesWidget
|
||||
* Default destructor
|
||||
*/
|
||||
XRefPropertiesWidget::~XRefPropertiesWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XRefPropertiesWidget::setProperties
|
||||
* set new properties for this widget
|
||||
* @param properties
|
||||
*/
|
||||
void XRefPropertiesWidget::setProperties(const XRefProperties &properties) {
|
||||
m_properties = properties;
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XRefPropertiesWidget::properties
|
||||
* @return the propertie edited by this widget
|
||||
*/
|
||||
XRefProperties XRefPropertiesWidget::properties() {
|
||||
m_properties.setShowPowerContac(ui->cb_show_power->isChecked());
|
||||
return m_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XRefPropertiesWidget::setReadOnly
|
||||
* Set all of this widget disable if true
|
||||
* @param ro
|
||||
*/
|
||||
void XRefPropertiesWidget::setReadOnly(bool ro) {
|
||||
ui->cb_show_power->setDisabled(ro);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XRefPropertiesWidget::updateDisplay
|
||||
* Update display with the content of the properties
|
||||
*/
|
||||
void XRefPropertiesWidget::updateDisplay() {
|
||||
ui->cb_show_power->setChecked(m_properties.showPowerContact());
|
||||
}
|
||||
53
sources/ui/xrefpropertieswidget.h
Normal file
53
sources/ui/xrefpropertieswidget.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright 2006-2014 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/>.
|
||||
*/
|
||||
#ifndef XREFPROPERTIESWIDGET_H
|
||||
#define XREFPROPERTIESWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "properties/xrefproperties.h"
|
||||
|
||||
namespace Ui {
|
||||
class XRefPropertiesWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The XRefPropertiesWidget class
|
||||
* This class provide a widget to edit the XRefProperties
|
||||
*/
|
||||
class XRefPropertiesWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
XRefPropertiesWidget(XRefProperties properties = XRefProperties(), QWidget *parent = 0);
|
||||
~XRefPropertiesWidget();
|
||||
|
||||
void setProperties (const XRefProperties &properties);
|
||||
XRefProperties properties();
|
||||
|
||||
void setReadOnly (bool = true);
|
||||
|
||||
private:
|
||||
void updateDisplay();
|
||||
|
||||
private:
|
||||
Ui::XRefPropertiesWidget *ui;
|
||||
XRefProperties m_properties;
|
||||
};
|
||||
|
||||
#endif // XREFPROPERTIESWIDGET_H
|
||||
41
sources/ui/xrefpropertieswidget.ui
Normal file
41
sources/ui/xrefpropertieswidget.ui
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>XRefPropertiesWidget</class>
|
||||
<widget class="QWidget" name="XRefPropertiesWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_show_power">
|
||||
<property name="text">
|
||||
<string>Afficher les contacts de puissance dans la croix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>253</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user