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) :
|
||||
QGraphicsScene(parent),
|
||||
project_(0),
|
||||
diagram_qet_version_(-1),
|
||||
draw_grid_(true),
|
||||
use_border_(true),
|
||||
draw_terminals_(true),
|
||||
draw_colored_conductors_(true),
|
||||
project_(0),
|
||||
read_only_(false),
|
||||
diagram_qet_version_(-1)
|
||||
read_only_(false)
|
||||
{
|
||||
qgi_manager_ = new QGIManager(this);
|
||||
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
|
||||
@return Une QImage representant le schema
|
||||
@ -327,13 +343,6 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
||||
QDomElement default_conductor = document.createElement("defaultconductor");
|
||||
defaultConductorProperties.toXml(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);
|
||||
|
||||
@ -504,16 +513,6 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
||||
if (!default_conductor_elmt.isNull()) {
|
||||
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)
|
||||
|
@ -58,7 +58,7 @@ class Diagram : public QGraphicsScene {
|
||||
private:
|
||||
Diagram(const Diagram &diagram);
|
||||
|
||||
// attributes
|
||||
// ATTRIBUTES
|
||||
public:
|
||||
/**
|
||||
Represents available options when rendering a particular diagram:
|
||||
@ -81,33 +81,42 @@ class Diagram : public QGraphicsScene {
|
||||
static const qreal margin;
|
||||
/// background color of diagram
|
||||
static QColor background_color;
|
||||
|
||||
private:
|
||||
QGraphicsLineItem *conductor_setter_;
|
||||
ElementsMover *elements_mover_;
|
||||
ElementTextsMover *element_texts_mover_;
|
||||
QGIManager *qgi_manager_;
|
||||
QETProject *project_;
|
||||
|
||||
QDomDocument xml_document_;
|
||||
|
||||
qreal diagram_qet_version_;
|
||||
|
||||
bool draw_grid_;
|
||||
bool use_border_;
|
||||
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
|
||||
QString m_conductors_autonum_name;
|
||||
|
||||
// METHODS
|
||||
protected:
|
||||
virtual void drawBackground(QPainter *, const QRectF &);
|
||||
virtual void keyPressEvent(QKeyEvent *);
|
||||
virtual void keyReleaseEvent(QKeyEvent *);
|
||||
|
||||
public:
|
||||
//methods related to xref properties
|
||||
QString defaultReportProperties () const {return project_ -> defaultReportProperties();}
|
||||
XRefProperties defaultXRefProperties (const QString &str) const {return project_ -> defaultXRefProperties(str);}
|
||||
|
||||
//methods related to autonum
|
||||
QString conductorsAutonumName() const;
|
||||
void setConductorsAutonumName(const QString &name);
|
||||
|
||||
static bool clipboardMayContainDiagram();
|
||||
bool setNumerotation (NumerotationType, NumerotationContext);
|
||||
NumerotationContext getNumerotation (NumerotationType) const;
|
||||
|
||||
// methods related to parent project
|
||||
QETProject *project() const;
|
||||
@ -217,31 +226,6 @@ class Diagram : public QGraphicsScene {
|
||||
};
|
||||
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.
|
||||
@param pf true pour ajouter le poseur de conducteur, false pour l'enlever
|
||||
|
@ -1289,7 +1289,6 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) {
|
||||
context_menu -> addAction(paste_here);
|
||||
context_menu -> addSeparator();
|
||||
context_menu -> addAction(qde -> infos_diagram);
|
||||
context_menu -> addAction(qde -> prj_diagramNum);
|
||||
context_menu -> addActions(qde -> m_row_column_actions_group.actions());
|
||||
} else {
|
||||
context_menu -> addAction(qde -> cut);
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <QtGui>
|
||||
#include "ui/reportpropertiewidget.h"
|
||||
#include "ui/xrefpropertieswidget.h"
|
||||
#include "selectautonumw.h"
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
/**
|
||||
Constructor
|
||||
@ -89,6 +91,8 @@ void ProjectConfigPage::init() {
|
||||
}
|
||||
}
|
||||
|
||||
//######################################################################################//
|
||||
|
||||
/**
|
||||
Constructor
|
||||
@param project Project this page is editing.
|
||||
@ -201,6 +205,8 @@ void ProjectMainConfigPage::adjustReadOnly() {
|
||||
title_value_ -> setReadOnly(is_read_only);
|
||||
}
|
||||
|
||||
//######################################################################################//
|
||||
|
||||
/**
|
||||
Constructor
|
||||
@param project Project this page is editing.
|
||||
@ -335,3 +341,134 @@ void ProjectNewDiagramConfigPage::adjustReadOnly() {
|
||||
conductor_ -> 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
|
||||
This file is part of QElectroTech.
|
||||
@ -27,6 +29,8 @@ class ConductorPropertiesWidget;
|
||||
class DiagramContextWidget;
|
||||
class ReportPropertieWidget;
|
||||
class XRefPropertiesWidget;
|
||||
class SelectAutonumW;
|
||||
class QComboBox;
|
||||
|
||||
/**
|
||||
This class, derived from ConfigPage, aims at providing the basic skeleton
|
||||
@ -148,4 +152,37 @@ class ProjectNewDiagramConfigPage : public ProjectConfigPage {
|
||||
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
|
||||
|
@ -449,6 +449,7 @@ void ProjectView::editProjectProperties() {
|
||||
properties_dialog.setWindowTitle(tr("Propri\351t\351s du projet", "window title"));
|
||||
properties_dialog.addPage(new ProjectMainConfigPage (project_));
|
||||
properties_dialog.addPage(new ProjectNewDiagramConfigPage (project_));
|
||||
properties_dialog.addPage(new ProjectAutoNumConfigPage (project_));
|
||||
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_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_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_nomenclature = new QAction(QET::Icons::DocumentExport, tr("Exporter une nomenclature (beta)"), 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_del_diagram, SIGNAL(triggered()), this, SLOT(removeDiagramFromProject()) );
|
||||
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_nomenclature, SIGNAL(triggered()), this, SLOT(nomenclatureProject()) );
|
||||
connect(print, SIGNAL(triggered()), this, SLOT(printDialog()) );
|
||||
@ -512,7 +510,6 @@ void QETDiagramEditor::menus() {
|
||||
menu_project -> addAction(prj_del_diagram);
|
||||
menu_project -> addAction(prj_clean);
|
||||
menu_project -> addSeparator();
|
||||
menu_project -> addAction(prj_diagramNum);
|
||||
menu_project -> addAction(prj_diagramList);
|
||||
menu_project -> addAction(prj_nomenclature);
|
||||
|
||||
@ -1152,7 +1149,6 @@ void QETDiagramEditor::slot_updateActions() {
|
||||
//prj_add_diagram_foliolist -> setEnabled(editable_project);
|
||||
prj_del_diagram -> setEnabled(editable_project);
|
||||
prj_clean -> setEnabled(editable_project);
|
||||
prj_diagramNum -> setEnabled(editable_project);
|
||||
prj_diagramList -> setEnabled(opened_project);
|
||||
prj_nomenclature -> setEnabled(editable_project);
|
||||
export_diagram -> setEnabled(opened_diagram);
|
||||
@ -1207,7 +1203,6 @@ void QETDiagramEditor::slot_updateComplexActions() {
|
||||
delete_selection -> setEnabled(editable_diagram && deletable_items);
|
||||
rotate_selection -> setEnabled(editable_diagram && dv -> diagram() -> canRotateSelection());
|
||||
selection_prop -> setEnabled(deletable_items);
|
||||
prj_diagramNum -> setEnabled(editable_diagram);
|
||||
|
||||
// actions ayant besoin de textes selectionnes
|
||||
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
|
||||
*/
|
||||
|
@ -157,7 +157,6 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
void moveDiagramUp(Diagram *);
|
||||
void moveDiagramDown(Diagram *);
|
||||
void cleanCurrentProject();
|
||||
void diagramNumProject();
|
||||
void nomenclatureProject();
|
||||
void diagramWasAdded(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_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_diagramNum; ///< Numerotation des schemas
|
||||
QAction *prj_diagramList; ///< Sommaire des schemas
|
||||
QAction *prj_nomenclature; ///< generate nomenclature
|
||||
QAction *tile_window; ///< Show MDI subwindows as tile
|
||||
|
@ -23,9 +23,9 @@
|
||||
#include "element.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramcommands.h"
|
||||
#include "conductorautonumerotation.h"
|
||||
#include "qetdiagrameditor.h"
|
||||
#include "terminal.h"
|
||||
#include "conductorautonumerotation.h"
|
||||
#define PR(x) qDebug() << #x " = " << x;
|
||||
|
||||
bool Conductor::pen_and_brush_initialized = false;
|
||||
@ -1320,11 +1320,6 @@ QSet<Conductor *> Conductor::relatedConductors() const {
|
||||
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
|
||||
* Return all conductors at the same potential of this conductor, this conductor isn't
|
||||
@ -1340,7 +1335,6 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(QList <Terminal *> *t_li
|
||||
}
|
||||
|
||||
QSet <Conductor *> other_conductors;
|
||||
// QList <Terminal *> this_terminal{terminal1, terminal2};
|
||||
QList <Terminal *> this_terminal;
|
||||
this_terminal << terminal1 << terminal2;
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "qetmessagebox.h"
|
||||
#include "titleblocktemplate.h"
|
||||
#include "ui/dialogwaiting.h"
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
QString QETProject::integration_category_name = "import";
|
||||
|
||||
@ -461,6 +462,36 @@ void QETProject::setDefaultXRefProperties(QHash<QString, XRefProperties> hash) {
|
||||
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
|
||||
*/
|
||||
@ -1167,7 +1198,7 @@ void QETProject::readDefaultPropertiesXml() {
|
||||
m_default_xref_properties = QETDiagramEditor::defaultXRefProperties();
|
||||
|
||||
//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()) {
|
||||
QDomElement child_elmt = child.toElement();
|
||||
@ -1182,10 +1213,12 @@ void QETProject::readDefaultPropertiesXml() {
|
||||
report_elmt = child_elmt;
|
||||
} else if (child_elmt.tagName() == "xrefs") {
|
||||
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 (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
xrefs_elmt.appendChild(xref_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 MoveElementsHandler;
|
||||
class MoveTitleBlockTemplatesHandler;
|
||||
class NumerotationContext;
|
||||
|
||||
/**
|
||||
This class represents a QET project. Typically saved as a .qet file, it
|
||||
@ -96,17 +97,25 @@ class QETProject : public QObject {
|
||||
///DEFAULT PROPERTIES
|
||||
BorderProperties defaultBorderProperties() const;
|
||||
void setDefaultBorderProperties(const BorderProperties &);
|
||||
|
||||
TitleBlockProperties defaultTitleBlockProperties() const;
|
||||
void setDefaultTitleBlockProperties(const TitleBlockProperties &);
|
||||
|
||||
ConductorProperties defaultConductorProperties() const;
|
||||
void setDefaultConductorProperties(const ConductorProperties &);
|
||||
|
||||
QString defaultReportProperties() const;
|
||||
void setDefaultReportProperties (const QString &properties);
|
||||
|
||||
XRefProperties defaultXRefProperties (const QString &type) const {return m_default_xref_properties[type];}
|
||||
QHash <QString, XRefProperties> defaultXRefProperties() const {return m_default_xref_properties;}
|
||||
void setDefaultXRefProperties(const QString type, const XRefProperties &properties);
|
||||
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();
|
||||
bool close();
|
||||
QETResult write();
|
||||
@ -218,6 +227,8 @@ class QETProject : public QObject {
|
||||
DiagramContext project_properties_;
|
||||
/// undo stack for this project
|
||||
QUndoStack *undo_stack_;
|
||||
/// Conductor auto numerotation
|
||||
QHash <QString, NumerotationContext> m_conductor_autonum;
|
||||
};
|
||||
Q_DECLARE_METATYPE(QETProject *)
|
||||
#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);
|
||||
}
|
||||
|
||||
void ConductorPropertiesWidget::addAutonumWidget(QWidget *widget) {
|
||||
ui->m_autonum_layout->addWidget(widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorPropertiesWidget::initWidget
|
||||
*/
|
||||
|
@ -40,6 +40,8 @@ class ConductorPropertiesWidget : public QWidget
|
||||
ConductorProperties properties() const;
|
||||
void setReadOnly(const bool &ro);
|
||||
|
||||
void addAutonumWidget (QWidget *widget);
|
||||
|
||||
private:
|
||||
void initWidget();
|
||||
void setConductorType(ConductorProperties::ConductorType type);
|
||||
|
@ -57,7 +57,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Texte :</string>
|
||||
<string>Texte par defaut :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -83,6 +83,9 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="m_autonum_layout"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "titleblockpropertieswidget.h"
|
||||
#include "conductorpropertieswidget.h"
|
||||
#include "diagramcommands.h"
|
||||
#include "autonumselectorwidget.h"
|
||||
|
||||
/**
|
||||
* @brief DiagramPropertiesDialog::DiagramPropertiesDialog
|
||||
@ -62,6 +63,11 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
||||
ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors, this);
|
||||
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
|
||||
QDialogButtonBox boutons(diagram_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(&boutons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
@ -94,6 +100,11 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
||||
/// TODO implement an undo command to allow the user to undo/redo this action
|
||||
diagram -> defaultConductorProperties = new_conductors;
|
||||
}
|
||||
|
||||
// Conductor autonum name
|
||||
if (asw -> text() != diagram -> conductorsAutonumName()) {
|
||||
diagram -> setConductorsAutonumName (asw -> text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "dialogautonum.h"
|
||||
#include "ui_dialogautonum.h"
|
||||
|
||||
#include "conductorautonumerotation.h"
|
||||
//#include "conductorautonumerotation.h"
|
||||
#include "qetmessagebox.h"
|
||||
#include "ui/selectautonumw.h"
|
||||
|
||||
@ -34,7 +34,7 @@ DialogAutoNum::DialogAutoNum(Diagram *dg, QWidget *parent) :
|
||||
{
|
||||
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);
|
||||
ui -> verticalLayout_Selection -> addWidget(dgselect_);
|
||||
@ -74,8 +74,8 @@ void DialogAutoNum::on_pushButton_delete_clicked() {
|
||||
// if yes remove all
|
||||
if( answer == QMessageBox::Yes) {
|
||||
for(int i=0; i<listDiag.count(); i++){
|
||||
ConductorAutoNumerotation can(listDiag.at(i));
|
||||
can.removeNumOfDiagram();
|
||||
/*ConductorAutoNumerotation can(listDiag.at(i));
|
||||
can.removeNumOfDiagram();*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,8 +107,8 @@ void DialogAutoNum::on_pushButton_annotation_clicked(){
|
||||
// if yes numerate all
|
||||
if( answer == QMessageBox::Yes) {
|
||||
foreach (Diagram *d, listDiag) {
|
||||
ConductorAutoNumerotation can(d);
|
||||
can.numerateDiagram();
|
||||
/*ConductorAutoNumerotation can(d);
|
||||
can.numerateDiagram();*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,21 +17,27 @@
|
||||
*/
|
||||
#include "selectautonumw.h"
|
||||
#include "ui_selectautonumw.h"
|
||||
#include "diagram.h"
|
||||
#include "numparteditorw.h"
|
||||
#include <QMessageBox>
|
||||
#include "qdebug.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
SelectAutonumW::SelectAutonumW(const QList <Diagram *> &diagrams, Diagram *current_diagram ,QWidget *parent) :
|
||||
SelectAutonumW::SelectAutonumW(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SelectAutonumW),
|
||||
diagram_list(diagrams)
|
||||
ui(new Ui::SelectAutonumW)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setContext(NumerotationContext());
|
||||
}
|
||||
|
||||
initDiagramChooser();
|
||||
if (current_diagram) ui -> diagram_chooser -> setCurrentIndex (diagram_list.indexOf(current_diagram));
|
||||
setCurrentContext();
|
||||
SelectAutonumW::SelectAutonumW(const NumerotationContext &context, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SelectAutonumW)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,36 +48,32 @@ SelectAutonumW::~SelectAutonumW()
|
||||
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
|
||||
* build the context of current diagram selected in the @diagram_chooser QcomboBox
|
||||
*/
|
||||
void SelectAutonumW::setCurrentContext() {
|
||||
NumerotationContext nc = diagram_list.at(ui->diagram_chooser->currentIndex()) -> getNumerotation(Diagram::Conductors);
|
||||
void SelectAutonumW::setContext(const NumerotationContext &context) {
|
||||
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();
|
||||
applyEnable(false);
|
||||
return;
|
||||
}
|
||||
for (int i=0; i<nc.size(); ++i) { //build with the content of @nc
|
||||
NumPartEditorW *part= new NumPartEditorW(nc, i, this);
|
||||
else {
|
||||
for (int i=0; i<m_context.size(); ++i) { //build with the content of @context
|
||||
NumPartEditorW *part= new NumPartEditorW(m_context, i, this);
|
||||
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||
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);
|
||||
}
|
||||
|
||||
@ -95,6 +97,7 @@ void SelectAutonumW::on_add_button_clicked() {
|
||||
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||
num_part_list_ << 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();
|
||||
disconnect(part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||
delete part;
|
||||
if (num_part_list_.size() == 1) {
|
||||
ui -> remove_button -> setDisabled(true);
|
||||
}
|
||||
}
|
||||
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
|
||||
* Action on @buttonBox clicked
|
||||
@ -130,10 +126,9 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
int answer = ui -> buttonBox -> buttonRole(button);
|
||||
|
||||
switch (answer) {
|
||||
//reset the displayed context to default context of @diagram_chooser.
|
||||
//Reset the curent context
|
||||
case QDialogButtonBox::ResetRole:
|
||||
on_diagram_chooser_activated();
|
||||
applyEnable(false);
|
||||
setContext(m_context);
|
||||
break;
|
||||
//help dialog
|
||||
case QDialogButtonBox::HelpRole:
|
||||
@ -157,9 +152,8 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
|
||||
//apply the context in the diagram displayed by @diagram_chooser.
|
||||
case QDialogButtonBox::ApplyRole:
|
||||
NumerotationContext nc = toNumContext();
|
||||
diagram_list.at(ui -> diagram_chooser -> currentIndex()) -> setNumerotation(Diagram::Conductors, nc);
|
||||
applyEnable(false);
|
||||
emit applyPressed();
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
@ -19,8 +19,10 @@
|
||||
#define SELECTAUTONUMW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "diagram.h"
|
||||
#include "ui/numparteditorw.h"
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
class NumPartEditorW;
|
||||
class QAbstractButton;
|
||||
|
||||
namespace Ui {
|
||||
class SelectAutonumW;
|
||||
@ -32,27 +34,28 @@ class SelectAutonumW : public QWidget
|
||||
|
||||
//METHODS
|
||||
public:
|
||||
explicit SelectAutonumW(const QList <Diagram *> &, Diagram * = 0, QWidget *parent = 0);
|
||||
explicit SelectAutonumW(QWidget *parent = 0);
|
||||
explicit SelectAutonumW(const NumerotationContext &context, QWidget *parent = 0);
|
||||
~SelectAutonumW();
|
||||
|
||||
private:
|
||||
void initDiagramChooser();
|
||||
void setCurrentContext ();
|
||||
void setContext (const NumerotationContext &context);
|
||||
NumerotationContext toNumContext() const;
|
||||
|
||||
signals:
|
||||
void applyPressed();
|
||||
|
||||
//SLOT
|
||||
private slots:
|
||||
void on_add_button_clicked();
|
||||
void on_remove_button_clicked();
|
||||
void on_diagram_chooser_activated();
|
||||
void on_buttonBox_clicked(QAbstractButton *);
|
||||
void applyEnable (bool = true);
|
||||
|
||||
//ATTRIBUTS
|
||||
private:
|
||||
Ui::SelectAutonumW *ui;
|
||||
const QList <Diagram *> diagram_list;
|
||||
QList <NumPartEditorW *> num_part_list_;
|
||||
NumerotationContext m_context;
|
||||
};
|
||||
|
||||
#endif // SELECTAUTONUMW_H
|
||||
|
@ -13,42 +13,18 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="definition_groupe">
|
||||
<property name="title">
|
||||
<string>Définition</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<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">
|
||||
@ -85,12 +61,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="definition_groupe">
|
||||
<property name="title">
|
||||
<string>Définition</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="editor_layout">
|
||||
<property name="spacing">
|
||||
|
Loading…
x
Reference in New Issue
Block a user