Translated all comments found in header files (*.h) from French to English.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1960 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-11-09 21:09:24 +00:00
parent 75c37aa029
commit 160ccec733
117 changed files with 1710 additions and 1770 deletions

View File

@@ -20,13 +20,12 @@
#include <QDialog> #include <QDialog>
class QLabel; class QLabel;
/** /**
Cette classe represente la boite de dialogue This class represents the "About QElectroTech" dialog.
"A propos de QElectroTech".
*/ */
class AboutQET : public QDialog { class AboutQET : public QDialog {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
AboutQET(QWidget * = 0); AboutQET(QWidget * = 0);
virtual ~AboutQET(); virtual ~AboutQET();
@@ -34,7 +33,7 @@ class AboutQET : public QDialog {
private: private:
AboutQET(AboutQET &); AboutQET(AboutQET &);
// methodes // methods
private: private:
QWidget *title() const; QWidget *title() const;
QWidget *aboutTab() const; QWidget *aboutTab() const;

View File

@@ -19,21 +19,21 @@
#define BASIC_MOVE_ELEMENTS_HANDLER #define BASIC_MOVE_ELEMENTS_HANDLER
#include "moveelementshandler.h" #include "moveelementshandler.h"
/** /**
Cette classe implemente basiquement la classe strategie MoveElementsHandler This class implements the MoveElementsHandler Strategy class in a baasic way.
Elle retourne toujours la meme action (parametrable) pour une methode It always returns the same (configurable) action or value for a particular
donnee. question.
*/ */
class BasicMoveElementsHandler : public MoveElementsHandler { class BasicMoveElementsHandler : public MoveElementsHandler {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
BasicMoveElementsHandler(QObject * = 0); BasicMoveElementsHandler(QObject * = 0);
virtual ~BasicMoveElementsHandler(); virtual ~BasicMoveElementsHandler();
private: private:
BasicMoveElementsHandler(const BasicMoveElementsHandler &); BasicMoveElementsHandler(const BasicMoveElementsHandler &);
// methodes // methods
public: public:
virtual void setActionIfItemAlreadyExists(QET::Action); virtual void setActionIfItemAlreadyExists(QET::Action);
virtual void setActionIfItemIsNotReadable(QET::Action); virtual void setActionIfItemIsNotReadable(QET::Action);
@@ -51,7 +51,7 @@ class BasicMoveElementsHandler : public MoveElementsHandler {
virtual QET::Action errorWithAnElement(ElementDefinition *, const QString &); virtual QET::Action errorWithAnElement(ElementDefinition *, const QString &);
virtual QString nameForRenamingOperation(); virtual QString nameForRenamingOperation();
// attributs // attributes
private: private:
QET::Action already_exists_; QET::Action already_exists_;
QET::Action not_readable_; QET::Action not_readable_;

View File

@@ -20,12 +20,12 @@
#include <QtCore> #include <QtCore>
#include <QtXml> #include <QtXml>
/** /**
Cette classe est un conteneur pour les dimensions et proprietes d'affichage This class is a container for dimensions and display properties of a
d'un schema : affichage, nombre et dimensions des colonnes et lignes, ... diagram.
*/ */
class BorderProperties { class BorderProperties {
public: public:
// constructeur, destructeur, operateurs // constructor, destructor, operators
BorderProperties(); BorderProperties();
virtual ~BorderProperties(); virtual ~BorderProperties();
@@ -37,15 +37,15 @@ class BorderProperties {
void toSettings(QSettings &, const QString & = QString()) const; void toSettings(QSettings &, const QString & = QString()) const;
void fromSettings(QSettings &, const QString & = QString()); void fromSettings(QSettings &, const QString & = QString());
// attributs // attributes
int columns_count; ///< Nombre de colonnes int columns_count; ///< Columns count
qreal columns_width; ///< Largeur des colonnes qreal columns_width; ///< Columns width
qreal columns_header_height; ///< Hauteur des entetes des colonnes qreal columns_header_height; ///< Column headers height
bool display_columns; ///< Afficher ou non les entetes des colonnes bool display_columns; ///< Whether to display column headers
int rows_count; ///< Nombre de lignes int rows_count; ///< Rows count
qreal rows_height; ///< Hauteur des lignes qreal rows_height; ///< Rows height
qreal rows_header_width; ///< Largeur des entetes des lignes qreal rows_header_width; ///< Row headers width
bool display_rows; ///< Afficher ou non les entetes des lignes bool display_rows; ///< Whether to display row headers
}; };
#endif #endif

View File

@@ -22,21 +22,21 @@
class QCheckBox; class QCheckBox;
class QSpinBox; class QSpinBox;
/** /**
Cette classe represente un widget permettant d'editer les dimensions et les This class provides a widget to edit dimensions and display properties of a
options d'affichage d'un schema, cartouche non inclus. diagram, title block excluded.
@see TitleBlockPropertiesWidget @see TitleBlockPropertiesWidget
*/ */
class BorderPropertiesWidget : public QWidget { class BorderPropertiesWidget : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
BorderPropertiesWidget(const BorderProperties &, QWidget * = 0); BorderPropertiesWidget(const BorderProperties &, QWidget * = 0);
virtual ~BorderPropertiesWidget(); virtual ~BorderPropertiesWidget();
private: private:
BorderPropertiesWidget(const BorderPropertiesWidget &); BorderPropertiesWidget(const BorderPropertiesWidget &);
// methodes // methods
public: public:
const BorderProperties &borderProperties(); const BorderProperties &borderProperties();
bool isReadOnly() const; bool isReadOnly() const;
@@ -46,14 +46,14 @@ class BorderPropertiesWidget : public QWidget {
private: private:
void build(); void build();
// attributs // attributes
private: private:
BorderProperties border_; ///< Proprietes editees BorderProperties border_; ///< Edited properties
QSpinBox *columns_count; ///< Widget d'edition du nombre de colonnes QSpinBox *columns_count; ///< Widget to edit the columns count
QSpinBox *columns_width; ///< Widget d'edition de la largeur des colonnes QSpinBox *columns_width; ///< Widget to edit the columns width
QCheckBox *display_columns; ///< Case a cocher pour afficher ou non les entetes des colonnes QCheckBox *display_columns; ///< Checkbox stating whether to display column headers
QSpinBox *rows_count; ///< Widget d'edition du nombre de lignes QSpinBox *rows_count; ///< Widget to edit the rows count
QSpinBox *rows_height; ///< Widget d'edition de la hauteur des lignes QSpinBox *rows_height; ///< Widget to edit the rows height
QCheckBox *display_rows; ///< Case a cocher pour afficher ou non les entetes des lignes QCheckBox *display_rows; ///< Checkbox stating whether to display row headers
}; };
#endif #endif

View File

@@ -32,12 +32,12 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) :
QObject(parent) QObject(parent)
{ {
// at first, the internal titleblock template renderer uses the default titleblock template // at first, the internal titleblock template renderer uses the default titleblock template
titleblock_template_renderer = new TitleBlockTemplateRenderer(this); titleblock_template_renderer_ = new TitleBlockTemplateRenderer(this);
titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate()); titleblock_template_renderer_ -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
// disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes // disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes
if (!QRegExp("4\\.[0-7]\\.").exactMatch(qVersion())) { if (!QRegExp("4\\.[0-7]\\.").exactMatch(qVersion())) {
titleblock_template_renderer -> setUseCache(false); titleblock_template_renderer_ -> setUseCache(false);
} }
// dimensions par defaut du schema // dimensions par defaut du schema
@@ -46,8 +46,8 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) :
// contenu par defaut du cartouche // contenu par defaut du cartouche
importTitleBlock(TitleBlockProperties()); importTitleBlock(TitleBlockProperties());
display_titleblock = true; display_titleblock_ = true;
display_border = true; display_border_ = true;
setFolioData(1, 1); setFolioData(1, 1);
updateRectangles(); updateRectangles();
} }
@@ -62,7 +62,7 @@ BorderTitleBlock::~BorderTitleBlock() {
@return la hauteur du cartouche @return la hauteur du cartouche
*/ */
qreal BorderTitleBlock::titleBlockHeight() const { qreal BorderTitleBlock::titleBlockHeight() const {
return(titleblock_template_renderer -> height()); return(titleblock_template_renderer_ -> height());
} }
/** /**
@@ -116,11 +116,11 @@ void BorderTitleBlock::titleBlockFromXml(const QDomElement &xml_elmt) {
@param xml_elmt the XML element attributes will be added to @param xml_elmt the XML element attributes will be added to
*/ */
void BorderTitleBlock::borderToXml(QDomElement &xml_elmt) { void BorderTitleBlock::borderToXml(QDomElement &xml_elmt) {
xml_elmt.setAttribute("cols", nbColumns()); xml_elmt.setAttribute("cols", columnsCount());
xml_elmt.setAttribute("colsize", QString("%1").arg(columnsWidth())); xml_elmt.setAttribute("colsize", QString("%1").arg(columnsWidth()));
xml_elmt.setAttribute("displaycols", columnsAreDisplayed() ? "true" : "false"); xml_elmt.setAttribute("displaycols", columnsAreDisplayed() ? "true" : "false");
xml_elmt.setAttribute("rows", nbRows()); xml_elmt.setAttribute("rows", rowsCount());
xml_elmt.setAttribute("rowsize", QString("%1").arg(rowsHeight())); xml_elmt.setAttribute("rowsize", QString("%1").arg(rowsHeight()));
xml_elmt.setAttribute("displayrows", rowsAreDisplayed() ? "true" : "false"); xml_elmt.setAttribute("displayrows", rowsAreDisplayed() ? "true" : "false");
@@ -136,7 +136,7 @@ void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) {
bool ok; bool ok;
// columns count // columns count
int cols_count = xml_elmt.attribute("cols").toInt(&ok); int cols_count = xml_elmt.attribute("cols").toInt(&ok);
if (ok) setNbColumns(cols_count); if (ok) setColumnsCount(cols_count);
// columns width // columns width
double cols_width = xml_elmt.attribute("colsize").toDouble(&ok); double cols_width = xml_elmt.attribute("colsize").toDouble(&ok);
@@ -146,7 +146,7 @@ void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) {
if (xml_elmt.hasAttribute("rows") && xml_elmt.hasAttribute("rowsize")) { if (xml_elmt.hasAttribute("rows") && xml_elmt.hasAttribute("rowsize")) {
// rows counts // rows counts
int rows_count = xml_elmt.attribute("rows").toInt(&ok); int rows_count = xml_elmt.attribute("rows").toInt(&ok);
if (ok) setNbRows(rows_count); if (ok) setRowsCount(rows_count);
// taille des lignes // taille des lignes
double rows_size = xml_elmt.attribute("rowsize").toDouble(&ok); double rows_size = xml_elmt.attribute("rowsize").toDouble(&ok);
@@ -202,11 +202,11 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) {
*/ */
BorderProperties BorderTitleBlock::exportBorder() { BorderProperties BorderTitleBlock::exportBorder() {
BorderProperties bp; BorderProperties bp;
bp.columns_count = nbColumns(); bp.columns_count = columnsCount();
bp.columns_width = columnsWidth(); bp.columns_width = columnsWidth();
bp.columns_header_height = columnsHeaderHeight(); bp.columns_header_height = columnsHeaderHeight();
bp.display_columns = columnsAreDisplayed(); bp.display_columns = columnsAreDisplayed();
bp.rows_count = nbRows(); bp.rows_count = rowsCount();
bp.rows_height = rowsHeight(); bp.rows_height = rowsHeight();
bp.rows_header_width = rowsHeaderWidth(); bp.rows_header_width = rowsHeaderWidth();
bp.display_rows = rowsAreDisplayed(); bp.display_rows = rowsAreDisplayed();
@@ -218,11 +218,11 @@ BorderProperties BorderTitleBlock::exportBorder() {
*/ */
void BorderTitleBlock::importBorder(const BorderProperties &bp) { void BorderTitleBlock::importBorder(const BorderProperties &bp) {
setColumnsHeaderHeight(bp.columns_header_height); setColumnsHeaderHeight(bp.columns_header_height);
setNbColumns(bp.columns_count); setColumnsCount(bp.columns_count);
setColumnsWidth(bp.columns_width); setColumnsWidth(bp.columns_width);
displayColumns(bp.display_columns); displayColumns(bp.display_columns);
setRowsHeaderWidth(bp.rows_header_width); setRowsHeaderWidth(bp.rows_header_width);
setNbRows(bp.rows_count); setRowsCount(bp.rows_count);
setRowsHeight(bp.rows_height); setRowsHeight(bp.rows_height);
displayRows(bp.display_rows); displayRows(bp.display_rows);
} }
@@ -232,7 +232,7 @@ void BorderTitleBlock::importBorder(const BorderProperties &bp) {
@see TitleBlockTemplateRenderer::titleBlockTemplate() @see TitleBlockTemplateRenderer::titleBlockTemplate()
*/ */
const TitleBlockTemplate *BorderTitleBlock::titleBlockTemplate() { const TitleBlockTemplate *BorderTitleBlock::titleBlockTemplate() {
return(titleblock_template_renderer -> titleBlockTemplate()); return(titleblock_template_renderer_ -> titleBlockTemplate());
} }
/** /**
@@ -240,14 +240,14 @@ const TitleBlockTemplate *BorderTitleBlock::titleBlockTemplate() {
@see TitleBlockTemplateRenderer::setTitleBlockTemplate() @see TitleBlockTemplateRenderer::setTitleBlockTemplate()
*/ */
void BorderTitleBlock::setTitleBlockTemplate(const TitleBlockTemplate *titleblock_template) { void BorderTitleBlock::setTitleBlockTemplate(const TitleBlockTemplate *titleblock_template) {
titleblock_template_renderer -> setTitleBlockTemplate(titleblock_template); titleblock_template_renderer_ -> setTitleBlockTemplate(titleblock_template);
} }
/** /**
@return The name of the template used to render the titleblock. @return The name of the template used to render the titleblock.
*/ */
QString BorderTitleBlock::titleBlockTemplateName() const { QString BorderTitleBlock::titleBlockTemplateName() const {
QString tbt_name = titleblock_template_renderer -> titleBlockTemplate() -> name(); QString tbt_name = titleblock_template_renderer_ -> titleBlockTemplate() -> name();
return((tbt_name == "default") ? "" : tbt_name); return((tbt_name == "default") ? "" : tbt_name);
} }
@@ -259,7 +259,7 @@ QString BorderTitleBlock::titleBlockTemplateName() const {
*/ */
void BorderTitleBlock::titleBlockTemplateChanged(const QString &template_name) { void BorderTitleBlock::titleBlockTemplateChanged(const QString &template_name) {
if (titleBlockTemplateName() != template_name) return; if (titleBlockTemplateName() != template_name) return;
titleblock_template_renderer -> invalidateRenderedTemplate(); titleblock_template_renderer_ -> invalidateRenderedTemplate();
} }
/** /**
@@ -284,8 +284,8 @@ void BorderTitleBlock::titleBlockTemplateRemoved(const QString &removed_template
@param di true pour afficher le cartouche, false sinon @param di true pour afficher le cartouche, false sinon
*/ */
void BorderTitleBlock::displayTitleBlock(bool di) { void BorderTitleBlock::displayTitleBlock(bool di) {
bool change = (di != display_titleblock); bool change = (di != display_titleblock_);
display_titleblock = di; display_titleblock_ = di;
if (change) emit(displayChanged()); if (change) emit(displayChanged());
} }
@@ -293,8 +293,8 @@ void BorderTitleBlock::displayTitleBlock(bool di) {
@param dc true pour afficher les entetes des colonnes, false sinon @param dc true pour afficher les entetes des colonnes, false sinon
*/ */
void BorderTitleBlock::displayColumns(bool dc) { void BorderTitleBlock::displayColumns(bool dc) {
bool change = (dc != display_columns); bool change = (dc != display_columns_);
display_columns = dc; display_columns_ = dc;
if (change) emit(displayChanged()); if (change) emit(displayChanged());
} }
@@ -302,8 +302,8 @@ void BorderTitleBlock::displayColumns(bool dc) {
@param dr true pour afficher les entetes des lignes, false sinon @param dr true pour afficher les entetes des lignes, false sinon
*/ */
void BorderTitleBlock::displayRows(bool dr) { void BorderTitleBlock::displayRows(bool dr) {
bool change = (dr != display_rows); bool change = (dr != display_rows_);
display_rows = dr; display_rows_ = dr;
if (change) emit(displayChanged()); if (change) emit(displayChanged());
} }
@@ -313,8 +313,8 @@ void BorderTitleBlock::displayRows(bool dr) {
colonnes ne seront pas dessinees. colonnes ne seront pas dessinees.
*/ */
void BorderTitleBlock::displayBorder(bool db) { void BorderTitleBlock::displayBorder(bool db) {
bool change = (db != display_border); bool change = (db != display_border_);
display_border = db; display_border_ = db;
if (change) emit(displayChanged()); if (change) emit(displayChanged());
} }
@@ -324,12 +324,12 @@ void BorderTitleBlock::displayBorder(bool db) {
*/ */
void BorderTitleBlock::updateRectangles() { void BorderTitleBlock::updateRectangles() {
// rectangle delimitant le schema // rectangle delimitant le schema
QRectF previous_diagram = diagram; QRectF previous_diagram = diagram_rect_;
diagram = QRectF(0, 0, diagramWidth(), diagramHeight()); diagram_rect_ = QRectF(0, 0, diagramWidth(), diagramHeight());
if (diagram != previous_diagram) emit(borderChanged(previous_diagram, diagram)); if (diagram_rect_ != previous_diagram) emit(borderChanged(previous_diagram, diagram_rect_));
// rectangles relatifs au cartouche // rectangles relatifs au cartouche
titleblock = QRectF(diagram.bottomLeft().x(), diagram.bottomLeft().y(), titleBlockWidth(), titleBlockHeight()); titleblock_rect_ = QRectF(diagram_rect_.bottomLeft().x(), diagram_rect_.bottomLeft().y(), titleBlockWidth(), titleBlockHeight());
} }
/** /**
@@ -340,8 +340,8 @@ void BorderTitleBlock::updateRectangles() {
*/ */
void BorderTitleBlock::draw(QPainter *qp, qreal x, qreal y) { void BorderTitleBlock::draw(QPainter *qp, qreal x, qreal y) {
// translate tous les rectangles // translate tous les rectangles
diagram .translate(x, y); diagram_rect_ .translate(x, y);
titleblock .translate(x, y); titleblock_rect_ .translate(x, y);
// prepare le QPainter // prepare le QPainter
qp -> save(); qp -> save();
@@ -349,30 +349,30 @@ void BorderTitleBlock::draw(QPainter *qp, qreal x, qreal y) {
qp -> setBrush(Qt::NoBrush); qp -> setBrush(Qt::NoBrush);
// dessine le cadre // dessine le cadre
if (display_border) qp -> drawRect(diagram); if (display_border_) qp -> drawRect(diagram_rect_);
qp -> setFont(QETApp::diagramTextsFont()); qp -> setFont(QETApp::diagramTextsFont());
// dessine la case vide qui apparait des qu'il y a un entete // dessine la case vide qui apparait des qu'il y a un entete
if (display_border && (display_columns || display_rows)) { if (display_border_ && (display_columns_ || display_rows_)) {
qp -> setBrush(Qt::white); qp -> setBrush(Qt::white);
QRectF first_rectangle( QRectF first_rectangle(
diagram.topLeft().x(), diagram_rect_.topLeft().x(),
diagram.topLeft().y(), diagram_rect_.topLeft().y(),
rows_header_width, rows_header_width_,
columns_header_height columns_header_height_
); );
qp -> drawRect(first_rectangle); qp -> drawRect(first_rectangle);
} }
// dessine la numerotation des colonnes // dessine la numerotation des colonnes
if (display_border && display_columns) { if (display_border_ && display_columns_) {
for (int i = 1 ; i <= nb_columns ; ++ i) { for (int i = 1 ; i <= columns_count_ ; ++ i) {
QRectF numbered_rectangle = QRectF( QRectF numbered_rectangle = QRectF(
diagram.topLeft().x() + (rows_header_width + ((i - 1) * columns_width)), diagram_rect_.topLeft().x() + (rows_header_width_ + ((i - 1) * columns_width_)),
diagram.topLeft().y(), diagram_rect_.topLeft().y(),
columns_width, columns_width_,
columns_header_height columns_header_height_
); );
qp -> drawRect(numbered_rectangle); qp -> drawRect(numbered_rectangle);
qp -> drawText(numbered_rectangle, Qt::AlignVCenter | Qt::AlignCenter, QString("%1").arg(i)); qp -> drawText(numbered_rectangle, Qt::AlignVCenter | Qt::AlignCenter, QString("%1").arg(i));
@@ -380,14 +380,14 @@ void BorderTitleBlock::draw(QPainter *qp, qreal x, qreal y) {
} }
// dessine la numerotation des lignes // dessine la numerotation des lignes
if (display_border && display_rows) { if (display_border_ && display_rows_) {
QString row_string("A"); QString row_string("A");
for (int i = 1 ; i <= nb_rows ; ++ i) { for (int i = 1 ; i <= rows_count_ ; ++ i) {
QRectF lettered_rectangle = QRectF( QRectF lettered_rectangle = QRectF(
diagram.topLeft().x(), diagram_rect_.topLeft().x(),
diagram.topLeft().y() + (columns_header_height + ((i - 1) * rows_height)), diagram_rect_.topLeft().y() + (columns_header_height_ + ((i - 1) * rows_height_)),
rows_header_width, rows_header_width_,
rows_height rows_height_
); );
qp -> drawRect(lettered_rectangle); qp -> drawRect(lettered_rectangle);
qp -> drawText(lettered_rectangle, Qt::AlignVCenter | Qt::AlignCenter, row_string); qp -> drawText(lettered_rectangle, Qt::AlignVCenter | Qt::AlignCenter, row_string);
@@ -396,24 +396,24 @@ void BorderTitleBlock::draw(QPainter *qp, qreal x, qreal y) {
} }
// render the titleblock, using the TitleBlockTemplate object // render the titleblock, using the TitleBlockTemplate object
if (display_titleblock) { if (display_titleblock_) {
qp -> translate(titleblock.topLeft()); qp -> translate(titleblock_rect_.topLeft());
titleblock_template_renderer -> render(qp, titleblock.width()); titleblock_template_renderer_ -> render(qp, titleblock_rect_.width());
qp -> translate(-titleblock.topLeft()); qp -> translate(-titleblock_rect_.topLeft());
} }
qp -> restore(); qp -> restore();
// annule la translation des rectangles // annule la translation des rectangles
diagram .translate(-x, -y); diagram_rect_ .translate(-x, -y);
titleblock .translate(-x, -y); titleblock_rect_ .translate(-x, -y);
} }
/** /**
Ajoute une colonne. Ajoute une colonne.
*/ */
void BorderTitleBlock::addColumn() { void BorderTitleBlock::addColumn() {
setNbColumns(nbColumns() + 1); setColumnsCount(columnsCount() + 1);
} }
/** /**
@@ -421,14 +421,14 @@ void BorderTitleBlock::addColumn() {
@see minNbColumns() @see minNbColumns()
*/ */
void BorderTitleBlock::removeColumn() { void BorderTitleBlock::removeColumn() {
setNbColumns(nbColumns() - 1); setColumnsCount(columnsCount() - 1);
} }
/** /**
Ajoute une ligne. Ajoute une ligne.
*/ */
void BorderTitleBlock::addRow() { void BorderTitleBlock::addRow() {
setNbRows(nbRows() + 1); setRowsCount(rowsCount() + 1);
} }
/** /**
@@ -436,7 +436,7 @@ void BorderTitleBlock::addRow() {
@see minNbRows() @see minNbRows()
*/ */
void BorderTitleBlock::removeRow() { void BorderTitleBlock::removeRow() {
setNbRows(nbRows() - 1); setRowsCount(rowsCount() - 1);
} }
/** /**
@@ -446,9 +446,9 @@ void BorderTitleBlock::removeRow() {
@param nb_c nouveau nombre de colonnes @param nb_c nouveau nombre de colonnes
@see minNbColumns() @see minNbColumns()
*/ */
void BorderTitleBlock::setNbColumns(int nb_c) { void BorderTitleBlock::setColumnsCount(int nb_c) {
if (nb_c == nbColumns()) return; if (nb_c == columnsCount()) return;
nb_columns = qMax(minNbColumns(), nb_c); columns_count_ = qMax(minNbColumns(), nb_c);
setTitleBlockWidth(diagramWidth()); setTitleBlockWidth(diagramWidth());
} }
@@ -461,7 +461,7 @@ void BorderTitleBlock::setNbColumns(int nb_c) {
*/ */
void BorderTitleBlock::setColumnsWidth(const qreal &new_cw) { void BorderTitleBlock::setColumnsWidth(const qreal &new_cw) {
if (new_cw == columnsWidth()) return; if (new_cw == columnsWidth()) return;
columns_width = qMax(minColumnsWidth(), new_cw); columns_width_ = qMax(minColumnsWidth(), new_cw);
setTitleBlockWidth(diagramWidth()); setTitleBlockWidth(diagramWidth());
} }
@@ -471,7 +471,7 @@ void BorderTitleBlock::setColumnsWidth(const qreal &new_cw) {
@param new_chh nouvelle hauteur des en-tetes de colonnes @param new_chh nouvelle hauteur des en-tetes de colonnes
*/ */
void BorderTitleBlock::setColumnsHeaderHeight(const qreal &new_chh) { void BorderTitleBlock::setColumnsHeaderHeight(const qreal &new_chh) {
columns_header_height = qBound(qreal(5.0), new_chh, qreal(50.0)); columns_header_height_ = qBound(qreal(5.0), new_chh, qreal(50.0));
updateRectangles(); updateRectangles();
} }
@@ -482,9 +482,9 @@ void BorderTitleBlock::setColumnsHeaderHeight(const qreal &new_chh) {
@param nb_r nouveau nombre de lignes @param nb_r nouveau nombre de lignes
@see minNbRows() @see minNbRows()
*/ */
void BorderTitleBlock::setNbRows(int nb_r) { void BorderTitleBlock::setRowsCount(int nb_r) {
if (nb_r == nbRows()) return; if (nb_r == rowsCount()) return;
nb_rows = qMax(minNbRows(), nb_r); rows_count_ = qMax(minNbRows(), nb_r);
setTitleBlockWidth(diagramWidth()); setTitleBlockWidth(diagramWidth());
updateRectangles(); updateRectangles();
} }
@@ -498,7 +498,7 @@ void BorderTitleBlock::setNbRows(int nb_r) {
*/ */
void BorderTitleBlock::setRowsHeight(const qreal &new_rh) { void BorderTitleBlock::setRowsHeight(const qreal &new_rh) {
if (new_rh == rowsHeight()) return; if (new_rh == rowsHeight()) return;
rows_height = qMax(minRowsHeight(), new_rh); rows_height_ = qMax(minRowsHeight(), new_rh);
updateRectangles(); updateRectangles();
} }
@@ -508,7 +508,7 @@ void BorderTitleBlock::setRowsHeight(const qreal &new_rh) {
@param new_rhw nouvelle largeur des en-tetes des lignes @param new_rhw nouvelle largeur des en-tetes des lignes
*/ */
void BorderTitleBlock::setRowsHeaderWidth(const qreal &new_rhw) { void BorderTitleBlock::setRowsHeaderWidth(const qreal &new_rhw) {
rows_header_width = qBound(qreal(5.0), new_rhw, qreal(50.0)); rows_header_width_ = qBound(qreal(5.0), new_rhw, qreal(50.0));
updateRectangles(); updateRectangles();
} }
@@ -518,7 +518,7 @@ void BorderTitleBlock::setRowsHeaderWidth(const qreal &new_rhw) {
*/ */
void BorderTitleBlock::setDiagramHeight(const qreal &height) { void BorderTitleBlock::setDiagramHeight(const qreal &height) {
// taille des lignes a utiliser = rows_height // taille des lignes a utiliser = rows_height
setNbRows(qRound(ceil(height / rows_height))); setRowsCount(qRound(ceil(height / rows_height_)));
} }
/** /**
@@ -526,7 +526,7 @@ void BorderTitleBlock::setDiagramHeight(const qreal &height) {
schema. schema.
*/ */
void BorderTitleBlock::setTitleBlockWidth(const qreal &new_iw) { void BorderTitleBlock::setTitleBlockWidth(const qreal &new_iw) {
titleblock_width = qMin(diagramWidth(), new_iw); titleblock_width_ = qMin(diagramWidth(), new_iw);
updateRectangles(); updateRectangles();
} }
@@ -584,15 +584,15 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(const DiagramContext &i
} }
// ... overridden by the historical and/or dynamically generated fields // ... overridden by the historical and/or dynamically generated fields
context.addValue("author", bi_author); context.addValue("author", btb_author_);
context.addValue("date", bi_date.toString("dd/MM/yyyy")); context.addValue("date", btb_date_.toString("dd/MM/yyyy"));
context.addValue("title", bi_title); context.addValue("title", btb_title_);
context.addValue("filename", bi_filename); context.addValue("filename", btb_filename_);
context.addValue("folio", bi_final_folio); context.addValue("folio", btb_final_folio_);
context.addValue("folio-id", folio_index_); context.addValue("folio-id", folio_index_);
context.addValue("folio-total", folio_total_); context.addValue("folio-total", folio_total_);
titleblock_template_renderer -> setContext(context); titleblock_template_renderer_ -> setContext(context);
} }
QString BorderTitleBlock::incrementLetters(const QString &string) { QString BorderTitleBlock::incrementLetters(const QString &string) {
@@ -625,9 +625,9 @@ void BorderTitleBlock::setFolioData(int index, int total, const DiagramContext &
folio_total_ = total; folio_total_ = total;
// regenere le contenu du champ folio // regenere le contenu du champ folio
bi_final_folio = bi_folio; btb_final_folio_ = btb_folio_;
bi_final_folio.replace("%id", QString::number(folio_index_)); btb_final_folio_.replace("%id", QString::number(folio_index_));
bi_final_folio.replace("%total", QString::number(folio_total_)); btb_final_folio_.replace("%total", QString::number(folio_total_));
updateDiagramContextForTitleBlock(project_properties); updateDiagramContextForTitleBlock(project_properties);
} }

View File

@@ -28,13 +28,13 @@ class DiagramPosition;
class TitleBlockTemplate; class TitleBlockTemplate;
class TitleBlockTemplateRenderer; class TitleBlockTemplateRenderer;
/** /**
Cette classe represente l'ensemble bordure + cartouche qui encadre le This class represents the border and the titleblock which frame a
schema electrique. particular electric diagram.
*/ */
class BorderTitleBlock : public QObject { class BorderTitleBlock : public QObject {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
BorderTitleBlock(QObject * = 0); BorderTitleBlock(QObject * = 0);
virtual ~BorderTitleBlock(); virtual ~BorderTitleBlock();
@@ -42,7 +42,7 @@ class BorderTitleBlock : public QObject {
private: private:
BorderTitleBlock(const BorderTitleBlock &); BorderTitleBlock(const BorderTitleBlock &);
// methodes // methods
public: public:
static int minNbColumns(); static int minNbColumns();
static qreal minColumnsWidth(); static qreal minColumnsWidth();
@@ -51,100 +51,100 @@ class BorderTitleBlock : public QObject {
void draw(QPainter *, qreal = 0.0, qreal = 0.0); void draw(QPainter *, qreal = 0.0, qreal = 0.0);
// methodes d'acces en lecture aux dimensions // methods to get dimensions
// colonnes // columns
/// @return le nombre de colonnes du schema /// @return the number of columns
int nbColumns() const { return(nb_columns); } int columnsCount() const { return(columns_count_); }
/// @return la largeur des colonnes en pixels /// @return the columns width, in pixels
qreal columnsWidth() const { return(columns_width); } qreal columnsWidth() const { return(columns_width_); }
/// @return la taille de l'ensemble des colonnes, en-tete des lignes non inclus /// @return the total width of all columns, headers excluded
qreal columnsTotalWidth() const { return(nb_columns * columns_width); } qreal columnsTotalWidth() const { return(columns_count_ * columns_width_); }
/// @return la hauteur, en pixels, des en-tetes des colonnes /// @return the column headers height, in pixels
qreal columnsHeaderHeight() const { return(columns_header_height); } qreal columnsHeaderHeight() const { return(columns_header_height_); }
// lignes // rows
/// @return le nombre de lignes du schema /// @return the number of rows
int nbRows() const { return(nb_rows); } int rowsCount() const { return(rows_count_); }
/// @return la hauteur des lignes en pixels /// @return the rows height, in pixels
qreal rowsHeight() const { return(rows_height); } qreal rowsHeight() const { return(rows_height_); }
/// @return la taille de l'ensemble des lignes, en-tete des colonnes non inclus /// @return the total height of all rows, headers excluded
qreal rowsTotalHeight() const { return(nb_rows * rows_height); } qreal rowsTotalHeight() const { return(rows_count_ * rows_height_); }
/// @return la largeur, en pixels, des en-tetes des lignes /// @return la rows header width, in pixels
qreal rowsHeaderWidth() const { return(rows_header_width); } qreal rowsHeaderWidth() const { return(rows_header_width_); }
// cadre sans le cartouche = schema // border - title block = diagram
/// @return la largeur du schema, c'est-a-dire du cadre sans le cartouche /// @return the diagram width, i.e. the width of the border without title block
qreal diagramWidth() const { return(columnsTotalWidth() + rowsHeaderWidth()); } qreal diagramWidth() const { return(columnsTotalWidth() + rowsHeaderWidth()); }
/// @return la hauteurdu schema, c'est-a-dire du cadre sans le cartouche /// @return the diagram height, i.e. the height of the border without title block
qreal diagramHeight() const { return(rowsTotalHeight() + columnsHeaderHeight()); } qreal diagramHeight() const { return(rowsTotalHeight() + columnsHeaderHeight()); }
// cartouche // title block
/// @return la largeur du cartouche /// @return the title block width
qreal titleBlockWidth() const { return(titleblock_width); } qreal titleBlockWidth() const { return(titleblock_width_); }
qreal titleBlockHeight() const; qreal titleBlockHeight() const;
// cadre avec le cartouche // border + title block
/// @return la hauteur de la bordure /// @return the border width
qreal borderWidth() const { return(diagramWidth()); } qreal borderWidth() const { return(diagramWidth()); }
/// @return la hauteur de la bordure /// @return the border height
qreal borderHeight() const { return(diagramHeight() + titleBlockHeight()); } qreal borderHeight() const { return(diagramHeight() + titleBlockHeight()); }
// methodes d'acces en lecture aux informations du cartouche // methods to get title block basic data
/// @return le champ "Auteur" du cartouche /// @return the value of the title block "Author" field
QString author() const { return(bi_author); } QString author() const { return(btb_author_); }
/// @return le champ "Date" du cartouche /// @return the value of the title block "Date" field
QDate date() const { return(bi_date); } QDate date() const { return(btb_date_); }
/// @return le champ "Titre" du cartouche /// @return the value of the title block "Title" field
QString title() const { return(bi_title); } QString title() const { return(btb_title_); }
/// @return le champ "Folio" du cartouche /// @return the value of the title block "Folio" field
QString folio() const { return(bi_folio); } QString folio() const { return(btb_folio_); }
/// @return le champ "Fichier" du cartouche /// @return the value of the title block "File" field
QString fileName() const { return(bi_filename); } QString fileName() const { return(btb_filename_); }
// methodes d'acces en lecture aux options // methods to get display options
/// @return true si le cartouche est affiche, false sinon /// @return true si le cartouche est affiche, false sinon
bool titleBlockIsDisplayed() const { return(display_titleblock); } bool titleBlockIsDisplayed() const { return(display_titleblock_); }
/// @return true si les entetes des colonnes sont affiches, false sinon /// @return true si les entetes des colonnes sont affiches, false sinon
bool columnsAreDisplayed() const { return(display_columns); } bool columnsAreDisplayed() const { return(display_columns_); }
/// @return true si les entetes des lignes sont affiches, false sinon /// @return true si les entetes des lignes sont affiches, false sinon
bool rowsAreDisplayed() const { return(display_rows); } bool rowsAreDisplayed() const { return(display_rows_); }
/// @return true si la bordure est affichee, false sinon /// @return true si la bordure est affichee, false sinon
bool borderIsDisplayed() const { return(display_border); } bool borderIsDisplayed() const { return(display_border_); }
// methodes d'acces en ecriture aux dimensions // methods to set dimensions
void addColumn (); void addColumn();
void addRow (); void addRow();
void removeColumn (); void removeColumn();
void removeRow (); void removeRow();
void setNbColumns (int); void setColumnsCount(int);
void setNbRows (int); void setRowsCount(int);
void setColumnsWidth (const qreal &); void setColumnsWidth(const qreal &);
void setRowsHeight (const qreal &); void setRowsHeight(const qreal &);
void setColumnsHeaderHeight(const qreal &); void setColumnsHeaderHeight(const qreal &);
void setRowsHeaderWidth (const qreal &); void setRowsHeaderWidth(const qreal &);
void setDiagramHeight (const qreal &); void setDiagramHeight(const qreal &);
void setTitleBlockWidth (const qreal &); void setTitleBlockWidth(const qreal &);
void adjustTitleBlockToColumns (); void adjustTitleBlockToColumns();
DiagramPosition convertPosition(const QPointF &); DiagramPosition convertPosition(const QPointF &);
// methodes d'acces en ecriture aux informations du cartouche // methods to set title block basic data
/// @param author le nouveau contenu du champ "Auteur" /// @param author the new value of the "Author" field
void setAuthor (const QString &author) { bi_author = author; } void setAuthor(const QString &author) { btb_author_ = author; }
/// @param date le nouveau contenu du champ "Date" /// @param author the new value of the "Date" field
void setDate (const QDate &date) { bi_date = date; } void setDate(const QDate &date) { btb_date_ = date; }
/// @param title le nouveau contenu du champ "Titre" /// @param author the new value of the "Title" field
void setTitle (const QString &title) { void setTitle(const QString &title) {
if (bi_title != title) { if (btb_title_ != title) {
bi_title = title; btb_title_ = title;
emit(diagramTitleChanged(title)); emit(diagramTitleChanged(title));
} }
} }
/// @param folio le nouveau contenu du champ "Folio" /// @param author the new value of the "Folio" field
void setFolio (const QString &folio) { bi_folio = folio; } void setFolio(const QString &folio) { btb_folio_ = folio; }
void setFolioData(int, int, const DiagramContext & = DiagramContext()); void setFolioData(int, int, const DiagramContext & = DiagramContext());
/// @param filename le nouveau contenu du champ "Fichier" /// @param author the new value of the "File" field
void setFileName (const QString &filename) { bi_filename = filename; } void setFileName(const QString &filename) { btb_filename_ = filename; }
void titleBlockToXml(QDomElement &); void titleBlockToXml(QDomElement &);
void titleBlockFromXml(const QDomElement &); void titleBlockFromXml(const QDomElement &);
@@ -164,7 +164,7 @@ class BorderTitleBlock : public QObject {
void titleBlockTemplateChanged(const QString &); void titleBlockTemplateChanged(const QString &);
void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate * = 0); void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate * = 0);
// methodes d'acces en ecriture aux options // methods to set display options
void displayTitleBlock(bool); void displayTitleBlock(bool);
void displayColumns(bool); void displayColumns(bool);
void displayRows(bool); void displayRows(bool);
@@ -175,27 +175,26 @@ class BorderTitleBlock : public QObject {
void updateDiagramContextForTitleBlock(const DiagramContext & = DiagramContext()); void updateDiagramContextForTitleBlock(const DiagramContext & = DiagramContext());
QString incrementLetters(const QString &); QString incrementLetters(const QString &);
// signaux
signals: signals:
/** /**
Signal emis lorsque la bordure change Signal emitted after the border has changed
@param old_border Ancienne bordure @param old_border Former border
@param new_border Nouvelle bordure @param new_border New border
*/ */
void borderChanged(QRectF old_border, QRectF new_border); void borderChanged(QRectF old_border, QRectF new_border);
/** /**
Signal emise lorsque des options d'affichage change Signal emitted after display options have changed
*/ */
void displayChanged(); void displayChanged();
/** /**
Signal emis lorsque le titre du schema change Signal emitted after the title has changed
*/ */
void diagramTitleChanged(const QString &); void diagramTitleChanged(const QString &);
/** /**
Signal emis lorsque le cartouche requiert une mise a jour des donnees Signal emitted when the title block requires its data to be updated in order
utilisees pour generer le folio. to generate the folio field.
*/ */
void needFolioData(); void needFolioData();
@@ -206,43 +205,43 @@ class BorderTitleBlock : public QObject {
*/ */
void needTitleBlockTemplate(const QString &); void needTitleBlockTemplate(const QString &);
// attributs // attributes
private: private:
// informations du cartouche // titleblock basic data
QString bi_author; QString btb_author_;
QDate bi_date; QDate btb_date_;
QString bi_title; QString btb_title_;
QString bi_folio; QString btb_folio_;
QString bi_final_folio; QString btb_final_folio_;
int folio_index_; int folio_index_;
int folio_total_; int folio_total_;
QString bi_filename; QString btb_filename_;
DiagramContext additional_fields_; DiagramContext additional_fields_;
// dimensions du cadre (lignes et colonnes) // border dimensions (rows and columns)
// colonnes : nombres et dimensions // columns: number and dimensions
int nb_columns; int columns_count_;
qreal columns_width; qreal columns_width_;
qreal columns_header_height; qreal columns_header_height_;
// lignes : nombres et dimensions // rows: number and dimensions
int nb_rows; int rows_count_;
qreal rows_height; qreal rows_height_;
qreal rows_header_width; qreal rows_header_width_;
// dimensions du cartouche // title block dimensions
qreal titleblock_width; qreal titleblock_width_;
qreal titleblock_height; qreal titleblock_height_;
// rectangles utilises pour le dessin // rectangles used for drawing operations
QRectF diagram; QRectF diagram_rect_;
QRectF titleblock; QRectF titleblock_rect_;
// booleens pour les options de dessin // display options
bool display_titleblock; bool display_titleblock_;
bool display_columns; bool display_columns_;
bool display_rows; bool display_rows_;
bool display_border; bool display_border_;
TitleBlockTemplateRenderer *titleblock_template_renderer; TitleBlockTemplateRenderer *titleblock_template_renderer_;
}; };
#endif #endif

View File

@@ -40,7 +40,7 @@ Conductor::Conductor(Terminal *p1, Terminal* p2, Diagram *parent_diagram) :
QGraphicsPathItem(0, parent_diagram), QGraphicsPathItem(0, parent_diagram),
terminal1(p1), terminal1(p1),
terminal2(p2), terminal2(p2),
destroyed(false), destroyed_(false),
text_item(0), text_item(0),
segments(NULL), segments(NULL),
moving_point(false), moving_point(false),
@@ -77,7 +77,7 @@ Conductor::Conductor(Terminal *p1, Terminal* p2, Diagram *parent_diagram) :
conductor_profiles.insert(Qt::BottomRightCorner, ConductorProfile()); conductor_profiles.insert(Qt::BottomRightCorner, ConductorProfile());
// calcul du rendu du conducteur // calcul du rendu du conducteur
priv_calculeConductor(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation()); generateConductorPath(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation());
setFlags(QGraphicsItem::ItemIsSelectable); setFlags(QGraphicsItem::ItemIsSelectable);
setAcceptsHoverEvents(true); setAcceptsHoverEvents(true);
@@ -116,10 +116,10 @@ void Conductor::updatePath(const QRectF &rect) {
QPointF p1, p2; QPointF p1, p2;
p1 = terminal1 -> dockConductor(); p1 = terminal1 -> dockConductor();
p2 = terminal2 -> dockConductor(); p2 = terminal2 -> dockConductor();
if (nbSegments() && !conductor_profiles[currentPathType()].isNull()) if (segmentsCount() && !conductor_profiles[currentPathType()].isNull())
priv_modifieConductor(p1, terminal1 -> orientation(), p2, terminal2 -> orientation()); updateConductorPath(p1, terminal1 -> orientation(), p2, terminal2 -> orientation());
else else
priv_calculeConductor(p1, terminal1 -> orientation(), p2, terminal2 -> orientation()); generateConductorPath(p1, terminal1 -> orientation(), p2, terminal2 -> orientation());
calculateTextItemPosition(); calculateTextItemPosition();
QGraphicsPathItem::update(rect); QGraphicsPathItem::update(rect);
} }
@@ -158,13 +158,13 @@ void Conductor::segmentsToPath() {
@param p2 Coordonnees du point d'amarrage de la borne 2 @param p2 Coordonnees du point d'amarrage de la borne 2
@param o2 Orientation de la borne 2 @param o2 Orientation de la borne 2
*/ */
void Conductor::priv_modifieConductor(const QPointF &p1, QET::Orientation o1, const QPointF &p2, QET::Orientation o2) { void Conductor::updateConductorPath(const QPointF &p1, QET::Orientation o1, const QPointF &p2, QET::Orientation o2) {
Q_UNUSED(o1); Q_UNUSED(o1);
Q_UNUSED(o2); Q_UNUSED(o2);
ConductorProfile &conductor_profile = conductor_profiles[currentPathType()]; ConductorProfile &conductor_profile = conductor_profiles[currentPathType()];
Q_ASSERT_X(conductor_profile.nbSegments(QET::Both) > 1, "Conductor::priv_modifieConductor", "pas de points a modifier"); Q_ASSERT_X(conductor_profile.segmentsCount(QET::Both) > 1, "Conductor::priv_modifieConductor", "pas de points a modifier");
Q_ASSERT_X(!conductor_profile.isNull(), "Conductor::priv_modifieConductor", "pas de profil utilisable"); Q_ASSERT_X(!conductor_profile.isNull(), "Conductor::priv_modifieConductor", "pas de profil utilisable");
// recupere les coordonnees fournies des bornes // recupere les coordonnees fournies des bornes
@@ -286,7 +286,7 @@ QHash<ConductorSegmentProfile *, qreal> Conductor::shareOffsetBetweenSegments(
@param p2 Coordonnees du point d'amarrage de la borne 2 @param p2 Coordonnees du point d'amarrage de la borne 2
@param o2 Orientation de la borne 2 @param o2 Orientation de la borne 2
*/ */
void Conductor::priv_calculeConductor(const QPointF &p1, QET::Orientation o1, const QPointF &p2, QET::Orientation o2) { void Conductor::generateConductorPath(const QPointF &p1, QET::Orientation o1, const QPointF &p2, QET::Orientation o2) {
QPointF sp1, sp2, depart, newp1, newp2, arrivee, depart0, arrivee0; QPointF sp1, sp2, depart, newp1, newp2, arrivee, depart0, arrivee0;
QET::Orientation ori_depart, ori_arrivee; QET::Orientation ori_depart, ori_arrivee;
@@ -509,7 +509,7 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
Methode de preparation a la destruction du conducteur ; le conducteur se detache de ses deux bornes Methode de preparation a la destruction du conducteur ; le conducteur se detache de ses deux bornes
*/ */
void Conductor::destroy() { void Conductor::destroy() {
destroyed = true; destroyed_ = true;
terminal1 -> removeConductor(this); terminal1 -> removeConductor(this);
terminal2 -> removeConductor(this); terminal2 -> removeConductor(this);
} }
@@ -862,7 +862,7 @@ qreal Conductor::conductor_bound(qreal tobound, qreal bound, bool positive) {
@param type Type de Segments @param type Type de Segments
@return Le nombre de segments composant le conducteur. @return Le nombre de segments composant le conducteur.
*/ */
uint Conductor::nbSegments(QET::ConductorSegmentType type) const { uint Conductor::segmentsCount(QET::ConductorSegmentType type) const {
QList<ConductorSegment *> segments_list = segmentsList(); QList<ConductorSegment *> segments_list = segmentsList();
if (type == QET::Both) return(segments_list.count()); if (type == QET::Both) return(segments_list.count());
uint nb_seg = 0; uint nb_seg = 0;
@@ -1174,10 +1174,10 @@ void Conductor::setProfile(const ConductorProfile &cp, Qt::Corner path_type) {
// si le type de trajet correspond a l'actuel // si le type de trajet correspond a l'actuel
if (currentPathType() == path_type) { if (currentPathType() == path_type) {
if (conductor_profiles[path_type].isNull()) { if (conductor_profiles[path_type].isNull()) {
priv_calculeConductor(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation()); generateConductorPath(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation());
modified_path = false; modified_path = false;
} else { } else {
priv_modifieConductor(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation()); updateConductorPath(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation());
modified_path = true; modified_path = true;
} }
if (type() == ConductorProperties::Multi) { if (type() == ConductorProperties::Multi) {
@@ -1468,10 +1468,10 @@ ConductorProfilesGroup Conductor::profiles() const {
void Conductor::setProfiles(const ConductorProfilesGroup &cpg) { void Conductor::setProfiles(const ConductorProfilesGroup &cpg) {
conductor_profiles = cpg; conductor_profiles = cpg;
if (conductor_profiles[currentPathType()].isNull()) { if (conductor_profiles[currentPathType()].isNull()) {
priv_calculeConductor(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation()); generateConductorPath(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation());
modified_path = false; modified_path = false;
} else { } else {
priv_modifieConductor(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation()); updateConductorPath(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation());
modified_path = true; modified_path = true;
} }
if (type() == ConductorProperties::Multi) { if (type() == ConductorProperties::Multi) {

View File

@@ -27,13 +27,14 @@ class Element;
typedef QPair<QPointF, Qt::Corner> ConductorBend; typedef QPair<QPointF, Qt::Corner> ConductorBend;
typedef QHash<Qt::Corner, ConductorProfile> ConductorProfilesGroup; typedef QHash<Qt::Corner, ConductorProfile> ConductorProfilesGroup;
/** /**
Cette classe represente un conducteur. Un conducteur relie deux bornes d'element. This class represents a conductor, i.e. a wire between two element
terminals.
*/ */
class Conductor : public QObject, public QGraphicsPathItem { class Conductor : public QObject, public QGraphicsPathItem {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
Conductor(Terminal *, Terminal *, Diagram * = 0); Conductor(Terminal *, Terminal *, Diagram * = 0);
virtual ~Conductor(); virtual ~Conductor();
@@ -41,26 +42,27 @@ class Conductor : public QObject, public QGraphicsPathItem {
private: private:
Conductor(const Conductor &); Conductor(const Conductor &);
// attributs // attributes
public: public:
enum { Type = UserType + 1001 }; enum { Type = UserType + 1001 };
enum Highlight { None, Normal, Alert }; enum Highlight { None, Normal, Alert };
/// premiere borne a laquelle le fil est rattache /// First terminal the wire is attached to
Terminal *terminal1; Terminal *terminal1;
/// deuxieme borne a laquelle le fil est rattache /// Second terminal the wire is attached to
Terminal *terminal2; Terminal *terminal2;
// methodes // methods
public: public:
/** /**
permet de caster un QGraphicsItem en Conductor avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem Conductor.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
void destroy(); void destroy();
/// @return true si ce conducteur est detruit /// @return true if this conductor is destroyed
bool isDestroyed() const { return(destroyed); } bool isDestroyed() const { return(destroyed_); }
Diagram *diagram() const; Diagram *diagram() const;
ConductorTextItem *textItem() const; ConductorTextItem *textItem() const;
void updatePath(const QRectF & = QRectF()); void updatePath(const QRectF & = QRectF());
@@ -104,15 +106,15 @@ class Conductor : public QObject, public QGraphicsPathItem {
virtual QVariant itemChange(GraphicsItemChange, const QVariant &); virtual QVariant itemChange(GraphicsItemChange, const QVariant &);
private: private:
/// caracteristiques du conducteur /// Functional properties
ConductorProperties properties_; ConductorProperties properties_;
/// booleen indiquant si le fil est encore valide /// Whether this conductor is still valid
bool destroyed; bool destroyed_;
/// champ de texte editable pour les conducteurs non unifilaires /// Text input for non simple, non-singleline conductors
ConductorTextItem *text_item; ConductorTextItem *text_item;
/// segments composant le conducteur /// Segments composing the conductor
ConductorSegment *segments; ConductorSegment *segments;
/// attributs lies aux manipulations a la souris /// Attributs related to mouse interaction
QPointF press_point; QPointF press_point;
bool moving_point; bool moving_point;
bool moving_segment; bool moving_segment;
@@ -120,28 +122,29 @@ class Conductor : public QObject, public QGraphicsPathItem {
qreal previous_z_value; qreal previous_z_value;
ConductorSegment *moved_segment; ConductorSegment *moved_segment;
QPointF before_mov_text_pos_; QPointF before_mov_text_pos_;
/// booleen indiquant si le conducteur a ete modifie manuellement par l'utilisateur /// Whether the conductor was manually modified by users
bool modified_path; bool modified_path;
/// booleen indiquant s'il faut sauver le profil courant au plus tot /// Whether the current profile should be saved as soon as possible
bool has_to_save_profile; bool has_to_save_profile;
/// profil du conducteur : "photo" de ce a quoi le conducteur doit ressembler - il y a un profil par type de trajet /// conductor profile: "photography" of what the conductor is supposed to look
/// like - there is one profile per kind of traject
ConductorProfilesGroup conductor_profiles; ConductorProfilesGroup conductor_profiles;
/// QPen et QBrush utilises pour dessiner les conducteurs /// QPen et QBrush objects used to draw conductors
static QPen conductor_pen; static QPen conductor_pen;
static QBrush conductor_brush; static QBrush conductor_brush;
static QBrush square_brush; static QBrush square_brush;
static bool pen_and_brush_initialized; static bool pen_and_brush_initialized;
/// facteur de taille du carre de saisie du segment /// Scale factor to render square used to move segments
qreal segments_squares_scale_; qreal segments_squares_scale_;
/// Definit la facon dont le conducteur doit etre mis en evidence /// Define whether and how the conductor should be highlighted
Highlight must_highlight_; Highlight must_highlight_;
private: private:
void segmentsToPath(); void segmentsToPath();
void saveProfile(bool = true); void saveProfile(bool = true);
void priv_calculeConductor(const QPointF &, QET::Orientation, const QPointF &, QET::Orientation); void generateConductorPath(const QPointF &, QET::Orientation, const QPointF &, QET::Orientation);
void priv_modifieConductor(const QPointF &, QET::Orientation, const QPointF &, QET::Orientation); void updateConductorPath(const QPointF &, QET::Orientation, const QPointF &, QET::Orientation);
uint nbSegments(QET::ConductorSegmentType = QET::Both) const; uint segmentsCount(QET::ConductorSegmentType = QET::Both) const;
QList<QPointF> segmentsToPoints() const; QList<QPointF> segmentsToPoints() const;
QSet<Conductor *> relatedConductors() const; QSet<Conductor *> relatedConductors() const;
QList<ConductorBend> bends() const; QList<ConductorBend> bends() const;

View File

@@ -100,7 +100,7 @@ qreal ConductorProfile::height() const{
@param type Type de Segments @param type Type de Segments
@return Le nombre de segments composant le conducteur. @return Le nombre de segments composant le conducteur.
*/ */
uint ConductorProfile::nbSegments(QET::ConductorSegmentType type) const { uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const {
if (type == QET::Both) return(segments.count()); if (type == QET::Both) return(segments.count());
uint nb_seg = 0; uint nb_seg = 0;
foreach(ConductorSegmentProfile *csp, segments) { foreach(ConductorSegmentProfile *csp, segments) {

View File

@@ -22,34 +22,34 @@
class Conductor; class Conductor;
class ConductorSegmentProfile; class ConductorSegmentProfile;
/** /**
Cette classe contient le profil (= les caracteristiques essentielles) d'un This class represents the profile of a conductor, i.e. its primary
conducteur. characteristics.
*/ */
class ConductorProfile { class ConductorProfile {
public: public:
// constructeurs, destructeur // constructors, destructor
ConductorProfile(); ConductorProfile();
ConductorProfile(Conductor *conductor); ConductorProfile(Conductor *conductor);
ConductorProfile(const ConductorProfile &); ConductorProfile(const ConductorProfile &);
ConductorProfile &operator=(const ConductorProfile &); ConductorProfile &operator=(const ConductorProfile &);
virtual ~ConductorProfile(); virtual ~ConductorProfile();
// attributs // attributes
public: public:
/// Segment composant le profil du conducteur /// Segments composing the conductor
QList<ConductorSegmentProfile *> segments; QList<ConductorSegmentProfile *> segments;
/// Orientation de la borne de depart du profil /// Orientation of the start terminal
QET::Orientation beginOrientation; QET::Orientation beginOrientation;
/// Orientation de la borne d'arrivee du profil /// Orientation of the end terminal.
QET::Orientation endOrientation; QET::Orientation endOrientation;
// methodes // methods
public: public:
bool isNull() const; bool isNull() const;
void setNull(); void setNull();
qreal width() const; qreal width() const;
qreal height() const; qreal height() const;
uint nbSegments(QET::ConductorSegmentType) const; uint segmentsCount(QET::ConductorSegmentType) const;
QList<ConductorSegmentProfile *> horizontalSegments(); QList<ConductorSegmentProfile *> horizontalSegments();
QList<ConductorSegmentProfile *> verticalSegments(); QList<ConductorSegmentProfile *> verticalSegments();
void fromConductor(Conductor *); void fromConductor(Conductor *);

View File

@@ -21,7 +21,7 @@
#include <QtGui> #include <QtGui>
#include <QtXml> #include <QtXml>
/** /**
Cette classe represente les proprietes specifiques a un conducteur unifilaire This class represents the properties of a singleline conductor.
*/ */
class SingleLineProperties { class SingleLineProperties {
public: public:
@@ -37,9 +37,9 @@ class SingleLineProperties {
void toSettings(QSettings &, const QString & = QString()) const; void toSettings(QSettings &, const QString & = QString()) const;
void fromSettings(QSettings &, const QString & = QString()); void fromSettings(QSettings &, const QString & = QString());
/// indique si le conducteur unifilaire doit afficher le symbole terre /// Whether the singleline conductor should display the ground symbol
bool hasGround; bool hasGround;
/// indique si le conducteur unifilaire doit afficher le symbole neutre /// Whether the singleline conductor should display the neutral symbol
bool hasNeutral; bool hasNeutral;
/// Protective Earth Neutral: visually merge neutral and ground /// Protective Earth Neutral: visually merge neutral and ground
bool is_pen; bool is_pen;
@@ -55,44 +55,44 @@ class SingleLineProperties {
}; };
/** /**
Cette classe represente les proprietes specifiques a un conducteur, This class represents the functional properties of a particular conductor,
en dehors de ses bornes et de son trajet. i.e. properties other than path and terminals.
*/ */
class ConductorProperties { class ConductorProperties {
// constructeurs, destructeur // constructors, destructor
public: public:
ConductorProperties(); ConductorProperties();
virtual ~ConductorProperties(); virtual ~ConductorProperties();
/** /**
Represente le type d'un conducteur : Represents the kind of a particular conductor:
* Simple : ni symbole ni champ de texte * Simple: no symbols, no text input
* Single : symboles unifilaires, pas de champ de texte * Single: singleline symbols, no text input
* Multi : champ de texte, pas de symbole * Multi: text input, no symbol
*/ */
enum ConductorType { Simple, Single, Multi }; enum ConductorType { Simple, Single, Multi };
// attributs // attributes
/// type du conducteur /// Conductor type
ConductorType type; ConductorType type;
/// couleur du conducteur /// Conductor color
QColor color; QColor color;
/// texte affiche si le conducteur est multifilaire /// Texte displayed for multiline conductors
QString text; QString text;
/// style du conducteur (Qt::SolidLine ou Qt::DashLine) /// conducteur style (Qt::SolidLine or Qt::DashLine)
Qt::PenStyle style; Qt::PenStyle style;
/// proprietes si le conducteur est unifilaire /// properties for singleline conductors
SingleLineProperties singleLineProperties; SingleLineProperties singleLineProperties;
// methodes // methods
void toXml(QDomElement &) const; void toXml(QDomElement &) const;
void fromXml(QDomElement &); void fromXml(QDomElement &);
void toSettings(QSettings &, const QString & = QString()) const; void toSettings(QSettings &, const QString & = QString()) const;
void fromSettings(QSettings &, const QString & = QString()); void fromSettings(QSettings &, const QString & = QString());
static QString typeToString(ConductorType); static QString typeToString(ConductorType);
// operateurs // operators
int operator==(const ConductorProperties &); int operator==(const ConductorProperties &);
int operator!=(const ConductorProperties &); int operator!=(const ConductorProperties &);

View File

@@ -20,14 +20,13 @@
#include "conductorproperties.h" #include "conductorproperties.h"
#include <QWidget> #include <QWidget>
/** /**
Ce widget permet a l utilisateur d'editer les proprietes d'un conducteur. This widget enables users to change the properties of a particular
Par proprietes, on entend non pas le trajet effectue par le conducteur mais conductor; these properties include singleline symbols, style, color, and
les options supplementaires : symboles unifilaires, presence ou non d'un conductor type but exclude the path it draws.
champ de texte, contenu de ce champ de texte, etc.
*/ */
class ConductorPropertiesWidget : public QWidget { class ConductorPropertiesWidget : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ConductorPropertiesWidget(QWidget * = 0); ConductorPropertiesWidget(QWidget * = 0);
ConductorPropertiesWidget(const ConductorProperties &, QWidget * = 0); ConductorPropertiesWidget(const ConductorProperties &, QWidget * = 0);
@@ -36,7 +35,7 @@ class ConductorPropertiesWidget : public QWidget {
private: private:
ConductorPropertiesWidget(const ConductorPropertiesWidget &); ConductorPropertiesWidget(const ConductorPropertiesWidget &);
// methodes // methods
public: public:
void setConductorProperties(const ConductorProperties &); void setConductorProperties(const ConductorProperties &);
ConductorProperties conductorProperties() const; ConductorProperties conductorProperties() const;
@@ -57,7 +56,7 @@ class ConductorPropertiesWidget : public QWidget {
protected: protected:
void focusInEvent(QFocusEvent *); void focusInEvent(QFocusEvent *);
// attributs prives // private attributes
private: private:
QButtonGroup *radio_buttons; QButtonGroup *radio_buttons;
QRadioButton *simple; QRadioButton *simple;
@@ -76,7 +75,7 @@ class ConductorPropertiesWidget : public QWidget {
ConductorProperties properties_; ConductorProperties properties_;
// methodes privees // private methods
void buildInterface(); void buildInterface();
void buildConnections(); void buildConnections();
void destroyConnections(); void destroyConnections();

View File

@@ -20,11 +20,11 @@
#include <QPointF> #include <QPointF>
#include "qet.h" #include "qet.h"
/** /**
Cette classe represente un segment de conducteur. This class represents a conductor segment.
*/ */
class ConductorSegment { class ConductorSegment {
// constructeurs, destructeur // constructors, destructor
public: public:
ConductorSegment(const QPointF &, const QPointF &, ConductorSegment * = NULL, ConductorSegment * = NULL); ConductorSegment(const QPointF &, const QPointF &, ConductorSegment * = NULL, ConductorSegment * = NULL);
virtual ~ConductorSegment(); virtual ~ConductorSegment();
@@ -32,14 +32,14 @@ class ConductorSegment {
private: private:
ConductorSegment(const ConductorSegment &); ConductorSegment(const ConductorSegment &);
// attributs // attributes
private: private:
ConductorSegment *previous_segment; ConductorSegment *previous_segment;
ConductorSegment *next_segment; ConductorSegment *next_segment;
QPointF point1; QPointF point1;
QPointF point2; QPointF point2;
// methodes // methods
public: public:
void moveX(const qreal &); void moveX(const qreal &);
void moveY(const qreal &); void moveY(const qreal &);

View File

@@ -20,16 +20,16 @@
#include <QtCore> #include <QtCore>
#include "conductorsegment.h" #include "conductorsegment.h"
/** /**
Cette classe contient le profil (= les caracteristiques essentielles) d'un This class embeds the profile (i.e. main characteristics) of a conductor
segment de conducteur. segment.
*/ */
class ConductorSegmentProfile { class ConductorSegmentProfile {
// constructeurs, destructeur // constructors, destructor
public: public:
/** /**
Constructeur Constructor
@param l longueur du segment @param l segment length
@param ori true si le segment est horizontal, false s'il est vertical @param ori true if the segment is horizontal, false if it is vertical
*/ */
ConductorSegmentProfile(qreal l, bool ori = true) : ConductorSegmentProfile(qreal l, bool ori = true) :
length(l), length(l),
@@ -38,8 +38,8 @@ class ConductorSegmentProfile {
} }
/** /**
Constructeur Constructor
@param segment ConductorSegment dont il faut extraire le profil @param segment Segment the profile should be copied from.
*/ */
ConductorSegmentProfile(ConductorSegment *segment) : ConductorSegmentProfile(ConductorSegment *segment) :
length(segment -> length()), length(segment -> length()),
@@ -47,15 +47,15 @@ class ConductorSegmentProfile {
{ {
} }
/// Destructeur /// Destructor
virtual ~ConductorSegmentProfile() { virtual ~ConductorSegmentProfile() {
} }
// attributs // attributes
public: public:
/// longueur du segment /// segment length
qreal length; qreal length;
/// orientation du segment /// segment orientation
bool isHorizontal; bool isHorizontal;
}; };
#endif #endif

View File

@@ -20,16 +20,16 @@
#include "diagramtextitem.h" #include "diagramtextitem.h"
class Conductor; class Conductor;
/** /**
Cette classe represente un champ de texte rattache a un conducteur. This class represents a text item attached to a parent conductor.
Il est editable et deplacable par l'utilisateur. It may be moved and edited by users.
Il peut egalement etre oriente a un angle quelconque. It may also be rotated to any angle.
Ses deplacements sont toutefois limites a une certaine distance autour de Its movements are however limited to a particular distance around its
son conducteur parent. parent conductor.
*/ */
class ConductorTextItem : public DiagramTextItem { class ConductorTextItem : public DiagramTextItem {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ConductorTextItem(Conductor * = 0, Diagram * = 0); ConductorTextItem(Conductor * = 0, Diagram * = 0);
ConductorTextItem(const QString &, Conductor * = 0, Diagram * = 0); ConductorTextItem(const QString &, Conductor * = 0, Diagram * = 0);
@@ -37,14 +37,14 @@ class ConductorTextItem : public DiagramTextItem {
private: private:
ConductorTextItem(const ConductorTextItem &); ConductorTextItem(const ConductorTextItem &);
// attributs // attributes
public: public:
enum { Type = UserType + 1006 }; enum { Type = UserType + 1006 };
Conductor *parentConductor() const; Conductor *parentConductor() const;
virtual void fromXml(const QDomElement &); virtual void fromXml(const QDomElement &);
virtual QDomElement toXml(QDomDocument &) const; virtual QDomElement toXml(QDomDocument &) const;
// methodes // methods
public: public:
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual bool wasMovedByUser() const; virtual bool wasMovedByUser() const;
@@ -55,7 +55,7 @@ class ConductorTextItem : public DiagramTextItem {
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
// attributs // attributes
private: private:
Conductor *parent_conductor_; Conductor *parent_conductor_;
bool moved_by_user_; bool moved_by_user_;

View File

@@ -24,20 +24,20 @@ class QListWidgetItem;
class QStackedWidget; class QStackedWidget;
class QDialogButtonBox; class QDialogButtonBox;
/** /**
Cette classe represente le dialogue de configuration de QElectroTech. This class represents the configuration dialog for QElectroTech.
Il s'agit d'un dialogue affichant des "pages de configuration". It displays "configuration pages", each page having to provide an icon and
Chaque page de configuration doit fournir une icone et un titre. a title.
*/ */
class ConfigDialog : public QDialog { class ConfigDialog : public QDialog {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ConfigDialog(QWidget * = 0); ConfigDialog(QWidget * = 0);
virtual ~ConfigDialog(); virtual ~ConfigDialog();
private: private:
ConfigDialog(const ConfigDialog &); ConfigDialog(const ConfigDialog &);
// methodes // methods
public slots: public slots:
void changePage(QListWidgetItem *, QListWidgetItem *); void changePage(QListWidgetItem *, QListWidgetItem *);
void applyConf(); void applyConf();
@@ -47,7 +47,7 @@ class ConfigDialog : public QDialog {
void buildPagesList(); void buildPagesList();
void addPageToList(ConfigPage *); void addPageToList(ConfigPage *);
// attributs // attributes
private: private:
QListWidget *pages_list; QListWidget *pages_list;
QStackedWidget *pages_widget; QStackedWidget *pages_widget;

View File

@@ -4,7 +4,7 @@
#include <QWidget> #include <QWidget>
/** /**
This abstract class specifies methods all derived classes should should This abstract class specifies methods all derived classes should
implement. implement.
*/ */
class ConfigPage : public QWidget { class ConfigPage : public QWidget {

View File

@@ -25,49 +25,51 @@ class TitleBlockPropertiesWidget;
class ExportPropertiesWidget; class ExportPropertiesWidget;
/** /**
Cette classe represente la page de configuration des nouveaux schemas. This configuration page enables users to define the properties of new
diagrams to come.
*/ */
class NewDiagramPage : public ConfigPage { class NewDiagramPage : public ConfigPage {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
NewDiagramPage(QWidget * = 0); NewDiagramPage(QWidget * = 0);
virtual ~NewDiagramPage(); virtual ~NewDiagramPage();
private: private:
NewDiagramPage(const NewDiagramPage &); NewDiagramPage(const NewDiagramPage &);
// methodes // methods
public: public:
void applyConf(); void applyConf();
QString title() const; QString title() const;
QIcon icon() const; QIcon icon() const;
// attributs // attributes
public: public:
BorderPropertiesWidget *bpw; ///< Widget d'edition des dimensions du schema BorderPropertiesWidget *bpw; ///< Widget to edit default diagram dimensions
TitleBlockPropertiesWidget *ipw; ///< Widget d'edition des proprietes par defaut du cartouche TitleBlockPropertiesWidget *ipw; ///< Widget to edit default title block properties
ConductorPropertiesWidget *cpw; ///< Widget d'edition des proprietes par defaut des conducteurs ConductorPropertiesWidget *cpw; ///< Widget to edit default conductor properties
}; };
/** /**
Cette classe represente la page de configuration generale. This configuration page enables users to specify various options,most of
them applying to the whole application.
*/ */
class GeneralConfigurationPage : public ConfigPage { class GeneralConfigurationPage : public ConfigPage {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
GeneralConfigurationPage(QWidget * = 0); GeneralConfigurationPage(QWidget * = 0);
virtual ~GeneralConfigurationPage(); virtual ~GeneralConfigurationPage();
private: private:
GeneralConfigurationPage(const GeneralConfigurationPage &); GeneralConfigurationPage(const GeneralConfigurationPage &);
// methodes // methods
public: public:
void applyConf(); void applyConf();
QString title() const; QString title() const;
QIcon icon() const; QIcon icon() const;
// attributs // attributes
public: public:
QLabel *title_label_; QLabel *title_label_;
QFrame *horiz_line_; QFrame *horiz_line_;
@@ -85,47 +87,47 @@ class GeneralConfigurationPage : public ConfigPage {
}; };
/** /**
Cette classe represente la page de configuration du dialogue d'exportation This configuration page enables users to set default export options.
*/ */
class ExportConfigPage : public ConfigPage { class ExportConfigPage : public ConfigPage {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ExportConfigPage(QWidget * = 0); ExportConfigPage(QWidget * = 0);
virtual ~ExportConfigPage(); virtual ~ExportConfigPage();
private: private:
ExportConfigPage(const ExportConfigPage &); ExportConfigPage(const ExportConfigPage &);
// methodes // methods
public: public:
void applyConf(); void applyConf();
QString title() const; QString title() const;
QIcon icon() const; QIcon icon() const;
// attributs // attributes
public: public:
ExportPropertiesWidget *epw; ExportPropertiesWidget *epw;
}; };
/** /**
Cette classe represente la page de configuration du dialogue d'impression This configuration page enables users to set default printing options.
*/ */
class PrintConfigPage : public ConfigPage { class PrintConfigPage : public ConfigPage {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
PrintConfigPage(QWidget * = 0); PrintConfigPage(QWidget * = 0);
virtual ~PrintConfigPage(); virtual ~PrintConfigPage();
private: private:
PrintConfigPage(const PrintConfigPage &); PrintConfigPage(const PrintConfigPage &);
// methodes // methods
public: public:
void applyConf(); void applyConf();
QString title() const; QString title() const;
QIcon icon() const; QIcon icon() const;
// attributs // attributes
public: public:
ExportPropertiesWidget *epw; ExportPropertiesWidget *epw;
}; };

View File

@@ -24,16 +24,15 @@
class ElementTextItem; class ElementTextItem;
class Terminal; class Terminal;
/** /**
Cette classe represente un element electrique. Elle est utilisable This class represents an electrical element; it may be used like a fixed
comme un element fixe. La difference est que l'element perso lit element, the difference being that the CustomElement reads its description
sa description (noms, dessin, comportement) dans un fichier XML a fournir (names, drawing, behavior) from an XML document.
en parametre.
*/ */
class CustomElement : public FixedElement { class CustomElement : public FixedElement {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
CustomElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0); CustomElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
CustomElement(const QDomElement &, QGraphicsItem * = 0, Diagram * = 0, int * = 0); CustomElement(const QDomElement &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
@@ -42,9 +41,9 @@ class CustomElement : public FixedElement {
private: private:
CustomElement(const CustomElement &); CustomElement(const CustomElement &);
// attributs // attributes
protected: protected:
int elmt_state; // contient le code d'erreur si l'instanciation a echoue ou 0 si l'instanciation s'est bien passe int elmt_state; // hold the error code in case the instanciation fails, or 0 if everything went well
NamesList names; NamesList names;
ElementsLocation location_; ElementsLocation location_;
QPicture drawing; QPicture drawing;
@@ -53,7 +52,7 @@ class CustomElement : public FixedElement {
QList<ElementTextItem *> list_texts_; QList<ElementTextItem *> list_texts_;
bool forbid_antialiasing; bool forbid_antialiasing;
// methodes // methods
public: public:
virtual QList<Terminal *> terminals() const; virtual QList<Terminal *> terminals() const;
virtual QList<Conductor *> conductors() const; virtual QList<Conductor *> conductors() const;
@@ -84,8 +83,8 @@ class CustomElement : public FixedElement {
}; };
/** /**
@return L'ID du type de l'element ; pour un CustomElement, cela revient au @return The element type ID; considering a CustomElement, this means the
nom du fichier @location of its XML description.
@see location() @see location()
*/ */
inline QString CustomElement::typeId() const { inline QString CustomElement::typeId() const {
@@ -93,38 +92,38 @@ inline QString CustomElement::typeId() const {
} }
/** /**
@return L'adresse du fichier contenant la description XML de cet element @return the location of the XML document describing this element.
*/ */
inline ElementsLocation CustomElement::location() const { inline ElementsLocation CustomElement::location() const {
return(location_); return(location_);
} }
/** /**
@return true si cet element est nul, c'est-a-dire si le chargement de sa @return true if this element is null, i.e. if its XML description could not
description XML a echoue be loaded.
*/ */
inline bool CustomElement::isNull() const { inline bool CustomElement::isNull() const {
return(elmt_state); return(elmt_state);
} }
/** /**
@return Un entier representant l'etat de l'element : @return An integer representing the state of this element:
- 0 : L'instanciation a reussi - 0: instantiation succeeded
- 1 : Le fichier n'existe pas - 1: the file does not exist
- 2 : Le fichier n'a pu etre ouvert - 2: the file could not be opened
- 3 : Le fichier n'est pas un document XML - 3: The file is not a valid XML document
- 4 : Le document XML n'a pas une "definition" comme racine - 4: The XML document does not have a "definition" root element.
- 5 : Les attributs de la definition ne sont pas presents et / ou valides - 5: The definition attributes are missing or invalid
- 6 : La definition est vide - 6: The definition is empty
- 7 : L'analyse d'un element XML decrivant une partie du dessin de l'element a echoue - 7: The parsing of an XML element describing an element drawing primitive failed
- 8 : Aucune partie du dessin n'a pu etre chargee - 8: No primitive could be loadedAucune partie du dessin n'a pu etre chargee
*/ */
inline int CustomElement::state() const { inline int CustomElement::state() const {
return(elmt_state); return(elmt_state);
} }
/** /**
@return Le nom de l'element @return The name of this element.
*/ */
inline QString CustomElement::name() const { inline QString CustomElement::name() const {
return(names.name(location_.baseName())); return(names.name(location_.baseName()));

View File

@@ -41,25 +41,25 @@ const qreal Diagram::margin = 5.0;
*/ */
Diagram::Diagram(QObject *parent) : Diagram::Diagram(QObject *parent) :
QGraphicsScene(parent), QGraphicsScene(parent),
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), project_(0),
read_only_(false), read_only_(false),
diagram_qet_version_(-1) diagram_qet_version_(-1)
{ {
undo_stack = new QUndoStack(); undo_stack_ = new QUndoStack();
qgi_manager = new QGIManager(this); qgi_manager_ = new QGIManager(this);
setBackgroundBrush(Qt::white); setBackgroundBrush(Qt::white);
conductor_setter = new QGraphicsLineItem(0, 0); conductor_setter_ = new QGraphicsLineItem(0, 0);
conductor_setter -> setZValue(1000000); conductor_setter_ -> setZValue(1000000);
QPen t; QPen t;
t.setColor(Qt::black); t.setColor(Qt::black);
t.setWidthF(1.5); t.setWidthF(1.5);
t.setStyle(Qt::DashLine); t.setStyle(Qt::DashLine);
conductor_setter -> setPen(t); conductor_setter_ -> setPen(t);
conductor_setter -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0))); conductor_setter_ -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0)));
// initialise les objets gerant les deplacements // initialise les objets gerant les deplacements
elements_mover_ = new ElementsMover(); // deplacements d'elements/conducteurs/textes elements_mover_ = new ElementsMover(); // deplacements d'elements/conducteurs/textes
@@ -80,9 +80,9 @@ Diagram::Diagram(QObject *parent) :
*/ */
Diagram::~Diagram() { Diagram::~Diagram() {
// suppression de la liste des annulations - l'undo stack fait appel au qgimanager pour supprimer certains elements // suppression de la liste des annulations - l'undo stack fait appel au qgimanager pour supprimer certains elements
delete undo_stack; delete undo_stack_;
// suppression du QGIManager - tous les elements qu'il connait sont supprimes // suppression du QGIManager - tous les elements qu'il connait sont supprimes
delete qgi_manager; delete qgi_manager_;
// suppression des objets gerant les deplacements // suppression des objets gerant les deplacements
delete elements_mover_; delete elements_mover_;
@@ -120,7 +120,7 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
p -> setBrush(Qt::white); p -> setBrush(Qt::white);
p -> drawRect(r); p -> drawRect(r);
if (draw_grid) { if (draw_grid_) {
// dessine les points de la grille // dessine les points de la grille
p -> setPen(Qt::black); p -> setPen(Qt::black);
p -> setBrush(Qt::NoBrush); p -> setBrush(Qt::NoBrush);
@@ -141,7 +141,7 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
p -> drawPoints(points); p -> drawPoints(points);
} }
if (use_border) border_and_titleblock.draw(p, margin, margin); if (use_border_) border_and_titleblock.draw(p, margin, margin);
p -> restore(); p -> restore();
} }
@@ -201,7 +201,7 @@ void Diagram::keyReleaseEvent(QKeyEvent *e) {
bool Diagram::toPaintDevice(QPaintDevice &pix, int width, int height, Qt::AspectRatioMode aspectRatioMode) { bool Diagram::toPaintDevice(QPaintDevice &pix, int width, int height, Qt::AspectRatioMode aspectRatioMode) {
// determine la zone source = contenu du schema + marges // determine la zone source = contenu du schema + marges
QRectF source_area; QRectF source_area;
if (!use_border) { if (!use_border_) {
source_area = itemsBoundingRect(); source_area = itemsBoundingRect();
source_area.translate(-margin, -margin); source_area.translate(-margin, -margin);
source_area.setWidth (source_area.width () + 2.0 * margin); source_area.setWidth (source_area.width () + 2.0 * margin);
@@ -248,7 +248,7 @@ bool Diagram::toPaintDevice(QPaintDevice &pix, int width, int height, Qt::Aspect
QSize Diagram::imageSize() const { QSize Diagram::imageSize() const {
// determine la zone source = contenu du schema + marges // determine la zone source = contenu du schema + marges
qreal image_width, image_height; qreal image_width, image_height;
if (!use_border) { if (!use_border_) {
QRectF items_rect = itemsBoundingRect(); QRectF items_rect = itemsBoundingRect();
image_width = items_rect.width(); image_width = items_rect.width();
image_height = items_rect.height(); image_height = items_rect.height();
@@ -399,8 +399,8 @@ bool Diagram::initFromXml(QDomElement &document, QPointF position, bool consider
// initialise le document XML interne a partir de l'element XML fourni en parametre // initialise le document XML interne a partir de l'element XML fourni en parametre
if (from_xml) { if (from_xml) {
xml_document.clear(); xml_document_.clear();
xml_document.appendChild(xml_document.importNode(document, true)); xml_document_.appendChild(xml_document_.importNode(document, true));
// a ce stade, le document XML interne contient le code XML qui a ete importe, et non pas une version re-exporte par la methode toXml() // a ce stade, le document XML interne contient le code XML qui a ete importe, et non pas une version re-exporte par la methode toXml()
} }
return(from_xml); return(from_xml);
@@ -585,8 +585,8 @@ void Diagram::write() {
@param element xml a enregistrer @param element xml a enregistrer
*/ */
void Diagram::write(const QDomElement &element) { void Diagram::write(const QDomElement &element) {
xml_document.clear(); xml_document_.clear();
xml_document.appendChild(xml_document.importNode(element, true)); xml_document_.appendChild(xml_document_.importNode(element, true));
emit(written()); emit(written());
} }
@@ -595,7 +595,7 @@ void Diagram::write(const QDomElement &element) {
si le document XML utilise en interne n'est pas vide), false sinon si le document XML utilise en interne n'est pas vide), false sinon
*/ */
bool Diagram::wasWritten() const { bool Diagram::wasWritten() const {
return(!xml_document.isNull()); return(!xml_document_.isNull());
} }
/** /**
@@ -606,7 +606,7 @@ QDomElement Diagram::writeXml(QDomDocument &xml_doc) const {
// si le schema n'a pas ete enregistre explicitement, on n'ecrit rien // si le schema n'a pas ete enregistre explicitement, on n'ecrit rien
if (!wasWritten()) return(QDomElement()); if (!wasWritten()) return(QDomElement());
QDomElement diagram_elmt = xml_document.documentElement(); QDomElement diagram_elmt = xml_document_.documentElement();
QDomNode new_node = xml_doc.importNode(diagram_elmt, true); QDomNode new_node = xml_doc.importNode(diagram_elmt, true);
return(new_node.toElement()); return(new_node.toElement());
} }
@@ -737,7 +737,7 @@ void Diagram::titleChanged(const QString &title) {
*/ */
void Diagram::diagramTextChanged(DiagramTextItem *text_item, const QString &old_text, const QString &new_text) { void Diagram::diagramTextChanged(DiagramTextItem *text_item, const QString &old_text, const QString &new_text) {
if (!text_item) return; if (!text_item) return;
undo_stack -> push(new ChangeDiagramTextCommand(text_item, old_text, new_text)); undo_stack_ -> push(new ChangeDiagramTextCommand(text_item, old_text, new_text));
} }
/** /**

View File

@@ -37,14 +37,13 @@ class IndependentTextItem;
class QETProject; class QETProject;
class Terminal; class Terminal;
/** /**
Cette classe represente un schema electrique. This class represents an electric diagram. It manages its various child
Elle gere les differents elements et conducteurs qui le composent elements, conductors and texts and handles their graphic rendering.
et en effectue le rendu graphique.
*/ */
class Diagram : public QGraphicsScene { class Diagram : public QGraphicsScene {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
Diagram(QObject * = 0); Diagram(QObject * = 0);
virtual ~Diagram(); virtual ~Diagram();
@@ -52,42 +51,42 @@ class Diagram : public QGraphicsScene {
private: private:
Diagram(const Diagram &diagram); Diagram(const Diagram &diagram);
// attributs // attributes
public: public:
/** /**
Represente les options possibles pour l'affichage du schema : Represents available options when rendering a particular diagram:
* EmptyBorder : N'afficher que la bordure * EmptyBorder: display border only
* TitleBlock : Afficher le cartouche * TitleBlock: display title block
* Columns : Afficher les colonnes * Columns: display columns
*/ */
enum BorderOptions { EmptyBorder, TitleBlock, Columns }; enum BorderOptions { EmptyBorder, TitleBlock, Columns };
/// Proprietes par defaut des nouveaux conducteurs /// Default properties for new conductors
ConductorProperties defaultConductorProperties; ConductorProperties defaultConductorProperties;
/// Dimensions et cartouches du schema /// Diagram dimensions and title block
BorderTitleBlock border_and_titleblock; BorderTitleBlock border_and_titleblock;
/// taille de la grille en abscisse /// abscissa grid step size
static const int xGrid; static const int xGrid;
/// taille de la grille en ordonnee /// ordinate grid step size
static const int yGrid; static const int yGrid;
/// marge autour du schema /// margin around the diagram
static const qreal margin; static const qreal margin;
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; bool draw_grid_;
bool use_border; bool use_border_;
QGIManager *qgi_manager; QGIManager *qgi_manager_;
QUndoStack *undo_stack; QUndoStack *undo_stack_;
bool draw_terminals; bool draw_terminals_;
bool draw_colored_conductors_; bool draw_colored_conductors_;
QDomDocument xml_document; QDomDocument xml_document_;
QETProject *project_; QETProject *project_;
bool read_only_; bool read_only_;
qreal diagram_qet_version_; qreal diagram_qet_version_;
// methodes // methods
protected: protected:
virtual void drawBackground(QPainter *, const QRectF &); virtual void drawBackground(QPainter *, const QRectF &);
virtual void keyPressEvent(QKeyEvent *); virtual void keyPressEvent(QKeyEvent *);
@@ -96,22 +95,22 @@ class Diagram : public QGraphicsScene {
public: public:
static bool clipboardMayContainDiagram(); static bool clipboardMayContainDiagram();
// fonctions relatives au projet parent // methods related to parent project
QETProject *project() const; QETProject *project() const;
void setProject(QETProject *); void setProject(QETProject *);
int folioIndex() const; int folioIndex() const;
qreal declaredQElectroTechVersion(bool = true) const; qreal declaredQElectroTechVersion(bool = true) const;
// fonctions relatives a la lecture seule // methods related to read only mode
bool isReadOnly() const; bool isReadOnly() const;
void setReadOnly(bool); void setReadOnly(bool);
// fonctions relatives a la pose de conducteurs // methods related to conductor creation
void setConductor(bool); void setConductor(bool);
void setConductorStart (QPointF); void setConductorStart (QPointF);
void setConductorStop(QPointF); void setConductorStop(QPointF);
// fonctions relatives a l'import / export XML // methods related to XML import/export
QDomDocument toXml(bool = true); QDomDocument toXml(bool = true);
bool initFromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = 0); bool initFromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = 0);
bool fromXml(QDomDocument &, QPointF = QPointF(), bool = true, DiagramContent * = 0); bool fromXml(QDomDocument &, QPointF = QPointF(), bool = true, DiagramContent * = 0);
@@ -121,7 +120,7 @@ class Diagram : public QGraphicsScene {
bool wasWritten() const; bool wasWritten() const;
QDomElement writeXml(QDomDocument &) const; QDomElement writeXml(QDomDocument &) const;
// fonctions relative a l'ajout et a l'enlevement d'elements graphiques sur le schema // methods related to graphics items addition/removal on the diagram
void addElement(Element *); void addElement(Element *);
void addConductor(Conductor *); void addConductor(Conductor *);
void addIndependentTextItem(IndependentTextItem *); void addIndependentTextItem(IndependentTextItem *);
@@ -130,7 +129,7 @@ class Diagram : public QGraphicsScene {
void removeConductor(Conductor *); void removeConductor(Conductor *);
void removeIndependentTextItem(IndependentTextItem *); void removeIndependentTextItem(IndependentTextItem *);
// fonctions relatives aux options graphiques // methods related to graphics options
ExportProperties applyProperties(const ExportProperties &); ExportProperties applyProperties(const ExportProperties &);
void setDisplayGrid(bool); void setDisplayGrid(bool);
bool displayGrid(); bool displayGrid();
@@ -177,7 +176,7 @@ class Diagram : public QGraphicsScene {
void titleBlockTemplateRemoved(const QString &, const QString & = QString()); void titleBlockTemplateRemoved(const QString &, const QString & = QString());
void setTitleBlockTemplate(const QString &); void setTitleBlockTemplate(const QString &);
// fonctions relative a la selection sur le schema // methods related to graphics items selection
void selectAll(); void selectAll();
void deselectAll(); void deselectAll();
void invertSelection(); void invertSelection();
@@ -191,71 +190,73 @@ class Diagram : public QGraphicsScene {
Q_DECLARE_METATYPE(Diagram *) Q_DECLARE_METATYPE(Diagram *)
/** /**
Permet d'ajouter ou enlever le "poseur de conducteur", c'est-a-dire la Display or hide the conductor setter, i.e. a dashed conductor stub which appears when creating a conductor between two terminals.
droite en pointilles qui apparait lorsqu'on pose un conducteur entre deux
bornes.
@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
*/ */
inline void Diagram::setConductor(bool pf) { inline void Diagram::setConductor(bool adding) {
if (pf) { if (adding) {
if (!conductor_setter -> scene()) addItem(conductor_setter); if (!conductor_setter_ -> scene()) addItem(conductor_setter_);
} else { } else {
if (conductor_setter -> scene()) removeItem(conductor_setter); if (conductor_setter_ -> scene()) removeItem(conductor_setter_);
} }
} }
/** /**
Specifie les coordonnees du point de depart du poseur de conducteur Set the start point of the conductor setter.
@param d Le nouveau point de depart du poseur de conducteur @param start the point (in scene coordinates) which the newly created
conductor should start from.
*/ */
inline void Diagram::setConductorStart(QPointF d) { inline void Diagram::setConductorStart(QPointF start) {
conductor_setter -> setLine(QLineF(d, conductor_setter -> line().p2())); conductor_setter_ -> setLine(QLineF(start, conductor_setter_ -> line().p2()));
} }
/** /**
Specifie les coordonnees du point d'arrivee du poseur de conducteur Set the end point of the conductor setter.
@param a Le nouveau point d'arrivee du poseur de conducteur @param end the point (in scene coordinates) upon to which the newly created
conductor should be drawn.
*/ */
inline void Diagram::setConductorStop(QPointF a) { inline void Diagram::setConductorStop(QPointF end) {
conductor_setter -> setLine(QLineF(conductor_setter -> line().p1(), a)); conductor_setter_ -> setLine(QLineF(conductor_setter_ -> line().p1(), end));
} }
/** /**
Permet de specifier si la grille du schema doit etre dessinee ou non Set whether the diagram grid should be drawn.
@param dg true pour afficher la grille, false pour ne pas l'afficher @param dg true to render the grid, false otherwise.
*/ */
inline void Diagram::setDisplayGrid(bool dg) { inline void Diagram::setDisplayGrid(bool dg) {
draw_grid = dg; draw_grid_ = dg;
} }
/** /**
Permet de savoir si la grille du schema est dessinee ou non @return true if the grid is drawn, false otherwise.
@return true si la grille est affichee , false sinon
*/ */
inline bool Diagram::displayGrid() { inline bool Diagram::displayGrid() {
return(draw_grid); return(draw_grid_);
} }
/** /**
Permet de specifier si le cadre du schema doit etre pris en compte pour Set whether the diagram border (including rows/colums headers and the title
determiner le contour du schema. block) should be rendered along with the diagram. When set to false, the size
@param ub true pour prendre le schema en compte, false sinon of the smallest rectangle containing all items is considered as the diagram
size.
@param ub true to take the border into account, false otherwise
*/ */
inline void Diagram::setUseBorder(bool ub) { inline void Diagram::setUseBorder(bool ub) {
use_border = ub; use_border_ = ub;
} }
/** /**
Permet de savoir si le cadre du schema est pris en compte pour @return true if the border is rendered and take into account, false
determiner le contour du schema. otherwise.
*/ */
inline bool Diagram::useBorder() { inline bool Diagram::useBorder() {
return(use_border); return(use_border_);
} }
/** /**
Permet de definir les options du cadre, des colonnes et du cartouche. Set the rendering options for the diagram border (including rows/colums
@param bo Un OU binaire entre les options possibles headers and the title block)
@param bo Enabled options ORed together
@see BorderOptions @see BorderOptions
*/ */
inline void Diagram::setBorderOptions(Diagram::BorderOptions bo) { inline void Diagram::setBorderOptions(Diagram::BorderOptions bo) {
@@ -265,33 +266,32 @@ inline void Diagram::setBorderOptions(Diagram::BorderOptions bo) {
} }
/** /**
Permet de savoir les options du cadre, des colonnes et du cartouche. @return The rendering optios for the diagram border
@return Un OU binaire entre les options possibles @see setBorderOptions
@see BorderOptions
*/ */
inline Diagram::BorderOptions Diagram::borderOptions() { inline Diagram::BorderOptions Diagram::borderOptions() {
BorderOptions retour = EmptyBorder; BorderOptions options = EmptyBorder;
if (border_and_titleblock.titleBlockIsDisplayed()) retour = (BorderOptions)(retour|TitleBlock); if (border_and_titleblock.titleBlockIsDisplayed()) options = (BorderOptions)(options|TitleBlock);
if (border_and_titleblock.columnsAreDisplayed()) retour = (BorderOptions)(retour|Columns); if (border_and_titleblock.columnsAreDisplayed()) options = (BorderOptions)(options|Columns);
return(retour); return(options);
} }
/// @return la pile d'annulations de ce schema /// @return the diagram undo stack
inline QUndoStack &Diagram::undoStack() { inline QUndoStack &Diagram::undoStack() {
return(*undo_stack); return(*undo_stack_);
} }
/// @return le egstionnaire de QGraphicsItem de ce schema /// @return the diagram graphics item manager
inline QGIManager &Diagram::qgiManager() { inline QGIManager &Diagram::qgiManager() {
return(*qgi_manager); return(*qgi_manager_);
} }
/// @return true si les bornes sont affichees, false sinon /// @return true if terminals are rendered, false otherwise
inline bool Diagram::drawTerminals() const { inline bool Diagram::drawTerminals() const {
return(draw_terminals); return(draw_terminals_);
} }
/// @return true si les couleurs des conducteurs sont respectees, false sinon /// @return true if conductors colors are rendered, false otherwise.
inline bool Diagram::drawColoredConductors() const { inline bool Diagram::drawColoredConductors() const {
return(draw_colored_conductors_); return(draw_colored_conductors_);
} }

View File

@@ -31,140 +31,139 @@ class ElementTextItem;
class IndependentTextItem; class IndependentTextItem;
/** /**
Cette classe represente l'action d'ajouter un element au schema This command adds an element to a particular diagram.
*/ */
class AddElementCommand : public QUndoCommand { class AddElementCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
AddElementCommand(Diagram *, Element *, const QPointF &, QUndoCommand * = 0); AddElementCommand(Diagram *, Element *, const QPointF &, QUndoCommand * = 0);
virtual ~AddElementCommand(); virtual ~AddElementCommand();
private: private:
AddElementCommand(const AddElementCommand &); AddElementCommand(const AddElementCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// element ajoute /// added element
Element *element; Element *element;
/// schema sur lequel on ajoute l'element /// diagram the element is added to
Diagram *diagram; Diagram *diagram;
/// position de l'element sur le schema /// position of the element on the diagram
QPointF position; QPointF position;
}; };
/** /**
Cette classe represente l'action d'ajouter du texte au schema This command adds an independent (i.e. related to neither an element nor a
conductor) text item to a particular diagram.
*/ */
class AddTextCommand : public QUndoCommand { class AddTextCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
AddTextCommand(Diagram *, IndependentTextItem *, const QPointF &, QUndoCommand * = 0); AddTextCommand(Diagram *, IndependentTextItem *, const QPointF &, QUndoCommand * = 0);
virtual ~AddTextCommand(); virtual ~AddTextCommand();
private: private:
AddTextCommand(const AddTextCommand &); AddTextCommand(const AddTextCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// texte ajoute /// added text item
IndependentTextItem *textitem; IndependentTextItem *textitem;
/// schema sur lequel on ajoute le texte /// diagram the text item is added to
Diagram *diagram; Diagram *diagram;
/// position du texte sur le schema /// position of the text item on the diagram
QPointF position; QPointF position;
}; };
/** /**
Cette classe represente l'action d'ajouter un conducteur au schema This command adds a conductor to a particular diagram.
*/ */
class AddConductorCommand : public QUndoCommand { class AddConductorCommand : public QUndoCommand {
// constructeurs, destructeur // 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 &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// conducteur ajoute /// added conductor
Conductor *conductor; Conductor *conductor;
/// schema auquel on ajoute le conducteur /// diagram the conductor is added to
Diagram *diagram; Diagram *diagram;
}; };
/** /**
Cette classe represente l'action de supprimer des elements, conducteurs This command removes content from a particular diagram.
et / ou textes independants d'un schema
*/ */
class DeleteElementsCommand : public QUndoCommand { class DeleteElementsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
DeleteElementsCommand(Diagram *, const DiagramContent &, QUndoCommand * = 0); DeleteElementsCommand(Diagram *, const DiagramContent &, QUndoCommand * = 0);
virtual ~DeleteElementsCommand(); virtual ~DeleteElementsCommand();
private: private:
DeleteElementsCommand(const DeleteElementsCommand &); DeleteElementsCommand(const DeleteElementsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// contenu enleve /// removed content
DiagramContent removed_content; DiagramContent removed_content;
/// schema dont on supprime des elements et conducteurs /// diagram which the content is removed from
Diagram *diagram; Diagram *diagram;
}; };
/** /**
Cette classe represente l'action de coller quelque chose sur un schema This command pastes some content onto a particular diagram.
*/ */
class PasteDiagramCommand : public QUndoCommand { class PasteDiagramCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
PasteDiagramCommand(Diagram *, const DiagramContent &, QUndoCommand * = 0); PasteDiagramCommand(Diagram *, const DiagramContent &, QUndoCommand * = 0);
virtual ~PasteDiagramCommand(); virtual ~PasteDiagramCommand();
private: private:
PasteDiagramCommand(const PasteDiagramCommand &); PasteDiagramCommand(const PasteDiagramCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// contenu ajoute /// pasted content
DiagramContent content; DiagramContent content;
/// schema sur lequel on colle les elements et conducteurs /// diagram content is pasted onto
Diagram *diagram; Diagram *diagram;
/// entien pour filtrer le contenu du schema /// filter stating what kinds of items should be pasted
int filter; int filter;
/// booleen pour empecher le premier appel a redo /// prevent the first call to redo()
bool first_redo; bool first_redo;
}; };
/** /**
Cette classe represente l'action de supprimer des elements et / ou This command cuts content from a particular diagram.
conducteurs d'un schema
*/ */
class CutDiagramCommand : public DeleteElementsCommand { class CutDiagramCommand : public DeleteElementsCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
CutDiagramCommand(Diagram *, const DiagramContent &, QUndoCommand * = 0); CutDiagramCommand(Diagram *, const DiagramContent &, QUndoCommand * = 0);
virtual ~CutDiagramCommand(); virtual ~CutDiagramCommand();
@@ -173,89 +172,84 @@ class CutDiagramCommand : public DeleteElementsCommand {
}; };
/** /**
Cette classe represente l'action de deplacer des elements et des This command moves some content on a particular diagram.
conducteurs sur un schema
*/ */
class MoveElementsCommand : public QUndoCommand { class MoveElementsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
MoveElementsCommand(Diagram *, const DiagramContent &, const QPointF &m, QUndoCommand * = 0); MoveElementsCommand(Diagram *, const DiagramContent &, const QPointF &m, QUndoCommand * = 0);
virtual ~MoveElementsCommand(); virtual ~MoveElementsCommand();
private: private:
MoveElementsCommand(const MoveElementsCommand &); MoveElementsCommand(const MoveElementsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
virtual void move(const QPointF &); virtual void move(const QPointF &);
virtual void addConductorTextItemMovement(ConductorTextItem *, const QPointF &, const QPointF &); virtual void addConductorTextItemMovement(ConductorTextItem *, const QPointF &, const QPointF &);
// attributs // attributes
private: private:
/// schema sur lequel on deplace les elements /// diagram the movement takes place on.
Diagram *diagram; Diagram *diagram;
/// contenu a deplacer /// moved content
DiagramContent content_to_move; DiagramContent content_to_move;
/// mouvement effectue /// applied movement
QPointF movement; QPointF movement;
/** /**
Deplacer des elements ou champs de texte entraine des conducteurs. Moving elements impacts their conductors: either they are moved, or their path
Soit ces conducteurs sont betement deplaces, soit leur trajet est needs to be generated again, which in turn tends to move their child text
recalcule. items. This attribute holds both new and previous positions for each moved
Si leur trajet est recalcule, les champs de texte dont la position a ete text item.
personnalisee par l'utilisateur
Liste des champs de texte de conducteurs dont la position a ete modifiee
par des mises
*/ */
QHash<ConductorTextItem *, QPair<QPointF, QPointF> > moved_conductor_texts_; QHash<ConductorTextItem *, QPair<QPointF, QPointF> > moved_conductor_texts_;
/// booleen pour ne pas executer le premier redo() /// prevent the first call to redo()
bool first_redo; bool first_redo;
}; };
/** /**
Cette classe represente l'action de deplacer des champs de texte rattaches This command moves text items related to elements on a particular diagram.
a des elements sur un schema
*/ */
class MoveElementsTextsCommand : public QUndoCommand { class MoveElementsTextsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
MoveElementsTextsCommand(Diagram *, const QSet<ElementTextItem *> &, const QPointF &m, QUndoCommand * = 0); MoveElementsTextsCommand(Diagram *, const QSet<ElementTextItem *> &, const QPointF &m, QUndoCommand * = 0);
virtual ~MoveElementsTextsCommand(); virtual ~MoveElementsTextsCommand();
private: private:
MoveElementsTextsCommand(const MoveElementsTextsCommand &); MoveElementsTextsCommand(const MoveElementsTextsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
virtual void move(const QPointF &); virtual void move(const QPointF &);
// attributs // attributes
private: private:
/// schema sur lequel on deplace les elements /// diagram the movement takes place on.
Diagram *diagram; Diagram *diagram;
/// liste des champs de texte a deplacer /// text items to be moved
QSet<ElementTextItem *> texts_to_move; QSet<ElementTextItem *> texts_to_move;
/// mouvement effectue /// applied movement
QPointF movement; QPointF movement;
/// booleen pour ne pas executer le premier redo() /// prevent the first call to redo()
bool first_redo; bool first_redo;
}; };
/** /**
Cette classe represente l'action de deplacer des champs de texte rattaches This command moves text items related to conductors on a particular
a des conducteurs sur un schema diagram.
*/ */
class MoveConductorsTextsCommand : public QUndoCommand { class MoveConductorsTextsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
MoveConductorsTextsCommand(Diagram *, QUndoCommand * = 0); MoveConductorsTextsCommand(Diagram *, QUndoCommand * = 0);
virtual ~MoveConductorsTextsCommand(); virtual ~MoveConductorsTextsCommand();
private: private:
MoveConductorsTextsCommand(const MoveConductorsTextsCommand &); MoveConductorsTextsCommand(const MoveConductorsTextsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
@@ -264,56 +258,56 @@ class MoveConductorsTextsCommand : public QUndoCommand {
private: private:
void regenerateTextLabel(); void regenerateTextLabel();
// attributs // attributes
private: private:
/// schema sur lequel on deplace les elements /// diagram the movement takes place on.
Diagram *diagram; Diagram *diagram;
/// liste des champs de texte a deplacer /// text items to be moved
QHash<ConductorTextItem *, QPair<QPointF, bool> > texts_to_move_; QHash<ConductorTextItem *, QPair<QPointF, bool> > texts_to_move_;
/// booleen pour ne pas executer le premier redo() /// prevent the first call to redo()
bool first_redo; bool first_redo;
}; };
/** /**
Cette classe represente la modification d'un champ de texte This commad modifies a text item.
*/ */
class ChangeDiagramTextCommand : public QUndoCommand { class ChangeDiagramTextCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangeDiagramTextCommand(DiagramTextItem *, const QString &before, const QString &after, QUndoCommand * = 0); ChangeDiagramTextCommand(DiagramTextItem *, const QString &before, const QString &after, QUndoCommand * = 0);
virtual ~ChangeDiagramTextCommand(); virtual ~ChangeDiagramTextCommand();
private: private:
ChangeDiagramTextCommand(const ChangeDiagramTextCommand &); ChangeDiagramTextCommand(const ChangeDiagramTextCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// DiagramTextItem modifie /// modified text item
DiagramTextItem *text_item; DiagramTextItem *text_item;
/// texte avant changement /// former text
QString text_before; QString text_before;
/// texte apres changement /// new text
QString text_after; QString text_after;
/// booleen pour ne pas executer le premier redo() /// prevent the first call to redo()
bool first_redo; bool first_redo;
}; };
/** /**
Cette classe represente l'action de pivoter plusieurs elements ou champs de textes avec un meme angle This command rotates several elements or text items by a particular angle.
*/ */
class RotateElementsCommand : public QUndoCommand { class RotateElementsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
RotateElementsCommand(const QHash<Element *, QET::Orientation> &elements, const QList<DiagramTextItem *> &, QUndoCommand * = 0); RotateElementsCommand(const QHash<Element *, QET::Orientation> &elements, const QList<DiagramTextItem *> &, QUndoCommand * = 0);
virtual ~RotateElementsCommand(); virtual ~RotateElementsCommand();
private: private:
RotateElementsCommand(const RotateElementsCommand &); RotateElementsCommand(const RotateElementsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
@@ -321,21 +315,22 @@ class RotateElementsCommand : public QUndoCommand {
void setAppliedRotationAngle(const qreal &); void setAppliedRotationAngle(const qreal &);
static void rotateElement(Element *, QET::Orientation); static void rotateElement(Element *, QET::Orientation);
// attributs // attributes
private: private:
/// elements pivotes associes a leur ancienne orientation /// hold rotated elements along with their former orientation
QHash<Element *, QET::Orientation> elements_to_rotate; QHash<Element *, QET::Orientation> elements_to_rotate;
/// textes a pivoter /// text items to be rotated
QList<DiagramTextItem *> texts_to_rotate; QList<DiagramTextItem *> texts_to_rotate;
/// angle de rotation a appliquer aux textes (valeur utilisee dans le redo /// angle of rotation to be applied to text items
qreal applied_rotation_angle_; qreal applied_rotation_angle_;
}; };
/** /**
Cette classe represente l'action d'orienter plusieurs textes a un meme angle de rotation bien precis This command directs several text items to a same particular angle of
rotation.
*/ */
class RotateTextsCommand : public QUndoCommand { class RotateTextsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
RotateTextsCommand(const QHash<DiagramTextItem *, double> &, double, QUndoCommand * = 0); RotateTextsCommand(const QHash<DiagramTextItem *, double> &, double, QUndoCommand * = 0);
RotateTextsCommand(const QList<DiagramTextItem *> &, double, QUndoCommand * = 0); RotateTextsCommand(const QList<DiagramTextItem *> &, double, QUndoCommand * = 0);
@@ -343,7 +338,7 @@ class RotateTextsCommand : public QUndoCommand {
private: private:
RotateTextsCommand(const RotateTextsCommand &); RotateTextsCommand(const RotateTextsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
@@ -351,152 +346,153 @@ class RotateTextsCommand : public QUndoCommand {
private: private:
void defineCommandName(); void defineCommandName();
// attributs // attributes
private: private:
/// textes pivotes associes a leur ancienne orientation /// hold rotated text items along with their former angle of rotation
QHash<DiagramTextItem *, double> texts_to_rotate; QHash<DiagramTextItem *, double> texts_to_rotate;
/// angle de rotation a appliquer aux textes /// angle of rotation of all text items after the command
double applied_rotation_angle_; double applied_rotation_angle_;
}; };
/** /**
Cette classe represente l'action de modifier un conducteur This command changes a particular conductor.
*/ */
class ChangeConductorCommand : public QUndoCommand { class ChangeConductorCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangeConductorCommand(Conductor *, const ConductorProfile &, const ConductorProfile &, Qt::Corner, QUndoCommand * = 0); ChangeConductorCommand(Conductor *, const ConductorProfile &, const ConductorProfile &, Qt::Corner, QUndoCommand * = 0);
virtual ~ChangeConductorCommand(); virtual ~ChangeConductorCommand();
private: private:
ChangeConductorCommand(const ChangeConductorCommand &); ChangeConductorCommand(const ChangeConductorCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
virtual void setConductorTextItemMove(const QPointF &, const QPointF &); virtual void setConductorTextItemMove(const QPointF &, const QPointF &);
// attributs // attributes
private: private:
/// conducteur modifie /// changed conductor
Conductor *conductor; Conductor *conductor;
/// profil avant changement /// profile before the change
ConductorProfile old_profile; ConductorProfile old_profile;
/// profil apres changement /// profile after the change
ConductorProfile new_profile; ConductorProfile new_profile;
/// Type de trajet /// Path type of the modified conductor
Qt::Corner path_type; Qt::Corner path_type;
/// Position du champ de texte avant le changement /// position of the text item before the change
QPointF text_pos_before_mov_; QPointF text_pos_before_mov_;
/// Position du champ de texte apres le changement /// position of the text item after the change
QPointF text_pos_after_mov_; QPointF text_pos_after_mov_;
/// booleen pour ne pas executer le premier redo() /// prevent the first call to redo()
bool first_redo; bool first_redo;
}; };
/** /**
Cette classe represente l'action de reinitialiser des conducteurs This command resets conductor paths.
*/ */
class ResetConductorCommand : public QUndoCommand { class ResetConductorCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ResetConductorCommand(const QHash<Conductor *, ConductorProfilesGroup> &, QUndoCommand * = 0); ResetConductorCommand(const QHash<Conductor *, ConductorProfilesGroup> &, QUndoCommand * = 0);
virtual ~ResetConductorCommand(); virtual ~ResetConductorCommand();
private: private:
ResetConductorCommand(const ResetConductorCommand &); ResetConductorCommand(const ResetConductorCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// conducteurs reinitialises associes a leur ancien profil /// impacted conductors along with their former profiles
QHash<Conductor *, ConductorProfilesGroup> conductors_profiles; QHash<Conductor *, ConductorProfilesGroup> conductors_profiles;
}; };
/** /**
Cette classe represente l'action de modifier les informations du cartouche d'un schema This command changes the title block properties for a particular diagram.
*/ */
class ChangeTitleBlockCommand : public QUndoCommand { class ChangeTitleBlockCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangeTitleBlockCommand(Diagram *, const TitleBlockProperties &, const TitleBlockProperties &, QUndoCommand * = 0); ChangeTitleBlockCommand(Diagram *, const TitleBlockProperties &, const TitleBlockProperties &, QUndoCommand * = 0);
virtual ~ChangeTitleBlockCommand(); virtual ~ChangeTitleBlockCommand();
private: private:
ChangeTitleBlockCommand(const ChangeTitleBlockCommand &); ChangeTitleBlockCommand(const ChangeTitleBlockCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// schema modifie /// modified diagram
Diagram *diagram; Diagram *diagram;
/// proprietes avant changement /// properties before the change
TitleBlockProperties old_titleblock; TitleBlockProperties old_titleblock;
/// proprietes apres changement /// properties after the change
TitleBlockProperties new_titleblock; TitleBlockProperties new_titleblock;
}; };
/** /**
Cette classe represente l'action de modifier les dimensions d'un schema This command changes the border properties of a particular diagram.
*/ */
class ChangeBorderCommand : public QUndoCommand { class ChangeBorderCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangeBorderCommand(Diagram *, const BorderProperties &, const BorderProperties &, QUndoCommand * = 0); ChangeBorderCommand(Diagram *, const BorderProperties &, const BorderProperties &, QUndoCommand * = 0);
virtual ~ChangeBorderCommand(); virtual ~ChangeBorderCommand();
private: private:
ChangeBorderCommand(const ChangeBorderCommand &); ChangeBorderCommand(const ChangeBorderCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// schema modifie /// modified diagram
Diagram *diagram; Diagram *diagram;
public: public:
/// anciennes dimensions du schema /// properties before the change
BorderProperties old_properties; BorderProperties old_properties;
/// nouvelles dimensions du schema /// properties after the change
BorderProperties new_properties; BorderProperties new_properties;
}; };
/** /**
Cette classe represente l'action de modifier les proprietes d'un conducteur This command changes the properties for a particular conductor.
*/ */
class ChangeConductorPropertiesCommand : public QUndoCommand { class ChangeConductorPropertiesCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangeConductorPropertiesCommand(Conductor *, QUndoCommand * = 0); ChangeConductorPropertiesCommand(Conductor *, QUndoCommand * = 0);
virtual ~ChangeConductorPropertiesCommand(); virtual ~ChangeConductorPropertiesCommand();
private: private:
ChangeConductorPropertiesCommand(const ChangeConductorPropertiesCommand &); ChangeConductorPropertiesCommand(const ChangeConductorPropertiesCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
virtual void setOldSettings(const ConductorProperties &); virtual void setOldSettings(const ConductorProperties &);
virtual void setNewSettings(const ConductorProperties &); virtual void setNewSettings(const ConductorProperties &);
// attributs // attributes
private: private:
/// conducteur modifie /// modified conductor
Conductor *conductor; Conductor *conductor;
/// anciennes proprietes /// properties before the change
ConductorProperties old_properties; ConductorProperties old_properties;
/// nouvelles proprietes /// properties after the change
ConductorProperties new_properties; ConductorProperties new_properties;
/// booleens indiquant si les proprietes ont ete definies ou non /// track whether pre-change properties were set
bool old_settings_set; bool old_settings_set;
/// track whether post-change properties were set
bool new_settings_set; bool new_settings_set;
}; };
#endif #endif

View File

@@ -22,14 +22,13 @@ class Conductor;
class Element; class Element;
class IndependentTextItem; class IndependentTextItem;
/** /**
Cette classe est un conteneur pour passer facilement le contenu d'un schema This class provides a container that makes the transmission of diagram content
a une fonction. Il permet d'acceder rapidement aux differents types de to other functions/methods easier. The different kind of items are made
composants que l'on peut trouver sur un schema, comme les elements, les available through a handful of filter-aware methods. Considering selected
champs de texte, les conducteurs (a deplacer ou a mettre a jour, en cas de elements are to be moved, the filter notably distinguishes conductors to be
deplacements), etc. moved from those to be updated.
A noter que ce container ne contient pas systematiquement l'integralite Please note this container does not systematically contains a whole
d'un schema. Il peut n'en contenir qu'une partie, typiquement les diagram: it may describe only a part of it, e.g. selected items.
composants selectionnes.
*/ */
class DiagramContent { class DiagramContent {
public: public:
@@ -37,7 +36,7 @@ class DiagramContent {
DiagramContent(const DiagramContent &); DiagramContent(const DiagramContent &);
~DiagramContent(); ~DiagramContent();
/// Permet de filtrer facilement les differentes parties d'un schema /// Used to filter the different items carried by this container.
enum Filter { enum Filter {
Elements = 1, Elements = 1,
TextFields = 2, TextFields = 2,
@@ -49,15 +48,15 @@ class DiagramContent {
SelectedOnly = 32 SelectedOnly = 32
}; };
/// Elements de texte du schema /// Hold electrical elements
QSet<Element *> elements; QSet<Element *> elements;
/// Champs de texte independants du schema /// Hold independent text items
QSet<IndependentTextItem *> textFields; QSet<IndependentTextItem *> textFields;
/// Conducteurs a mettre a jour du schema /// Hold conductors that would get updated considering electrical elements are moved
QSet<Conductor *> conductorsToUpdate; QSet<Conductor *> conductorsToUpdate;
/// Conducteurs a deplacer du schema /// Hold conductors that would be moved as is considering electrical elements are moved
QSet<Conductor *> conductorsToMove; QSet<Conductor *> conductorsToMove;
/// Conducteurs isoles (ni a deplacer, ni a mettre a jour) /// Hold conductors that would be left untouched considering electrical elements are moved
QSet<Conductor *> otherConductors; QSet<Conductor *> otherConductors;
QList<Conductor *> conductors(int = AnyConductor) const; QList<Conductor *> conductors(int = AnyConductor) const;

View File

@@ -21,25 +21,25 @@
#include <QString> #include <QString>
#include <QRegExp> #include <QRegExp>
/** /**
Cette classe represente la position d'un element sur le schema. Il ne This class stores the position of an electrical element on its parent diagram.
s'agit pas de ses coordonnees (bien que celles-ci puissent etre embarquees While exact coordinates can be stored for convenience, the concept of diagram
par commodite), mais du secteur du schema dans lequel il se situe, par position as implemented by this class simply designates the intersection
exemple B2 ou C4. between a column and a row, e.g. B2 or C4.
*/ */
class DiagramPosition { class DiagramPosition {
// constructeurs, destructeur // constructors, destructor
public: public:
DiagramPosition(const QString & = "", unsigned int = 0); DiagramPosition(const QString & = "", unsigned int = 0);
virtual ~DiagramPosition(); virtual ~DiagramPosition();
// methodes // methods
public: public:
QPointF position() const; QPointF position() const;
void setPosition(const QPointF &); void setPosition(const QPointF &);
QString toString(); QString toString();
bool isOutOfBounds() const; bool isOutOfBounds() const;
// attributs // attributes
private: private:
QString letter_; QString letter_;
unsigned int number_; unsigned int number_;

View File

@@ -22,20 +22,19 @@
#include "diagram.h" #include "diagram.h"
#include "exportproperties.h" #include "exportproperties.h"
/** /**
Cette classe represente le dialogue de configuration de l'impression d'un This class implements both the dialog allowing users to configure the printing
schema electrique. of a project file and the printing itself.
Elle se charge egalement de l'impression elle-meme
*/ */
class DiagramPrintDialog : public QWidget { class DiagramPrintDialog : public QWidget {
Q_OBJECT Q_OBJECT
// Constructeurs, destructeur // Constructors, destructor
public: public:
DiagramPrintDialog(QETProject *, QWidget * = 0); DiagramPrintDialog(QETProject *, QWidget * = 0);
virtual ~DiagramPrintDialog(); virtual ~DiagramPrintDialog();
private: private:
DiagramPrintDialog(const DiagramPrintDialog &); DiagramPrintDialog(const DiagramPrintDialog &);
// methodes // methods
public: public:
void setFileName(const QString &); void setFileName(const QString &);
QString fileName() const; QString fileName() const;
@@ -62,14 +61,13 @@ class DiagramPrintDialog : public QWidget {
void acceptPrintTypeDialog(); void acceptPrintTypeDialog();
void browseFilePrintTypeDialog(); void browseFilePrintTypeDialog();
// attributs // attributes
private: private:
QETProject *project_; QETProject *project_;
QPrinter *printer_; QPrinter *printer_;
QString doc_name_; QString doc_name_;
QString file_name_; QString file_name_;
/// Attributs relatifs au 1er dialogue
QDialog *dialog_; QDialog *dialog_;
QLabel *printtype_label_; QLabel *printtype_label_;
QGridLayout *glayout0_; QGridLayout *glayout0_;

View File

@@ -21,20 +21,20 @@
class QETProject; class QETProject;
class Diagram; class Diagram;
/** /**
Cette classe represente un widget permettant de choisir 0 a n schemas parmi This class provides a widget which allows users to select 0 to n diagrams
ceux d'un projet. among those of a particular project.
*/ */
class DiagramsChooser : public QScrollArea { class DiagramsChooser : public QScrollArea {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
DiagramsChooser(QETProject *, QWidget * = 0); DiagramsChooser(QETProject *, QWidget * = 0);
virtual ~DiagramsChooser(); virtual ~DiagramsChooser();
private: private:
DiagramsChooser(const DiagramsChooser &); DiagramsChooser(const DiagramsChooser &);
// methodes // methods
public: public:
QETProject *project() const; QETProject *project() const;
QList<Diagram *> selectedDiagrams() const; QList<Diagram *> selectedDiagrams() const;
@@ -52,7 +52,7 @@ class DiagramsChooser : public QScrollArea {
private: private:
void buildLayout(); void buildLayout();
// attributs // attributes
private: private:
QETProject *project_; QETProject *project_;
QWidget *widget0_; QWidget *widget0_;

View File

@@ -20,27 +20,28 @@
#include <QtGui> #include <QtGui>
#include "diagram.h" #include "diagram.h"
/** /**
Cette classe represente un champ de texte editable sur le schema. This class represents a selectable, movable and editable text field on a
Par defaut, les DiagramTextItem sont Selectable et Movable. diagram.
@see QGraphicsItem::GraphicsItemFlags @see QGraphicsItem::GraphicsItemFlags
*/ */
class DiagramTextItem : public QGraphicsTextItem { class DiagramTextItem : public QGraphicsTextItem {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
DiagramTextItem(QGraphicsItem * = 0, Diagram * = 0); DiagramTextItem(QGraphicsItem * = 0, Diagram * = 0);
DiagramTextItem(const QString &, QGraphicsItem * = 0, Diagram * = 0); DiagramTextItem(const QString &, QGraphicsItem * = 0, Diagram * = 0);
virtual ~DiagramTextItem(); virtual ~DiagramTextItem();
// attributs // attributes
public: public:
enum { Type = UserType + 1004 }; enum { Type = UserType + 1004 };
// methodes // methods
public: public:
/** /**
Cette methode permet d'utiliser qgraphicsitem_cast sur cet objet Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem DiagramTextItem
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
Diagram *diagram() const; Diagram *diagram() const;
@@ -64,22 +65,19 @@ class DiagramTextItem : public QGraphicsTextItem {
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *); virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
virtual void applyRotation(const qreal &); virtual void applyRotation(const qreal &);
// signaux
signals: signals:
/// signal emis lorsque le champ de texte perd le focus /// signal emitted when the text field loses focus
void lostFocus(); void lostFocus();
/// signal emis lorsque le champ de texte a ete modifie /// signal emitted after text was changed
void diagramTextChanged(DiagramTextItem *, const QString &, const QString &); void diagramTextChanged(DiagramTextItem *, const QString &, const QString &);
// slots
public slots: public slots:
void setNonFocusable(); void setNonFocusable();
// attributs prives
private: private:
/// Texte precedent /// Previous text value
QString previous_text_; QString previous_text_;
/// angle de rotation du champ de texte /// angle of rotation of the text field
qreal rotation_angle_; qreal rotation_angle_;
}; };
#endif #endif

View File

@@ -26,12 +26,13 @@ class Element;
class IndependentTextItem; class IndependentTextItem;
class QETDiagramEditor; class QETDiagramEditor;
/** /**
Classe representant graphiquement un schema electrique This class provides a widget to render an electric diagram in an editable,
interactive way.
*/ */
class DiagramView : public QGraphicsView { class DiagramView : public QGraphicsView {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
DiagramView(Diagram * = 0, QWidget * = 0); DiagramView(Diagram * = 0, QWidget * = 0);
virtual ~DiagramView(); virtual ~DiagramView();
@@ -39,7 +40,7 @@ class DiagramView : public QGraphicsView {
private: private:
DiagramView(const DiagramView &); DiagramView(const DiagramView &);
// attributs // attributes
private: private:
Diagram *scene; Diagram *scene;
QMenu *context_menu; QMenu *context_menu;
@@ -52,7 +53,7 @@ class DiagramView : public QGraphicsView {
ElementsLocation next_location_; ElementsLocation next_location_;
QPoint next_position_; QPoint next_position_;
// methodes // methods
public: public:
QString title() const; QString title() const;
void editDiagramProperties(); void editDiagramProperties();
@@ -60,7 +61,7 @@ class DiagramView : public QGraphicsView {
void removeColumn(); void removeColumn();
void addRow(); void addRow();
void removeRow(); void removeRow();
/// @return Le schema visualise par ce DiagramView /// @return the diagram rendered by this view
Diagram *diagram() { return(scene); } Diagram *diagram() { return(scene); }
QETDiagramEditor *diagramEditor() const; QETDiagramEditor *diagramEditor() const;
bool hasSelectedItems(); bool hasSelectedItems();
@@ -96,23 +97,23 @@ class DiagramView : public QGraphicsView {
bool addElementAtPos(const ElementsLocation &, const QPoint &); bool addElementAtPos(const ElementsLocation &, const QPoint &);
signals: signals:
/// Signal emis lorsque la selection change /// Signal emitted after the selection changed
void selectionChanged(); void selectionChanged();
/// Signal emis lorsque le mode de selection change /// Signal emitted after the selection mode changed
void modeChanged(); void modeChanged();
/// Signal emis lorsqu'un texte a ete pose /// Signal emitted after a text was added
void textAdded(bool); void textAdded(bool);
/// Signal emis lorsque le titre du schema change /// Signal emitted after the diagram title changed
void titleChanged(DiagramView *, const QString &); void titleChanged(DiagramView *, const QString &);
/// Signal emis avant l'integration d'un element /// Signal emitted before integrating an element
void aboutToAddElement(); void aboutToAddElement();
/// Signal emitted before integrating a title block template /// Signal emitted before integrating a title block template
void aboutToSetDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &); void aboutToSetDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &);
/// Signal emis lorsque l'utilisateur souhaite retrouver un element du schema dans les collections /// Signal emitted when users wish to locate an element from the diagram within elements collection
void findElementRequired(const ElementsLocation &); void findElementRequired(const ElementsLocation &);
/// Signal emis lorsque l'utilisateur souhaite editer un element du schema /// Signal emitted when users wish to edit an element from the diagram
void editElementRequired(const ElementsLocation &); void editElementRequired(const ElementsLocation &);
/// Signal emitted when the user wants to edit and/or duplicate an existing title block template /// Signal emitted when users want to edit and/or duplicate an existing title block template
void editTitleBlockTemplate(const QString &, bool); void editTitleBlockTemplate(const QString &, bool);
public slots: public slots:

View File

@@ -22,26 +22,25 @@
class PartArc; class PartArc;
class StyleEditor; class StyleEditor;
/** /**
Cette classe represente le widget d'edition d'un arc dans l'editeur This class provides a widget to edit elliptical arcs within the element editor.
d'element.
*/ */
class ArcEditor : public ElementItemEditor { class ArcEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
//constructeurs, destructeur // constructors, destructor
public: public:
ArcEditor(QETElementEditor *, PartArc * = 0, QWidget * = 0); ArcEditor(QETElementEditor *, PartArc * = 0, QWidget * = 0);
virtual ~ArcEditor(); virtual ~ArcEditor();
private: private:
ArcEditor(const ArcEditor &); ArcEditor(const ArcEditor &);
// attributs // attributes
private: private:
PartArc *part; PartArc *part;
StyleEditor *style_; StyleEditor *style_;
QLineEdit *x, *y, *h, *v; QLineEdit *x, *y, *h, *v;
QSpinBox *angle, *start_angle; QSpinBox *angle, *start_angle;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -22,9 +22,7 @@
class PartCircle; class PartCircle;
class StyleEditor; class StyleEditor;
/** /**
Cette classe represente un editeur de cercle. This class provides a widget to edit circles within the element editor.
Elle permet d'editer a travers une interface graphique les
proprietes d'une cercle composant le dessin d'un element.
*/ */
class CircleEditor : public ElementItemEditor { class CircleEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
@@ -35,13 +33,13 @@ class CircleEditor : public ElementItemEditor {
private: private:
CircleEditor(const CircleEditor &); CircleEditor(const CircleEditor &);
// attributs // attributes
private: private:
PartCircle *part; PartCircle *part;
StyleEditor *style_; StyleEditor *style_;
QLineEdit *x, *y, *r; QLineEdit *x, *y, *r;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -23,44 +23,43 @@
class QETElementEditor; class QETElementEditor;
typedef CustomElementGraphicPart CEGP; typedef CustomElementGraphicPart CEGP;
/** /**
Cette classe represente une partie graphique d'element This class represents an element visual/geometric primitive. It provides
Elle encapsule des methodes afin de gerer les attributs de style communs methods to manage style attributes common to most primitives.
a la plupart des parties d'elements
*/ */
class CustomElementGraphicPart : public CustomElementPart { class CustomElementGraphicPart : public CustomElementPart {
public: public:
/// Qualifie le style de ligne utilise pour dessiner la partie /// This enum lists the various line styles available to draw primitives.
enum LineStyle { enum LineStyle {
NormalStyle, ///< Ligne pleine NormalStyle, ///< Normal line
DashedStyle, ///< Ligne pointillee (tirets) DashedStyle, ///< Dashed line
DottedStyle ///< Ligne pointillee (points) DottedStyle ///< Dotted line
}; };
/// Qualifie l'epaisseur de ligne utilisee pour dessiner la partie /// This enum lists the various line weights available to draw primitives.
enum LineWeight { enum LineWeight {
NormalWeight, ///< Ligne normale NormalWeight, ///< Normal line
ThinWeight, ///< Ligne fine ThinWeight, ///< Thin line
NoneWeight ///< Ligne invisible NoneWeight ///< Invisible line
}; };
/// Qualifie la couleur utilisee pour remplir la partie /// This enum lists the various filling colors available to draw primitives.
enum Filling { enum Filling {
NoneFilling, ///< Remplissage transparent NoneFilling, ///< No filling (i.e. transparent)
BlackFilling, ///< Remplissage en noir BlackFilling, ///< Black filling
WhiteFilling ///< Remplissage en blanc WhiteFilling ///< White filling
}; };
/// Qualifie la couleur de ligne utilisee pour dessiner la partie /// This enum lists the various line colors available to draw primitives.
enum Color { enum Color {
BlackColor, ///< Ligne noire BlackColor, ///< Black line
WhiteColor ///< Ligne blanche WhiteColor ///< White line
}; };
// constructeurs, destructeur // constructors, destructor
public: public:
/** /**
Constructeur Constructor
@param editor Editeur d'element auquel cette partie est rattachee @param editor Element editor this primitive lives in.
*/ */
CustomElementGraphicPart(QETElementEditor *editor) : CustomElementGraphicPart(QETElementEditor *editor) :
CustomElementPart(editor), CustomElementPart(editor),
@@ -72,11 +71,11 @@ class CustomElementGraphicPart : public CustomElementPart {
{ {
}; };
/// Destructeur /// Destructor
virtual ~CustomElementGraphicPart() { virtual ~CustomElementGraphicPart() {
}; };
// attributs // attributes
private: private:
LineStyle _linestyle; LineStyle _linestyle;
LineWeight _lineweight; LineWeight _lineweight;
@@ -84,7 +83,7 @@ class CustomElementGraphicPart : public CustomElementPart {
Color _color; Color _color;
bool _antialiased; bool _antialiased;
//methodes // methods
public: public:
void setLineStyle(LineStyle); void setLineStyle(LineStyle);
void setLineWeight(LineWeight); void setLineWeight(LineWeight);
@@ -109,75 +108,75 @@ class CustomElementGraphicPart : public CustomElementPart {
}; };
/** /**
Change le style de trait Set the primitive line style.
@param ls Le nouveau style de trait @param ls the new line style
*/ */
inline void CustomElementGraphicPart::setLineStyle(LineStyle ls) { inline void CustomElementGraphicPart::setLineStyle(LineStyle ls) {
_linestyle = ls; _linestyle = ls;
} }
/** /**
Change l'epaisseur de trait Set the primitive line weight.
@param lw La nouvelle epaisseur de trait @param lw the new line weight
*/ */
inline void CustomElementGraphicPart::setLineWeight(LineWeight lw) { inline void CustomElementGraphicPart::setLineWeight(LineWeight lw) {
_lineweight = lw; _lineweight = lw;
} }
/** /**
Change la couleur de remplissage Set the filling color.
@param f La nouvelle couleur de remplissage @param f the new filling color
*/ */
inline void CustomElementGraphicPart::setFilling(Filling f) { inline void CustomElementGraphicPart::setFilling(Filling f) {
_filling = f; _filling = f;
} }
/** /**
Change la couleur de trait Set the line color.
@param c La nouvelle couleur de trait @param c the new line color
*/ */
inline void CustomElementGraphicPart::setColor(Color c) { inline void CustomElementGraphicPart::setColor(Color c) {
_color = c; _color = c;
} }
/** /**
@return Le style de trait @return the current line style
*/ */
inline CustomElementGraphicPart::LineStyle CustomElementGraphicPart::lineStyle() const { inline CustomElementGraphicPart::LineStyle CustomElementGraphicPart::lineStyle() const {
return(_linestyle); return(_linestyle);
} }
/** /**
@return L'epaisseur de trait @return the current line weight
*/ */
inline CustomElementGraphicPart::LineWeight CustomElementGraphicPart::lineWeight() const { inline CustomElementGraphicPart::LineWeight CustomElementGraphicPart::lineWeight() const {
return(_lineweight); return(_lineweight);
} }
/** /**
@return La couleur de remplissage @return the current filling color
*/ */
inline CustomElementGraphicPart::Filling CustomElementGraphicPart::filling() const { inline CustomElementGraphicPart::Filling CustomElementGraphicPart::filling() const {
return(_filling); return(_filling);
} }
/** /**
@return La couleur de trait @return the current line color
*/ */
inline CustomElementGraphicPart::Color CustomElementGraphicPart::color() const { inline CustomElementGraphicPart::Color CustomElementGraphicPart::color() const {
return(_color); return(_color);
} }
/** /**
Definit si la partie doit etre antialiasee ou non Set whether the primitive should be drawn antialiased.
@param aa True pour activer l'antialiasing, false pour le desactiver @param aa True to enable antialiasing, false to disable it.
*/ */
inline void CustomElementGraphicPart::setAntialiased(bool aa) { inline void CustomElementGraphicPart::setAntialiased(bool aa) {
_antialiased = aa; _antialiased = aa;
} }
/** /**
@return true si la partie est antialiasee, false sinon @return whether the primitive is drawn antialiased.
*/ */
inline bool CustomElementGraphicPart::antialiased() const { inline bool CustomElementGraphicPart::antialiased() const {
return(_antialiased); return(_antialiased);

View File

@@ -24,69 +24,67 @@ class CustomElement;
class QETElementEditor; class QETElementEditor;
class ElementScene; class ElementScene;
/** /**
Cette classe abstraite represente une partie de la representation graphique This abstract class represents a primitive of the visual representation of an
d'un element de schema electrique. Les attributs et methodes qu'elle electrical element. The Element, FixedElement and CustomElement classes do not
encapsule ne sont pas integres directement dans la classe CustomElement embed its attributes and methods in order to remain lightweight; indeed, there
afin de ne pas alourdir celle-ci. Il est en effet inutile pour cette classe is no point for those classes to store their visual representation with
de retenir sa conception graphique autrement que sous la forme d'une anything more complex than a QImage.
QImage.
*/ */
class CustomElementPart { class CustomElementPart {
// constructeurs, destructeur // constructors, destructor
public: public:
/** /**
Constructeur Constructor
@param editor Editeur d'element auquel cette partie est rattachee @param editor Element editor this primitive is attached to
*/ */
CustomElementPart(QETElementEditor *editor) : element_editor(editor) {} CustomElementPart(QETElementEditor *editor) : element_editor(editor) {}
/// Destructeur /// Destructor
virtual ~CustomElementPart() {} virtual ~CustomElementPart() {}
private: private:
CustomElementPart(const CustomElementPart &); CustomElementPart(const CustomElementPart &);
// attributs // attributes
private: private:
QETElementEditor *element_editor; QETElementEditor *element_editor;
// methodes // methods
public: public:
/** /**
Charge la partie depuis un element XML sense le decrire Load the primitive from an XML element that describes it
*/ */
virtual void fromXml(const QDomElement &) = 0; virtual void fromXml(const QDomElement &) = 0;
/** /**
Enregistre la partie dans un document XML Export the primitive as an XML element
*/ */
virtual const QDomElement toXml(QDomDocument &) const = 0; virtual const QDomElement toXml(QDomDocument &) const = 0;
/** /**
Permet de modifier une des proprietes de la partie Set a specific property of the primitive
*/ */
virtual void setProperty(const QString &, const QVariant &) = 0; virtual void setProperty(const QString &, const QVariant &) = 0;
/** /**
Permet de lire une des proprietes de la partie Get the current value of a specific primitive property
*/ */
virtual QVariant property(const QString &) = 0; virtual QVariant property(const QString &) = 0;
/** /**
@return true si la partie n'est pas pertinente, false sinon @return whether the primitive appears to be useless (e.g. 0-length line)
Typiquement, une partie non pertinente n'est pas conservee lors de Typically, useless primitives are discarded when saving the element.
l'enregistrement de l'element.
*/ */
virtual bool isUseless() const = 0; virtual bool isUseless() const = 0;
/// @return un pointeur vers l'editeur d'element parent /// @return a pointer to the parent element editor
virtual QETElementEditor *elementEditor() const; virtual QETElementEditor *elementEditor() const;
/** /**
Appelle le slot updateCurrentPartEditor de l'editeur Call the updateCurrentPartEditor() slot of the editor
@see QETElementEditor::updateCurrentPartEditor() @see QETElementEditor::updateCurrentPartEditor()
*/ */
virtual void updateCurrentPartEditor() const; virtual void updateCurrentPartEditor() const;
/// @return un pointeur vers la scene d'edition parente /// @return a pointer to the parent editing scene
virtual ElementScene *elementScene() const; virtual ElementScene *elementScene() const;
/// @return la pile d'annulations a utiliser /// @return the element editor undo stack
virtual QUndoStack &undoStack() const; virtual QUndoStack &undoStack() const;
/// @return le nom de la partie /// @return the name of the primitive
virtual QString name() const = 0; virtual QString name() const = 0;
/// @return le nom qui sera utilise pour nommer l'element XML lors de l'export /// @return the name that will be used as XML tag when exporting the primitive
virtual QString xmlName() const = 0; virtual QString xmlName() const = 0;
}; };
#endif #endif

View File

@@ -25,69 +25,69 @@
#include "qgimanager.h" #include "qgimanager.h"
#include <QtGui> #include <QtGui>
/** /**
Cette classe represente l'action de supprimer une ou plusieurs This command deletes one or several primitives/parts when editing an
parties lors de l'edition d'un element electrical element.
*/ */
class DeletePartsCommand : public QUndoCommand { class DeletePartsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
DeletePartsCommand(ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = 0); DeletePartsCommand(ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = 0);
virtual ~DeletePartsCommand(); virtual ~DeletePartsCommand();
private: private:
DeletePartsCommand(const DeletePartsCommand &); DeletePartsCommand(const DeletePartsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// Liste des parties supprimees /// Deleted primitives
QList<QGraphicsItem *> deleted_parts; QList<QGraphicsItem *> deleted_parts;
/// scene sur laquelle se produisent les actions /// Element editor/view/scene the command should take place on
ElementScene *editor_scene; ElementScene *editor_scene;
}; };
/** /**
Cette classe represente l'action de coller quelque chose dans un element This command pastes primitives when editing an electrical element.
*/ */
class PastePartsCommand : public QUndoCommand { class PastePartsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
PastePartsCommand(ElementView *, const ElementContent &, QUndoCommand * = 0); PastePartsCommand(ElementView *, const ElementContent &, QUndoCommand * = 0);
virtual ~PastePartsCommand(); virtual ~PastePartsCommand();
private: private:
PastePartsCommand(const PastePartsCommand &); PastePartsCommand(const PastePartsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
virtual void setOffset(int, const QPointF &, int, const QPointF &); virtual void setOffset(int, const QPointF &, int, const QPointF &);
// attributs // attributes
private: private:
/// contenu ajoute /// Pasted content
ElementContent content_; ElementContent content_;
/// schema sur lequel on colle les elements et conducteurs /// Element editor/view/scene the command should take place on
ElementView *editor_view_; ElementView *editor_view_;
ElementScene *editor_scene_; ElementScene *editor_scene_;
/// Informations pour annuler un c/c avec decalage /// Data required to undo a copy/paste with offset
int old_offset_paste_count_; int old_offset_paste_count_;
QPointF old_start_top_left_corner_; QPointF old_start_top_left_corner_;
int new_offset_paste_count_; int new_offset_paste_count_;
QPointF new_start_top_left_corner_; QPointF new_start_top_left_corner_;
bool uses_offset; bool uses_offset;
/// booleen pour empecher le premier appel a redo /// Prevent the first call to redo()
bool first_redo; bool first_redo;
}; };
/** /**
Cette classe represente l'action de supprimer des parties d'un element This command cut primitives when editing an electrical element.
*/ */
class CutPartsCommand : public DeletePartsCommand { class CutPartsCommand : public DeletePartsCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
CutPartsCommand(ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = 0); CutPartsCommand(ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = 0);
virtual ~CutPartsCommand(); virtual ~CutPartsCommand();
@@ -96,127 +96,127 @@ class CutPartsCommand : public DeletePartsCommand {
}; };
/** /**
Cette classe represente l'action de deplacer une ou plusieurs This command moves primitives when editing an electrical element.
parties lors de l'edition d'un element
*/ */
class MovePartsCommand : public QUndoCommand { class MovePartsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
MovePartsCommand(const QPointF &, ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = 0); MovePartsCommand(const QPointF &, ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = 0);
virtual ~MovePartsCommand(); virtual ~MovePartsCommand();
private: private:
MovePartsCommand(const MovePartsCommand &); MovePartsCommand(const MovePartsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// Liste des parties supprimees /// List of moved primitives
QList<QGraphicsItem *> moved_parts; QList<QGraphicsItem *> moved_parts;
/// scene sur laquelle se produisent les actions /// Element editor/view/scene the command should take place on
ElementScene *editor_scene; ElementScene *editor_scene;
/// translation appliquee /// applied movement
QPointF movement; QPointF movement;
/// booleen pour eviter d'appeler redo() lors de la construction de l'objet /// Prevent the first call to redo()
bool first_redo; bool first_redo;
}; };
/** /**
Cette classe represente l'action d'ajouter une partie lors de l'edition This command adds a primitive when editing an electrical element.
d'un element
*/ */
class AddPartCommand : public QUndoCommand { class AddPartCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
AddPartCommand(const QString &, ElementScene *, QGraphicsItem *, QUndoCommand * = 0); AddPartCommand(const QString &, ElementScene *, QGraphicsItem *, QUndoCommand * = 0);
virtual ~AddPartCommand(); virtual ~AddPartCommand();
private: private:
AddPartCommand(const AddPartCommand &); AddPartCommand(const AddPartCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// Liste des parties supprimees /// Added primitive
QGraphicsItem *part; QGraphicsItem *part;
/// scene sur laquelle se produisent les actions /// Element editor/view/scene the command should take place on
ElementScene *editor_scene; ElementScene *editor_scene;
/// booleen pour eviter d'appeler redo() lors de la construction de l'objet /// Prevent the first call to redo()
bool first_redo; bool first_redo;
}; };
/** /**
Cette classe represente l'action de modifier une propriete d'une partie This command changes a property of a primitive when editing an electrical
lors de l'edition d'un element element.
*/ */
class ChangePartCommand : public QUndoCommand { class ChangePartCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangePartCommand(const QString &, CustomElementPart *, const QString &, const QVariant &, const QVariant &, QUndoCommand * = 0); ChangePartCommand(const QString &, CustomElementPart *, const QString &, const QVariant &, const QVariant &, QUndoCommand * = 0);
virtual ~ChangePartCommand(); virtual ~ChangePartCommand();
private: private:
ChangePartCommand(const ChangePartCommand &); ChangePartCommand(const ChangePartCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// Partie modifiee /// Changed primitive
CustomElementPart *cep; CustomElementPart *cep;
/// Propriete modifiee /// Changed property
QString property; QString property;
/// ancienne valeur /// Former value
QVariant old_value; QVariant old_value;
/// nouvelle valeur /// New value
QVariant new_value; QVariant new_value;
}; };
/** /**
Cette classe represente l'action de modifier les points composants un polygone This command changes the points of a polygon when editing an electrical
element.
*/ */
class ChangePolygonPointsCommand : public QUndoCommand { class ChangePolygonPointsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangePolygonPointsCommand(PartPolygon *, const QVector<QPointF> &, const QVector<QPointF> &, QUndoCommand * = 0); ChangePolygonPointsCommand(PartPolygon *, const QVector<QPointF> &, const QVector<QPointF> &, QUndoCommand * = 0);
virtual ~ChangePolygonPointsCommand(); virtual ~ChangePolygonPointsCommand();
private: private:
ChangePolygonPointsCommand(const ChangePolygonPointsCommand &); ChangePolygonPointsCommand(const ChangePolygonPointsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
/// Polygone modifie /// Changed polygon
PartPolygon *polygon; PartPolygon *polygon;
/// anciens points /// Former points
QVector<QPointF> old_points; QVector<QPointF> old_points;
/// nouveaux points /// New points
QVector<QPointF> new_points; QVector<QPointF> new_points;
}; };
/** /**
Cette classe represente l'action de modifier les dimensions et le point de saisie d'un element This command changes the dimensions and/or the hotspot of an electrical
element.
*/ */
class ChangeHotspotCommand : public QUndoCommand { class ChangeHotspotCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangeHotspotCommand(ElementScene *, const QSize &, const QSize &, const QPoint &, const QPoint &, const QPoint & = QPoint(), QUndoCommand * = 0); ChangeHotspotCommand(ElementScene *, const QSize &, const QSize &, const QPoint &, const QPoint &, const QPoint & = QPoint(), QUndoCommand * = 0);
virtual ~ChangeHotspotCommand(); virtual ~ChangeHotspotCommand();
private: private:
ChangeHotspotCommand(const ChangeHotspotCommand &); ChangeHotspotCommand(const ChangeHotspotCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
@@ -224,92 +224,93 @@ class ChangeHotspotCommand : public QUndoCommand {
private: private:
void applyOffset(const QPointF &); void applyOffset(const QPointF &);
// attributs // attributes
/// Element edite auquel il faut appliquer les modifications /// Element editor/view/scene the command should take place on
ElementScene *element; ElementScene *element;
/// dimensions avant l'action /// Former dimensions
QSize size_before; QSize size_before;
/// dimensions apres l'action /// new dimensions
QSize size_after; QSize size_after;
/// point de saisie avant l'action /// Former hotspot
QPoint hotspot_before; QPoint hotspot_before;
/// point de saisie apres l'action /// New hotspot
QPoint hotspot_after; QPoint hotspot_after;
/// decalage a appliquer aux elements /// Offset to be applied to primitives
QPoint offset; QPoint offset;
}; };
/** /**
Cette classe represente l'action de changer les noms d'un element This command changes the translated names of an electrical element.
*/ */
class ChangeNamesCommand : public QUndoCommand { class ChangeNamesCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangeNamesCommand(ElementScene *, const NamesList &, const NamesList &, QUndoCommand * = 0); ChangeNamesCommand(ElementScene *, const NamesList &, const NamesList &, QUndoCommand * = 0);
virtual ~ChangeNamesCommand(); virtual ~ChangeNamesCommand();
private: private:
ChangeNamesCommand(const ChangeNamesCommand &); ChangeNamesCommand(const ChangeNamesCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// Liste des noms avant changement /// List of former names
NamesList names_before; NamesList names_before;
/// Liste des noms apres changement /// List of new names
NamesList names_after; NamesList names_after;
/// Element edite auquel il faut appliquer les modifications /// Element editor/view/scene the command should take place on
ElementScene *element; ElementScene *element;
}; };
/** /**
Cette classe represente l'action de changer les noms d'un element This command changes the allowed orientations of an electrical element.
*/ */
class ChangeOrientationsCommand : public QUndoCommand { class ChangeOrientationsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangeOrientationsCommand(ElementScene *, const OrientationSet &, const OrientationSet &, QUndoCommand * = 0); ChangeOrientationsCommand(ElementScene *, const OrientationSet &, const OrientationSet &, QUndoCommand * = 0);
virtual ~ChangeOrientationsCommand(); virtual ~ChangeOrientationsCommand();
private: private:
ChangeOrientationsCommand(const ChangeOrientationsCommand &); ChangeOrientationsCommand(const ChangeOrientationsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// Orientations avant changement /// Former orientations
OrientationSet ori_before; OrientationSet ori_before;
/// Orientations apres changement /// New orientations
OrientationSet ori_after; OrientationSet ori_after;
/// Element edite auquel il faut appliquer les modifications /// Element editor/view/scene the command should take place on
ElementScene *element; ElementScene *element;
}; };
/** /**
Cette classe represente l'action de changer les noms d'un element This command changes the zValue of a set of primitives when editing an
electrical element.
*/ */
class ChangeZValueCommand : public QUndoCommand { class ChangeZValueCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
/// Qualifie le type de changement de zValue /// List the various kind of changes for the zValue
enum Option { enum Option {
BringForward, ///< Amene la partie a l'avant-plan ; elle a alors la plus haute zValue BringForward, ///< Bring primitives to the foreground so they have the highest zValue
Raise, ///< Amene la partie un plan au-dessus ; la zValue de la partie est incrementee Raise, ///< Raise primitives one layer above their current one; zValues are incremented
Lower, ///< Envoie la partie un plan en-dessous ; la zValue de la partie est decrementee Lower, ///< Send primitives one layer below their current one; zValues are decremented
SendBackward ///< Envoie la partie a l'arriere-plan ; elle a alors la plus faible zValue SendBackward ///< Send primitives to the background so they have the lowest zValue
}; };
ChangeZValueCommand(ElementScene *, Option, QUndoCommand * = 0); ChangeZValueCommand(ElementScene *, Option, QUndoCommand * = 0);
virtual ~ChangeZValueCommand(); virtual ~ChangeZValueCommand();
private: private:
ChangeZValueCommand(const ChangeZValueCommand &); ChangeZValueCommand(const ChangeZValueCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
@@ -320,67 +321,66 @@ class ChangeZValueCommand : public QUndoCommand {
void applyLower(const QList<QGraphicsItem *> &); void applyLower(const QList<QGraphicsItem *> &);
void applySendBackward(const QList<QGraphicsItem *> &); void applySendBackward(const QList<QGraphicsItem *> &);
// attributs // attributes
private: private:
/// zValues avant changement /// associates impacted primitives with their former zValues
QHash<QGraphicsItem *, qreal> undo_hash; QHash<QGraphicsItem *, qreal> undo_hash;
/// zValues apres changement /// associates impacted primitives with their new zValues
QHash<QGraphicsItem *, qreal> redo_hash; QHash<QGraphicsItem *, qreal> redo_hash;
/// Element edite auquel il faut appliquer les modifications /// Element editor/view/scene the command should take place on
ElementScene *element; ElementScene *element;
/// type de traitement /// kind of treatment to apply
Option option; Option option;
}; };
/** /**
Cette classe represente l'action d'autoriser ou non les connexions This command enables or disables internal connections for an electrical
internes pour un element. element.
*/ */
class AllowInternalConnectionsCommand : public QUndoCommand { class AllowInternalConnectionsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
AllowInternalConnectionsCommand(ElementScene *, bool, QUndoCommand * = 0); AllowInternalConnectionsCommand(ElementScene *, bool, QUndoCommand * = 0);
virtual ~AllowInternalConnectionsCommand(); virtual ~AllowInternalConnectionsCommand();
private: private:
AllowInternalConnectionsCommand(const AllowInternalConnectionsCommand &); AllowInternalConnectionsCommand(const AllowInternalConnectionsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// Element edite auquel il faut appliquer les modifications /// Element editor/view/scene the command should take place on
ElementScene *element; ElementScene *element;
/// autorisation des connexions internes apres modification /// whether internal connections are allowed afterward
bool ic; bool ic;
}; };
/** /**
Cette classe represente l'action de changer les informations This command changes extra information carried by an electrical element.
complementaires d'un element.
*/ */
class ChangeInformationsCommand : public QUndoCommand { class ChangeInformationsCommand : public QUndoCommand {
// constructeurs, destructeur // constructors, destructor
public: public:
ChangeInformationsCommand(ElementScene *, const QString &, const QString &, QUndoCommand * = 0); ChangeInformationsCommand(ElementScene *, const QString &, const QString &, QUndoCommand * = 0);
virtual ~ChangeInformationsCommand(); virtual ~ChangeInformationsCommand();
private: private:
ChangeInformationsCommand(const ChangeInformationsCommand &); ChangeInformationsCommand(const ChangeInformationsCommand &);
// methodes // methods
public: public:
virtual void undo(); virtual void undo();
virtual void redo(); virtual void redo();
// attributs // attributes
private: private:
/// Element edite auquel il faut appliquer les modifications /// Element editor/view/scene the command should take place on
ElementScene *element; ElementScene *element;
/// Informations avant modification /// Former information
QString old_informations_; QString old_informations_;
/// Informations apres modification /// New information
QString new_informations_; QString new_informations_;
}; };
#endif #endif

View File

@@ -20,11 +20,12 @@
#include <QList> #include <QList>
class QGraphicsItem; class QGraphicsItem;
/** /**
Lors de son edition dans l'editeur d'element, un element est decompose en When edited using the element editor, electrical elements are decomposed into
parties graphiques. La classe ElementContent represente un ensemble de parties visual primitives. The ElementContent class represents a set of visual
graphiques constituant tout ou partie d'un element. primitives composing all or a part of an electrical element.
Note : pour le moment, ElementContent est un typedef pour QList\<QGraphicsItem *\>
@see la documentation Qt de la classe QList Note: currently, ElementContent is a simple typedef for
QList\<QGraphicsItem *\>
*/ */
typedef QList<QGraphicsItem *> ElementContent; typedef QList<QGraphicsItem *> ElementContent;
#endif #endif

View File

@@ -22,21 +22,20 @@ class QETElementEditor;
class ElementScene; class ElementScene;
class CustomElementPart; class CustomElementPart;
/** /**
Cette classe est la classe de base pour les editeurs de parties dans This is the base class for primitives editors within the element editor. It
l'editeur d'element. Elle fournit des methodes pour acceder facilement provides methods to access the editor itself, the undo stack, the edition
a l'editeur, a la pile d'annulation, a la scene d'edition ou encore pour scene and even a method to easily take a ChangePartCommand into account.
ajouter facilement une annulation de type ChangePartCommand.
*/ */
class ElementItemEditor : public QWidget { class ElementItemEditor : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ElementItemEditor(QETElementEditor *, QWidget * = 0); ElementItemEditor(QETElementEditor *, QWidget * = 0);
virtual ~ElementItemEditor() {}; virtual ~ElementItemEditor() {};
private: private:
ElementItemEditor(const ElementItemEditor &); ElementItemEditor(const ElementItemEditor &);
// methodes // methods
public: public:
virtual QETElementEditor *elementEditor() const; virtual QETElementEditor *elementEditor() const;
virtual ElementScene *elementScene() const; virtual ElementScene *elementScene() const;
@@ -49,7 +48,7 @@ class ElementItemEditor : public QWidget {
virtual CustomElementPart *currentPart() const = 0; virtual CustomElementPart *currentPart() const = 0;
virtual void updateForm() = 0; virtual void updateForm() = 0;
// attributs // attributes
private: private:
QETElementEditor *element_editor; QETElementEditor *element_editor;
QString element_type_name; QString element_type_name;

View File

@@ -31,10 +31,9 @@ class PartCircle;
class PartPolygon; class PartPolygon;
class PartArc; class PartArc;
/** /**
Cette classe est le canevas permettant l'edition d'un element electrique. This class is the canvas allowing the visual edition of an electrial element.
Elle regroupe les differentes parties composant le dessin de l'element mais It displays the various primitives composing the drawing of the element, the
egalement les informations complementaires : dimensions, orientations, border due to its fixed size and its hotspot.
noms.
*/ */
class ElementScene : public QGraphicsScene { class ElementScene : public QGraphicsScene {
Q_OBJECT Q_OBJECT
@@ -42,7 +41,7 @@ class ElementScene : public QGraphicsScene {
// enum // enum
enum Behavior { Normal, Line, Rectangle, Circle, Ellipse, Polygon, Text, Terminal, Arc, TextField, PasteArea }; enum Behavior { Normal, Line, Rectangle, Circle, Ellipse, Polygon, Text, Terminal, Arc, TextField, PasteArea };
// constructeurs, destructeur // constructors, destructor
public: public:
ElementScene(QETElementEditor *, QObject * = 0); ElementScene(QETElementEditor *, QObject * = 0);
virtual ~ElementScene(); virtual ~ElementScene();
@@ -50,37 +49,36 @@ class ElementScene : public QGraphicsScene {
private: private:
ElementScene(const ElementScene &); ElementScene(const ElementScene &);
// attributs // attributes
private: private:
/// longueur de l'element en dizaines de pixels /// element width, in dozens of pixels
uint _width; uint _width;
/// hauteur de l'element en dizaines de pixels /// element height, in dozens of pixels
uint _height; uint _height;
/// position du point de saisie /// hotspot position
QPoint _hotspot; QPoint _hotspot;
/// Liste des noms de l'element /// List of localized names
NamesList _names; NamesList _names;
/// Liste des orientations de l'element /// Set of orientations
OrientationSet ori; OrientationSet ori;
/// booleen indiquant si les bornes de l'element peuvent etre reliees a des bornes de ce meme element /// whether internal connections (i.e. connections between terminals of a same element) are accepted
bool internal_connections; bool internal_connections;
/// Chaine contenant les informations complementaires de l'element /// Extra informations
QString informations_; QString informations_;
/// Gestionnaire de QGraphicsItem /// QGraphicsItem manager
QGIManager qgi_manager; QGIManager qgi_manager;
/// Pile des actions annulables /// Undo stack
QUndoStack undo_stack; QUndoStack undo_stack;
/** /**
fsi_pos (first selected item pos) : Position du premier item fsi_pos (first selected item pos) : Position of the forst selected item: used
selectionne : utilise pour annuler les deplacements a la souris ; to cancel mouse movements; also used to handle movements using keybard
egalement utilise pour gerer les deplacements avec les fleches du arrwows.
clavier.
*/ */
QPointF fsi_pos; QPointF fsi_pos;
QPointF moving_press_pos; QPointF moving_press_pos;
bool moving_parts_; bool moving_parts_;
/// Variables relatives a la gestion du dessin des parties sur la scene /// Variables related to drawing
Behavior behavior; Behavior behavior;
PartLine *current_line; PartLine *current_line;
PartRectangle *current_rectangle; PartRectangle *current_rectangle;
@@ -90,19 +88,19 @@ class ElementScene : public QGraphicsScene {
PartArc *current_arc; PartArc *current_arc;
QETElementEditor *element_editor; QETElementEditor *element_editor;
/// Variables relatives a la gestion de la zone de collage sur la scene /// Variables to manage the paste area on the scene
QGraphicsRectItem *paste_area_; QGraphicsRectItem *paste_area_;
QRectF defined_paste_area_; QRectF defined_paste_area_;
/// Variables relatives au copier-coller avec decalage /// Variables to handle copy/paste with offset
QString last_copied_; QString last_copied_;
///< Taille horizontale de la grille ///< Size of the horizontal grid step
int x_grid; int x_grid;
///< Taille verticale de la grille ///< Size of the vertical grid step
int y_grid; int y_grid;
// methodes // methods
public: public:
void setWidth(const uint &); void setWidth(const uint &);
uint width() const; uint width() const;
@@ -188,22 +186,22 @@ class ElementScene : public QGraphicsScene {
signals: signals:
/** /**
Signal emis lorsque la scene exige que l'editeur d'element repasse Signal emitted when the scene requires the element editor to switch back to
en mode normal normal mode.
*/ */
void needNormalMode(); void needNormalMode();
/// Signal emis lorsqu'une ou plusieurs parties sont ajoutees /// Signal emitted after one or several parts were added
void partsAdded(); void partsAdded();
/// Signal emis lorsqu'une ou plusieurs parties sont enlevees /// Signal emitted after one or several parts were removed
void partsRemoved(); void partsRemoved();
/// Signal emis lorsque la zValue d'une ou plusieurs parties change /// Signal emitted when the zValue of one or several parts change
void partsZValueChanged(); void partsZValueChanged();
/// Signal emis lorsque l'utilisateur a fini de choisir une zone pour un copier/coller /// Signal emitted when users have defined the copy/paste area
void pasteAreaDefined(const QRectF &); void pasteAreaDefined(const QRectF &);
}; };
/** /**
@param wid Nouvelle largeur de l'element edite @param wid the new width for the currently edited element
*/ */
inline void ElementScene::setWidth(const uint &wid) { inline void ElementScene::setWidth(const uint &wid) {
_width = wid; _width = wid;
@@ -212,14 +210,14 @@ inline void ElementScene::setWidth(const uint &wid) {
} }
/** /**
@return la largeur de l'element edite @return the height of the currently edited element
*/ */
inline uint ElementScene::width() const { inline uint ElementScene::width() const {
return(_width * 10); return(_width * 10);
} }
/** /**
@param hei Nouvelle hauteur de l'element edite @param hei the new height for the currently edited element
*/ */
inline void ElementScene::setHeight(const uint &hei) { inline void ElementScene::setHeight(const uint &hei) {
_height = hei; _height = hei;
@@ -228,77 +226,77 @@ inline void ElementScene::setHeight(const uint &hei) {
} }
/** /**
@return la largeur de l'element edite @return the width of the currently edited element
*/ */
inline uint ElementScene::height() const { inline uint ElementScene::height() const {
return(_height * 10); return(_height * 10);
} }
/** /**
@param hs Nouveau point de saisie de l'element edite @param hs the new hotspot for the currently edited element
*/ */
inline void ElementScene::setHotspot(const QPoint &hs) { inline void ElementScene::setHotspot(const QPoint &hs) {
_hotspot = hs; _hotspot = hs;
} }
/** /**
@return le point de saisie de l'element edite @return the hotspot of the currently edited element
*/ */
inline QPoint ElementScene::hotspot() const { inline QPoint ElementScene::hotspot() const {
return(_hotspot); return(_hotspot);
} }
/** /**
@param nameslist Nouvel ensemble de noms de l'element edite @param nameslist New set of naes for the currently edited element
*/ */
inline void ElementScene::setNames(const NamesList &nameslist) { inline void ElementScene::setNames(const NamesList &nameslist) {
_names = nameslist; _names = nameslist;
} }
/** /**
@return l'ensemble de noms de l'element edite @return the list of names of the currently edited element
*/ */
inline NamesList ElementScene::names() const { inline NamesList ElementScene::names() const {
return(_names); return(_names);
} }
/** /**
@return l'ensemble d'orientations de l'element edite @return the orientation set of the currently edited element
*/ */
inline OrientationSet ElementScene::orientations() { inline OrientationSet ElementScene::orientations() {
return(ori); return(ori);
} }
/** /**
@param orientation_set Nouvel ensemble d'orientations de l'element edite @param orientation_set the new orientation set for the currently edited element
*/ */
inline void ElementScene::setOrientations(const OrientationSet &orientation_set) { inline void ElementScene::setOrientations(const OrientationSet &orientation_set) {
ori = orientation_set; ori = orientation_set;
} }
/** /**
@return true si les connexions internes sont acceptees, false sinon @return whether internal connections are accepted
*/ */
inline bool ElementScene::internalConnections() { inline bool ElementScene::internalConnections() {
return(internal_connections); return(internal_connections);
} }
/** /**
@param ic true pour que les connexions internes soient acceptees, false sinon @param ic true for internal connections to be accepted, false otherwise
*/ */
inline void ElementScene::setInternalConnections(bool ic) { inline void ElementScene::setInternalConnections(bool ic) {
internal_connections = ic; internal_connections = ic;
} }
/** /**
@return les informations complementaires de cet element @return extra informations of the currently edited element
*/ */
inline QString ElementScene::informations() const { inline QString ElementScene::informations() const {
return(informations_); return(informations_);
} }
/** /**
@param infos les nouvelles informations complementaires de cet element @param infos new extra information for the currently edited element
*/ */
inline void ElementScene::setInformations(const QString &infos) { inline void ElementScene::setInformations(const QString &infos) {
informations_ = infos; informations_ = infos;

View File

@@ -20,14 +20,14 @@
#include <QGraphicsView> #include <QGraphicsView>
#include "elementscene.h" #include "elementscene.h"
/** /**
Cette classe represente un widget permettant de visualiser une This class provides a widget to render an ElementScene instance, i.e. the
ElementScene, c'est-a-dire la classe d'edition des elements. edition class for electrical elements.
*/ */
class ElementView : public QGraphicsView { class ElementView : public QGraphicsView {
Q_OBJECT Q_OBJECT
friend class PastePartsCommand; friend class PastePartsCommand;
// constructeurs, destructeur // constructors, destructor
public: public:
ElementView(ElementScene *, QWidget * = 0); ElementView(ElementScene *, QWidget * = 0);
virtual ~ElementView(); virtual ~ElementView();
@@ -35,7 +35,7 @@ class ElementView : public QGraphicsView {
private: private:
ElementView(const ElementView &); ElementView(const ElementView &);
// methodes // methods
public: public:
ElementScene *scene() const; ElementScene *scene() const;
void setScene(ElementScene *); void setScene(ElementScene *);
@@ -50,7 +50,6 @@ class ElementView : public QGraphicsView {
private: private:
QRectF applyMovement(const QRectF &, const QET::OrientedMovement &, const QPointF &); QRectF applyMovement(const QRectF &, const QET::OrientedMovement &, const QPointF &);
// slots
public slots: public slots:
void zoomIn(); void zoomIn();
void zoomOut(); void zoomOut();
@@ -69,7 +68,7 @@ class ElementView : public QGraphicsView {
ElementContent paste(const QDomDocument &, const QPointF &); ElementContent paste(const QDomDocument &, const QPointF &);
ElementContent pasteWithOffset(const QDomDocument &); ElementContent pasteWithOffset(const QDomDocument &);
//attributs // attributes
private: private:
ElementScene *scene_; ElementScene *scene_;
QString to_paste_in_area_; QString to_paste_in_area_;

View File

@@ -22,25 +22,24 @@
class PartEllipse; class PartEllipse;
class StyleEditor; class StyleEditor;
/** /**
Cette classe represente le widget d'edition d'une ellipse dans l'editeur This class provides a widget to edit ellipses within the element editor.
d'element.
*/ */
class EllipseEditor : public ElementItemEditor { class EllipseEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
//constructeurs, destructeur // constructors, destructor
public: public:
EllipseEditor(QETElementEditor *, PartEllipse * = 0, QWidget * = 0); EllipseEditor(QETElementEditor *, PartEllipse * = 0, QWidget * = 0);
virtual ~EllipseEditor(); virtual ~EllipseEditor();
private: private:
EllipseEditor(const EllipseEditor &); EllipseEditor(const EllipseEditor &);
// attributs // attributes
private: private:
PartEllipse *part; PartEllipse *part;
StyleEditor *style_; StyleEditor *style_;
QLineEdit *x, *y, *h, *v; QLineEdit *x, *y, *h, *v;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -22,19 +22,18 @@
class PartLine; class PartLine;
class StyleEditor; class StyleEditor;
/** /**
Cette classe represente le widget d'edition d'une ligne dans l'editeur This class provides a widget to edit lines within the element editor.
d'element.
*/ */
class LineEditor : public ElementItemEditor { class LineEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
//constructeurs, destructeur // constructors, destructor
public: public:
LineEditor(QETElementEditor *, PartLine * = 0, QWidget * = 0); LineEditor(QETElementEditor *, PartLine * = 0, QWidget * = 0);
virtual ~LineEditor(); virtual ~LineEditor();
private: private:
LineEditor(const LineEditor &); LineEditor(const LineEditor &);
// attributs // attributes
private: private:
PartLine *part; PartLine *part;
StyleEditor *style_; StyleEditor *style_;
@@ -42,7 +41,7 @@ class LineEditor : public ElementItemEditor {
QComboBox *end1_type, *end2_type; QComboBox *end1_type, *end2_type;
QLineEdit *end1_length, *end2_length; QLineEdit *end1_length, *end2_length;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -20,11 +20,11 @@
#include <QtGui> #include <QtGui>
#include "customelementgraphicpart.h" #include "customelementgraphicpart.h"
/** /**
Cette classe represente un arc pouvant etre utilise pour composer le This class represents an elliptical arc primitive which may be used to
dessin d'un element dans l'editeur d'element. compose the drawing of an electrical element within the element editor.
*/ */
class PartArc : public QGraphicsEllipseItem, public CustomElementGraphicPart { class PartArc : public QGraphicsEllipseItem, public CustomElementGraphicPart {
// constructeurs, destructeur // constructors, destructor
public: public:
PartArc(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0); PartArc(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0);
virtual ~PartArc(); virtual ~PartArc();
@@ -32,17 +32,18 @@ class PartArc : public QGraphicsEllipseItem, public CustomElementGraphicPart {
private: private:
PartArc(const PartArc &); PartArc(const PartArc &);
// attributs // attributes
private: private:
int _angle; int _angle;
int start_angle; int start_angle;
// methodes // methods
public: public:
enum { Type = UserType + 1101 }; enum { Type = UserType + 1101 };
/** /**
permet de caster un QGraphicsItem en PartArc avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem PartArc.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0); virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0);

View File

@@ -20,11 +20,11 @@
#include <QtGui> #include <QtGui>
#include "customelementgraphicpart.h" #include "customelementgraphicpart.h"
/** /**
Cette classe represente un cercle pouvant etre utilise pour composer le This class represents a circle primitive which may be used to compose the
dessin d'un element dans l'editeur d'element. drawing of an electrical element within the element editor.
*/ */
class PartCircle : public QGraphicsEllipseItem, public CustomElementGraphicPart { class PartCircle : public QGraphicsEllipseItem, public CustomElementGraphicPart {
// constructeurs, destructeur // constructors, destructor
public: public:
PartCircle(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0); PartCircle(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0);
virtual ~PartCircle(); virtual ~PartCircle();
@@ -32,12 +32,13 @@ class PartCircle : public QGraphicsEllipseItem, public CustomElementGraphicPart
private: private:
PartCircle(const PartCircle &); PartCircle(const PartCircle &);
// methodes // methods
public: public:
enum { Type = UserType + 1102 }; enum { Type = UserType + 1102 };
/** /**
permet de caster un QGraphicsItem en PartCircle avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem PartCircle.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0); virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0);

View File

@@ -20,11 +20,11 @@
#include <QtGui> #include <QtGui>
#include "customelementgraphicpart.h" #include "customelementgraphicpart.h"
/** /**
Cette classe represente une ellipse pouvant etre utilisee pour composer le This class represents an ellipse primitive which may be used to compose the
dessin d'un element dans l'editeur d'element. drawing of an electrical element within the element editor.
*/ */
class PartEllipse : public QGraphicsEllipseItem, public CustomElementGraphicPart { class PartEllipse : public QGraphicsEllipseItem, public CustomElementGraphicPart {
// constructeurs, destructeur // constructors, destructor
public: public:
PartEllipse(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0); PartEllipse(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0);
virtual ~PartEllipse(); virtual ~PartEllipse();
@@ -32,12 +32,13 @@ class PartEllipse : public QGraphicsEllipseItem, public CustomElementGraphicPart
private: private:
PartEllipse(const PartEllipse &); PartEllipse(const PartEllipse &);
// methodes // methods
public: public:
enum { Type = UserType + 1103 }; enum { Type = UserType + 1103 };
/** /**
permet de caster un QGraphicsItem en PartEllipse avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem PartEllipse.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0); virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0);

View File

@@ -21,18 +21,16 @@
#include "customelementgraphicpart.h" #include "customelementgraphicpart.h"
#include "qet.h" #include "qet.h"
/** /**
Cette classe represente une ligne pouvant etre utilisee pour composer le This class represents a line primitive which may be used to compose the
dessin d'un element dans l'editeur d'element. drawing of an electrical element within the element editor. Lines may have
Une ligne est composee de deux points. Elle peut comporter des extremites specific visual ends (e.g. arrows) through the setFirstEndType and
speciales definissables grace aux methodes setFirstEndType et setSecondEndType methods. Their size can be defined using the
setSecondEndType. La taille des extremites est definissable via les setFirstEndLength and setSecondEndLength methods. Please note ends are not
methodes setFirstEndLength et setSecondEndLength. drawn if the required length for their drawing is longer than the line itself.
A noter que les extremites ne sont pas dessinees si la longueur requise In case there is room for a single end only, the first one get priority.
pour leur dessin n'est pas contenue dans la ligne. S'il n'y a de la place
que pour une seule extremite, c'est la premiere qui est privilegiee.
*/ */
class PartLine : public QGraphicsLineItem, public CustomElementGraphicPart { class PartLine : public QGraphicsLineItem, public CustomElementGraphicPart {
// constructeurs, destructeur // constructors, destructor
public: public:
PartLine(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0); PartLine(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0);
virtual ~PartLine(); virtual ~PartLine();
@@ -40,20 +38,21 @@ class PartLine : public QGraphicsLineItem, public CustomElementGraphicPart {
private: private:
PartLine(const PartLine &); PartLine(const PartLine &);
// attributs // attributes
private: private:
QET::EndType first_end; QET::EndType first_end;
qreal first_length; qreal first_length;
QET::EndType second_end; QET::EndType second_end;
qreal second_length; qreal second_length;
// methodes // methods
public: public:
enum { Type = UserType + 1104 }; enum { Type = UserType + 1104 };
/** /**
permet de caster un QGraphicsItem en PartLine avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem PartLine.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0); virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0);

View File

@@ -20,11 +20,11 @@
#include <QtGui> #include <QtGui>
#include "customelementgraphicpart.h" #include "customelementgraphicpart.h"
/** /**
Cette classe represente un polygone pouvant etre utilise pour composer le This class represents a polygon primitive which may be used to compose the
dessin d'un element dans l'editeur d'element. drawing of an electrical element within the element editor.
*/ */
class PartPolygon : public QGraphicsPolygonItem, public CustomElementGraphicPart { class PartPolygon : public QGraphicsPolygonItem, public CustomElementGraphicPart {
// constructeurs, destructeur // constructors, destructor
public: public:
PartPolygon(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0); PartPolygon(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0);
virtual ~PartPolygon(); virtual ~PartPolygon();
@@ -32,16 +32,17 @@ class PartPolygon : public QGraphicsPolygonItem, public CustomElementGraphicPart
private: private:
PartPolygon(const PartPolygon &); PartPolygon(const PartPolygon &);
// attributs // attributes
private: private:
bool closed; bool closed;
// methodes // methods
public: public:
enum { Type = UserType + 1105 }; enum { Type = UserType + 1105 };
/** /**
permet de caster un QGraphicsItem en PartPolygon avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem PartPolygon.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual QString name() const { return(QObject::tr("polygone", "element part name")); } virtual QString name() const { return(QObject::tr("polygone", "element part name")); }
@@ -61,16 +62,16 @@ class PartPolygon : public QGraphicsPolygonItem, public CustomElementGraphicPart
}; };
/** /**
Specifie si le polygone doit etre ferme Whether the polygon should be closed.
@param c true pour un polygone ferme, false sinon @param c true for the polygon to be closed, false otherwise
*/ */
inline void PartPolygon::setClosed(bool c) { inline void PartPolygon::setClosed(bool c) {
closed = c; closed = c;
} }
/** /**
Indique si le polygone est ferme Indicate whether the polygon is closed.
@return true si le polygone est ferme, false sinon @return true if the polygon is closed, false otherwise
*/ */
inline bool PartPolygon::isClosed() const { inline bool PartPolygon::isClosed() const {
return(closed); return(closed);

View File

@@ -20,11 +20,11 @@
#include <QtGui> #include <QtGui>
#include "customelementgraphicpart.h" #include "customelementgraphicpart.h"
/** /**
Cette classe represente un rectangle pouvant etre utilise pour composer le This class represents a rectangle primitive which may be used to compose the
dessin d'un element dans l'editeur d'element. drawing of an electrical element within the element editor.
*/ */
class PartRectangle : public QGraphicsRectItem, public CustomElementGraphicPart { class PartRectangle : public QGraphicsRectItem, public CustomElementGraphicPart {
// constructeurs, destructeur // constructors, destructor
public: public:
PartRectangle(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0); PartRectangle(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0);
virtual ~PartRectangle(); virtual ~PartRectangle();
@@ -32,12 +32,13 @@ class PartRectangle : public QGraphicsRectItem, public CustomElementGraphicPart
private: private:
PartRectangle(const PartRectangle &); PartRectangle(const PartRectangle &);
// methodes // methods
public: public:
enum { Type = UserType + 1109 }; enum { Type = UserType + 1109 };
/** /**
permet de caster un QGraphicsItem en PartRectangle avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem PartRectangle.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0); virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0);

View File

@@ -21,28 +21,29 @@
#include "qet.h" #include "qet.h"
#include <QtGui> #include <QtGui>
/** /**
Cette classe represente une borne pouvant etre utilisee pour composer le This class represents a terminal which may be used to compose the drawing of
dessin d'un element dans l'editeur d'element. an electrical element within the element editor.
*/ */
class PartTerminal : public CustomElementPart, public QGraphicsItem { class PartTerminal : public CustomElementPart, public QGraphicsItem {
public: public:
// constructeurs, destructeur // constructors, destructor
PartTerminal(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0); PartTerminal(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0);
virtual ~PartTerminal(); virtual ~PartTerminal();
private: private:
PartTerminal(const PartTerminal &); PartTerminal(const PartTerminal &);
// attributs // attributes
private: private:
QET::Orientation _orientation; QET::Orientation _orientation;
QPointF second_point; QPointF second_point;
// methodes // methods
public: public:
enum { Type = UserType + 1106 }; enum { Type = UserType + 1106 };
/** /**
permet de caster un QGraphicsItem en PartTerminal avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem PartTerminal.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual QString name() const { return(QObject::tr("borne", "element part name")); } virtual QString name() const { return(QObject::tr("borne", "element part name")); }

View File

@@ -21,13 +21,13 @@
#include "customelementpart.h" #include "customelementpart.h"
class TextEditor; class TextEditor;
/** /**
Cette classe represente un texte pouvant etre utilise pour composer le This class represents an static text primitive which may be used to compose
dessin d'un element dans l'editeur d'element. the drawing of an electrical element within the element editor.
*/ */
class PartText : public QGraphicsTextItem, public CustomElementPart { class PartText : public QGraphicsTextItem, public CustomElementPart {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
PartText(QETElementEditor *, QGraphicsItem * = 0, ElementScene * = 0); PartText(QETElementEditor *, QGraphicsItem * = 0, ElementScene * = 0);
virtual ~PartText(); virtual ~PartText();
@@ -35,12 +35,13 @@ class PartText : public QGraphicsTextItem, public CustomElementPart {
private: private:
PartText(const PartText &); PartText(const PartText &);
// methodes // methods
public: public:
enum { Type = UserType + 1107 }; enum { Type = UserType + 1107 };
/** /**
permet de caster un QGraphicsItem en PartText avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem PartText.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual QString name() const { return(QObject::tr("texte", "element part name")); } virtual QString name() const { return(QObject::tr("texte", "element part name")); }

View File

@@ -22,15 +22,15 @@
class TextFieldEditor; class TextFieldEditor;
class QETElementEditor; class QETElementEditor;
/** /**
Cette classe represente un champ de texte editable pouvant etre utilise This class represents an editable text field which may be used to compose the
pour composer le dessin d'un element dans l'editeur d'element. drawing of an electrical element within the element editor. Users may specify
L'utilisateur peut specifier un valeur par defaut. Le champ sera editable a default value. The field will remain editable once the element is added onto
lorsque l'element sera pose sur un schema. a diagram. lorsque l'element sera pose sur un schema.
*/ */
class PartTextField : public QGraphicsTextItem, public CustomElementPart { class PartTextField : public QGraphicsTextItem, public CustomElementPart {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
PartTextField(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0); PartTextField(QETElementEditor *, QGraphicsItem * = 0, QGraphicsScene * = 0);
virtual ~PartTextField(); virtual ~PartTextField();
@@ -38,15 +38,16 @@ class PartTextField : public QGraphicsTextItem, public CustomElementPart {
private: private:
PartTextField(const PartTextField &); PartTextField(const PartTextField &);
// attributs // attributes
bool follow_parent_rotations; bool follow_parent_rotations;
// methodes // methods
public: public:
enum { Type = UserType + 1108 }; enum { Type = UserType + 1108 };
/** /**
permet de caster un QGraphicsItem en PartTextField avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a
@return le type de QGraphicsItem PartTextField.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
virtual QString name() const { return(QObject::tr("champ de texte", "element part name")); } virtual QString name() const { return(QObject::tr("champ de texte", "element part name")); }

View File

@@ -21,14 +21,13 @@
class PartPolygon; class PartPolygon;
class StyleEditor; class StyleEditor;
/** /**
Cette classe represente le widget d'edition d'un polygone dans l'editeur This class provides a widget to edit polygons within the element editor.
d'element.
*/ */
class PolygonEditor : public ElementItemEditor { class PolygonEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
PolygonEditor(QETElementEditor *, PartPolygon * = 0, QWidget * = 0); PolygonEditor(QETElementEditor *, PartPolygon * = 0, QWidget * = 0);
virtual ~PolygonEditor(); virtual ~PolygonEditor();
@@ -36,14 +35,14 @@ class PolygonEditor : public ElementItemEditor {
private: private:
PolygonEditor(const PolygonEditor &); PolygonEditor(const PolygonEditor &);
// attributs // attributes
private: private:
PartPolygon *part; PartPolygon *part;
StyleEditor *style_; StyleEditor *style_;
QTreeWidget points_list; QTreeWidget points_list;
QCheckBox close_polygon; QCheckBox close_polygon;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -26,72 +26,71 @@
class ElementItemEditor; class ElementItemEditor;
class ElementView; class ElementView;
/** /**
Cette classe represente un editeur d'element. Elle permet a l'utilisateur This class represents an element editor, allowing users to draw, change and
de dessiner, modifier et parametrer un element electrique. Le dessin se configure a particular electrical element.
fait par ajout de parties (Part).
*/ */
class QETElementEditor : public QETMainWindow { class QETElementEditor : public QETMainWindow {
Q_OBJECT Q_OBJECT
// constructeur, destructeur // constructor, destructor
public: public:
QETElementEditor(QWidget * = 0); QETElementEditor(QWidget * = 0);
virtual ~QETElementEditor(); virtual ~QETElementEditor();
private: private:
QETElementEditor(const QETElementEditor &); QETElementEditor(const QETElementEditor &);
// attributs // attributes
private: private:
/// booleen indiquant si l'editeur est en mode "lecture seule" ou non /// whether the editor is "read-only"
bool read_only; bool read_only;
/// menus /// menus
QMenu *file_menu, *edit_menu, *paste_from_menu, *display_menu, *tools_menu; QMenu *file_menu, *edit_menu, *paste_from_menu, *display_menu, *tools_menu;
/// vue sur la scene d'edition /// view widget for the editing scene
ElementView *ce_view; ElementView *ce_view;
/// scene d'edition /// editing scene
ElementScene *ce_scene; ElementScene *ce_scene;
/// container pour les widgets d'edition des parties /// container for widgets dedicated to primitive edition
QDockWidget *tools_dock; QDockWidget *tools_dock;
/// Pile de widgets pour tools_dock /// Stack of widgets for tools_dock
QStackedWidget *tools_dock_stack_; QStackedWidget *tools_dock_stack_;
/// label affiche lors de la selection de plusieurs elements /// label displayed when several primitives are selected
QLabel *default_informations; QLabel *default_informations;
/// Hash permettant d'acceder aux widgets d'editions disponibles /// Hash associating primitive names with their matching edition widget
QHash<QString, ElementItemEditor *> editors_; QHash<QString, ElementItemEditor *> editors_;
/// ScrollArea pour le DockWidget affichant des infos sur la partie selectionnee /// ScrollArea for the tools_dock DockWidget
QScrollArea *tools_dock_scroll_area_; QScrollArea *tools_dock_scroll_area_;
/// container pour la liste des annulations /// container for the undo list
QDockWidget *undo_dock; QDockWidget *undo_dock;
/// Container pour la liste des parties /// Container for the list of existing primitives
QDockWidget *parts_dock; QDockWidget *parts_dock;
/// Liste des parties /// List of primitives
QListWidget *parts_list; QListWidget *parts_list;
/// actions du menu fichier /// actions for the "file" menu
QAction *new_element, *open, *open_file, *save, *save_as, *save_as_file, *reload, *quit; QAction *new_element, *open, *open_file, *save, *save_as, *save_as_file, *reload, *quit;
/// actions du menu edition /// actions for the "edit" menu
QAction *selectall, *deselectall, *inv_select; QAction *selectall, *deselectall, *inv_select;
QAction *cut, *copy, *paste, *paste_in_area, *paste_from_file, *paste_from_elmt; QAction *cut, *copy, *paste, *paste_in_area, *paste_from_file, *paste_from_elmt;
QAction *undo, *redo; QAction *undo, *redo;
QAction *edit_delete, *edit_size_hs, *edit_names, *edit_ori, *edit_author; QAction *edit_delete, *edit_size_hs, *edit_names, *edit_ori, *edit_author;
QAction *edit_raise, *edit_lower, *edit_backward, *edit_forward; QAction *edit_raise, *edit_lower, *edit_backward, *edit_forward;
/// actions du menu affichage /// actions for the "display" menu
QAction *zoom_in, *zoom_out, *zoom_fit, *zoom_reset; QAction *zoom_in, *zoom_out, *zoom_fit, *zoom_reset;
/// barres d'outils /// toolbars
QToolBar *parts_toolbar, *main_toolbar, *view_toolbar, *depth_toolbar, *element_toolbar; QToolBar *parts_toolbar, *main_toolbar, *view_toolbar, *depth_toolbar, *element_toolbar;
/// actions de la barre d'outils /// toolbars actions
QActionGroup *parts; QActionGroup *parts;
QAction *move, *add_line, *add_circle, *add_rectangle, *add_ellipse, *add_polygon, *add_text; QAction *move, *add_line, *add_circle, *add_rectangle, *add_ellipse, *add_polygon, *add_text;
QAction *add_arc, *add_terminal, *add_textfield; QAction *add_arc, *add_terminal, *add_textfield;
/// titre minimal /// minimum window title
QString min_title; QString min_title;
/// Nom de fichier de l'element edite /// filename of the currently edited element
QString filename_; QString filename_;
/// Emplacement de l'element edite /// location of the currently edited element
ElementsLocation location_; ElementsLocation location_;
/// booleen indiquant si l'element en cours d'edition provient d'un fichier ou d'un emplacement /// whether the currently edited element comes from a file or a location
bool opened_from_file; bool opened_from_file;
// methodes // methods
public: public:
void setSize(const QSize &); void setSize(const QSize &);
QSize size() const; QSize size() const;
@@ -158,7 +157,7 @@ class QETElementEditor : public QETMainWindow {
}; };
/** /**
@param siz La nouvelle taille de l'element edite @param siz The new size for the currently edited element
*/ */
inline void QETElementEditor::setSize(const QSize &siz) { inline void QETElementEditor::setSize(const QSize &siz) {
ce_scene -> setWidth(siz.width()); ce_scene -> setWidth(siz.width());
@@ -166,7 +165,7 @@ inline void QETElementEditor::setSize(const QSize &siz) {
} }
/** /**
@return la taille de l'element edite @return the size of the currently edited element
*/ */
inline QSize QETElementEditor::size() const { inline QSize QETElementEditor::size() const {
return( return(
@@ -178,56 +177,56 @@ inline QSize QETElementEditor::size() const {
} }
/** /**
@param hs Le nouveau point de saisie de l'element edite @param hs The new hotspot for the currently edited element
*/ */
inline void QETElementEditor::setHotspot(const QPoint &hs) { inline void QETElementEditor::setHotspot(const QPoint &hs) {
ce_scene -> setHotspot(hs); ce_scene -> setHotspot(hs);
} }
/** /**
@return le point de saisie de l'element edite @return the hotspot of the currently edited element
*/ */
inline QPoint QETElementEditor::hotspot() const { inline QPoint QETElementEditor::hotspot() const {
return(ce_scene -> hotspot()); return(ce_scene -> hotspot());
} }
/** /**
@param nameslist le nouvel ensemble de noms de l'element edite @param nameslist the new list of names for the currently edited element
*/ */
inline void QETElementEditor::setNames(const NamesList &nameslist) { inline void QETElementEditor::setNames(const NamesList &nameslist) {
ce_scene -> setNames(nameslist); ce_scene -> setNames(nameslist);
} }
/** /**
@param orientation_set le nouvel ensemble d'orientations de l'element edite @param orientation_set the new set of orientations for the currently edited element
*/ */
inline void QETElementEditor::setOrientations(const OrientationSet &orientation_set) { inline void QETElementEditor::setOrientations(const OrientationSet &orientation_set) {
ce_scene -> setOrientations(orientation_set); ce_scene -> setOrientations(orientation_set);
} }
/** /**
@return le nouvel ensemble d'orientations de l'element edite @param the set of orientations for the currently edited element
*/ */
inline OrientationSet QETElementEditor::orientations() const { inline OrientationSet QETElementEditor::orientations() const {
return(ce_scene -> orientations()); return(ce_scene -> orientations());
} }
/** /**
@return l'emplacement de l'element edite @return the location of the currently edited element
*/ */
inline ElementsLocation QETElementEditor::location() const { inline ElementsLocation QETElementEditor::location() const {
return(location_); return(location_);
} }
/** /**
@return le nom de fichier de l'element edite @return the filename of the currently edited element
*/ */
inline QString QETElementEditor::fileName() const { inline QString QETElementEditor::fileName() const {
return(filename_); return(filename_);
} }
/** /**
@return la scene d'edition de l'element @return the editing scene
*/ */
inline ElementScene *QETElementEditor::elementScene() const { inline ElementScene *QETElementEditor::elementScene() const {
return(ce_scene); return(ce_scene);

View File

@@ -22,25 +22,24 @@
class PartRectangle; class PartRectangle;
class StyleEditor; class StyleEditor;
/** /**
Cette classe represente le widget d'edition d'un rectangle dans l'editeur This class provides a widget to edit rectangles within the element editor.
d'element.
*/ */
class RectangleEditor : public ElementItemEditor { class RectangleEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
//constructeurs, destructeur // constructors, destructor
public: public:
RectangleEditor(QETElementEditor *, PartRectangle * = 0, QWidget * = 0); RectangleEditor(QETElementEditor *, PartRectangle * = 0, QWidget * = 0);
virtual ~RectangleEditor(); virtual ~RectangleEditor();
private: private:
RectangleEditor(const RectangleEditor &); RectangleEditor(const RectangleEditor &);
// attributs // attributes
private: private:
PartRectangle *part; PartRectangle *part;
StyleEditor *style_; StyleEditor *style_;
QLineEdit *x, *y, *w, *h; QLineEdit *x, *y, *w, *h;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -21,14 +21,14 @@
#include "elementitemeditor.h" #include "elementitemeditor.h"
class CustomElementGraphicPart; class CustomElementGraphicPart;
/** /**
Cette classe represente un widget d'edition des styles que peut comporter This class provides a widget to edit styles (color, pen style and thickness,
une partie d'elements (couleur, epaisseur et style du trait, remplissage, filling, antialiasing) common to most primitives within the element editor.
antialiasing). Elle peut accueillir un widget sous cette interface grace a Its appendWidget() method makes the insertion of another widget below it
la methode appendWidget. easier.
*/ */
class StyleEditor : public ElementItemEditor { class StyleEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
StyleEditor(QETElementEditor *, CustomElementGraphicPart * = 0, QWidget * = 0); StyleEditor(QETElementEditor *, CustomElementGraphicPart * = 0, QWidget * = 0);
virtual ~StyleEditor(); virtual ~StyleEditor();
@@ -36,7 +36,7 @@ class StyleEditor : public ElementItemEditor {
private: private:
StyleEditor(const StyleEditor &); StyleEditor(const StyleEditor &);
// attributs // attributes
private: private:
CustomElementGraphicPart *part; CustomElementGraphicPart *part;
QVBoxLayout *main_layout; QVBoxLayout *main_layout;
@@ -46,7 +46,7 @@ class StyleEditor : public ElementItemEditor {
QRadioButton *black_filling, *white_filling; QRadioButton *black_filling, *white_filling;
QCheckBox *antialiasing; QCheckBox *antialiasing;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -21,26 +21,24 @@
#include "elementitemeditor.h" #include "elementitemeditor.h"
class PartTerminal; class PartTerminal;
/** /**
Cette classe represente un editeur de borne. This class provides a widget to edit terminals within the element editor.
Elle permet d'editer a travers une interface graphique les
proprietes d'une borne d'element.
*/ */
class TerminalEditor : public ElementItemEditor { class TerminalEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
// Constructeurs, destructeur // Constructors, destructor
public: public:
TerminalEditor(QETElementEditor *, PartTerminal * = 0, QWidget * = 0); TerminalEditor(QETElementEditor *, PartTerminal * = 0, QWidget * = 0);
virtual ~TerminalEditor(); virtual ~TerminalEditor();
private: private:
TerminalEditor(const TerminalEditor &); TerminalEditor(const TerminalEditor &);
// attributs // attributes
private: private:
PartTerminal *part; PartTerminal *part;
QLineEdit *qle_x, *qle_y; QLineEdit *qle_x, *qle_y;
QComboBox *orientation; QComboBox *orientation;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -22,20 +22,19 @@
class PartText; class PartText;
class QTextOrientationSpinBoxWidget; class QTextOrientationSpinBoxWidget;
/** /**
Cette classe represente un editeur de champ de texte non editable This class provides a widget to edit static texts within the element
Elle permet d'editer a travers une interface graphique les editor.
proprietes d'un champ de texte non editable.
*/ */
class TextEditor : public ElementItemEditor { class TextEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
// Constructeurs, destructeur // Constructors, destructor
public: public:
TextEditor(QETElementEditor *, PartText * = 0, QWidget * = 0); TextEditor(QETElementEditor *, PartText * = 0, QWidget * = 0);
virtual ~TextEditor(); virtual ~TextEditor();
private: private:
TextEditor(const TextEditor &); TextEditor(const TextEditor &);
// attributs // attributes
private: private:
PartText *part; PartText *part;
QLineEdit *qle_x, *qle_y, *qle_text; QLineEdit *qle_x, *qle_y, *qle_text;
@@ -44,7 +43,7 @@ class TextEditor : public ElementItemEditor {
QRadioButton *black_color_, *white_color_; QRadioButton *black_color_, *white_color_;
QTextOrientationSpinBoxWidget *rotation_angle_; QTextOrientationSpinBoxWidget *rotation_angle_;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -22,21 +22,18 @@
class PartTextField; class PartTextField;
class QTextOrientationSpinBoxWidget; class QTextOrientationSpinBoxWidget;
/** /**
Cette classe represente un editeur de champ de texte This class provides a widget to edit text fields within the element editor.
Elle permet d'editer a travers une interface graphique les
proprietes d'un champ de texte : taille de la police, texte par
defaut et position.
*/ */
class TextFieldEditor : public ElementItemEditor { class TextFieldEditor : public ElementItemEditor {
Q_OBJECT Q_OBJECT
// Constructeurs, destructeur // Constructors, destructor
public: public:
TextFieldEditor(QETElementEditor *, PartTextField * = 0, QWidget * = 0); TextFieldEditor(QETElementEditor *, PartTextField * = 0, QWidget * = 0);
virtual ~TextFieldEditor(); virtual ~TextFieldEditor();
private: private:
TextFieldEditor(const TextFieldEditor &); TextFieldEditor(const TextFieldEditor &);
// attributs // attributes
private: private:
PartTextField *part; PartTextField *part;
QLineEdit *qle_x, *qle_y, *qle_text; QLineEdit *qle_x, *qle_y, *qle_text;
@@ -44,7 +41,7 @@ class TextFieldEditor : public ElementItemEditor {
QCheckBox *rotate; QCheckBox *rotate;
QTextOrientationSpinBoxWidget *rotation_angle_; QTextOrientationSpinBoxWidget *rotation_angle_;
// methodes // methods
public: public:
virtual bool setPart(CustomElementPart *); virtual bool setPart(CustomElementPart *);
virtual CustomElementPart *currentPart() const; virtual CustomElementPart *currentPart() const;

View File

@@ -29,7 +29,7 @@
Element::Element(QGraphicsItem *parent, Diagram *scene) : Element::Element(QGraphicsItem *parent, Diagram *scene) :
QObject(), QObject(),
QGraphicsItem(parent, scene), QGraphicsItem(parent, scene),
internal_connections(false), internal_connections_(false),
must_highlight_(false), must_highlight_(false),
first_move_(true) first_move_(true)
{ {

View File

@@ -23,14 +23,14 @@
class Diagram; class Diagram;
class ElementTextItem; class ElementTextItem;
/** /**
Cette classe abstraite represente un element electrique. This is the base class for electrical elements.
*/ */
class Element : public QObject, public QGraphicsItem { class Element : public QObject, public QGraphicsItem {
Q_OBJECT Q_OBJECT
Q_INTERFACES(QGraphicsItem) Q_INTERFACES(QGraphicsItem)
// constructeurs, destructeur // constructors, destructor
public: public:
Element(QGraphicsItem * = 0, Diagram * = 0); Element(QGraphicsItem * = 0, Diagram * = 0);
virtual ~Element(); virtual ~Element();
@@ -38,16 +38,16 @@ class Element : public QObject, public QGraphicsItem {
private: private:
Element(const Element &); Element(const Element &);
// attributs // attributes
public: public:
enum { Type = UserType + 1000 }; enum { Type = UserType + 1000 };
protected: protected:
/** /**
orientations de l'element : Hold orientations for the element :
* autorisations * allowed orientations
* orientation en cours * current orientation
* orientation par defaut * default orientation
@see OrientationSet @see OrientationSet
*/ */
OrientationSet ori; OrientationSet ori;
@@ -57,34 +57,35 @@ class Element : public QObject, public QGraphicsItem {
QPoint hotspot_coord; QPoint hotspot_coord;
QPixmap preview; QPixmap preview;
// methodes // methods
public: public:
/** /**
permet de caster un QGraphicsItem en Element avec qgraphicsitem_cast Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into an
@return le type de QGraphicsItem Element.
@return the QGraphicsItem type
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }
// methodes virtuelles pures a definir dans les classes enfants // pure virtual methods to be defined in derived classes
/// @return la liste des bornes de cet element /// @return the list of terminals for this element
virtual QList<Terminal *> terminals() const = 0; virtual QList<Terminal *> terminals() const = 0;
/// @return la liste des conducteurs relies a cet element /// @return the list of conductors attached to this element
virtual QList<Conductor *> conductors() const = 0; virtual QList<Conductor *> conductors() const = 0;
/// @return la liste des champs de textes de cet element /// @return the list of text items attached to this element
virtual QList<ElementTextItem *> texts() const = 0; virtual QList<ElementTextItem *> texts() const = 0;
/// @return le nombre de bornes actuel de cet element /// @return the current number of terminals of this element
virtual int terminalsCount() const = 0; virtual int terminalsCount() const = 0;
/// @return le nombre de bornes minimum de cet element /// @return the minimum number of terminals for this element
virtual int minTerminalsCount() const = 0; virtual int minTerminalsCount() const = 0;
/// @return le nombre de bornes maximum de cet element /// @return the maximum number of terminals for this element
virtual int maxTerminalsCount() const = 0; virtual int maxTerminalsCount() const = 0;
/** /**
Dessine l'element Draw this element
*/ */
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *) = 0; virtual void paint(QPainter *, const QStyleOptionGraphicsItem *) = 0;
/// @return L'ID du type de l'element /// @return This element type ID
virtual QString typeId() const = 0; virtual QString typeId() const = 0;
/// @return Le nom de l'element /// @return the human name for this element
virtual QString name() const = 0; virtual QString name() const = 0;
Diagram *diagram() const; Diagram *diagram() const;
@@ -96,28 +97,28 @@ class Element : public QObject, public QGraphicsItem {
QSize size() const; QSize size() const;
QPixmap pixmap(); QPixmap pixmap();
// methodes relatives au point de saisie // methods related to the hotspot
QPoint setHotspot(QPoint); QPoint setHotspot(QPoint);
QPoint hotspot() const; QPoint hotspot() const;
// methodes relatives a la selection // selection-related methods
void select(); void select();
void deselect(); void deselect();
// methodes relatives a la position // position-related methods
void setPos(const QPointF &); void setPos(const QPointF &);
void setPos(qreal, qreal); void setPos(qreal, qreal);
// methodes relatives aux connexions internes // methods related to internal connections
bool internalConnections(); bool internalConnections();
void setInternalConnections(bool); void setInternalConnections(bool);
// methodes relatives aux fichiers XML // methods related to XML import/export
static bool valideXml(QDomElement &); static bool valideXml(QDomElement &);
virtual bool fromXml(QDomElement &, QHash<int, Terminal *> &, bool = false); virtual bool fromXml(QDomElement &, QHash<int, Terminal *> &, bool = false);
virtual QDomElement toXml(QDomDocument &, QHash<Terminal *, int> &) const; virtual QDomElement toXml(QDomDocument &, QHash<Terminal *, int> &) const;
// methodes d'acces aux possibilites d'orientation // orientation-related methods
bool setOrientation(QET::Orientation o); bool setOrientation(QET::Orientation o);
const OrientationSet &orientation() const; const OrientationSet &orientation() const;
@@ -128,7 +129,7 @@ class Element : public QObject, public QGraphicsItem {
void mouseReleaseEvent(QGraphicsSceneMouseEvent *); void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
private: private:
bool internal_connections; bool internal_connections_;
bool must_highlight_; bool must_highlight_;
bool first_move_; bool first_move_;
void drawSelection(QPainter *, const QStyleOptionGraphicsItem *); void drawSelection(QPainter *, const QStyleOptionGraphicsItem *);
@@ -137,27 +138,26 @@ class Element : public QObject, public QGraphicsItem {
}; };
/** /**
Permet de savoir si l'element accepte les connexions internes, Indicate whether this element allows internal connections, i.e. whether its
c'est-a-dire que ses bornes peuvent etre reliees entre elles terminals can be linked together using a conductor.
@return true si l'element accepte les connexions internes, false sinon @return true if internal connections are accepted, false otherwise
*/ */
inline bool Element::internalConnections() { inline bool Element::internalConnections() {
return(internal_connections); return(internal_connections_);
} }
/** /**
Permet de specifier si l'element accepte les connexions internes, Specify whether this element allows internal connections, i.e. whether its
c'est-a-dire que ses bornes peuvent etre reliees entre elles terminals can be linked together using a conductor.
@param ic true pour que l'element accepte les connexions internes, false pour @return true for internal connections to be accepted, false otherwise
qu'il les interdise
*/ */
inline void Element::setInternalConnections(bool ic) { inline void Element::setInternalConnections(bool ic) {
internal_connections = ic; internal_connections_ = ic;
} }
/** /**
Permet de connaitre l'orientation actuelle de l'element Indicate the current orientation of this element
@return L'orientation actuelle de l'element @return the current orientation of this element
*/ */
inline const OrientationSet & Element::orientation() const { inline const OrientationSet & Element::orientation() const {
return(ori); return(ori);

View File

@@ -22,39 +22,37 @@
class ElementsCollection; class ElementsCollection;
class MoveElementsHandler; class MoveElementsHandler;
/** /**
Cette classe abstraite represente une definition XML d'element, This abstract class represents a way to access the XML definition of an
c'est-a-dire qu'elle definit l'interface a implementer pour acceder a la element, be it from a .elmt file or from a QET project file.
definition XML d'un element, que celle-ci proviennt d'un fichier *.elmt ou
d'un fichier projet QET.
*/ */
class ElementDefinition : public ElementsCollectionItem { class ElementDefinition : public ElementsCollectionItem {
Q_OBJECT Q_OBJECT
public: public:
/** /**
Constructeur Constructor
*/ */
ElementDefinition(ElementsCategory *category = 0, ElementsCollection *collection = 0) : ElementsCollectionItem(category), parent_category_(category), parent_collection_(collection) {}; ElementDefinition(ElementsCategory *category = 0, ElementsCollection *collection = 0) : ElementsCollectionItem(category), parent_category_(category), parent_collection_(collection) {};
/** /**
Destructeur Destructor
*/ */
virtual ~ElementDefinition() {}; virtual ~ElementDefinition() {};
/** /**
@return la definition XML de l'element @return the XML definition of a particular element
*/ */
virtual QDomElement xml() = 0; virtual QDomElement xml() = 0;
/** /**
Change la definition XML de l'element Specify the XML definition of a particular element
@param xml_element Nouvelle definition XML de l'element @param xml_element New XML definition
@return true si l'operation s'est bien passee, false sinon @return true if everything went well, false otherwise
*/ */
virtual bool setXml(const QDomElement &xml_element) = 0; virtual bool setXml(const QDomElement &xml_element) = 0;
/** /**
@return true si la definition n'est pas disponible @return true if the definition is not available
*/ */
virtual bool isNull() const = 0; virtual bool isNull() const = 0;
@@ -63,35 +61,36 @@ class ElementDefinition : public ElementsCollectionItem {
virtual bool hasParentCategory(); virtual bool hasParentCategory();
/** /**
@return true si l'element est rattache a une collection d'elements @return whether the element is attached to an elements collection
Un element appartenant a une collection a forcement un chemin virtuel. An elemet which belongs to a collection always has a virtual path.
*/ */
virtual bool hasParentCollection(); virtual bool hasParentCollection();
virtual bool isChildOf(ElementsCollectionItem *); virtual bool isChildOf(ElementsCollectionItem *);
/** /**
@return la collection d'element a laquelle appartient cet element @return the elements collections this element belongs to
*/ */
virtual ElementsCollection *parentCollection(); virtual ElementsCollection *parentCollection();
virtual QETProject *project(); virtual QETProject *project();
virtual void setProject(QETProject *); virtual void setProject(QETProject *);
/** /**
@return le protocole utilise par la collection a laquelle appartient cet element @return the "protocol" used by the parent collection
*/ */
virtual QString protocol(); virtual QString protocol();
/** /**
Ne fait rien. Has no effect.
*/ */
virtual void setProtocol(const QString &); virtual void setProtocol(const QString &);
/** /**
@return le chemin virtuel complet de cet element (protocole + chemin) @return the full virtual path for this element (i.e. "protocol" + path)
*/ */
virtual QString fullVirtualPath(); virtual QString fullVirtualPath();
/** /**
@return l'emplacement de cet element @return the location of this element, as an ElementsLocation object.
@see ElementsLocation
*/ */
virtual ElementsLocation location(); virtual ElementsLocation location();
@@ -107,10 +106,10 @@ class ElementDefinition : public ElementsCollectionItem {
virtual ElementsCollectionItem *copy(ElementsCategory *, MoveElementsHandler *, bool = true); virtual ElementsCollectionItem *copy(ElementsCategory *, MoveElementsHandler *, bool = true);
virtual ElementsCollectionItem *move(ElementsCategory *, MoveElementsHandler *); virtual ElementsCollectionItem *move(ElementsCategory *, MoveElementsHandler *);
virtual bool isCollection() const { return(false); } ///< @return toujours false virtual bool isCollection() const { return(false); } ///< @return always false
virtual bool isRootCategory() const { return(false); } ///< @return toujours false virtual bool isRootCategory() const { return(false); } ///< @return always false
virtual bool isCategory() const { return(false); } ///< @return toujours false virtual bool isCategory() const { return(false); } ///< @return always false
virtual bool isElement() const { return(true ); } ///< @return toujours true virtual bool isElement() const { return(true ); } ///< @return always true
virtual ElementsCollection *toCollection(); virtual ElementsCollection *toCollection();
virtual ElementsCategory *toCategory(); virtual ElementsCategory *toCategory();
virtual ElementsCategory *toPureCategory(); virtual ElementsCategory *toPureCategory();
@@ -121,7 +120,7 @@ class ElementDefinition : public ElementsCollectionItem {
void copy(MoveElementsDescription *); void copy(MoveElementsDescription *);
void move(MoveElementsDescription *); void move(MoveElementsDescription *);
// attributs // attributes
private: private:
ElementsCategory *parent_category_; ElementsCategory *parent_category_;
ElementsCollection *parent_collection_; ElementsCollection *parent_collection_;

View File

@@ -21,24 +21,23 @@
#include "elementslocation.h" #include "elementslocation.h"
#include <QtGui> #include <QtGui>
/** /**
Cette classe represente une couche d'abstraction pour supprimer This class provides an abstract way to delete an element from its parent
un element de la collection d'elements. collection. Especially, it requires a confirmation from users.
Elle demande notamment confirmation a l'utilisateur.
*/ */
class ElementDeleter : public QWidget { class ElementDeleter : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ElementDeleter(const ElementsLocation &, QWidget * = 0); ElementDeleter(const ElementsLocation &, QWidget * = 0);
virtual ~ElementDeleter(); virtual ~ElementDeleter();
private: private:
ElementDeleter(const ElementsCategory &); ElementDeleter(const ElementsCategory &);
// methodes // methods
public slots: public slots:
bool exec(); bool exec();
// attributs // attributes
private: private:
ElementsCollectionItem *element; ElementsCollectionItem *element;
}; };

View File

@@ -24,30 +24,30 @@ class QDialogButtonBox;
class ElementsCategoriesList; class ElementsCategoriesList;
class QFileNameEdit; class QFileNameEdit;
/** /**
Cette classe permet d'acceder a plusieurs types de dialogues lies a la This class provides several dialogs to select an element or a category
selection d'element ou de categorie. (e.g. new or existing, for opening or for saving...).
*/ */
class ElementDialog : public QObject { class ElementDialog : public QObject {
Q_OBJECT Q_OBJECT
// enumerations // enumerations
/** /**
Cette enum represente les configurations possible pour ce dialogue This enum represents the available configurations for the required dialog
*/ */
enum { enum {
OpenElement = 0, ///< Le dialogue sera en mode ouverture OpenElement = 0, ///< The dialog should open an element
SaveElement = 1, ///< Le dialogue sera en mode enregistrement SaveElement = 1, ///< The dialog should select an element for saving
OpenCategory = 2, ///< Le dialogue concernera une categorie OpenCategory = 2, ///< The dialog should open a category
SaveCategory = 3 ///< Le dialogue concernera un element SaveCategory = 3 ///< The dialog should select a category for saving
}; };
// constructeurs, destructeur // constructors, destructor
public: public:
ElementDialog(uint = ElementDialog::OpenElement, QWidget * = 0, QObject * = 0); ElementDialog(uint = ElementDialog::OpenElement, QWidget * = 0, QObject * = 0);
virtual ~ElementDialog(); virtual ~ElementDialog();
private: private:
ElementDialog(const ElementDialog &); ElementDialog(const ElementDialog &);
// methodes // methods
public: public:
int exec(); int exec();
ElementsLocation location() const; ElementsLocation location() const;
@@ -69,7 +69,7 @@ class ElementDialog : public QObject {
private: private:
void makeInterface(); void makeInterface();
// attributs // attributes
private: private:
uint mode_; uint mode_;
ElementsLocation location_; ElementsLocation location_;

View File

@@ -25,13 +25,12 @@ class ElementsCollection;
class ElementsCategory; class ElementsCategory;
class ElementDefinition; class ElementDefinition;
/** /**
Cette classe fournit une liste graphique des categories d'elements de This class provides a visual listing of available elements categories.
l'utilisateur.
*/ */
class ElementsCategoriesList : public GenericPanel { class ElementsCategoriesList : public GenericPanel {
Q_OBJECT Q_OBJECT
// Constructeurs, destructeur // Constructors, destructor
public: public:
ElementsCategoriesList(bool = false, uint = QET::All, QWidget * = 0); ElementsCategoriesList(bool = false, uint = QET::All, QWidget * = 0);
virtual ~ElementsCategoriesList(); virtual ~ElementsCategoriesList();
@@ -39,7 +38,7 @@ class ElementsCategoriesList : public GenericPanel {
private: private:
ElementsCategoriesList(const ElementsCategoriesList &); ElementsCategoriesList(const ElementsCategoriesList &);
// methodes // methods
public: public:
ElementsLocation selectedLocation() const; ElementsLocation selectedLocation() const;
bool selectLocation(const ElementsLocation &); bool selectLocation(const ElementsLocation &);
@@ -57,7 +56,7 @@ class ElementsCategoriesList : public GenericPanel {
signals: signals:
void locationChanged(const ElementsLocation &); void locationChanged(const ElementsLocation &);
// attributs // attributes
private: private:
bool display_elements_; bool display_elements_;
int selectables_; int selectables_;

View File

@@ -20,14 +20,13 @@
#include <QtGui> #include <QtGui>
class ElementsCategoriesList; class ElementsCategoriesList;
/** /**
Cette classe represente un widget integrant la liste des categories This class provides a widget listing available elements categories along
de l'utilisteur surplombee de boutons permettant d'ajouter, de modifier with buttons to add, change or create categories.
ou de supprimer des categories
*/ */
class ElementsCategoriesWidget : public QWidget { class ElementsCategoriesWidget : public QWidget {
Q_OBJECT Q_OBJECT
// Constructeurs, destructeur // Constructors, destructor
public: public:
ElementsCategoriesWidget(QWidget * = 0); ElementsCategoriesWidget(QWidget * = 0);
virtual ~ElementsCategoriesWidget(); virtual ~ElementsCategoriesWidget();
@@ -35,7 +34,7 @@ class ElementsCategoriesWidget : public QWidget {
private: private:
ElementsCategoriesWidget(const ElementsCategoriesWidget &); ElementsCategoriesWidget(const ElementsCategoriesWidget &);
// attributs // attributes
private: private:
ElementsCategoriesList *elementscategorieslist; ElementsCategoriesList *elementscategorieslist;
QToolBar *toolbar; QToolBar *toolbar;
@@ -44,7 +43,7 @@ class ElementsCategoriesWidget : public QWidget {
QAction *action_open; QAction *action_open;
QAction *action_delete; QAction *action_delete;
// methodes // methods
public: public:
ElementsCategoriesList &elementsCategoriesList() const; ElementsCategoriesList &elementsCategoriesList() const;
@@ -56,7 +55,7 @@ class ElementsCategoriesWidget : public QWidget {
}; };
/** /**
@return La liste des categories d'elements du widget @return The ElementsCategoriesList embedded within this widget.
*/ */
inline ElementsCategoriesList &ElementsCategoriesWidget::elementsCategoriesList() const { inline ElementsCategoriesList &ElementsCategoriesWidget::elementsCategoriesList() const {
return(*elementscategorieslist); return(*elementscategorieslist);

View File

@@ -25,12 +25,13 @@ class ElementsCollection;
class MoveElementsHandler; class MoveElementsHandler;
class MoveElementsDescription; class MoveElementsDescription;
/** /**
Cette classe abstraite represente une categorie d'elements. This abstract class represents an elements category, i.e. a kind of
subfolder within elements collections.
*/ */
class ElementsCategory : public ElementsCollectionItem { class ElementsCategory : public ElementsCollectionItem {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ElementsCategory(ElementsCategory * = 0, ElementsCollection * = 0); ElementsCategory(ElementsCategory * = 0, ElementsCollection * = 0);
virtual ~ElementsCategory(); virtual ~ElementsCategory();
@@ -38,7 +39,7 @@ class ElementsCategory : public ElementsCollectionItem {
private: private:
ElementsCategory(const ElementsCategory &); ElementsCategory(const ElementsCategory &);
// Implementations de methodes virtuelles pures des classes parentes // Implementations of pure virtual methods from parent classes
public: public:
virtual QETProject *project(); virtual QETProject *project();
virtual void setProject(QETProject *); virtual void setProject(QETProject *);
@@ -67,7 +68,7 @@ class ElementsCategory : public ElementsCollectionItem {
virtual bool isEmpty(); virtual bool isEmpty();
virtual int count(); virtual int count();
// Methodes propres a la classe ElementsCategory // Methods specific to the ElementsCategory class
public: public:
virtual QString name() const; virtual QString name() const;
virtual NamesList categoryNames() const; virtual NamesList categoryNames() const;
@@ -77,13 +78,13 @@ class ElementsCategory : public ElementsCollectionItem {
void copy(MoveElementsDescription *); void copy(MoveElementsDescription *);
void move(MoveElementsDescription *); void move(MoveElementsDescription *);
// attributs // attributes
protected: protected:
/// Collection parente /// parent collection
ElementsCollection *parent_collection_; ElementsCollection *parent_collection_;
/// Categorie parente /// parent category
ElementsCategory *parent_category_; ElementsCategory *parent_category_;
/// Liste des noms de la categorie /// names list for this category
NamesList category_names; NamesList category_names;
}; };
#endif #endif

View File

@@ -21,26 +21,26 @@
#include "elementslocation.h" #include "elementslocation.h"
#include <QtGui> #include <QtGui>
/** /**
Cette classe represente une couche d'abstraction pour supprimer This class provide an abstract way to delete an elements category along with
une categorie d'elements et les elements qu'elle contient. its child elements and subcategories. It always requires a double confirmation
Si la categorie racine d'une collection est fournie, elle sera from users before actually proceeding to the deletion.
videe apres un avertissement. If the deletion of a whole elements collection is required, this class will
Cette classe demande toujours confirmation a l'utilisateur par deux fois. require an extra confirmation.
*/ */
class ElementsCategoryDeleter : public QWidget { class ElementsCategoryDeleter : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ElementsCategoryDeleter(const ElementsLocation &, QWidget * = 0); ElementsCategoryDeleter(const ElementsLocation &, QWidget * = 0);
virtual ~ElementsCategoryDeleter(); virtual ~ElementsCategoryDeleter();
private: private:
ElementsCategoryDeleter(const ElementsCategory &); ElementsCategoryDeleter(const ElementsCategory &);
// methodes // methods
public slots: public slots:
bool exec(); bool exec();
// attributs // attributes
private: private:
ElementsCollectionItem *category; ElementsCollectionItem *category;
}; };

View File

@@ -23,13 +23,13 @@ class ElementsCategory;
class NamesListWidget; class NamesListWidget;
class QFileNameEdit; class QFileNameEdit;
/** /**
Cette classe permet d'editer une categorie existante ou de creer une This class provides a dialog to edit an existing category or create a new
categorie. one.
*/ */
class ElementsCategoryEditor : public QDialog { class ElementsCategoryEditor : public QDialog {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ElementsCategoryEditor(const ElementsLocation &, bool = true, QWidget * = 0); ElementsCategoryEditor(const ElementsLocation &, bool = true, QWidget * = 0);
virtual ~ElementsCategoryEditor(); virtual ~ElementsCategoryEditor();
@@ -37,7 +37,7 @@ class ElementsCategoryEditor : public QDialog {
private: private:
ElementsCategoryEditor(const ElementsCategoryEditor &); ElementsCategoryEditor(const ElementsCategoryEditor &);
// attributs // attributes
private: private:
ElementsCategory *category; ElementsCategory *category;
QDialogButtonBox *buttons; QDialogButtonBox *buttons;
@@ -46,7 +46,7 @@ class ElementsCategoryEditor : public QDialog {
QFileNameEdit *internal_name_; QFileNameEdit *internal_name_;
bool mode_edit; bool mode_edit;
// methodes // methods
private: private:
void buildDialog(); void buildDialog();

View File

@@ -26,21 +26,21 @@ class ElementsCollectionCache;
class ElementDefinition; class ElementDefinition;
class MoveElementsHandler; class MoveElementsHandler;
/** /**
Cette classe abstraite represente une collection d'elements. Il peut s'agir This abstract class represents an elements collection. For instance, it may
de la collection QET, de la collection utilisateur ou encore de la represent the collection provided along with QElectroTech, users custom
collection fournie par un fichier projet. collections or collections embedded within QET project files.
*/ */
class ElementsCollection : public ElementsCollectionItem { class ElementsCollection : public ElementsCollectionItem {
Q_OBJECT Q_OBJECT
public: public:
// constructeurs, destructeur // constructors, destructor
ElementsCollection(ElementsCollectionItem * = 0); ElementsCollection(ElementsCollectionItem * = 0);
virtual ~ElementsCollection(); virtual ~ElementsCollection();
private: private:
ElementsCollection(const ElementsCollection &); ElementsCollection(const ElementsCollection &);
// Implementations de methodes virtuelles pures des classes parentes // Implementations of pure virtual methodes from parent classes
public: public:
virtual QString title() const; virtual QString title() const;
virtual void setTitle(const QString &); virtual void setTitle(const QString &);
@@ -81,10 +81,10 @@ class ElementsCollection : public ElementsCollectionItem {
virtual bool isEmpty(); virtual bool isEmpty();
virtual int count(); virtual int count();
// Methodes propres a la classe ElementsCollection // Methods specific to the ElementsCollection class
public: public:
/** /**
@return la categorie racine de cette collection @return the root category of this collection
*/ */
virtual ElementsCategory *rootCategory() = 0; virtual ElementsCategory *rootCategory() = 0;
virtual ElementsCollectionItem *item(const QString &, bool = true); virtual ElementsCollectionItem *item(const QString &, bool = true);
@@ -95,15 +95,15 @@ class ElementsCollection : public ElementsCollectionItem {
signals: signals:
void elementsCollectionChanged(ElementsCollection *); void elementsCollectionChanged(ElementsCollection *);
// attributs // attributes
protected: protected:
/// Title to be used when referring to this collection /// Title to be used when referring to this collection
QString title_; QString title_;
/// Icon to be displayed when representing this collection /// Icon to be displayed when representing this collection
QIcon icon_; QIcon icon_;
/// Protocole utilise pour acceder a cette collection /// "Protocol" used to access this collection
QString protocol_; QString protocol_;
/// Projet auquel appartient cette collection /// Project this collection belongs to, if any
QETProject *project_; QETProject *project_;
/// Optional cache used to improve performance /// Optional cache used to improve performance
ElementsCollectionCache *cache_; ElementsCollectionCache *cache_;

View File

@@ -24,13 +24,13 @@ class ElementsCategory;
class ElementDefinition; class ElementDefinition;
class MoveElementsHandler; class MoveElementsHandler;
/** /**
Cette interface est la classe mere pour toutes les classes This interface is the base class for all classes representing a part of an
modelisant une partie d'une collection d'elements. elements collection.
*/ */
class ElementsCollectionItem : public QObject { class ElementsCollectionItem : public QObject {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ElementsCollectionItem(ElementsCollectionItem *parent = 0) : QObject(parent) {}; ElementsCollectionItem(ElementsCollectionItem *parent = 0) : QObject(parent) {};
virtual ~ElementsCollectionItem() {}; virtual ~ElementsCollectionItem() {};
@@ -38,172 +38,170 @@ class ElementsCollectionItem : public QObject {
private: private:
ElementsCollectionItem(const ElementsCollectionItem &); ElementsCollectionItem(const ElementsCollectionItem &);
// methodes // methods
public: public:
/// @return true si l'item est une collection d'elements /// @return whether the item is an elements collection
virtual bool isCollection() const = 0; virtual bool isCollection() const = 0;
/// @return true si l'item est une categorie d'elements /// @return whether the item is an elements category
virtual bool isCategory() const = 0; virtual bool isCategory() const = 0;
/// @return true si l'item est la categorie racine de sa collection /// @return whether the item is the root category of a collection
virtual bool isRootCategory() const = 0; virtual bool isRootCategory() const = 0;
/// @return true si l'item est un element /// @return whether the item is an element
virtual bool isElement() const = 0; virtual bool isElement() const = 0;
/** /**
@return un pointeur sur cet item en tant que collection, ou 0 si cet item n'est pas une collection @return a pointer to this item as a collection object, or 0 if this item is not a collection.
*/ */
virtual ElementsCollection *toCollection() = 0; virtual ElementsCollection *toCollection() = 0;
/** /**
@return un pointeur sur cet item en tant que categorie. @return a pointer to this item as a category object.
Si cet objet est une collection, un pointeur valide vers sa categorie racine sera renvoye. If this item is a collection, return a valid pointer to its root category.
Si cet objet est une categorie, un pointeur valide sera renvoye. If this item is a category, return a valid pointer.
Si cet objet est un element, un pointeur valide vers sa categorie parente sera renvoye. If this item is an element, return a valid pointer to its parent category.
*/ */
virtual ElementsCategory *toCategory() = 0; virtual ElementsCategory *toCategory() = 0;
/** /**
@return un pointeur sur cet item en tant que categorie si et seulement @return a pointer to this item as a category if and only if this object is a non-root elements category.
si cet objet est une categorie non racine. If this item is a collection, return 0.
Si cet objet est une collection, 0 sera retourne If this item is a category, return a valid pointer.
Si cet objet est une categorie, un pointeur valide sera renvoye. If this item is an element, return 0.
Si cet objet est un element, 0 sera retourne.
*/ */
virtual ElementsCategory *toPureCategory() = 0; virtual ElementsCategory *toPureCategory() = 0;
/** /**
@return un pointeur sur cet item en tant qu'element @return a pointer to this item as an element object.
*/ */
virtual ElementDefinition *toElement() = 0; virtual ElementDefinition *toElement() = 0;
/** /**
Copie l'item vers la destination indiquee en parametre ; le booleen Copy this item to the specified target, using a specific strategy to handle
doit etre a true pour une copie recursive, a false sinon. corner cases (errors, conflicts, confirmations, ...), recursively or not.
*/ */
virtual ElementsCollectionItem *copy(ElementsCategory *, MoveElementsHandler *, bool = true) = 0; virtual ElementsCollectionItem *copy(ElementsCategory *, MoveElementsHandler *, bool = true) = 0;
/** /**
Deplace l'item vers la destination indiquee en parametre. Move this item to the specified destination, using a specific strategy to
handle corner cases (errors, conflicts, confirmations, ...).
*/ */
virtual ElementsCollectionItem *move(ElementsCategory *, MoveElementsHandler *) = 0; virtual ElementsCollectionItem *move(ElementsCategory *, MoveElementsHandler *) = 0;
/// Recharge l'item /// Reload this item
virtual void reload() = 0; virtual void reload() = 0;
/// @return true si l'item existe /// @return whether the item really exists
virtual bool exists() = 0; virtual bool exists() = 0;
/// @return true si l'item est lisible /// @return whether the item is readable
virtual bool isReadable() = 0; virtual bool isReadable() = 0;
/// @return true si l'item est accessible en ecriture /// @return whether the item is writable
virtual bool isWritable() = 0; virtual bool isWritable() = 0;
/** /**
supprime le contenu de l'item (categories et elements) sans supprimer Delete the item content (elements and subcategories) without deleting the item itself.
l'item lui-meme @return true if the operation succeeded, false otherwise
@return true si l'operation a reussi, false sinon
*/ */
virtual bool removeContent() = 0; virtual bool removeContent() = 0;
/** /**
supprime le contenu de l'item (categories et elements) puis l'item Delete the item content (elements and categories) before deleting the item itself.
lui-meme @return true if the operation succeeded, false otherwise
@return true si l'operation a reussi, false sinon
*/ */
virtual bool remove() = 0; virtual bool remove() = 0;
/** /**
Enregistre l'item Save the item.
@return true si l'operation a reussi, false sinon @return true if the operation succeeded, false otherwise
*/ */
virtual bool write() = 0; virtual bool write() = 0;
/** /**
@return le projet auquel appartient cet item @return the project this item belongs to
*/ */
virtual QETProject *project() = 0; virtual QETProject *project() = 0;
/** /**
Definit le projet auquel appartient cet item Set the project this item belongs to.
*/ */
virtual void setProject(QETProject *) = 0; virtual void setProject(QETProject *) = 0;
/** /**
@return le protocole utilise pour acceder a la collection de cet item @return the protocol used to access the collection this item belongs to.
*/ */
virtual QString protocol() = 0; virtual QString protocol() = 0;
/** /**
Definit le protocole a utiliser pour acceder a la collection de cet item Set the protocol used to access the collection this item belongs to.
*/ */
virtual void setProtocol(const QString &) = 0; virtual void setProtocol(const QString &) = 0;
/** /**
@return la categorie parente de cet item, ou 0 si celui-ci n'en possede pas @return the parent category of this item, or 0 if it does not have any
*/ */
virtual ElementsCategory *parentCategory() = 0; virtual ElementsCategory *parentCategory() = 0;
/** /**
@return la liste des categories parentes de cet item @return the list of parent categories of this item
*/ */
virtual QList<ElementsCategory *> parentCategories() = 0; virtual QList<ElementsCategory *> parentCategories() = 0;
/** /**
@return true si cet item possede une categorie parente, false sinon @return whether this item has a parent category
*/ */
virtual bool hasParentCategory() = 0; virtual bool hasParentCategory() = 0;
/** /**
@return la collection parente de cet item, ou 0 si celui-ci n'en possede pas @return the parent collection of this item, or 0 if it does not have any
*/ */
virtual ElementsCollection *parentCollection() = 0; virtual ElementsCollection *parentCollection() = 0;
/** /**
@return true si cet item possede une collection parente, false sinon @return whether this item belongs to an elements collection
*/ */
virtual bool hasParentCollection() = 0; virtual bool hasParentCollection() = 0;
/** /**
@param other_item Autre item @param other_item other item
@return true si other_item est parent (direct ou indirect) de other_item, false sinon @return whether \a other_item is a direct or indirect parent of this item.
*/ */
virtual bool isChildOf(ElementsCollectionItem *other_item) = 0; virtual bool isChildOf(ElementsCollectionItem *other_item) = 0;
/** /**
@return le nom de cet item dans l'arborescence @return the name of this item within the elements tree.
*/ */
virtual QString pathName() const = 0; virtual QString pathName() const = 0;
/** /**
@return le chemin virtuel vers cet item dans l'arborescence, sans le protocole @return the virtual path to this item within the elements tree, protocol excluded.
*/ */
virtual QString virtualPath() = 0; virtual QString virtualPath() = 0;
/** /**
@return le chemin virtuel vers cet item dans l'arborescence, avec le protocole @return the virtual path to this item within the elements tree, protocol included.
*/ */
virtual QString fullVirtualPath() = 0; virtual QString fullVirtualPath() = 0;
/** /**
@return l'emplacement de cet item @return the location of this item
*/ */
virtual ElementsLocation location() = 0; virtual ElementsLocation location() = 0;
/** /**
@return true si cet item est represente quelque part sur le systeme de fichiers @return whether this item is stored somewhere on the filesystem.
*/ */
virtual bool hasFilePath() = 0; virtual bool hasFilePath() = 0;
/** /**
@return le chemin de cet item sur le systeme de fichiers @return the path of this item within the filesystem
*/ */
virtual QString filePath() = 0; virtual QString filePath() = 0;
/** /**
Definit le chemin de cet item sur le systeme de fichiers Set the path to this item within the filesystem.
*/ */
virtual void setFilePath(const QString &) = 0; virtual void setFilePath(const QString &) = 0;
/** /**
@return la liste des categories d'elements contenues dans cet item @return the list of direct child elements category within this item
*/ */
virtual QList<ElementsCategory *> categories() = 0; virtual QList<ElementsCategory *> categories() = 0;
/** /**
@return une categorie a partir de son chemin virtuel @return the specified category, provided its virtual path
*/ */
virtual ElementsCategory *category(const QString &) = 0; virtual ElementsCategory *category(const QString &) = 0;
/** /**
@return une nouvelle categorie creee a partir d'un chemin virtuel @return a new category, created from the spcified virtual path
*/ */
virtual ElementsCategory *createCategory(const QString &) = 0; virtual ElementsCategory *createCategory(const QString &) = 0;
/** /**
@return la liste des elements contenus dans cet item @return the list of child elements within this item
*/ */
virtual QList<ElementDefinition *> elements() = 0; virtual QList<ElementDefinition *> elements() = 0;
/** /**
@return un element a partir de son chemin virtuel @return an element, provided its virtual path
*/ */
virtual ElementDefinition *element(const QString &) = 0; virtual ElementDefinition *element(const QString &) = 0;
/** /**
@return un nouvel element cree a partir d'un chemin virtuel @return a new element, created from the specified virtual path
*/ */
virtual ElementDefinition *createElement(const QString &) = 0; virtual ElementDefinition *createElement(const QString &) = 0;
/** /**
@return true if the item is empty, false otherwise @return whether the item is empty
*/ */
virtual bool isEmpty() = 0; virtual bool isEmpty() = 0;
/** /**

View File

@@ -26,7 +26,7 @@ class QETProject;
encapsule un chemin virtuel. encapsule un chemin virtuel.
*/ */
class ElementsLocation { class ElementsLocation {
// constructeurs, destructeur et operateur d'affectation // constructors, destructor et operateur d'affectation
public: public:
ElementsLocation(); ElementsLocation();
explicit ElementsLocation(const QString &, QETProject * = 0); explicit ElementsLocation(const QString &, QETProject * = 0);
@@ -36,7 +36,7 @@ class ElementsLocation {
bool operator==(const ElementsLocation &) const; bool operator==(const ElementsLocation &) const;
bool operator!=(const ElementsLocation &) const; bool operator!=(const ElementsLocation &) const;
// methodes // methods
public: public:
QString baseName() const; QString baseName() const;
QString path() const; QString path() const;
@@ -50,7 +50,7 @@ class ElementsLocation {
void fromString(const QString &); void fromString(const QString &);
static ElementsLocation locationFromString(const QString &); static ElementsLocation locationFromString(const QString &);
// attributs // attributes
private: private:
QString path_; QString path_;
QETProject *project_; QETProject *project_;

View File

@@ -22,25 +22,25 @@
class ConductorTextItem; class ConductorTextItem;
class Diagram; class Diagram;
/** /**
Cette classe permet de gerer le deplacement des differents items composant This class manages the interactive movement of different items (elements,
un schema electrique sur ce schema. conductors, text items) on a particular diagram.
*/ */
class ElementsMover { class ElementsMover {
// constructeurs, destructeur // constructors, destructor
public: public:
ElementsMover(); ElementsMover();
virtual ~ElementsMover(); virtual ~ElementsMover();
private: private:
ElementsMover(const ElementsMover &); ElementsMover(const ElementsMover &);
// methodes // methods
public: public:
bool isReady() const; bool isReady() const;
int beginMovement(Diagram *, QGraphicsItem * = 0); int beginMovement(Diagram *, QGraphicsItem * = 0);
void continueMovement(const QPointF &); void continueMovement(const QPointF &);
void endMovement(); void endMovement();
// attributs // attributes
private: private:
bool movement_running_; bool movement_running_;
QPointF current_movement_; QPointF current_movement_;

View File

@@ -31,14 +31,15 @@ class ElementsCollectionCache;
class TitleBlockTemplatesFilesCollection; class TitleBlockTemplatesFilesCollection;
/** /**
Cette classe represente le panel d'appareils (en tant qu'element This class provides a tree widget listing known filesystem-based elements
graphique) dans lequel l'utilisateur choisit les composants de collections and opened project files along with their content (diagrams,
son choix et les depose sur le schema par drag'n drop. embedded collections, ...). It enables users to perform various actions on
the displayed content
*/ */
class ElementsPanel : public GenericPanel { class ElementsPanel : public GenericPanel {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ElementsPanel(QWidget * = 0); ElementsPanel(QWidget * = 0);
virtual ~ElementsPanel(); virtual ~ElementsPanel();
@@ -48,11 +49,11 @@ class ElementsPanel : public GenericPanel {
// methods // methods
public: public:
// methodes pour determiner ce que represente un item donne // methods used to determine what is represented by a particular visual item
bool itemIsWritable(QTreeWidgetItem *) const; bool itemIsWritable(QTreeWidgetItem *) const;
bool selectedItemIsWritable() const; bool selectedItemIsWritable() const;
// methodes pour obtenir ce que represente un item donne // methods used to get what is represented by a particular visual item
ElementsCollectionItem *collectionItemForItem(QTreeWidgetItem *) const; ElementsCollectionItem *collectionItemForItem(QTreeWidgetItem *) const;
ElementsCollectionItem *selectedItem() const; ElementsCollectionItem *selectedItem() const;
ElementsCategory *categoryForItem(QTreeWidgetItem *); ElementsCategory *categoryForItem(QTreeWidgetItem *);

View File

@@ -20,13 +20,14 @@
#include <QtGui> #include <QtGui>
#include "elementspanel.h" #include "elementspanel.h"
/** /**
Cette classe est un widget qui contient le panel d'elements surplombe d'une This class embeds an elements panel under a toolbar providing various actions
barre d'outils avec differentes actions pour gerer les elements. to manage elements.
@see ElementsPanel
*/ */
class ElementsPanelWidget : public QWidget { class ElementsPanelWidget : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ElementsPanelWidget(QWidget * = 0); ElementsPanelWidget(QWidget * = 0);
virtual ~ElementsPanelWidget(); virtual ~ElementsPanelWidget();
@@ -34,7 +35,7 @@ class ElementsPanelWidget : public QWidget {
private: private:
ElementsPanelWidget(const ElementsPanelWidget &); ElementsPanelWidget(const ElementsPanelWidget &);
// attributs // attributes
private: private:
ElementsPanel *elements_panel; ElementsPanel *elements_panel;
QToolBar *toolbar, *filter_toolbar; QToolBar *toolbar, *filter_toolbar;
@@ -51,7 +52,7 @@ class ElementsPanelWidget : public QWidget {
ElementsCollectionItem *dnd_item_src_, *dnd_item_dst_; ElementsCollectionItem *dnd_item_src_, *dnd_item_dst_;
QProgressBar *progress_bar_; QProgressBar *progress_bar_;
// methodes // methods
public: public:
inline ElementsPanel &elementsPanel() const; inline ElementsPanel &elementsPanel() const;
@@ -110,7 +111,7 @@ class ElementsPanelWidget : public QWidget {
}; };
/** /**
@return Le panel d'elements imbrique dans ce widget @return The elements panel embedded within this widget.
*/ */
inline ElementsPanel &ElementsPanelWidget::elementsPanel() const { inline ElementsPanel &ElementsPanelWidget::elementsPanel() const {
return(*elements_panel); return(*elements_panel);

View File

@@ -22,22 +22,19 @@
class Diagram; class Diagram;
class Element; class Element;
/** /**
Cette classe represente un champ de texte rattache a un element. This class represents a text item attached to an element. Users can change its
Il est editable et deplacable (relativement a son element parent) par value, adjust its position (defined relatively to its parent element), and
l'utilisateur. direct it to any angle.
Il peut egalement etre oriente a un angle quelconque.
Il est possible pour ce champ de texte de rester dans le sens de la lecture
malgre les rotations de son element parent.
*/ */
class ElementTextItem : public DiagramTextItem { class ElementTextItem : public DiagramTextItem {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ElementTextItem(Element * = 0, Diagram * = 0); ElementTextItem(Element * = 0, Diagram * = 0);
ElementTextItem(const QString &, Element * = 0, Diagram * = 0); ElementTextItem(const QString &, Element * = 0, Diagram * = 0);
virtual ~ElementTextItem(); virtual ~ElementTextItem();
// attributs // attributes
public: public:
enum { Type = UserType + 1003 }; enum { Type = UserType + 1003 };
@@ -48,11 +45,11 @@ class ElementTextItem : public DiagramTextItem {
qreal original_rotation_angle_; qreal original_rotation_angle_;
bool first_move_; bool first_move_;
// methodes // methods
public: public:
virtual int type() const { return Type; } virtual int type() const { return Type; }
Element *parentElement() const; Element *parentElement() const;
/// @return le rectangle delimitant le champ de texte /// @return the rectangle defining the bounds of this text item
virtual QRectF boundingRect() const { return(QGraphicsTextItem::boundingRect().adjusted(0.0, -1.1, 0.0, 0.0)); } virtual QRectF boundingRect() const { return(QGraphicsTextItem::boundingRect().adjusted(0.0, -1.1, 0.0, 0.0)); }
bool followParentRotations() const; bool followParentRotations() const;
void setFollowParentRotations(bool); void setFollowParentRotations(bool);
@@ -78,18 +75,19 @@ class ElementTextItem : public DiagramTextItem {
}; };
/** /**
Permet de savoir si le champ de texte suit les rotations de son parent. Element text items can optionally be applied a counter-rotation when their
@return true si le champ de texte suit les rotations de son parent, false parent element is rotated, thus preserving their readability.
sinon @return whether this text item follows the rotations of its parent element.
*/ */
inline bool ElementTextItem::followParentRotations() const { inline bool ElementTextItem::followParentRotations() const {
return(follow_parent_rotations); return(follow_parent_rotations);
} }
/** /**
Permet de specifier si le champ de texte suit les rotations de son parent. Element text items can optionally be applied a counter-rotation when their
@param frp true si le champ de texte doit suivre les rotations de son parent element is rotated, thus preserving their readability.
parent, false pour qu'ils ne les suivent pas @param frp whether this text item should follow the rotations of its parent
element.
*/ */
inline void ElementTextItem::setFollowParentRotations(bool frp) { inline void ElementTextItem::setFollowParentRotations(bool frp) {
follow_parent_rotations = frp; follow_parent_rotations = frp;

View File

@@ -22,25 +22,25 @@
class ElementTextItem; class ElementTextItem;
class Diagram; class Diagram;
/** /**
Cette classe permet de gerer le deplacement des ElementTextItems d'un schema This class manages the interactive movement of element text items on a
electrique. particular diagram.
*/ */
class ElementTextsMover { class ElementTextsMover {
// constructeurs, destructeur // constructors, destructor
public: public:
ElementTextsMover(); ElementTextsMover();
virtual ~ElementTextsMover(); virtual ~ElementTextsMover();
private: private:
ElementTextsMover(const ElementTextsMover &); ElementTextsMover(const ElementTextsMover &);
// methodes // methods
public: public:
bool isReady() const; bool isReady() const;
int beginMovement(Diagram *, QGraphicsItem * = 0); int beginMovement(Diagram *, QGraphicsItem * = 0);
void continueMovement(const QPointF &); void continueMovement(const QPointF &);
void endMovement(); void endMovement();
// attributs // attributes
private: private:
bool movement_running_; bool movement_running_;
QPointF current_movement_; QPointF current_movement_;

View File

@@ -23,13 +23,14 @@
class QSvgGenerator; class QSvgGenerator;
class ExportPropertiesWidget; class ExportPropertiesWidget;
/** /**
Cette classe represente le dialogue permettant d'exporter un schema This class provides a dialog enabling users to export 1 to n diagrams from
sous forme d'image selon les desirs de l'utilisateur a project as image files, with features like preview, copy to clipboard,
resize, etc.
*/ */
class ExportDialog : public QDialog { class ExportDialog : public QDialog {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ExportDialog(QETProject *, QWidget * = 0); ExportDialog(QETProject *, QWidget * = 0);
virtual ~ExportDialog(); virtual ~ExportDialog();
@@ -37,11 +38,10 @@ class ExportDialog : public QDialog {
private: private:
ExportDialog(const ExportDialog &); ExportDialog(const ExportDialog &);
// methodes // methods
public: public:
int diagramsToExportCount() const; int diagramsToExportCount() const;
// classes privees
private: private:
class ExportDiagramLine { class ExportDiagramLine {
public: public:
@@ -61,10 +61,10 @@ class ExportDialog : public QDialog {
QPushButton *clipboard; QPushButton *clipboard;
}; };
// attributs // attributes
private: private:
QHash<int, ExportDialog::ExportDiagramLine *> diagram_lines_; QHash<int, ExportDialog::ExportDiagramLine *> diagram_lines_;
// elements graphiques // visual items
QGridLayout *diagrams_list_layout_; QGridLayout *diagrams_list_layout_;
ExportPropertiesWidget *epw; ExportPropertiesWidget *epw;
QDialogButtonBox *buttons; QDialogButtonBox *buttons;
@@ -76,10 +76,10 @@ class ExportDialog : public QDialog {
QSignalMapper *reset_mapper_; QSignalMapper *reset_mapper_;
QSignalMapper *clipboard_mapper_; QSignalMapper *clipboard_mapper_;
// elements relatifs au traitement effectue par le dialogue // project whose diagrams are to be exported
QETProject *project_; QETProject *project_;
// methodes // methods
private: private:
QWidget *initDiagramsListPart(); QWidget *initDiagramsListPart();
void saveReloadDiagramParameters(Diagram *, bool = true); void saveReloadDiagramParameters(Diagram *, bool = true);

View File

@@ -21,8 +21,8 @@
#include "qet.h" #include "qet.h"
/** /**
Cette classe represente les differentes options utilisees pour exporter un This class is a container for various options used when printing or
schema sous forme d'image, ou encore pour l'imprimer. exporting a diagram as an image file.
*/ */
class ExportProperties { class ExportProperties {
// constructeur, destructeur // constructeur, destructeur
@@ -30,20 +30,20 @@ class ExportProperties {
ExportProperties(); ExportProperties();
virtual ~ExportProperties(); virtual ~ExportProperties();
// methodes // methods
public: public:
void toSettings (QSettings &, const QString & = QString()) const; void toSettings (QSettings &, const QString & = QString()) const;
void fromSettings(QSettings &, const QString & = QString()); void fromSettings(QSettings &, const QString & = QString());
// attributs // attributes
public: public:
QDir destination_directory; ///< Quel est le repertoire de destination du ou des fichiers generes ? QDir destination_directory; ///< Target directory for generated files
QString format; ///< Quel format d'image faut-il utiliser ? QString format; ///< Image format of generated files
bool draw_grid; ///< Faut-il dessiner la grille ? bool draw_grid; ///< Whether to render the diagram grid
bool draw_border; ///< Faut-il dessiner le cadre ? bool draw_border; ///< Whether to render the border (along with rows/columns headers)
bool draw_titleblock; ///< Faut-il dessiner le cartouche ? bool draw_titleblock; ///< Whether to render the title block
bool draw_terminals; ///< Faut-il dessiner les bornes ? bool draw_terminals; ///< Whether to render terminals
bool draw_colored_conductors; ///< Faut-il respecter les couleurs des conducteurs ? bool draw_colored_conductors; ///< Whether to render conductors colors
QET::DiagramArea exported_area; ///< Zone du schema a exporter QET::DiagramArea exported_area; ///< Area of diagrams to be rendered
}; };
#endif #endif

View File

@@ -21,12 +21,12 @@
#include "exportproperties.h" #include "exportproperties.h"
/** /**
Ce widget permet d'editer les differentes options utilisees This widget enables users to edit the various options available when
pour exporter un projet. exporting a project.
*/ */
class ExportPropertiesWidget : public QWidget { class ExportPropertiesWidget : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
ExportPropertiesWidget(QWidget * = 0); ExportPropertiesWidget(QWidget * = 0);
ExportPropertiesWidget(const ExportProperties &, QWidget * = 0); ExportPropertiesWidget(const ExportProperties &, QWidget * = 0);
@@ -34,7 +34,7 @@ class ExportPropertiesWidget : public QWidget {
private: private:
ExportPropertiesWidget(const ExportPropertiesWidget &); ExportPropertiesWidget(const ExportPropertiesWidget &);
// methodes // methods
public: public:
void setExportProperties(const ExportProperties &); void setExportProperties(const ExportProperties &);
ExportProperties exportProperties() const; ExportProperties exportProperties() const;
@@ -48,11 +48,10 @@ class ExportPropertiesWidget : public QWidget {
void exportedAreaChanged(); void exportedAreaChanged();
void optionChanged(); void optionChanged();
// methodes privees
private: private:
void build(); void build();
// attributs // attributes
private: private:
QLabel *dirpath_label; QLabel *dirpath_label;
QLineEdit *dirpath; QLineEdit *dirpath;

View File

@@ -22,8 +22,7 @@
class FileElementsCategory; class FileElementsCategory;
class FileElementsCollection; class FileElementsCollection;
/** /**
Cette classe represente la definition d'un element stockee dans un fichier. This class represents an element definition stored into a file.
*/ */
class FileElementDefinition : public ElementDefinition { class FileElementDefinition : public ElementDefinition {
public: public:
@@ -33,7 +32,7 @@ class FileElementDefinition : public ElementDefinition {
private: private:
FileElementDefinition(const FileElementDefinition &); FileElementDefinition(const FileElementDefinition &);
// methodes // methods
public: public:
virtual QDomElement xml(); virtual QDomElement xml();
virtual bool setXml(const QDomElement &); virtual bool setXml(const QDomElement &);
@@ -51,7 +50,7 @@ class FileElementDefinition : public ElementDefinition {
virtual void setFilePath(const QString &); virtual void setFilePath(const QString &);
virtual QDateTime modificationTime() const; virtual QDateTime modificationTime() const;
// attributs // attributes
private: private:
bool is_null; bool is_null;
QString file_path; QString file_path;

View File

@@ -22,13 +22,12 @@
class FileElementsCollection; class FileElementsCollection;
class FileElementDefinition; class FileElementDefinition;
/** /**
Cette classe represente une categorie d'elements accessible via un systeme This class represents an elements category stored on a filesystem.
de fichiers.
*/ */
class FileElementsCategory : public ElementsCategory { class FileElementsCategory : public ElementsCategory {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
FileElementsCategory(const QString & = QString(), FileElementsCategory * = 0, FileElementsCollection * = 0); FileElementsCategory(const QString & = QString(), FileElementsCategory * = 0, FileElementsCollection * = 0);
virtual ~FileElementsCategory(); virtual ~FileElementsCategory();
@@ -36,7 +35,7 @@ class FileElementsCategory : public ElementsCategory {
private: private:
FileElementsCategory(const FileElementsCategory &); FileElementsCategory(const FileElementsCategory &);
// methodes // methods
public: public:
virtual QString pathName() const; virtual QString pathName() const;
virtual QString virtualPath(); virtual QString virtualPath();
@@ -67,17 +66,17 @@ class FileElementsCategory : public ElementsCategory {
void loadNames(); void loadNames();
void deleteContent(); void deleteContent();
// attributs // attributes
protected: protected:
/// Collection parente, de type fichier /// Parent collection, stored on filesystem too
FileElementsCollection *file_parent_collection_; FileElementsCollection *file_parent_collection_;
/// Categorie parente, de type fichier /// Paremt Collection, stored on filesystem too
FileElementsCategory *file_parent_category_; FileElementsCategory *file_parent_category_;
/// Sous-categories contenues dans cette categorie /// Child sub-categories
QHash<QString, FileElementsCategory *> categories_; QHash<QString, FileElementsCategory *> categories_;
/// Elements contenus dans cette categorie /// Child elements
QHash<QString, FileElementDefinition *> elements_; QHash<QString, FileElementDefinition *> elements_;
/// Dossier representant cette categorie sur le systeme de fichiers /// Directory matching this category on filesystem
QDir cat_dir; QDir cat_dir;
}; };
#endif #endif

View File

@@ -21,14 +21,13 @@
#include "elementscollection.h" #include "elementscollection.h"
class FileElementsCategory; class FileElementsCategory;
/** /**
Cette classe represente une collection d'elements accessible via un This class represents an elements collection stored on filesystem, like the
systeme de fichier. Typiquement, il s'agit de la collection QET ou collection provided along with QET or users custom collection.
de la collection utilisateur.
*/ */
class FileElementsCollection : public ElementsCollection { class FileElementsCollection : public ElementsCollection {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
FileElementsCollection(const QString &, ElementsCollectionItem *parent = 0); FileElementsCollection(const QString &, ElementsCollectionItem *parent = 0);
virtual ~FileElementsCollection(); virtual ~FileElementsCollection();
@@ -36,7 +35,7 @@ class FileElementsCollection : public ElementsCollection {
private: private:
FileElementsCollection(const FileElementsCollection &); FileElementsCollection(const FileElementsCollection &);
// methodes // methods
public: public:
virtual void reload(); virtual void reload();
virtual ElementsCategory *rootCategory(); virtual ElementsCategory *rootCategory();
@@ -53,7 +52,7 @@ class FileElementsCollection : public ElementsCollection {
private: private:
void deleteContent(); void deleteContent();
// attributs // attributes
private: private:
QString coll_path; QString coll_path;
FileElementsCategory *root; FileElementsCategory *root;

View File

@@ -19,18 +19,18 @@
#define ELEMENTFIXE_H #define ELEMENTFIXE_H
#include "element.h" #include "element.h"
/** /**
Cette classe represente un element avec un nombre fixe de bornes. This class represents an element having a fixed number of terminals.
*/ */
class FixedElement : public Element { class FixedElement : public Element {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
FixedElement(QGraphicsItem * = 0, Diagram * = 0); FixedElement(QGraphicsItem * = 0, Diagram * = 0);
virtual ~FixedElement(); virtual ~FixedElement();
// methodes // methods
public: public:
int minTerminalsCount() const; int minTerminalsCount() const;
int maxTerminalsCount() const; int maxTerminalsCount() const;

View File

@@ -23,26 +23,24 @@ class QGraphicsItem;
class ElementsLocation; class ElementsLocation;
class Terminal; class Terminal;
/** /**
La classe GhostElement herite de la classe CustomElement. Un GhostElement The GhostElement class inherits CustomElement. A GhostElement aims at
est destine a remplacer visuellement un CustomElement dont la definition visually replacing a CustomElement whose definition could not be loaded.
n'a pu etre trouvee. Ainsi, au lieu de ne pas charger un element, et donc This way, instead of not loading an element, thus potentially losing its
de perdre potentiellement : position, its orientation, its child text items and conductors, one can
* sa position, son orientation, ses textes, substitute a GhostElement. The GhostElement will extrapolate the position
* les conducteurs qui y sont lies, of terminals and text items from the rest of the diagram. It is visually
on peut lui substituer un GhostElement. Celui-ci extrapolera depuis le rendered using a simple rectangle.
schema la position des bornes et des champs de texte.
Visuellement, il sera represente par un rectangle.
*/ */
class GhostElement : public CustomElement { class GhostElement : public CustomElement {
Q_OBJECT Q_OBJECT
// constructeur, destructeur // constructor, destructor
public: public:
GhostElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0); GhostElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0);
virtual ~GhostElement(); virtual ~GhostElement();
// methodes // methods
public: public:
virtual bool fromXml(QDomElement &, QHash<int, Terminal *> &, bool = false); virtual bool fromXml(QDomElement &, QHash<int, Terminal *> &, bool = false);

View File

@@ -54,9 +54,9 @@ HotspotEditor::HotspotEditor(QWidget *parent) :
diagram_scene = new Diagram(); diagram_scene = new Diagram();
diagram_scene -> border_and_titleblock.setColumnsWidth(50.0); diagram_scene -> border_and_titleblock.setColumnsWidth(50.0);
diagram_scene -> border_and_titleblock.setNbColumns(3); diagram_scene -> border_and_titleblock.setColumnsCount(3);
diagram_scene -> border_and_titleblock.setRowsHeight(60.0); diagram_scene -> border_and_titleblock.setRowsHeight(60.0);
diagram_scene -> border_and_titleblock.setNbRows(2); diagram_scene -> border_and_titleblock.setRowsCount(2);
diagram_scene -> border_and_titleblock.displayRows(false); diagram_scene -> border_and_titleblock.displayRows(false);
diagram_scene -> border_and_titleblock.displayTitleBlock(false); diagram_scene -> border_and_titleblock.displayTitleBlock(false);

View File

@@ -20,13 +20,13 @@
#include <QtGui> #include <QtGui>
#include "diagram.h" #include "diagram.h"
/** /**
Ce widget permet a l'utilisateur d'editer les dimensions ainsi que le point This widget enable users to edit the dimensions and the hotspot of an
de saisie d'un element. electrical element.
*/ */
class HotspotEditor : public QWidget { class HotspotEditor : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
HotspotEditor(QWidget * = 0); HotspotEditor(QWidget * = 0);
virtual ~HotspotEditor() {}; virtual ~HotspotEditor() {};
@@ -34,7 +34,7 @@ class HotspotEditor : public QWidget {
private: private:
HotspotEditor(const HotspotEditor &); HotspotEditor(const HotspotEditor &);
// attributs // attributes
private: private:
QLabel *informations_label_; QLabel *informations_label_;
QSpinBox *sb_width; QSpinBox *sb_width;
@@ -49,7 +49,7 @@ class HotspotEditor : public QWidget {
bool parts_rect_enabled; bool parts_rect_enabled;
QVBoxLayout *vlayout; QVBoxLayout *vlayout;
// methodes // methods
public: public:
void setElementWidth(uint); void setElementWidth(uint);
void setElementHeight(uint); void setElementHeight(uint);

View File

@@ -20,25 +20,26 @@
#include <QtGui> #include <QtGui>
#include "diagramtextitem.h" #include "diagramtextitem.h"
/** /**
Cette classe represente un champ de texte editable independant sur le schema. This class represents an independent text field on a particular diagram.
Il peut etre pivote et deplace. It may be moved, edited, and rotated.
*/ */
class IndependentTextItem : public DiagramTextItem { class IndependentTextItem : public DiagramTextItem {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
IndependentTextItem(Diagram * = 0); IndependentTextItem(Diagram * = 0);
IndependentTextItem(const QString &, Diagram* = 0); IndependentTextItem(const QString &, Diagram* = 0);
virtual ~IndependentTextItem(); virtual ~IndependentTextItem();
// attributs // attributes
public: public:
enum { Type = UserType + 1005 }; enum { Type = UserType + 1005 };
// methodes // methods
public: public:
/** /**
Cette methode permet d'utiliser qgraphicsitem_cast sur cet objet Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into an
IndependentTextItem.
@return le type de QGraphicsItem @return le type de QGraphicsItem
*/ */
virtual int type() const { return Type; } virtual int type() const { return Type; }

View File

@@ -20,26 +20,25 @@
#include "basicmoveelementshandler.h" #include "basicmoveelementshandler.h"
#include <QtGui> #include <QtGui>
/** /**
Cette classe implemente la classe strategie MoveElementsHandler. This class implements the MoveElementsHandler Strategy class.
Elle correspond a un BasiMoveElementsHandler configure pour repondre It acts like a BasiMoveElementsHandler configured to answer QET::Abort to any question.
QET::Abort a toutes les questions. Please note this class was designed with the context of integrating an element definition into a project in mind.
Elle redefinit seulement la methode elementAlreadyExists pour, dans le cadre For this purpose, the elementAlreadyExists method was redefined to ask users whether they wish to:
de l'integration d'un element dans un projet demander a l'utilisateur s'il souahite : * erase a different, already-existing element,
* ecraser l'element precedent, manifestement different * keep the already-existing element by renaming the new one,
* conserver l'element precedent, en renommant le nouveau * or cancel the integration.
* annuler l'integration de l'element dans le projet
*/ */
class IntegrationMoveElementsHandler : public BasicMoveElementsHandler { class IntegrationMoveElementsHandler : public BasicMoveElementsHandler {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
IntegrationMoveElementsHandler(QWidget * = 0); IntegrationMoveElementsHandler(QWidget * = 0);
virtual ~IntegrationMoveElementsHandler(); virtual ~IntegrationMoveElementsHandler();
private: private:
IntegrationMoveElementsHandler(const IntegrationMoveElementsHandler &); IntegrationMoveElementsHandler(const IntegrationMoveElementsHandler &);
// methodes // methods
public: public:
virtual QET::Action elementAlreadyExists(ElementDefinition *, ElementDefinition *); virtual QET::Action elementAlreadyExists(ElementDefinition *, ElementDefinition *);
virtual QString nameForRenamingOperation(); virtual QString nameForRenamingOperation();
@@ -54,11 +53,11 @@ class IntegrationMoveElementsHandler : public BasicMoveElementsHandler {
private slots: private slots:
void correctRadioButtons(); void correctRadioButtons();
// attributs // attributes
private: private:
QWidget *parent_widget_; ///< Widget a utiliser comme parent pour l'affichage des dialogues QWidget *parent_widget_; ///< Widget to be used as parent when displaying dialogs
QString rename_; ///< Nom a utiliser lors d'une operation de renommage QString rename_; ///< Name to be used when renaming the integrated element
QDialog *integ_dialog_; ///< Dialogue en cas de conflit lors de l'integration d'un element QDialog *integ_dialog_; ///< Dialog in case of conflict when integration an element
QLabel *dialog_label_; QLabel *dialog_label_;
QVBoxLayout *dialog_vlayout_; QVBoxLayout *dialog_vlayout_;
QGridLayout *dialog_glayout; QGridLayout *dialog_glayout;

View File

@@ -27,22 +27,21 @@ class QHBoxLayout;
class QVBoxLayout; class QVBoxLayout;
class QLabel; class QLabel;
/** /**
Cette classe implemente la classe strategie MoveElementsHandler. This class implements the MoveElementsHandler Strategy class by asking
Via une interface graphique, elle demande a l'utilisateur comment il faut users how to handle the various expected problems through interactive
traiter tel ou tel probleme puis transmet la reponse via l'API de la classe dialogs.
MoveElementsHandler.
*/ */
class InteractiveMoveElementsHandler : public BasicMoveElementsHandler { class InteractiveMoveElementsHandler : public BasicMoveElementsHandler {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
InteractiveMoveElementsHandler(QWidget * = 0); InteractiveMoveElementsHandler(QWidget * = 0);
virtual ~InteractiveMoveElementsHandler(); virtual ~InteractiveMoveElementsHandler();
private: private:
InteractiveMoveElementsHandler(const InteractiveMoveElementsHandler &); InteractiveMoveElementsHandler(const InteractiveMoveElementsHandler &);
// methodes // methods
public: public:
virtual QET::Action categoryAlreadyExists(ElementsCategory *, ElementsCategory *); virtual QET::Action categoryAlreadyExists(ElementsCategory *, ElementsCategory *);
virtual QET::Action elementAlreadyExists(ElementDefinition *, ElementDefinition *); virtual QET::Action elementAlreadyExists(ElementDefinition *, ElementDefinition *);
@@ -68,15 +67,16 @@ class InteractiveMoveElementsHandler : public BasicMoveElementsHandler {
void simpleErrorMessage(const QString &) const; void simpleErrorMessage(const QString &) const;
// attributs // attributes
private: private:
QWidget *parent_widget_; ///< Widget a utiliser comme parent pour l'affichage des dialogues QWidget *parent_widget_; ///< Widget to be used as parent when displaying dialogs
QString rename_; ///< Nom a utiliser lors d'une operation de renommage QString rename_; ///< Name to be used when renaming an item
bool always_erase_; ///< Booleen indiquant qu'il faut toujours ecraser les cibles en conflit sans poser de question bool always_erase_; ///< Whether to systematically erase conflicting targets without bothering users
bool always_skip_; ///< Booleen indiquant qu'il faut toujours ignorer les cibles en conflit sans poser de question bool always_skip_; ///< Whether to systematically ignore conflicting targets without bothering users
bool aborted_; /// Booleen indiquant que le mouvement a ete annule bool aborted_; ///< Whether the movement has been cancelled
// attributs relatifs au dialogue affiche pour les elements et categories deja existants (= dialogue de conflit) // attributes related to the dialog displayed for already existing elements and
// categories (= i.e. conflict dialog)
QET::Action conflict_result_; QET::Action conflict_result_;
QDialog *conflict_dialog_; QDialog *conflict_dialog_;
QVBoxLayout *conflict_layout0_; QVBoxLayout *conflict_layout0_;
@@ -84,7 +84,7 @@ class InteractiveMoveElementsHandler : public BasicMoveElementsHandler {
QLabel *rename_label_; QLabel *rename_label_;
QFileNameEdit *rename_textfield_; QFileNameEdit *rename_textfield_;
/// Boutons pour le dialogue de conflit /// Buttons for the conflict dialog
QDialogButtonBox *conflict_buttons_; QDialogButtonBox *conflict_buttons_;
QPushButton *rename_button_; QPushButton *rename_button_;
QPushButton *erase_button_; QPushButton *erase_button_;

View File

@@ -22,21 +22,21 @@ class ElementsCollectionItem;
class ElementsCategory; class ElementsCategory;
class MoveElementsHandler; class MoveElementsHandler;
/** /**
Cette classe represente la description d'un mouvement d'elements. This class describes the evolution of an elements item move (actually
Il peut s'agir d'un deplacement ou d'une copie. La source n'est pas either move or copy), i.e. whether the source was deleted, whether the
mentionnee target changed and to what path, etc.
*/ */
class MoveElementsDescription : public QObject { class MoveElementsDescription : public QObject {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
MoveElementsDescription(QObject * = 0); MoveElementsDescription(QObject * = 0);
virtual ~MoveElementsDescription(); virtual ~MoveElementsDescription();
private: private:
MoveElementsDescription(const MoveElementsDescription &); MoveElementsDescription(const MoveElementsDescription &);
// methodes // methods
public: public:
bool isRecursive() const; bool isRecursive() const;
void setRecursive(bool); void setRecursive(bool);
@@ -62,7 +62,7 @@ class MoveElementsDescription : public QObject {
bool mustAbort() const; bool mustAbort() const;
void abort(); void abort();
// attributs // attributes
private: private:
bool recursive_; bool recursive_;
MoveElementsHandler *handler_; MoveElementsHandler *handler_;

View File

@@ -22,79 +22,75 @@
class ElementDefinition; class ElementDefinition;
class ElementsCategory; class ElementsCategory;
/** /**
Cette classe definit l'interface minimale pour implementer un objet capable This class defines the minimum interface required to implement an object able
de prendre en main une operation de deplacement ou de copie d'elements. to handle a move/copy operation among elements collections. This kind of
Ce type d'objet est typiquement utilise dans les methodes move et copy des objects is typically useful in the move() and copy() method of the
classes ElementDefinition et ElementsCategory. Ces methodes font appel a cet ElementDefinition and ElementsCategory classes. These methods simply rely on
objet pour qu'il leur indique comment gerer les eventuels problemes answers provided by an instance of this class as soon as they encounter
rencontres lors du deplacement / de la copie. typical move/copy problems, such as conflicts or permission issues.
Exemple : lors de la recopie d'un element dans une categorie, il se peut que
cet element existe deja. Il est alors possible d'ecraser l'element cible ou For instance, when copying a particular element to a given category, that
d'abandonner l'operation. Cette decision est a la charge d'une classe fille element may already exist in the target category. It is then possible either
de MoveElementsHandler. to erase the target element, change the target name or cancel the operation.
Cet objet peut effectuer des interactions avec l'utilisateur ou non. There is no systematic or calculable answer to this kind of questions, hence
Cet aspect, ainsi que la politique de gestion des elements, est laisse aux the rational to delegate the decision process to a dedicated "Strategy" object.
bons soins de l'implementation.
Il s'agit d'un pattern Strategie qui encapsule non pas l'algorithme de All we know from this object is the fact it implements the interface defined
deplacement / copie des categories / elements mais la gestion des erreurs below. It is then free to create complicated dialogs to ask a user what to do
durant l'execution de cet algorithme. or even to pick a random decision.
@see ElementsCategory @see ElementsCategory
@see ElementDefinition @see ElementDefinition
*/ */
class MoveElementsHandler : public QObject { class MoveElementsHandler : public QObject {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
MoveElementsHandler(QObject * = 0) {}; MoveElementsHandler(QObject * = 0) {};
virtual ~MoveElementsHandler() {}; virtual ~MoveElementsHandler() {};
private: private:
MoveElementsHandler(const MoveElementsHandler &); MoveElementsHandler(const MoveElementsHandler &);
// methodes // methods
public: public:
/** /**
@return l'action a effectuer si la categorie cible existe deja @return what to do if the target category already exists
*/ */
virtual QET::Action categoryAlreadyExists(ElementsCategory *src, ElementsCategory *dst) = 0; virtual QET::Action categoryAlreadyExists(ElementsCategory *src, ElementsCategory *dst) = 0;
/** /**
@return l'action a effectuer si l'element cible existe deja @return what to do if the target element already exists
*/ */
virtual QET::Action elementAlreadyExists(ElementDefinition *src, ElementDefinition *dst) = 0; virtual QET::Action elementAlreadyExists(ElementDefinition *src, ElementDefinition *dst) = 0;
/** /**
@return l'action a effectuer si la categorie existe deja @return what to do if a category is not readable
*/ */
virtual QET::Action categoryIsNotReadable(ElementsCategory *) = 0; virtual QET::Action categoryIsNotReadable(ElementsCategory *) = 0;
/** /**
@return l'action a effectuer si l'element existe deja @return what to do if an element is not readable
*/ */
virtual QET::Action elementIsNotReadable(ElementDefinition *) = 0; virtual QET::Action elementIsNotReadable(ElementDefinition *) = 0;
/** /**
@return l'action a effectuer si la categorie cible n'est pas accessible @return what to do if the target category is not writable
en ecriture
*/ */
virtual QET::Action categoryIsNotWritable(ElementsCategory *) = 0; virtual QET::Action categoryIsNotWritable(ElementsCategory *) = 0;
/** /**
@return l'action a effectuer si l'element cible n'est pas accessible @return what to do if the target element is not writable
en ecriture
*/ */
virtual QET::Action elementIsNotWritable(ElementDefinition *) = 0; virtual QET::Action elementIsNotWritable(ElementDefinition *) = 0;
/** /**
@return l'action a effectuer lorsque l'erreur decrite dans la QString @return what to do when an error, described by the provided QString, occurs in relation with the given elements category.
s'est produite avec la categorie indiquee
*/ */
virtual QET::Action errorWithACategory(ElementsCategory *, const QString &) = 0; virtual QET::Action errorWithACategory(ElementsCategory *, const QString &) = 0;
/** /**
@return l'action a effectuer lorsque l'erreur decrite dans la QString @return what to do when an error, described by the provided QString, occurs in relation with the given element.
s'est produite avec l'element indique
*/ */
virtual QET::Action errorWithAnElement(ElementDefinition *, const QString &) = 0; virtual QET::Action errorWithAnElement(ElementDefinition *, const QString &) = 0;
/** /**
@return le nom a utiliser pour le renommage si une methode de cet objet @return the name to be used along with the latest QET::Rename answer
a precedemment renvoye QET::Rename.
*/ */
virtual QString nameForRenamingOperation() = 0; virtual QString nameForRenamingOperation() = 0;
}; };

View File

@@ -27,22 +27,22 @@
pour le francais. pour le francais.
*/ */
class NamesList { class NamesList {
// constructeurs, destructeur // constructors, destructor
public: public:
NamesList(); NamesList();
NamesList(const NamesList &); NamesList(const NamesList &);
virtual ~NamesList(); virtual ~NamesList();
// attributs // attributes
private: private:
QHash<QString, QString> hash_names; QHash<QString, QString> hash_names;
public: public:
static int MetaTypeId; static int MetaTypeId;
// methodes // methods
public: public:
// methodes relatives a la gestion de la liste // methods relatives a la gestion de la liste
void addName(const QString &, const QString &); void addName(const QString &, const QString &);
void removeName(const QString &); void removeName(const QString &);
void clearNames(); void clearNames();
@@ -55,7 +55,7 @@ class NamesList {
bool operator==(const NamesList &) const; bool operator==(const NamesList &) const;
QString name(const QString & = QString()) const; QString name(const QString & = QString()) const;
// methodes relatives a XML // methods relatives a XML
void fromXml(const QDomElement &, const QHash<QString, QString> & = QHash<QString, QString>()); void fromXml(const QDomElement &, const QHash<QString, QString> & = QHash<QString, QString>());
QDomElement toXml(QDomDocument &, const QHash<QString, QString> & = QHash<QString, QString>()) const; QDomElement toXml(QDomDocument &, const QHash<QString, QString> & = QHash<QString, QString>()) const;

View File

@@ -20,13 +20,13 @@
#include <QtGui> #include <QtGui>
#include "nameslist.h" #include "nameslist.h"
/** /**
Cette classe represente une interface permettant de saisir les noms des This class provides a widget enabling users to enter localized names for
categories et elements. categories and elements.
*/ */
class NamesListWidget : public QWidget { class NamesListWidget : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
NamesListWidget(QWidget * = 0); NamesListWidget(QWidget * = 0);
virtual ~NamesListWidget(); virtual ~NamesListWidget();
@@ -34,14 +34,14 @@ class NamesListWidget : public QWidget {
private: private:
NamesListWidget(const NamesListWidget &); NamesListWidget(const NamesListWidget &);
// attributs // attributes
private: private:
QTreeWidget *tree_names; QTreeWidget *tree_names;
QPushButton *button_add_line; QPushButton *button_add_line;
NamesList hash_names; NamesList hash_names;
bool read_only; bool read_only;
// methodes // methods
public: public:
bool checkOneName(); bool checkOneName();
NamesList names(); NamesList names();
@@ -59,8 +59,8 @@ class NamesListWidget : public QWidget {
signals: signals:
/** /**
Signal emis lors de la verification de la saisie s'il y a au moins un Signal emitted after the widget successfully checked there was at least one
nom saisi name entered
*/ */
void inputChecked(); void inputChecked();
}; };

View File

@@ -25,20 +25,21 @@ class OrientationSetWidget;
class HotspotEditor; class HotspotEditor;
class QFileNameEdit; class QFileNameEdit;
/** /**
Cette classe represente un dialogue qui permet a l'utilisateur de specifier This class provides a wizard dialog enabling users to to specify the basic
les premiers parametres de l'element qu'il va construire. parameters of the electrical elements they intend to draw.
Ces parametres sont :
- la categorie dans laquelle il faut enregistrer l'element These parameters include:
- le nom du fichier dans lequel il faut enregistrer l'element - the category the element should be saved to
- les noms de cet element - the filename the element should be saved to
- les dimensions - localized names
- la position du hotspot - dimensions
- les orientations possibles - hotspot position
- allowed and default orientations
*/ */
class NewElementWizard : public QWizard { class NewElementWizard : public QWizard {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
NewElementWizard(QWidget * = 0, Qt::WindowFlags = 0); NewElementWizard(QWidget * = 0, Qt::WindowFlags = 0);
virtual ~NewElementWizard(); virtual ~NewElementWizard();
@@ -46,12 +47,12 @@ class NewElementWizard : public QWizard {
private: private:
NewElementWizard(const NewElementWizard &); NewElementWizard(const NewElementWizard &);
// methodes // methods
public: public:
ElementsCategory *selectedCategory() const; ElementsCategory *selectedCategory() const;
bool preselectCategory(ElementsCategory *); bool preselectCategory(ElementsCategory *);
// attributs // attributes
private: private:
enum WizardState { Category, Filename, Names, Dimensions, Orientations }; enum WizardState { Category, Filename, Names, Dimensions, Orientations };
ElementsCategoriesWidget *categories_list; ElementsCategoriesWidget *categories_list;
@@ -63,7 +64,7 @@ class NewElementWizard : public QWizard {
QString chosen_file; QString chosen_file;
ElementsCategory *chosen_category; ElementsCategory *chosen_category;
// methodes // methods
private: private:
QWizardPage *buildStep1(); QWizardPage *buildStep1();
QWizardPage *buildStep2(); QWizardPage *buildStep2();

View File

@@ -19,23 +19,20 @@
#define ORIENTATION_SET_H #define ORIENTATION_SET_H
#include "qet.h" #include "qet.h"
/** /**
Cette classe represente un containeur d'orientations, c'est-a-dire une This class provides a container for element orientations, i.e. a data
structure de donnees stockant une orientation par defaut, une orientation structure that stores, for a particular element:
courante et l'autorisation ou non d'utiliser les quatre autres orientations - its default orientation,
: nord, est, sud, ouest. - its current orientation,
Elle possede des methodes pour definir les autorisations. Le changement - whether the North, East, South and West orientations are allowed.
d'autorisation peut echouer car il faut au moins une orientation autorisee.
Le changement d'autorisation peut eventuellement modifier les orientations
par defaut et courante.
*/ */
class OrientationSet { class OrientationSet {
// constructeurs, destructeur // constructors, destructor
public: public:
OrientationSet(); OrientationSet();
virtual ~OrientationSet() {}; virtual ~OrientationSet() {};
// attributs // attributes
private: private:
bool north_ori; bool north_ori;
bool east_ori; bool east_ori;
@@ -44,7 +41,7 @@ class OrientationSet {
QET::Orientation default_ori; QET::Orientation default_ori;
QET::Orientation current_ori; QET::Orientation current_ori;
// methodes // methods
public: public:
bool north() const; bool north() const;
bool east() const; bool east() const;
@@ -74,49 +71,49 @@ class OrientationSet {
}; };
/** /**
@return true si l'orientation "Nord" est autorisee, false sinon @return whether the Northern orientation is allowed
*/ */
inline bool OrientationSet::north() const { inline bool OrientationSet::north() const {
return(north_ori); return(north_ori);
} }
/** /**
@return true si l'orientation "Est" est autorisee, false sinon @return whether the Eastern orientation is allowed
*/ */
inline bool OrientationSet::east() const { inline bool OrientationSet::east() const {
return(east_ori); return(east_ori);
} }
/** /**
@return true si l'orientation "Sud" est autorisee, false sinon @return whether the Southern orientation is allowed
*/ */
inline bool OrientationSet::south() const { inline bool OrientationSet::south() const {
return(south_ori); return(south_ori);
} }
/** /**
@return true si l'orientation "Ouest" est autorisee, false sinon @return whether the Western orientation is allowed
*/ */
inline bool OrientationSet::west() const { inline bool OrientationSet::west() const {
return(west_ori); return(west_ori);
} }
/** /**
@param theValue La nouvelle orientation par defaut @param new_default_orientation The new default orientation
*/ */
inline void OrientationSet::setDefaultOrientation(const QET::Orientation& theValue) { inline void OrientationSet::setDefaultOrientation(const QET::Orientation& new_default_orientation) {
default_ori = theValue; default_ori = new_default_orientation;
} }
/** /**
@return L'orientation par defaut @return the default orientation
*/ */
inline QET::Orientation OrientationSet::defaultOrientation() const { inline QET::Orientation OrientationSet::defaultOrientation() const {
return(default_ori); return(default_ori);
} }
/** /**
@return L'orientation actuelle @return the current orientation
*/ */
inline QET::Orientation OrientationSet::current() const { inline QET::Orientation OrientationSet::current() const {
return(current_ori); return(current_ori);

View File

@@ -20,11 +20,12 @@
#include <QtGui> #include <QtGui>
#include "orientationset.h" #include "orientationset.h"
/** /**
Widget permettant d'editer un OrientationSet Widget to edit an OrientationSet.
@see OrientationSet
*/ */
class OrientationSetWidget : public QWidget { class OrientationSetWidget : public QWidget {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
OrientationSetWidget(QWidget * = 0); OrientationSetWidget(QWidget * = 0);
virtual ~OrientationSetWidget() {}; virtual ~OrientationSetWidget() {};
@@ -32,7 +33,7 @@ class OrientationSetWidget : public QWidget {
private: private:
OrientationSetWidget(const OrientationSetWidget &); OrientationSetWidget(const OrientationSetWidget &);
// attributs // attributes
private: private:
OrientationSet ori; OrientationSet ori;
QComboBox *north_orientation; QComboBox *north_orientation;
@@ -45,7 +46,7 @@ class OrientationSetWidget : public QWidget {
QRadioButton *west_default; QRadioButton *west_default;
QButtonGroup *default_radios; QButtonGroup *default_radios;
// methodes // methods
public: public:
OrientationSet orientationSet() const; OrientationSet orientationSet() const;
void setOrientationSet(const OrientationSet &); void setOrientationSet(const OrientationSet &);

View File

@@ -26,7 +26,8 @@ class Diagram;
class ElementsLocation; class ElementsLocation;
class QETTabWidget; class QETTabWidget;
/** /**
Cette classe affiche les schemas d'un projet dans des onglets. This class provides a widget displaying the diagrams of a particular
project using tabs.
*/ */
class ProjectView : public QWidget { class ProjectView : public QWidget {
Q_OBJECT Q_OBJECT
@@ -41,14 +42,14 @@ class ProjectView : public QWidget {
Q_DECLARE_FLAGS(ProjectSaveOptions, ProjectSaveOption) Q_DECLARE_FLAGS(ProjectSaveOptions, ProjectSaveOption)
// constructeurs, destructeur // constructors, destructor
public: public:
ProjectView(QETProject *, QWidget * = 0); ProjectView(QETProject *, QWidget * = 0);
virtual ~ProjectView(); virtual ~ProjectView();
private: private:
ProjectView(const ProjectView &); ProjectView(const ProjectView &);
// methodes // methods
public: public:
QETProject *project(); QETProject *project();
void setProject(QETProject *); void setProject(QETProject *);
@@ -119,7 +120,7 @@ class ProjectView : public QWidget {
void setDisplayFallbackWidget(bool); void setDisplayFallbackWidget(bool);
void adjustReadOnlyState(); void adjustReadOnlyState();
// attributs // attributes
private: private:
QAction *add_new_diagram_; QAction *add_new_diagram_;
QETProject *project_; QETProject *project_;

View File

@@ -19,20 +19,19 @@
#define _QET_H #define _QET_H
#include <QtXml> #include <QtXml>
/** /**
Ce fichier contient des fonctions utiles pouvant etre appelees depuis This file provides useful functions and enums that may be used from
n'importe ou. Il contient egalement des enums utilises dans plusieurs anywhere else within the QElectroTech application.
classes de l'application
*/ */
namespace QET { namespace QET {
/// version de QElectroTech (utilisee pour estampiller les projets et elements) /// QElectroTech version (as string, used to mark projects and elements XML documents)
const QString version = "0.3"; const QString version = "0.3";
/// version affichee de QElectroTech /// QElectroTech displayed version
const QString displayedVersion = "0.3a"; const QString displayedVersion = "0.3a";
QString license(); QString license();
/// Orientation (utilise pour les bornes mais aussi pour les elements) /// Orientation (used for electrical elements and their terminals)
enum Orientation {North, East, South, West}; enum Orientation {North, East, South, West};
/// Mouvements orientes /// Oriented movements
enum OrientedMovement { enum OrientedMovement {
ToNorth, ToNorth,
ToNorthEast, ToNorthEast,
@@ -44,28 +43,28 @@ namespace QET {
ToNorthWest ToNorthWest
}; };
/// Types de segment de conducteurs /// Known kinds of conductor segments
enum ConductorSegmentType { enum ConductorSegmentType {
Horizontal = 1, ///< Segment horizontal Horizontal = 1, ///< Horizontal segment
Vertical = 2, ///< Segment vertical Vertical = 2, ///< Vertical segment
Both = 3 ///< Segment en biais / invalide Both = 3 ///< Invalid segment
}; };
/** /**
Cet enum represente les differents embouts possibles pour les This enum lists the various available endings for line primitives when drawing
extremites d'une ligne. an electrical element.
*/ */
enum EndType { enum EndType {
None, ///< Ligne normale None, ///< Regular line
Simple, ///< Triangle sans base Simple, ///< Base-less triangle
Triangle, ///< Triangle Triangle, ///< Triangle
Circle, ///< Cercle Circle, ///< Circle
Diamond ///< Losange Diamond ///< Diamond
}; };
/** /**
Cet enum represente les differents items manipulables dans une This enums lists the various kind of items users can manage within the
collection d'elements. application.
*/ */
enum ItemType { enum ItemType {
Element = 1, Element = 1,
@@ -91,25 +90,25 @@ namespace QET {
}; };
/** /**
Cet enum represente les differentes facons de gerer un probleme lors de This enums lists the various ways to handle a standard problem when copying
la recopie ou du deplacement d'un element ou d'une categorie. or moving element items (collections, categories, elements).
@see MoveElementsHandler @see MoveElementsHandler
*/ */
enum Action { enum Action {
Retry, ///< il faut reessayer l'operation Retry, ///< The operation must be tried again
Ignore, ///< il faut passer a la suite Ignore, ///< Skip the current item
Erase, ///< il faut ecraser le contenu cible Erase, ///< Erase the target content
Abort, ///< il faut arreter : ignorer l'item en cours et ne pas continuer Abort, ///< abort the whole operation, ignoring the curent item
Managed, ///< le cas a ete gere par l'objet delegue : ne pas le traiter et passer a la suite Managed, ///< the current item was handled by the Strategy object: do not treat it and continue
Rename ///< il faut renommer la cible Rename ///< the target has to be renamed
}; };
/** /**
Cet enum represente la zone d'un schema a exporter / imprimer This enum represents diagram areas that may be exported/printed.
*/ */
enum DiagramArea { enum DiagramArea {
BorderArea, ///< Exporte le schema avec son cadre et son cartouche BorderArea, ///< Export the diagram along with its border and title block
ElementsArea ///< Exporte le contenu du schema sans le cadre et le cartouche ElementsArea ///< Export the content of the diagram only
}; };
/// enum used to specify the type of a length /// enum used to specify the type of a length

View File

@@ -45,12 +45,11 @@ class QTextOrientationSpinBoxWidget;
class RecentFiles; class RecentFiles;
/** /**
Cette classe represente l'application QElectroTech. This class represents the QElectroTech application.
*/ */
class QETApp : public QETSingleApplication { class QETApp : public QETSingleApplication {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
QETApp(int &, char **); QETApp(int &, char **);
virtual ~QETApp(); virtual ~QETApp();
@@ -58,7 +57,7 @@ class QETApp : public QETSingleApplication {
private: private:
QETApp(const QETApp &); QETApp(const QETApp &);
// methodes // methods
public: public:
static QETApp *instance(); static QETApp *instance();
void setLanguage(const QString &); void setLanguage(const QString &);
@@ -103,7 +102,7 @@ class QETApp : public QETSingleApplication {
public: public:
static void overrideCommonElementsDir(const QString &); static void overrideCommonElementsDir(const QString &);
private: private:
static QString common_elements_dir; ///< Dossier contenant la collection d'elements commune static QString common_elements_dir; ///< Directory containing the common elements collection
#endif #endif
#ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION #ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION
public: public:
@@ -115,11 +114,11 @@ class QETApp : public QETSingleApplication {
public: public:
static void overrideConfigDir(const QString &); static void overrideConfigDir(const QString &);
private: private:
static QString config_dir; ///< Dossier contenant la configuration et la collection d'elements de l'utilisateur static QString config_dir; ///< Directory containing the user configuration and the custom elements collection
#endif #endif
public: public:
static void overrideLangDir(const QString &); static void overrideLangDir(const QString &);
static QString lang_dir; ///< Dossier contenant les fichiers de langue static QString lang_dir; ///< Directory containing localization files.
static QFont diagramTextsFont(qreal = -1.0); static QFont diagramTextsFont(qreal = -1.0);
static QETDiagramEditor *diagramEditorForFile(const QString &); static QETDiagramEditor *diagramEditorForFile(const QString &);
static QList<QETDiagramEditor *> diagramEditors(); static QList<QETDiagramEditor *> diagramEditors();
@@ -135,7 +134,7 @@ class QETApp : public QETSingleApplication {
bool event(QEvent *); bool event(QEvent *);
#endif #endif
// attributs // attributes
private: private:
QTranslator qtTranslator; QTranslator qtTranslator;
QTranslator qetTranslator; QTranslator qetTranslator;
@@ -164,9 +163,9 @@ class QETApp : public QETSingleApplication {
bool every_template_visible; bool every_template_visible;
QSignalMapper signal_map; QSignalMapper signal_map;
QSettings *qet_settings; QSettings *qet_settings;
QETArguments qet_arguments_; ///< Analyseur d'arguments QETArguments qet_arguments_; ///< Comand-line arguments parser
bool non_interactive_execution_; ///< booleen indiquant si l'application va se terminer immediatement apres un court traitement bool non_interactive_execution_; ///< Whether the application will end without any user interaction
QPalette initial_palette_; ///< Palette des couleurs systeme QPalette initial_palette_; ///< System color palette
static FileElementsCollection *common_collection; static FileElementsCollection *common_collection;
static FileElementsCollection *custom_collection; static FileElementsCollection *custom_collection;
@@ -209,7 +208,6 @@ class QETApp : public QETSingleApplication {
void configureQET(); void configureQET();
void aboutQET(); void aboutQET();
// methodes privees
private slots: private slots:
void cleanup(); void cleanup();
@@ -236,8 +234,8 @@ class QETApp : public QETSingleApplication {
}; };
/** /**
Cette classe represente le style de QElectroTech This class represents the custom QElectroTech style.
Il s'agit de modifications simples appliquees aux styles communs de Qt It implements simple modification such as extra standard icons.
*/ */
class QETStyle : public QPlastiqueStyle { class QETStyle : public QPlastiqueStyle {
Q_OBJECT Q_OBJECT

View File

@@ -19,15 +19,14 @@
#define QET_ARGUMENTS_H #define QET_ARGUMENTS_H
#include <QtCore> #include <QtCore>
/** /**
Cette classe represente un ensemble d'arguments que l'application peut This class represents a set of arguments the application has received as
recevoir en parametres. Initialisee a partir d'une liste de chaine de parameters. Initialized from a list of strings, an instance of this class
caracteres, chaque instance de cette classe permet d'acceder aux differents provides access to the differents options and files given on the command line.
types de fichiers et options passes en parametres.
*/ */
class QETArguments : public QObject { class QETArguments : public QObject {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
QETArguments(QObject * = 0); QETArguments(QObject * = 0);
QETArguments(const QList<QString> &, QObject * = 0); QETArguments(const QList<QString> &, QObject * = 0);
@@ -35,7 +34,7 @@ class QETArguments : public QObject {
QETArguments &operator=(const QETArguments &); QETArguments &operator=(const QETArguments &);
virtual ~QETArguments(); virtual ~QETArguments();
// methodes // methods
public: public:
virtual void setArguments(const QList<QString> &); virtual void setArguments(const QList<QString> &);
virtual QList<QString> arguments() const; virtual QList<QString> arguments() const;
@@ -69,7 +68,7 @@ class QETArguments : public QObject {
void handleFileArgument(const QString &); void handleFileArgument(const QString &);
void handleOptionArgument(const QString &); void handleOptionArgument(const QString &);
// attributs // attributes
private: private:
QList<QString> project_files_; QList<QString> project_files_;
QList<QString> element_files_; QList<QString> element_files_;

View File

@@ -32,16 +32,13 @@ class ElementsPanelWidget;
class ElementsLocation; class ElementsLocation;
class RecentFiles; class RecentFiles;
/** /**
Cette classe represente la fenetre principale de QElectroTech et, This class represents the main window of the QElectroTech diagram editor and,
ipso facto, la plus grande partie de l'interface graphique de QElectroTech. ipso facto, the most important part of the QElectroTech user interface.
Il s'agit d'un objet QMainWindow avec un QWorkSpace contenant des objets
"DiagramView" en guise de widget central et un "Panel d'Elements" en
guise de widget "Dock".
*/ */
class QETDiagramEditor : public QETMainWindow { class QETDiagramEditor : public QETMainWindow {
Q_OBJECT Q_OBJECT
// constructeurs, destructeur // constructors, destructor
public: public:
QETDiagramEditor(const QStringList & = QStringList(), QWidget * = 0); QETDiagramEditor(const QStringList & = QStringList(), QWidget * = 0);
virtual ~QETDiagramEditor(); virtual ~QETDiagramEditor();
@@ -49,7 +46,7 @@ class QETDiagramEditor : public QETMainWindow {
private: private:
QETDiagramEditor(const QETDiagramEditor &); QETDiagramEditor(const QETDiagramEditor &);
// methodes // methods
public: public:
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);
QList<ProjectView *> openedProjects() const; QList<ProjectView *> openedProjects() const;
@@ -152,69 +149,69 @@ class QETDiagramEditor : public QETMainWindow {
void showError(const QETResult &); void showError(const QETResult &);
void showError(const QString &); void showError(const QString &);
// attributs // attributes
public: public:
// Actions faisables au travers de menus dans l'application QElectroTech // Actions reachable through menus within QElectroTech
QActionGroup *grp_visu_sel; ///< Groupe d'actions pour les modes (edition et visualisation) QActionGroup *grp_visu_sel; ///< Action group for visualisation vs edition mode
QActionGroup *grp_view_mode; ///< Groupe d'actions pour l'affichage des projets (onglets ou fenetres) QActionGroup *grp_view_mode; ///< Action group for project
QAction *tabbed_view_mode; ///< Passe les projets en mode onglets QAction *tabbed_view_mode; ///< Display projects as tabs
QAction *windowed_view_mode; ///< Passe les projets en mode fenetre QAction *windowed_view_mode; ///< Display projects as windows
QAction *mode_selection; ///< Passe en mode edition QAction *mode_selection; ///< Set edition mode
QAction *mode_visualise; ///< Passe en mode visualisation QAction *mode_visualise; ///< Set visualisation mode
QAction *new_file; ///< Cree un nouveau schema QAction *new_file; ///< Create new project file
QAction *open_file; ///< OUvre un fichier QAction *open_file; ///< Open project file
QAction *close_file; ///< Ferme le fichier QAction *close_file; ///< Close current project file
QAction *save_file; ///< Save current project QAction *save_file; ///< Save current project
QAction *save_file_as; ///< Save current project as a specific file QAction *save_file_as; ///< Save current project as a specific file
QAction *save_cur_diagram; ///< Save current diagram of the current project only QAction *save_cur_diagram; ///< Save current diagram of the current project only
QAction *import_diagram; ///< Importe un schema existant (non implemente) QAction *import_diagram; ///< Importe an existing diagram (not implemented)
QAction *export_diagram; ///< Exporte le schema sous forme d'image QAction *export_diagram; ///< Export diagrams of the current project as imagess
QAction *print; ///< Imprime le schema QAction *print; ///< Print diagrams of the current project
QAction *quit_editor; ///< Quitte l'editeur de schema QAction *quit_editor; ///< Quit the diagram editor
QAction *undo; ///< Annule la derniere action QAction *undo; ///< Cancel the latest action
QAction *redo; ///< Refait une action annulee QAction *redo; ///< Redo the latest cancelled operation
QAction *cut; ///< Coupe la selection dans le presse-papier QAction *cut; ///< Cut selection to clipboard
QAction *copy; ///< Copie la selection dans le presse-papier QAction *copy; ///< Copy selection to clipboard
QAction *paste; ///< Colle le contenu du presse-papier sur le schema QAction *paste; ///< Paste clipboard content on the current diagram
QAction *select_all; ///< Selectionne tout QAction *select_all; ///< Select all
QAction *select_nothing; ///< Deselectionne tout QAction *select_nothing; ///< Cancel selection
QAction *select_invert; ///< Inverse la selection QAction *select_invert; ///< Invest selection
QAction *delete_selection; ///< Supprime la selection QAction *delete_selection; ///< Delete selection
QAction *rotate_selection; ///< Pivote les elements et textes selectionnes de 90 degres QAction *rotate_selection; ///< Rotate selected elements and text items by 90 degrees
QAction *rotate_texts; ///< Pivote les textes selectionnes selon un angle parametrable QAction *rotate_texts; ///< Direct selected text items to a specific angle
QAction *selection_prop; ///< Lance le dialogue de description ou d'edition de la selection QAction *selection_prop; ///< Show a dialog describing the selection
QAction *conductor_reset; ///< Reinitialise les conducteurs selectionnes QAction *conductor_reset; ///< Reset paths of selected conductors
QAction *conductor_default; ///< Lance le dialogue d'edition des conducteurs par defaut QAction *conductor_default; ///< Show a dialog to edit default conductor properties
QAction *infos_diagram; ///< Lance le dialogue d'edition des proprietes du schema QAction *infos_diagram; ///< Show a dialog to edit diagram properties
QAction *add_text; ///< Passe en mode "Ajout de texte" QAction *add_text; ///< Tool to add an independent text item on diagrams
QAction *add_column; ///< Ajoute une colonne au schema QAction *add_column; ///< Increase diagram width by adding an extra column
QAction *remove_column; ///< Enleve une colonne du schema QAction *remove_column; ///< Decrease diagram width by removing the last column
QAction *add_row; ///< Augmente la hauteur du schema QAction *add_row; ///< Increase diagram height by adding an extra row
QAction *remove_row; ///< Reduit la hauteur du schema QAction *remove_row; ///< Decrease diagram height by removing the last row
QAction *prj_edit_prop; ///< Edite les proprietes du projet QAction *prj_edit_prop; ///< Edit the properties of the current project.
QAction *prj_add_diagram; ///< Ajoute un schema au projet QAction *prj_add_diagram; ///< Add a diagram to the current project.
QAction *prj_del_diagram; ///< Supprime un schema du projet QAction *prj_del_diagram; ///< Delete a diagram from the current project
QAction *prj_clean; ///< Nettoie un projet QAction *prj_clean; ///< Clean the content of the curent project by removing useless items
QAction *zoom_in; ///< Zoome avant QAction *zoom_in; ///< Zoom in
QAction *zoom_out; ///< Zoome arriere QAction *zoom_out; ///< Zoom out
QAction *zoom_fit; ///< Adjust zoom to fit the whole diagram, including potential elements outside its borders, in the view QAction *zoom_fit; ///< Adjust zoom to fit the whole diagram, including potential elements outside its borders, in the view
QAction *zoom_content; ///< Adjust zoom to fit all elements in the view, regardless of diagram borders QAction *zoom_content; ///< Adjust zoom to fit all elements in the view, regardless of diagram borders
QAction *zoom_reset; ///< Remet le zoom 1:1 QAction *zoom_reset; ///< Reset zoom to 1:1
QAction *tile_window; ///< Affiche les fenetre MDI en mosaique QAction *tile_window; ///< Show MDI subwindows as tile
QAction *cascade_window; ///< Affiche les fenetres MDI en cascade QAction *cascade_window; ///< Show MDI subwindows as cascade
QAction *prev_window; ///< Affiche la fenetre MDI precedente QAction *prev_window; ///< Switch to the previous document
QAction *next_window; ///< Affiche la fenetre MDI suivante QAction *next_window; ///< Switch to the next document
private: private:
QMdiArea workspace; QMdiArea workspace;
QSignalMapper windowMapper; QSignalMapper windowMapper;
/// Dossier a utiliser pour Fichier > ouvrir /// Directory to use for file dialogs such as File > save
QDir open_dialog_dir; QDir open_dialog_dir;
/// Dock pour le Panel d'Elements /// Dock for the elements panel
QDockWidget *qdw_pa; QDockWidget *qdw_pa;
/// Dock pour la liste des annulations /// Dock for the undo list
QDockWidget *qdw_undo; QDockWidget *qdw_undo;
/// Panel d'Elements /// Elements panel
ElementsPanelWidget *pa; ElementsPanelWidget *pa;
QMenu *windows_menu; QMenu *windows_menu;
QToolBar *main_bar; QToolBar *main_bar;

View File

@@ -19,15 +19,15 @@
#define QET_ICONS_H #define QET_ICONS_H
#include <QIcon> #include <QIcon>
/** /**
Ce namespace est reserve a la declaration des icones de l'application This namespace is meant to delare icons used within the QElectroTech
QElectroTech. application.
*/ */
namespace QET { namespace QET {
namespace Icons { namespace Icons {
void initIcons(); void initIcons();
// l'utilisation du mot-cle extern permet l'acces aux objets statiques // using the extern keyword enables access to static objects from outside the
// depuis l'exterieur du namespace // namespace
extern QIcon Add; extern QIcon Add;
extern QIcon Allowed; extern QIcon Allowed;
extern QIcon ApplicationExit; extern QIcon ApplicationExit;

View File

@@ -20,14 +20,11 @@
#include <QMessageBox> #include <QMessageBox>
namespace QET { namespace QET {
/** /**
Ce namespace definit certaines methodes statiques visant a recreer le This namespace defines static methods behaving in a very similar way to some
comportement de certaines methodes statiques de la classe Qt static methods from the QMessageBox Qt class. The behavior is expected to be
QMessageBox. the same under X11 and Windows. However, under MacOS, when a parent widget is
Le comportement est sense etre le meme sur les plateformes X11 et provided, these methodes ensure the dialog box is "window modal" and has the
Windows. En revanche, sous MacOS, si un widget parent est fourni, ces Qt:Sheet flag, thus enabling a better MacOS integration.
methodes s'assurent que la boite de dialogue sera "window modal" mais
aussi qu'elle sera dotee du flag "Qt:Sheet", qui permet une meilleure
integration sous MacOS.
*/ */
namespace MessageBox { namespace MessageBox {
QMessageBox::StandardButton critical (QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton); QMessageBox::StandardButton critical (QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton);

Some files were not shown because too many files have changed in this diff Show More