mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Conductor autonumerotation: Remove one autonum per diagram and add global autonums for the project.
several diagram can share the same autonumerotation. This is first step, need to be improved and readd some feature (disabled for first step). git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3239 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
d1730f39bd
commit
6fce7010f8
@ -47,13 +47,13 @@ QColor Diagram::background_color = Qt::white;
|
|||||||
*/
|
*/
|
||||||
Diagram::Diagram(QObject *parent) :
|
Diagram::Diagram(QObject *parent) :
|
||||||
QGraphicsScene(parent),
|
QGraphicsScene(parent),
|
||||||
|
project_(0),
|
||||||
|
diagram_qet_version_(-1),
|
||||||
draw_grid_(true),
|
draw_grid_(true),
|
||||||
use_border_(true),
|
use_border_(true),
|
||||||
draw_terminals_(true),
|
draw_terminals_(true),
|
||||||
draw_colored_conductors_(true),
|
draw_colored_conductors_(true),
|
||||||
project_(0),
|
read_only_(false)
|
||||||
read_only_(false),
|
|
||||||
diagram_qet_version_(-1)
|
|
||||||
{
|
{
|
||||||
qgi_manager_ = new QGIManager(this);
|
qgi_manager_ = new QGIManager(this);
|
||||||
setBackgroundBrush(Qt::white);
|
setBackgroundBrush(Qt::white);
|
||||||
@ -204,6 +204,22 @@ void Diagram::keyReleaseEvent(QKeyEvent *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Diagram::conductorsAutonumName
|
||||||
|
* @return the name of autonum to use.
|
||||||
|
*/
|
||||||
|
QString Diagram::conductorsAutonumName() const {
|
||||||
|
return m_conductors_autonum_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Diagram::setConductorsAutonumName
|
||||||
|
* @param name, name of autonum to use.
|
||||||
|
*/
|
||||||
|
void Diagram::setConductorsAutonumName(const QString &name) {
|
||||||
|
m_conductors_autonum_name= name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Exporte le schema vers une image
|
Exporte le schema vers une image
|
||||||
@return Une QImage representant le schema
|
@return Une QImage representant le schema
|
||||||
@ -327,13 +343,6 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
QDomElement default_conductor = document.createElement("defaultconductor");
|
QDomElement default_conductor = document.createElement("defaultconductor");
|
||||||
defaultConductorProperties.toXml(default_conductor);
|
defaultConductorProperties.toXml(default_conductor);
|
||||||
racine.appendChild(default_conductor);
|
racine.appendChild(default_conductor);
|
||||||
|
|
||||||
//autonumerotation of conductor
|
|
||||||
if (!getNumerotation(Diagram::Conductors).isEmpty()) {
|
|
||||||
QDomElement autonum = document.createElement("autonum");
|
|
||||||
autonum.appendChild(getNumerotation(Diagram::Conductors).toXml(document, "conductor"));
|
|
||||||
racine.appendChild(autonum);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
document.appendChild(racine);
|
document.appendChild(racine);
|
||||||
|
|
||||||
@ -504,16 +513,6 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
if (!default_conductor_elmt.isNull()) {
|
if (!default_conductor_elmt.isNull()) {
|
||||||
defaultConductorProperties.fromXml(default_conductor_elmt);
|
defaultConductorProperties.fromXml(default_conductor_elmt);
|
||||||
}
|
}
|
||||||
// find the first element autonum
|
|
||||||
QDomElement num_auto = root.firstChildElement("autonum");
|
|
||||||
if (!num_auto.isNull()) {
|
|
||||||
QDomElement num_conductor = num_auto.firstChildElement("conductor");
|
|
||||||
//set the auto-numerotation of conductor
|
|
||||||
if (!num_conductor.isNull()) {
|
|
||||||
NumerotationContext nc(num_conductor);
|
|
||||||
setNumerotation(Diagram::Conductors, nc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// si la racine n'a pas d'enfant : le chargement est fini (schema vide)
|
// si la racine n'a pas d'enfant : le chargement est fini (schema vide)
|
||||||
|
@ -58,63 +58,72 @@ class Diagram : public QGraphicsScene {
|
|||||||
private:
|
private:
|
||||||
Diagram(const Diagram &diagram);
|
Diagram(const Diagram &diagram);
|
||||||
|
|
||||||
// attributes
|
// ATTRIBUTES
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Represents available options when rendering a particular diagram:
|
Represents available options when rendering a particular diagram:
|
||||||
* EmptyBorder: display border only
|
* EmptyBorder: display border only
|
||||||
* TitleBlock: display title block
|
* TitleBlock: display title block
|
||||||
* Columns: display columns
|
* Columns: display columns
|
||||||
*/
|
*/
|
||||||
enum BorderOptions { EmptyBorder, TitleBlock, Columns };
|
enum BorderOptions { EmptyBorder, TitleBlock, Columns };
|
||||||
/// Represents available option of Numerotation type.
|
/// Represents available option of Numerotation type.
|
||||||
enum NumerotationType { Conductors };
|
enum NumerotationType { Conductors };
|
||||||
/// Default properties for new conductors
|
/// Default properties for new conductors
|
||||||
ConductorProperties defaultConductorProperties;
|
ConductorProperties defaultConductorProperties;
|
||||||
/// Diagram dimensions and title block
|
/// Diagram dimensions and title block
|
||||||
BorderTitleBlock border_and_titleblock;
|
BorderTitleBlock border_and_titleblock;
|
||||||
/// abscissa grid step size
|
/// abscissa grid step size
|
||||||
static const int xGrid;
|
static const int xGrid;
|
||||||
/// ordinate grid step size
|
/// ordinate grid step size
|
||||||
static const int yGrid;
|
static const int yGrid;
|
||||||
/// margin around the diagram
|
/// margin around the diagram
|
||||||
static const qreal margin;
|
static const qreal margin;
|
||||||
/// background color of diagram
|
/// background color of diagram
|
||||||
static QColor background_color;
|
static QColor background_color;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGraphicsLineItem *conductor_setter_;
|
QGraphicsLineItem *conductor_setter_;
|
||||||
ElementsMover *elements_mover_;
|
ElementsMover *elements_mover_;
|
||||||
ElementTextsMover *element_texts_mover_;
|
ElementTextsMover *element_texts_mover_;
|
||||||
bool draw_grid_;
|
QGIManager *qgi_manager_;
|
||||||
bool use_border_;
|
QETProject *project_;
|
||||||
QGIManager *qgi_manager_;
|
|
||||||
bool draw_terminals_;
|
|
||||||
bool draw_colored_conductors_;
|
|
||||||
QDomDocument xml_document_;
|
|
||||||
QETProject *project_;
|
|
||||||
bool read_only_;
|
|
||||||
qreal diagram_qet_version_;
|
|
||||||
QHash <NumerotationType, NumerotationContext > numerotation_;
|
|
||||||
|
|
||||||
// methods
|
QDomDocument xml_document_;
|
||||||
|
|
||||||
|
qreal diagram_qet_version_;
|
||||||
|
|
||||||
|
bool draw_grid_;
|
||||||
|
bool use_border_;
|
||||||
|
bool draw_terminals_;
|
||||||
|
bool draw_colored_conductors_;
|
||||||
|
bool read_only_;
|
||||||
|
|
||||||
|
QString m_conductors_autonum_name;
|
||||||
|
|
||||||
|
// METHODS
|
||||||
protected:
|
protected:
|
||||||
virtual void drawBackground(QPainter *, const QRectF &);
|
virtual void drawBackground(QPainter *, const QRectF &);
|
||||||
virtual void keyPressEvent(QKeyEvent *);
|
virtual void keyPressEvent(QKeyEvent *);
|
||||||
virtual void keyReleaseEvent(QKeyEvent *);
|
virtual void keyReleaseEvent(QKeyEvent *);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString defaultReportProperties () const {return project_ -> defaultReportProperties();}
|
//methods related to xref properties
|
||||||
XRefProperties defaultXRefProperties (const QString &str) const {return project_ -> defaultXRefProperties(str);}
|
QString defaultReportProperties () const {return project_ -> defaultReportProperties();}
|
||||||
static bool clipboardMayContainDiagram();
|
XRefProperties defaultXRefProperties (const QString &str) const {return project_ -> defaultXRefProperties(str);}
|
||||||
bool setNumerotation (NumerotationType, NumerotationContext);
|
|
||||||
NumerotationContext getNumerotation (NumerotationType) const;
|
|
||||||
|
|
||||||
// methods related to parent project
|
//methods related to autonum
|
||||||
QETProject *project() const;
|
QString conductorsAutonumName() const;
|
||||||
void setProject(QETProject *);
|
void setConductorsAutonumName(const QString &name);
|
||||||
int folioIndex() const;
|
|
||||||
qreal declaredQElectroTechVersion(bool = true) const;
|
static bool clipboardMayContainDiagram();
|
||||||
void showMe() {emit showDiagram(this);}
|
|
||||||
|
// methods related to parent project
|
||||||
|
QETProject *project() const;
|
||||||
|
void setProject(QETProject *);
|
||||||
|
int folioIndex() const;
|
||||||
|
qreal declaredQElectroTechVersion(bool = true) const;
|
||||||
|
void showMe() {emit showDiagram(this);}
|
||||||
|
|
||||||
// methods related to read only mode
|
// methods related to read only mode
|
||||||
bool isReadOnly() const;
|
bool isReadOnly() const;
|
||||||
@ -217,31 +226,6 @@ class Diagram : public QGraphicsScene {
|
|||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(Diagram *)
|
Q_DECLARE_METATYPE(Diagram *)
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Diagram::setNumerotation, store a numerotation type
|
|
||||||
* @return true if storage is available
|
|
||||||
*/
|
|
||||||
inline bool Diagram::setNumerotation(Diagram::NumerotationType type, NumerotationContext context) {
|
|
||||||
switch (type) {
|
|
||||||
case Conductors:
|
|
||||||
numerotation_.insert(type, context);
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Diagram::getNumerotation
|
|
||||||
* @return the NumerotationContext associated with the key.
|
|
||||||
* If numerotation_ contains no item with the key, the function returns a default-constructed NumerotationContext
|
|
||||||
*/
|
|
||||||
inline NumerotationContext Diagram::getNumerotation(Diagram::NumerotationType type) const {
|
|
||||||
return numerotation_.value(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Display or hide the conductor setter, i.e. a dashed conductor stub which appears when creating a conductor between two terminals.
|
Display or hide the conductor setter, i.e. a dashed conductor stub which appears when creating a conductor between two terminals.
|
||||||
@param pf true pour ajouter le poseur de conducteur, false pour l'enlever
|
@param pf true pour ajouter le poseur de conducteur, false pour l'enlever
|
||||||
|
@ -147,22 +147,22 @@ class AddShapeCommand : public QUndoCommand {
|
|||||||
class AddConductorCommand : public QUndoCommand {
|
class AddConductorCommand : public QUndoCommand {
|
||||||
// constructors, destructor
|
// constructors, destructor
|
||||||
public:
|
public:
|
||||||
AddConductorCommand(Diagram *, Conductor *, QUndoCommand * = 0);
|
AddConductorCommand(Diagram *, Conductor *, QUndoCommand * = 0);
|
||||||
virtual ~AddConductorCommand();
|
virtual ~AddConductorCommand();
|
||||||
private:
|
private:
|
||||||
AddConductorCommand(const AddConductorCommand &);
|
AddConductorCommand(const AddConductorCommand &);
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
virtual void undo();
|
virtual void undo();
|
||||||
virtual void redo();
|
virtual void redo();
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
private:
|
private:
|
||||||
/// added conductor
|
/// added conductor
|
||||||
Conductor *conductor;
|
Conductor *conductor;
|
||||||
/// diagram the conductor is added to
|
/// diagram the conductor is added to
|
||||||
Diagram *diagram;
|
Diagram *diagram;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1289,7 +1289,6 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
context_menu -> addAction(paste_here);
|
context_menu -> addAction(paste_here);
|
||||||
context_menu -> addSeparator();
|
context_menu -> addSeparator();
|
||||||
context_menu -> addAction(qde -> infos_diagram);
|
context_menu -> addAction(qde -> infos_diagram);
|
||||||
context_menu -> addAction(qde -> prj_diagramNum);
|
|
||||||
context_menu -> addActions(qde -> m_row_column_actions_group.actions());
|
context_menu -> addActions(qde -> m_row_column_actions_group.actions());
|
||||||
} else {
|
} else {
|
||||||
context_menu -> addAction(qde -> cut);
|
context_menu -> addAction(qde -> cut);
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include "ui/reportpropertiewidget.h"
|
#include "ui/reportpropertiewidget.h"
|
||||||
#include "ui/xrefpropertieswidget.h"
|
#include "ui/xrefpropertieswidget.h"
|
||||||
|
#include "selectautonumw.h"
|
||||||
|
#include "numerotationcontext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor
|
Constructor
|
||||||
@ -89,6 +91,8 @@ void ProjectConfigPage::init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//######################################################################################//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor
|
Constructor
|
||||||
@param project Project this page is editing.
|
@param project Project this page is editing.
|
||||||
@ -201,6 +205,8 @@ void ProjectMainConfigPage::adjustReadOnly() {
|
|||||||
title_value_ -> setReadOnly(is_read_only);
|
title_value_ -> setReadOnly(is_read_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//######################################################################################//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor
|
Constructor
|
||||||
@param project Project this page is editing.
|
@param project Project this page is editing.
|
||||||
@ -335,3 +341,134 @@ void ProjectNewDiagramConfigPage::adjustReadOnly() {
|
|||||||
conductor_ -> setReadOnly(is_read_only);
|
conductor_ -> setReadOnly(is_read_only);
|
||||||
xref_ -> setReadOnly(is_read_only);
|
xref_ -> setReadOnly(is_read_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//######################################################################################//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::ProjectAutoNumConfigPage
|
||||||
|
* Default constructor
|
||||||
|
* @param project, project to edit
|
||||||
|
* @param parent, parent widget
|
||||||
|
*/
|
||||||
|
ProjectAutoNumConfigPage::ProjectAutoNumConfigPage (QETProject *project, QWidget *parent) :
|
||||||
|
ProjectConfigPage(project, parent)
|
||||||
|
{
|
||||||
|
initWidgets();
|
||||||
|
initLayout();
|
||||||
|
buildConnections();
|
||||||
|
readValuesFromProject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::title
|
||||||
|
* Title of this config page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
QString ProjectAutoNumConfigPage::title() const {
|
||||||
|
return tr("Auto numerotation");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::icon
|
||||||
|
* Icon of this config pafe
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
QIcon ProjectAutoNumConfigPage::icon() const {
|
||||||
|
return QIcon ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::applyProjectConf
|
||||||
|
*/
|
||||||
|
void ProjectAutoNumConfigPage::applyProjectConf() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::initWidgets
|
||||||
|
* Init some widget of this page
|
||||||
|
*/
|
||||||
|
void ProjectAutoNumConfigPage::initWidgets() {
|
||||||
|
m_label = new QLabel(tr("Num\351rotations disponibles :", "availables numerotations"), this);
|
||||||
|
m_context_cb = new QComboBox(this);
|
||||||
|
m_context_cb->addItem(tr("Nouveau"));
|
||||||
|
m_name_le = new QLineEdit(this);
|
||||||
|
m_name_le->setPlaceholderText(tr("Nom de la nouvelle num\351rotation"));
|
||||||
|
|
||||||
|
m_saw = new SelectAutonumW(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::initLayout
|
||||||
|
* Init the layout of this page
|
||||||
|
*/
|
||||||
|
void ProjectAutoNumConfigPage::initLayout() {
|
||||||
|
QHBoxLayout *context_layout = new QHBoxLayout();
|
||||||
|
context_layout -> addWidget (m_label);
|
||||||
|
context_layout -> addWidget (m_context_cb);
|
||||||
|
context_layout -> addWidget (m_name_le);
|
||||||
|
|
||||||
|
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||||
|
this -> setLayout (main_layout);
|
||||||
|
main_layout -> addLayout (context_layout);
|
||||||
|
main_layout -> addWidget (m_saw);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::readValuesFromProject
|
||||||
|
* Read value stored on project, and update display
|
||||||
|
*/
|
||||||
|
void ProjectAutoNumConfigPage::readValuesFromProject() {
|
||||||
|
QList <QString> keys = project_->conductorAutoNum().keys();
|
||||||
|
if (keys.isEmpty()) return;
|
||||||
|
foreach (QString str, keys) { m_context_cb -> addItem(str); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::adjustReadOnly
|
||||||
|
* set this config page disable if project is read only
|
||||||
|
*/
|
||||||
|
void ProjectAutoNumConfigPage::adjustReadOnly() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::buildConnections
|
||||||
|
* setup some connections
|
||||||
|
*/
|
||||||
|
void ProjectAutoNumConfigPage::buildConnections() {
|
||||||
|
connect(m_context_cb, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext(QString)));
|
||||||
|
connect(m_saw, SIGNAL (applyPressed()), this, SLOT (saveContext()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::updateContext
|
||||||
|
* Display the current selected context
|
||||||
|
* @param str, key of context stored in project
|
||||||
|
*/
|
||||||
|
void ProjectAutoNumConfigPage::updateContext(QString str) {
|
||||||
|
if (str == tr("Nouveau")) {
|
||||||
|
m_saw -> setContext(NumerotationContext());
|
||||||
|
m_name_le -> setText(QString());
|
||||||
|
m_name_le ->setEnabled(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_saw ->setContext(project_->conductorAutoNum(str));
|
||||||
|
m_name_le -> setText(str);
|
||||||
|
m_name_le -> setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ProjectAutoNumConfigPage::saveContext
|
||||||
|
* Save the current displayed context in project
|
||||||
|
*/
|
||||||
|
void ProjectAutoNumConfigPage::saveContext() {
|
||||||
|
if (m_context_cb->currentText() == tr("Nouveau")) {
|
||||||
|
if (m_name_le->text().isEmpty()) {
|
||||||
|
m_name_le->setText(tr("Nouvel num\351rotation"));
|
||||||
|
}
|
||||||
|
project_->addConductorAutoNum(m_name_le -> text(), m_saw -> toNumContext());
|
||||||
|
m_context_cb -> addItem(m_name_le -> text());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
project_->addConductorAutoNum (m_context_cb -> currentText(), m_saw -> toNumContext());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2006-2014 The QElectroTech Team
|
Copyright 2006-2014 The QElectroTech Team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
@ -27,6 +29,8 @@ class ConductorPropertiesWidget;
|
|||||||
class DiagramContextWidget;
|
class DiagramContextWidget;
|
||||||
class ReportPropertieWidget;
|
class ReportPropertieWidget;
|
||||||
class XRefPropertiesWidget;
|
class XRefPropertiesWidget;
|
||||||
|
class SelectAutonumW;
|
||||||
|
class QComboBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class, derived from ConfigPage, aims at providing the basic skeleton
|
This class, derived from ConfigPage, aims at providing the basic skeleton
|
||||||
@ -148,4 +152,37 @@ class ProjectNewDiagramConfigPage : public ProjectConfigPage {
|
|||||||
XRefPropertiesWidget *xref_;
|
XRefPropertiesWidget *xref_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ProjectAutoNumConfigPage : public ProjectConfigPage {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
//Methods
|
||||||
|
public:
|
||||||
|
ProjectAutoNumConfigPage (QETProject *project, QWidget *parent = 0);
|
||||||
|
|
||||||
|
virtual QString title() const;
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
virtual void applyProjectConf();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void initWidgets();
|
||||||
|
virtual void initLayout();
|
||||||
|
virtual void readValuesFromProject();
|
||||||
|
virtual void adjustReadOnly();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void buildConnections();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateContext(QString);
|
||||||
|
void saveContext();
|
||||||
|
|
||||||
|
//Attributes
|
||||||
|
private:
|
||||||
|
QLabel *m_label;
|
||||||
|
QLineEdit *m_name_le;
|
||||||
|
QComboBox *m_context_cb;
|
||||||
|
SelectAutonumW *m_saw;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -447,8 +447,9 @@ void ProjectView::editProjectProperties() {
|
|||||||
|
|
||||||
ConfigDialog properties_dialog(parentWidget());
|
ConfigDialog properties_dialog(parentWidget());
|
||||||
properties_dialog.setWindowTitle(tr("Propri\351t\351s du projet", "window title"));
|
properties_dialog.setWindowTitle(tr("Propri\351t\351s du projet", "window title"));
|
||||||
properties_dialog.addPage(new ProjectMainConfigPage(project_));
|
properties_dialog.addPage(new ProjectMainConfigPage (project_));
|
||||||
properties_dialog.addPage(new ProjectNewDiagramConfigPage(project_));
|
properties_dialog.addPage(new ProjectNewDiagramConfigPage (project_));
|
||||||
|
properties_dialog.addPage(new ProjectAutoNumConfigPage (project_));
|
||||||
properties_dialog.exec();
|
properties_dialog.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,6 @@ void QETDiagramEditor::actions() {
|
|||||||
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un sch\351ma"), this);
|
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un sch\351ma"), this);
|
||||||
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer le sch\351ma"), this);
|
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer le sch\351ma"), this);
|
||||||
prj_clean = new QAction(QET::Icons::EditClear, tr("Nettoyer le projet"), this);
|
prj_clean = new QAction(QET::Icons::EditClear, tr("Nettoyer le projet"), this);
|
||||||
prj_diagramNum = new QAction(QET::Icons::ConductorSettings, tr("Annoter les sch\351mas"), this);
|
|
||||||
prj_diagramList = new QAction(QET::Icons::listDrawings, tr("Ajouter un sommaire"), this);
|
prj_diagramList = new QAction(QET::Icons::listDrawings, tr("Ajouter un sommaire"), this);
|
||||||
prj_nomenclature = new QAction(QET::Icons::DocumentExport, tr("Exporter une nomenclature (beta)"), this);
|
prj_nomenclature = new QAction(QET::Icons::DocumentExport, tr("Exporter une nomenclature (beta)"), this);
|
||||||
tabbed_view_mode = new QAction( tr("en utilisant des onglets"), this);
|
tabbed_view_mode = new QAction( tr("en utilisant des onglets"), this);
|
||||||
@ -424,7 +423,6 @@ void QETDiagramEditor::actions() {
|
|||||||
connect(prj_add_diagram, SIGNAL(triggered()), this, SLOT(addDiagramToProject()) );
|
connect(prj_add_diagram, SIGNAL(triggered()), this, SLOT(addDiagramToProject()) );
|
||||||
connect(prj_del_diagram, SIGNAL(triggered()), this, SLOT(removeDiagramFromProject()) );
|
connect(prj_del_diagram, SIGNAL(triggered()), this, SLOT(removeDiagramFromProject()) );
|
||||||
connect(prj_clean, SIGNAL(triggered()), this, SLOT(cleanCurrentProject()) );
|
connect(prj_clean, SIGNAL(triggered()), this, SLOT(cleanCurrentProject()) );
|
||||||
connect(prj_diagramNum, SIGNAL(triggered()), this, SLOT(diagramNumProject()) );
|
|
||||||
connect(prj_diagramList, SIGNAL(triggered()), this, SLOT(addDiagramFolioListToProject()));
|
connect(prj_diagramList, SIGNAL(triggered()), this, SLOT(addDiagramFolioListToProject()));
|
||||||
connect(prj_nomenclature, SIGNAL(triggered()), this, SLOT(nomenclatureProject()) );
|
connect(prj_nomenclature, SIGNAL(triggered()), this, SLOT(nomenclatureProject()) );
|
||||||
connect(print, SIGNAL(triggered()), this, SLOT(printDialog()) );
|
connect(print, SIGNAL(triggered()), this, SLOT(printDialog()) );
|
||||||
@ -512,7 +510,6 @@ void QETDiagramEditor::menus() {
|
|||||||
menu_project -> addAction(prj_del_diagram);
|
menu_project -> addAction(prj_del_diagram);
|
||||||
menu_project -> addAction(prj_clean);
|
menu_project -> addAction(prj_clean);
|
||||||
menu_project -> addSeparator();
|
menu_project -> addSeparator();
|
||||||
menu_project -> addAction(prj_diagramNum);
|
|
||||||
menu_project -> addAction(prj_diagramList);
|
menu_project -> addAction(prj_diagramList);
|
||||||
menu_project -> addAction(prj_nomenclature);
|
menu_project -> addAction(prj_nomenclature);
|
||||||
|
|
||||||
@ -1152,7 +1149,6 @@ void QETDiagramEditor::slot_updateActions() {
|
|||||||
//prj_add_diagram_foliolist -> setEnabled(editable_project);
|
//prj_add_diagram_foliolist -> setEnabled(editable_project);
|
||||||
prj_del_diagram -> setEnabled(editable_project);
|
prj_del_diagram -> setEnabled(editable_project);
|
||||||
prj_clean -> setEnabled(editable_project);
|
prj_clean -> setEnabled(editable_project);
|
||||||
prj_diagramNum -> setEnabled(editable_project);
|
|
||||||
prj_diagramList -> setEnabled(opened_project);
|
prj_diagramList -> setEnabled(opened_project);
|
||||||
prj_nomenclature -> setEnabled(editable_project);
|
prj_nomenclature -> setEnabled(editable_project);
|
||||||
export_diagram -> setEnabled(opened_diagram);
|
export_diagram -> setEnabled(opened_diagram);
|
||||||
@ -1207,7 +1203,6 @@ void QETDiagramEditor::slot_updateComplexActions() {
|
|||||||
delete_selection -> setEnabled(editable_diagram && deletable_items);
|
delete_selection -> setEnabled(editable_diagram && deletable_items);
|
||||||
rotate_selection -> setEnabled(editable_diagram && dv -> diagram() -> canRotateSelection());
|
rotate_selection -> setEnabled(editable_diagram && dv -> diagram() -> canRotateSelection());
|
||||||
selection_prop -> setEnabled(deletable_items);
|
selection_prop -> setEnabled(deletable_items);
|
||||||
prj_diagramNum -> setEnabled(editable_diagram);
|
|
||||||
|
|
||||||
// actions ayant besoin de textes selectionnes
|
// actions ayant besoin de textes selectionnes
|
||||||
int selected_texts = dv ? (dv -> diagram() -> selectedTexts().count()) : 0;
|
int selected_texts = dv ? (dv -> diagram() -> selectedTexts().count()) : 0;
|
||||||
@ -1810,17 +1805,6 @@ void QETDiagramEditor::cleanCurrentProject() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief launch dialog for numerate diagram
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::diagramNumProject() {
|
|
||||||
DialogAutoNum *dg = new DialogAutoNum(currentDiagram()->diagram(), this);
|
|
||||||
dg->setModal(true);
|
|
||||||
dg->exec();
|
|
||||||
|
|
||||||
delete dg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief export nomemclature of schema
|
* @brief export nomemclature of schema
|
||||||
*/
|
*/
|
||||||
|
@ -157,7 +157,6 @@ class QETDiagramEditor : public QETMainWindow {
|
|||||||
void moveDiagramUp(Diagram *);
|
void moveDiagramUp(Diagram *);
|
||||||
void moveDiagramDown(Diagram *);
|
void moveDiagramDown(Diagram *);
|
||||||
void cleanCurrentProject();
|
void cleanCurrentProject();
|
||||||
void diagramNumProject();
|
|
||||||
void nomenclatureProject();
|
void nomenclatureProject();
|
||||||
void diagramWasAdded(DiagramView *);
|
void diagramWasAdded(DiagramView *);
|
||||||
void diagramIsAboutToBeRemoved(DiagramView *);
|
void diagramIsAboutToBeRemoved(DiagramView *);
|
||||||
@ -194,7 +193,6 @@ class QETDiagramEditor : public QETMainWindow {
|
|||||||
QAction *prj_add_diagram; ///< Add a diagram to the current project.
|
QAction *prj_add_diagram; ///< Add a diagram to the current project.
|
||||||
QAction *prj_del_diagram; ///< Delete a diagram from the current project
|
QAction *prj_del_diagram; ///< Delete a diagram from the current project
|
||||||
QAction *prj_clean; ///< Clean the content of the curent project by removing useless items
|
QAction *prj_clean; ///< Clean the content of the curent project by removing useless items
|
||||||
QAction *prj_diagramNum; ///< Numerotation des schemas
|
|
||||||
QAction *prj_diagramList; ///< Sommaire des schemas
|
QAction *prj_diagramList; ///< Sommaire des schemas
|
||||||
QAction *prj_nomenclature; ///< generate nomenclature
|
QAction *prj_nomenclature; ///< generate nomenclature
|
||||||
QAction *tile_window; ///< Show MDI subwindows as tile
|
QAction *tile_window; ///< Show MDI subwindows as tile
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
#include "element.h"
|
#include "element.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#include "diagramcommands.h"
|
#include "diagramcommands.h"
|
||||||
#include "conductorautonumerotation.h"
|
|
||||||
#include "qetdiagrameditor.h"
|
#include "qetdiagrameditor.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
#include "conductorautonumerotation.h"
|
||||||
#define PR(x) qDebug() << #x " = " << x;
|
#define PR(x) qDebug() << #x " = " << x;
|
||||||
|
|
||||||
bool Conductor::pen_and_brush_initialized = false;
|
bool Conductor::pen_and_brush_initialized = false;
|
||||||
@ -1320,11 +1320,6 @@ QSet<Conductor *> Conductor::relatedConductors() const {
|
|||||||
return(other_conductors);
|
return(other_conductors);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param t_list terminaux a ne pas inclure dans la recherche
|
|
||||||
* @return les conducteurs avec lesquels ce conducteur partage
|
|
||||||
* le meme potentiel electrique a l'exception de lui même
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @brief Conductor::relatedPotentialConductors
|
* @brief Conductor::relatedPotentialConductors
|
||||||
* Return all conductors at the same potential of this conductor, this conductor isn't
|
* Return all conductors at the same potential of this conductor, this conductor isn't
|
||||||
@ -1340,9 +1335,8 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(QList <Terminal *> *t_li
|
|||||||
}
|
}
|
||||||
|
|
||||||
QSet <Conductor *> other_conductors;
|
QSet <Conductor *> other_conductors;
|
||||||
// QList <Terminal *> this_terminal{terminal1, terminal2};
|
|
||||||
QList <Terminal *> this_terminal;
|
QList <Terminal *> this_terminal;
|
||||||
this_terminal << terminal1 << terminal2;
|
this_terminal << terminal1 << terminal2;
|
||||||
|
|
||||||
// Return all conductor of terminal 1 and 2
|
// Return all conductor of terminal 1 and 2
|
||||||
foreach (Terminal *terminal, this_terminal) {
|
foreach (Terminal *terminal, this_terminal) {
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "qetmessagebox.h"
|
#include "qetmessagebox.h"
|
||||||
#include "titleblocktemplate.h"
|
#include "titleblocktemplate.h"
|
||||||
#include "ui/dialogwaiting.h"
|
#include "ui/dialogwaiting.h"
|
||||||
|
#include "numerotationcontext.h"
|
||||||
|
|
||||||
QString QETProject::integration_category_name = "import";
|
QString QETProject::integration_category_name = "import";
|
||||||
|
|
||||||
@ -461,6 +462,36 @@ void QETProject::setDefaultXRefProperties(QHash<QString, XRefProperties> hash) {
|
|||||||
emit XRefPropertiesChanged();
|
emit XRefPropertiesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETProject::conductorAutoNum
|
||||||
|
* @return All value of conductor autonum stored in project
|
||||||
|
*/
|
||||||
|
QHash <QString, NumerotationContext> QETProject::conductorAutoNum() const {
|
||||||
|
return m_conductor_autonum;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETProject::addConductorAutoNum
|
||||||
|
* Add a new numerotation context. If key already exist,
|
||||||
|
* replace old context by the new context
|
||||||
|
* @param key
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
void QETProject::addConductorAutoNum(QString key, NumerotationContext context) {
|
||||||
|
m_conductor_autonum.insert(key, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETProject::conductorAutoNum
|
||||||
|
* Return the numerotation context stored with @key.
|
||||||
|
* If key is not found, return an empty numerotation context
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
NumerotationContext QETProject::conductorAutoNum (const QString &key) const {
|
||||||
|
if (m_conductor_autonum.contains(key)) return m_conductor_autonum[key];
|
||||||
|
else return NumerotationContext();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return un document XML representant le projet
|
@return un document XML representant le projet
|
||||||
*/
|
*/
|
||||||
@ -1167,7 +1198,7 @@ void QETProject::readDefaultPropertiesXml() {
|
|||||||
m_default_xref_properties = QETDiagramEditor::defaultXRefProperties();
|
m_default_xref_properties = QETDiagramEditor::defaultXRefProperties();
|
||||||
|
|
||||||
//Read values indicate in project
|
//Read values indicate in project
|
||||||
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt;
|
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums;
|
||||||
|
|
||||||
for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling()) {
|
for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling()) {
|
||||||
QDomElement child_elmt = child.toElement();
|
QDomElement child_elmt = child.toElement();
|
||||||
@ -1182,10 +1213,12 @@ void QETProject::readDefaultPropertiesXml() {
|
|||||||
report_elmt = child_elmt;
|
report_elmt = child_elmt;
|
||||||
} else if (child_elmt.tagName() == "xrefs") {
|
} else if (child_elmt.tagName() == "xrefs") {
|
||||||
xref_elmt = child_elmt;
|
xref_elmt = child_elmt;
|
||||||
|
} else if (child_elmt.tagName() == "conductors_autonums") {
|
||||||
|
conds_autonums = child_elmt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// size, titleblock, conductor, report
|
// size, titleblock, conductor, report, conductor autonum
|
||||||
if (!border_elmt.isNull()) default_border_properties_.fromXml(border_elmt);
|
if (!border_elmt.isNull()) default_border_properties_.fromXml(border_elmt);
|
||||||
if (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_elmt);
|
if (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_elmt);
|
||||||
if (!conductors_elmt.isNull()) default_conductor_properties_.fromXml(conductors_elmt);
|
if (!conductors_elmt.isNull()) default_conductor_properties_.fromXml(conductors_elmt);
|
||||||
@ -1197,6 +1230,13 @@ void QETProject::readDefaultPropertiesXml() {
|
|||||||
m_default_xref_properties.insert(elmt.attribute("type"), xrp);
|
m_default_xref_properties.insert(elmt.attribute("type"), xrp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!conds_autonums.isNull()) {
|
||||||
|
foreach (QDomElement elmt, QET::findInDomElement(conds_autonums, "conductor_autonum")) {
|
||||||
|
NumerotationContext nc;
|
||||||
|
nc.fromXml(elmt);
|
||||||
|
m_conductor_autonum.insert(elmt.attribute("title"), nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1241,8 +1281,16 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
|||||||
defaultXRefProperties()[key].toXml(xref_elmt);
|
defaultXRefProperties()[key].toXml(xref_elmt);
|
||||||
xrefs_elmt.appendChild(xref_elmt);
|
xrefs_elmt.appendChild(xref_elmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
xml_element.appendChild(xrefs_elmt);
|
xml_element.appendChild(xrefs_elmt);
|
||||||
|
|
||||||
|
//Export conductors autonums
|
||||||
|
QDomElement conds_autonums = xml_document.createElement("conductors_autonums");
|
||||||
|
foreach (QString key, conductorAutoNum().keys()) {
|
||||||
|
QDomElement cond_autonum = conductorAutoNum(key).toXml(xml_document, "conductor_autonum");
|
||||||
|
cond_autonum.setAttribute("title", key);
|
||||||
|
conds_autonums.appendChild(cond_autonum);
|
||||||
|
}
|
||||||
|
xml_element.appendChild(conds_autonums);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +37,7 @@ class TitleBlockTemplate;
|
|||||||
class XmlElementsCollection;
|
class XmlElementsCollection;
|
||||||
class MoveElementsHandler;
|
class MoveElementsHandler;
|
||||||
class MoveTitleBlockTemplatesHandler;
|
class MoveTitleBlockTemplatesHandler;
|
||||||
|
class NumerotationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class represents a QET project. Typically saved as a .qet file, it
|
This class represents a QET project. Typically saved as a .qet file, it
|
||||||
@ -96,17 +97,25 @@ class QETProject : public QObject {
|
|||||||
///DEFAULT PROPERTIES
|
///DEFAULT PROPERTIES
|
||||||
BorderProperties defaultBorderProperties() const;
|
BorderProperties defaultBorderProperties() const;
|
||||||
void setDefaultBorderProperties(const BorderProperties &);
|
void setDefaultBorderProperties(const BorderProperties &);
|
||||||
|
|
||||||
TitleBlockProperties defaultTitleBlockProperties() const;
|
TitleBlockProperties defaultTitleBlockProperties() const;
|
||||||
void setDefaultTitleBlockProperties(const TitleBlockProperties &);
|
void setDefaultTitleBlockProperties(const TitleBlockProperties &);
|
||||||
|
|
||||||
ConductorProperties defaultConductorProperties() const;
|
ConductorProperties defaultConductorProperties() const;
|
||||||
void setDefaultConductorProperties(const ConductorProperties &);
|
void setDefaultConductorProperties(const ConductorProperties &);
|
||||||
|
|
||||||
QString defaultReportProperties() const;
|
QString defaultReportProperties() const;
|
||||||
void setDefaultReportProperties (const QString &properties);
|
void setDefaultReportProperties (const QString &properties);
|
||||||
|
|
||||||
XRefProperties defaultXRefProperties (const QString &type) const {return m_default_xref_properties[type];}
|
XRefProperties defaultXRefProperties (const QString &type) const {return m_default_xref_properties[type];}
|
||||||
QHash <QString, XRefProperties> defaultXRefProperties() const {return m_default_xref_properties;}
|
QHash <QString, XRefProperties> defaultXRefProperties() const {return m_default_xref_properties;}
|
||||||
void setDefaultXRefProperties(const QString type, const XRefProperties &properties);
|
void setDefaultXRefProperties(const QString type, const XRefProperties &properties);
|
||||||
void setDefaultXRefProperties(QHash <QString, XRefProperties> hash);
|
void setDefaultXRefProperties(QHash <QString, XRefProperties> hash);
|
||||||
|
|
||||||
|
QHash <QString, NumerotationContext> conductorAutoNum() const;
|
||||||
|
void addConductorAutoNum (QString key, NumerotationContext context);
|
||||||
|
NumerotationContext conductorAutoNum(const QString &key) const;
|
||||||
|
|
||||||
QDomDocument toXml();
|
QDomDocument toXml();
|
||||||
bool close();
|
bool close();
|
||||||
QETResult write();
|
QETResult write();
|
||||||
@ -218,6 +227,8 @@ class QETProject : public QObject {
|
|||||||
DiagramContext project_properties_;
|
DiagramContext project_properties_;
|
||||||
/// undo stack for this project
|
/// undo stack for this project
|
||||||
QUndoStack *undo_stack_;
|
QUndoStack *undo_stack_;
|
||||||
|
/// Conductor auto numerotation
|
||||||
|
QHash <QString, NumerotationContext> m_conductor_autonum;
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(QETProject *)
|
Q_DECLARE_METATYPE(QETProject *)
|
||||||
#endif
|
#endif
|
||||||
|
74
sources/ui/autonumselectorwidget.cpp
Normal file
74
sources/ui/autonumselectorwidget.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 "autonumselectorwidget.h"
|
||||||
|
#include "ui_autonumselectorwidget.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief AutonumSelectorWidget::AutonumSelectorWidget
|
||||||
|
* default constructor
|
||||||
|
* @param parent, parent widget
|
||||||
|
*/
|
||||||
|
AutonumSelectorWidget::AutonumSelectorWidget(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::AutonumSelectorWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->m_edit_autonum_pb->setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief AutonumSelectorWidget::AutonumSelectorWidget
|
||||||
|
* Constructor with texts to fill the combo box
|
||||||
|
* @param text, texts for fill the combo box
|
||||||
|
* @param parent, parent widget
|
||||||
|
*/
|
||||||
|
AutonumSelectorWidget::AutonumSelectorWidget(const QList <QString> &text, QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::AutonumSelectorWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui -> m_available_autonum_cb -> addItems(text);
|
||||||
|
ui->m_edit_autonum_pb->setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief AutonumSelectorWidget::~AutonumSelectorWidget
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
AutonumSelectorWidget::~AutonumSelectorWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief AutonumSelectorWidget::setCurrentItem
|
||||||
|
* Set the combo box current index by text.
|
||||||
|
* If text doesn't exist, set current index -1
|
||||||
|
* @param text, text of index
|
||||||
|
*/
|
||||||
|
void AutonumSelectorWidget::setCurrentItem(const QString &text) {
|
||||||
|
ui -> m_available_autonum_cb -> setCurrentIndex( ui -> m_available_autonum_cb -> findText(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief AutonumSelectorWidget::text
|
||||||
|
* @return the current displayed text
|
||||||
|
*/
|
||||||
|
QString AutonumSelectorWidget::text() const {
|
||||||
|
return ui -> m_available_autonum_cb -> currentText();
|
||||||
|
}
|
49
sources/ui/autonumselectorwidget.h
Normal file
49
sources/ui/autonumselectorwidget.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
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 AUTONUMSELECTORWIDGET_H
|
||||||
|
#define AUTONUMSELECTORWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class AutonumSelectorWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The AutonumSelectorWidget class
|
||||||
|
* This widget show a combobox to select an autonum and a button to edit the autonum
|
||||||
|
* The combo box is empty and the button isn't linked with anything, it's the role of caller
|
||||||
|
* of this class to fill the combo box and edit the connection with the button.
|
||||||
|
*/
|
||||||
|
class AutonumSelectorWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AutonumSelectorWidget(QWidget *parent = 0);
|
||||||
|
explicit AutonumSelectorWidget(const QList <QString> &text, QWidget *parent = 0);
|
||||||
|
~AutonumSelectorWidget();
|
||||||
|
|
||||||
|
void setCurrentItem (const QString &text);
|
||||||
|
QString text() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::AutonumSelectorWidget *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // AUTONUMSELECTORWIDGET_H
|
63
sources/ui/autonumselectorwidget.ui
Normal file
63
sources/ui/autonumselectorwidget.ui
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>AutonumSelectorWidget</class>
|
||||||
|
<widget class="QWidget" name="AutonumSelectorWidget">
|
||||||
|
<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="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Autonumérotation :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="m_available_autonum_cb"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="m_edit_autonum_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>éditer les numérotations</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/16x16/configure.png</normaloff>:/ico/16x16/configure.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../qelectrotech.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -115,6 +115,10 @@ void ConductorPropertiesWidget::setReadOnly(const bool &ro) {
|
|||||||
this->setDisabled(ro);
|
this->setDisabled(ro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConductorPropertiesWidget::addAutonumWidget(QWidget *widget) {
|
||||||
|
ui->m_autonum_layout->addWidget(widget);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ConductorPropertiesWidget::initWidget
|
* @brief ConductorPropertiesWidget::initWidget
|
||||||
*/
|
*/
|
||||||
|
@ -40,6 +40,8 @@ class ConductorPropertiesWidget : public QWidget
|
|||||||
ConductorProperties properties() const;
|
ConductorProperties properties() const;
|
||||||
void setReadOnly(const bool &ro);
|
void setReadOnly(const bool &ro);
|
||||||
|
|
||||||
|
void addAutonumWidget (QWidget *widget);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initWidget();
|
void initWidget();
|
||||||
void setConductorType(ConductorProperties::ConductorType type);
|
void setConductorType(ConductorProperties::ConductorType type);
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Texte :</string>
|
<string>Texte par defaut :</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -83,6 +83,9 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="m_autonum_layout"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "titleblockpropertieswidget.h"
|
#include "titleblockpropertieswidget.h"
|
||||||
#include "conductorpropertieswidget.h"
|
#include "conductorpropertieswidget.h"
|
||||||
#include "diagramcommands.h"
|
#include "diagramcommands.h"
|
||||||
|
#include "autonumselectorwidget.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DiagramPropertiesDialog::DiagramPropertiesDialog
|
* @brief DiagramPropertiesDialog::DiagramPropertiesDialog
|
||||||
@ -62,6 +63,11 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
|||||||
ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors, this);
|
ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors, this);
|
||||||
cpw -> setReadOnly(diagram_is_read_only);
|
cpw -> setReadOnly(diagram_is_read_only);
|
||||||
|
|
||||||
|
//Conductor autonum
|
||||||
|
AutonumSelectorWidget *asw = new AutonumSelectorWidget(diagram -> project() -> conductorAutoNum().keys(), this);
|
||||||
|
asw -> setCurrentItem(diagram -> conductorsAutonumName());
|
||||||
|
cpw->addAutonumWidget(asw);
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
QDialogButtonBox boutons(diagram_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
QDialogButtonBox boutons(diagram_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
connect(&boutons, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(&boutons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
@ -70,7 +76,7 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
|||||||
QGridLayout glayout(this);
|
QGridLayout glayout(this);
|
||||||
glayout.addWidget(border_infos,0,0);
|
glayout.addWidget(border_infos,0,0);
|
||||||
glayout.addWidget(titleblock_infos, 1, 0);
|
glayout.addWidget(titleblock_infos, 1, 0);
|
||||||
glayout.addWidget(cpw, 0, 1, 0 ,1, Qt::AlignTop);
|
glayout.addWidget(cpw, 0, 1, 0, 1, Qt::AlignTop);
|
||||||
glayout.addWidget(&boutons, 2, 1);
|
glayout.addWidget(&boutons, 2, 1);
|
||||||
|
|
||||||
// if dialog is accepted
|
// if dialog is accepted
|
||||||
@ -94,6 +100,11 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
|||||||
/// TODO implement an undo command to allow the user to undo/redo this action
|
/// TODO implement an undo command to allow the user to undo/redo this action
|
||||||
diagram -> defaultConductorProperties = new_conductors;
|
diagram -> defaultConductorProperties = new_conductors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Conductor autonum name
|
||||||
|
if (asw -> text() != diagram -> conductorsAutonumName()) {
|
||||||
|
diagram -> setConductorsAutonumName (asw -> text());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "dialogautonum.h"
|
#include "dialogautonum.h"
|
||||||
#include "ui_dialogautonum.h"
|
#include "ui_dialogautonum.h"
|
||||||
|
|
||||||
#include "conductorautonumerotation.h"
|
//#include "conductorautonumerotation.h"
|
||||||
#include "qetmessagebox.h"
|
#include "qetmessagebox.h"
|
||||||
#include "ui/selectautonumw.h"
|
#include "ui/selectautonumw.h"
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ DialogAutoNum::DialogAutoNum(Diagram *dg, QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui -> setupUi(this);
|
ui -> setupUi(this);
|
||||||
|
|
||||||
ui -> configuration_layout -> addWidget (new SelectAutonumW(dg_ -> project() -> diagrams(), dg, ui -> configuration_tab));
|
ui -> configuration_layout -> addWidget (new SelectAutonumW());
|
||||||
|
|
||||||
dgselect_ = new diagramselection( dg_ -> project(), ui -> annotation_tab);
|
dgselect_ = new diagramselection( dg_ -> project(), ui -> annotation_tab);
|
||||||
ui -> verticalLayout_Selection -> addWidget(dgselect_);
|
ui -> verticalLayout_Selection -> addWidget(dgselect_);
|
||||||
@ -74,8 +74,8 @@ void DialogAutoNum::on_pushButton_delete_clicked() {
|
|||||||
// if yes remove all
|
// if yes remove all
|
||||||
if( answer == QMessageBox::Yes) {
|
if( answer == QMessageBox::Yes) {
|
||||||
for(int i=0; i<listDiag.count(); i++){
|
for(int i=0; i<listDiag.count(); i++){
|
||||||
ConductorAutoNumerotation can(listDiag.at(i));
|
/*ConductorAutoNumerotation can(listDiag.at(i));
|
||||||
can.removeNumOfDiagram();
|
can.removeNumOfDiagram();*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,8 +107,8 @@ void DialogAutoNum::on_pushButton_annotation_clicked(){
|
|||||||
// if yes numerate all
|
// if yes numerate all
|
||||||
if( answer == QMessageBox::Yes) {
|
if( answer == QMessageBox::Yes) {
|
||||||
foreach (Diagram *d, listDiag) {
|
foreach (Diagram *d, listDiag) {
|
||||||
ConductorAutoNumerotation can(d);
|
/*ConductorAutoNumerotation can(d);
|
||||||
can.numerateDiagram();
|
can.numerateDiagram();*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,21 +17,27 @@
|
|||||||
*/
|
*/
|
||||||
#include "selectautonumw.h"
|
#include "selectautonumw.h"
|
||||||
#include "ui_selectautonumw.h"
|
#include "ui_selectautonumw.h"
|
||||||
#include "diagram.h"
|
#include "numparteditorw.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include "qdebug.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
SelectAutonumW::SelectAutonumW(const QList <Diagram *> &diagrams, Diagram *current_diagram ,QWidget *parent) :
|
SelectAutonumW::SelectAutonumW(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::SelectAutonumW),
|
ui(new Ui::SelectAutonumW)
|
||||||
diagram_list(diagrams)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
setContext(NumerotationContext());
|
||||||
|
}
|
||||||
|
|
||||||
initDiagramChooser();
|
SelectAutonumW::SelectAutonumW(const NumerotationContext &context, QWidget *parent) :
|
||||||
if (current_diagram) ui -> diagram_chooser -> setCurrentIndex (diagram_list.indexOf(current_diagram));
|
QWidget(parent),
|
||||||
setCurrentContext();
|
ui(new Ui::SelectAutonumW)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,36 +48,32 @@ SelectAutonumW::~SelectAutonumW()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SelectAutonumW::setDiagramChooser
|
|
||||||
* build the content of QComboBox @diagram_chooser.
|
|
||||||
*/
|
|
||||||
void SelectAutonumW::initDiagramChooser() {
|
|
||||||
for (int i=0; i<diagram_list.size(); ++i) {
|
|
||||||
QString diagram_title = diagram_list.at(i) -> title();
|
|
||||||
if (diagram_title.isEmpty()) diagram_title = (tr("Sch\351ma sans titre"));
|
|
||||||
ui -> diagram_chooser -> addItem(diagram_title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SelectAutonumW::setCurrentContext
|
* @brief SelectAutonumW::setCurrentContext
|
||||||
* build the context of current diagram selected in the @diagram_chooser QcomboBox
|
* build the context of current diagram selected in the @diagram_chooser QcomboBox
|
||||||
*/
|
*/
|
||||||
void SelectAutonumW::setCurrentContext() {
|
void SelectAutonumW::setContext(const NumerotationContext &context) {
|
||||||
NumerotationContext nc = diagram_list.at(ui->diagram_chooser->currentIndex()) -> getNumerotation(Diagram::Conductors);
|
m_context = context;
|
||||||
|
|
||||||
if (nc.size() == 0) { //@nc contain nothing, build a default numPartEditor
|
qDeleteAll(num_part_list_);
|
||||||
|
num_part_list_.clear();
|
||||||
|
|
||||||
|
if (m_context.size() == 0) { //@context contain nothing, build a default numPartEditor
|
||||||
on_add_button_clicked();
|
on_add_button_clicked();
|
||||||
applyEnable(false);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
for (int i=0; i<nc.size(); ++i) { //build with the content of @nc
|
else {
|
||||||
NumPartEditorW *part= new NumPartEditorW(nc, i, this);
|
for (int i=0; i<m_context.size(); ++i) { //build with the content of @context
|
||||||
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
NumPartEditorW *part= new NumPartEditorW(m_context, i, this);
|
||||||
num_part_list_ << part;
|
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||||
ui -> editor_layout -> addWidget(part);
|
num_part_list_ << part;
|
||||||
|
ui -> editor_layout -> addWidget(part);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
num_part_list_.size() == 1 ?
|
||||||
|
ui -> remove_button -> setDisabled(true):
|
||||||
|
ui -> remove_button -> setEnabled (true);
|
||||||
|
|
||||||
applyEnable(false);
|
applyEnable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +97,7 @@ void SelectAutonumW::on_add_button_clicked() {
|
|||||||
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||||
num_part_list_ << part;
|
num_part_list_ << part;
|
||||||
ui -> editor_layout -> addWidget(part);
|
ui -> editor_layout -> addWidget(part);
|
||||||
|
ui -> remove_button -> setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,20 +110,13 @@ void SelectAutonumW::on_remove_button_clicked() {
|
|||||||
NumPartEditorW *part = num_part_list_.takeLast();
|
NumPartEditorW *part = num_part_list_.takeLast();
|
||||||
disconnect(part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
disconnect(part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||||
delete part;
|
delete part;
|
||||||
|
if (num_part_list_.size() == 1) {
|
||||||
|
ui -> remove_button -> setDisabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
applyEnable();
|
applyEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SelectAutonumW::on_diagram_chooser_activated
|
|
||||||
* Action on diagram_chooser
|
|
||||||
*/
|
|
||||||
void SelectAutonumW::on_diagram_chooser_activated() {
|
|
||||||
foreach(NumPartEditorW *npew, num_part_list_) delete npew;
|
|
||||||
num_part_list_.clear();
|
|
||||||
setCurrentContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SelectAutonumW::on_buttonBox_clicked
|
* @brief SelectAutonumW::on_buttonBox_clicked
|
||||||
* Action on @buttonBox clicked
|
* Action on @buttonBox clicked
|
||||||
@ -130,10 +126,9 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
|||||||
int answer = ui -> buttonBox -> buttonRole(button);
|
int answer = ui -> buttonBox -> buttonRole(button);
|
||||||
|
|
||||||
switch (answer) {
|
switch (answer) {
|
||||||
//reset the displayed context to default context of @diagram_chooser.
|
//Reset the curent context
|
||||||
case QDialogButtonBox::ResetRole:
|
case QDialogButtonBox::ResetRole:
|
||||||
on_diagram_chooser_activated();
|
setContext(m_context);
|
||||||
applyEnable(false);
|
|
||||||
break;
|
break;
|
||||||
//help dialog
|
//help dialog
|
||||||
case QDialogButtonBox::HelpRole:
|
case QDialogButtonBox::HelpRole:
|
||||||
@ -157,9 +152,8 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
|||||||
|
|
||||||
//apply the context in the diagram displayed by @diagram_chooser.
|
//apply the context in the diagram displayed by @diagram_chooser.
|
||||||
case QDialogButtonBox::ApplyRole:
|
case QDialogButtonBox::ApplyRole:
|
||||||
NumerotationContext nc = toNumContext();
|
|
||||||
diagram_list.at(ui -> diagram_chooser -> currentIndex()) -> setNumerotation(Diagram::Conductors, nc);
|
|
||||||
applyEnable(false);
|
applyEnable(false);
|
||||||
|
emit applyPressed();
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,10 @@
|
|||||||
#define SELECTAUTONUMW_H
|
#define SELECTAUTONUMW_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "diagram.h"
|
#include "numerotationcontext.h"
|
||||||
#include "ui/numparteditorw.h"
|
|
||||||
|
class NumPartEditorW;
|
||||||
|
class QAbstractButton;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SelectAutonumW;
|
class SelectAutonumW;
|
||||||
@ -32,27 +34,28 @@ class SelectAutonumW : public QWidget
|
|||||||
|
|
||||||
//METHODS
|
//METHODS
|
||||||
public:
|
public:
|
||||||
explicit SelectAutonumW(const QList <Diagram *> &, Diagram * = 0, QWidget *parent = 0);
|
explicit SelectAutonumW(QWidget *parent = 0);
|
||||||
~SelectAutonumW();
|
explicit SelectAutonumW(const NumerotationContext &context, QWidget *parent = 0);
|
||||||
|
~SelectAutonumW();
|
||||||
|
|
||||||
private:
|
void setContext (const NumerotationContext &context);
|
||||||
void initDiagramChooser();
|
NumerotationContext toNumContext() const;
|
||||||
void setCurrentContext ();
|
|
||||||
NumerotationContext toNumContext() const;
|
signals:
|
||||||
|
void applyPressed();
|
||||||
|
|
||||||
//SLOT
|
//SLOT
|
||||||
private slots:
|
private slots:
|
||||||
void on_add_button_clicked();
|
void on_add_button_clicked();
|
||||||
void on_remove_button_clicked();
|
void on_remove_button_clicked();
|
||||||
void on_diagram_chooser_activated();
|
void on_buttonBox_clicked(QAbstractButton *);
|
||||||
void on_buttonBox_clicked(QAbstractButton *);
|
void applyEnable (bool = true);
|
||||||
void applyEnable (bool = true);
|
|
||||||
|
|
||||||
//ATTRIBUTS
|
//ATTRIBUTS
|
||||||
private:
|
private:
|
||||||
Ui::SelectAutonumW *ui;
|
Ui::SelectAutonumW *ui;
|
||||||
const QList <Diagram *> diagram_list;
|
QList <NumPartEditorW *> num_part_list_;
|
||||||
QList <NumPartEditorW *> num_part_list_;
|
NumerotationContext m_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SELECTAUTONUMW_H
|
#endif // SELECTAUTONUMW_H
|
||||||
|
@ -13,84 +13,54 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Folio: </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="diagram_chooser">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Choisir le folio</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="maxVisibleItems">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="remove_button">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Supprimer une variable de numérotation</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../qelectrotech.qrc">
|
|
||||||
<normaloff>:/ico/22x22/list-remove.png</normaloff>:/ico/22x22/list-remove.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="add_button">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Ajouter une variable de numérotation</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../qelectrotech.qrc">
|
|
||||||
<normaloff>:/ico/22x22/list-add.png</normaloff>:/ico/22x22/list-add.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="definition_groupe">
|
<widget class="QGroupBox" name="definition_groupe">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Définition</string>
|
<string>Définition</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="remove_button">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Supprimer une variable de numérotation</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/22x22/list-remove.png</normaloff>:/ico/22x22/list-remove.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="add_button">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Ajouter une variable de numérotation</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/22x22/list-add.png</normaloff>:/ico/22x22/list-add.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="editor_layout">
|
<layout class="QVBoxLayout" name="editor_layout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user