mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Mise a jour de la documentation (sauf dossier editor/)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@167 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
8e244b17ef
commit
08b01bccb0
@ -24,7 +24,6 @@ BorderInset::BorderInset(QObject *parent) : QObject(parent) {
|
|||||||
Destructeur - ne fait rien
|
Destructeur - ne fait rien
|
||||||
*/
|
*/
|
||||||
BorderInset::~BorderInset() {
|
BorderInset::~BorderInset() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,7 +155,7 @@ void BorderInset::setNbColumns(int nb_c) {
|
|||||||
200px.
|
200px.
|
||||||
*/
|
*/
|
||||||
void BorderInset::setColumnsWidth(const qreal &new_cw) {
|
void BorderInset::setColumnsWidth(const qreal &new_cw) {
|
||||||
columns_width = qMax(10.0, qMin(200.0, new_cw));
|
columns_width = qBound(10.0, new_cw, 200.0);
|
||||||
updateRectangles();
|
updateRectangles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +164,7 @@ void BorderInset::setColumnsWidth(const qreal &new_cw) {
|
|||||||
doit rester comprise entre 5 et 50 px.
|
doit rester comprise entre 5 et 50 px.
|
||||||
*/
|
*/
|
||||||
void BorderInset::setColumnsHeaderHeight(const qreal &new_chh) {
|
void BorderInset::setColumnsHeaderHeight(const qreal &new_chh) {
|
||||||
columns_header_height = qMax(5.0, qMin(50.0, new_chh));
|
columns_header_height = qBound(5.0, new_chh, 50.0);
|
||||||
updateRectangles();
|
updateRectangles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ class Conductor : public QGraphicsPathItem {
|
|||||||
public:
|
public:
|
||||||
enum { Type = UserType + 1001 };
|
enum { Type = UserType + 1001 };
|
||||||
|
|
||||||
///Premiere borne a laquelle le fil est rattache
|
/// premiere borne a laquelle le fil est rattache
|
||||||
Terminal *terminal1;
|
Terminal *terminal1;
|
||||||
///Deuxieme borne a laquelle le fil est rattache
|
/// deuxieme borne a laquelle le fil est rattache
|
||||||
Terminal *terminal2;
|
Terminal *terminal2;
|
||||||
/// caracteristiques des conducteurs unifilaires
|
/// caracteristiques des conducteurs unifilaires
|
||||||
SingleLineProperties singleLineProperties;
|
SingleLineProperties singleLineProperties;
|
||||||
@ -87,9 +87,9 @@ class Conductor : public QGraphicsPathItem {
|
|||||||
bool is_single_line;
|
bool is_single_line;
|
||||||
/// champ de texte editable pour les conducteurs non unifilaires
|
/// champ de texte editable pour les conducteurs non unifilaires
|
||||||
DiagramTextItem *text_item;
|
DiagramTextItem *text_item;
|
||||||
/// Segments composant le conducteur
|
/// segments composant le conducteur
|
||||||
ConductorSegment *segments;
|
ConductorSegment *segments;
|
||||||
/// Attributs lies aux manipulations a la souris
|
/// attributs lies aux manipulations a la souris
|
||||||
QPointF press_point;
|
QPointF press_point;
|
||||||
bool moving_point;
|
bool moving_point;
|
||||||
bool moving_segment;
|
bool moving_segment;
|
||||||
|
@ -111,6 +111,9 @@ QList<ConductorSegmentProfile *> ConductorProfile::verticalSegments() {
|
|||||||
return(segments_list);
|
return(segments_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reconstruit le profil a partir d'un conducteur existant
|
||||||
|
*/
|
||||||
void ConductorProfile::fromConductor(Conductor *conductor) {
|
void ConductorProfile::fromConductor(Conductor *conductor) {
|
||||||
// supprime les segments precedents
|
// supprime les segments precedents
|
||||||
setNull();
|
setNull();
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
#include "conductorproperties.h"
|
#include "conductorproperties.h"
|
||||||
#include "conductor.h"
|
#include "conductor.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Constructeur
|
||||||
|
@param parent QWidget parent
|
||||||
|
*/
|
||||||
ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) :
|
ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
buildInterface();
|
buildInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// construit l'interface du widget
|
||||||
void ConductorPropertiesWidget::buildInterface() {
|
void ConductorPropertiesWidget::buildInterface() {
|
||||||
|
|
||||||
setFixedSize(380, 245);
|
setFixedSize(380, 245);
|
||||||
@ -64,6 +69,7 @@ void ConductorPropertiesWidget::buildInterface() {
|
|||||||
setSingleLine(false);
|
setSingleLine(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Met en place les connexions signaux/slots
|
||||||
void ConductorPropertiesWidget::buildConnections() {
|
void ConductorPropertiesWidget::buildConnections() {
|
||||||
connect(phase_slider, SIGNAL(valueChanged(int)), phase_spinbox, SLOT(setValue(int)));
|
connect(phase_slider, SIGNAL(valueChanged(int)), phase_spinbox, SLOT(setValue(int)));
|
||||||
connect(phase_spinbox, SIGNAL(valueChanged(int)), phase_slider, SLOT(setValue(int)));
|
connect(phase_spinbox, SIGNAL(valueChanged(int)), phase_slider, SLOT(setValue(int)));
|
||||||
@ -75,6 +81,7 @@ void ConductorPropertiesWidget::buildConnections() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Enleve les connexions signaux/slots
|
||||||
void ConductorPropertiesWidget::destroyConnections() {
|
void ConductorPropertiesWidget::destroyConnections() {
|
||||||
disconnect(phase_slider, SIGNAL(valueChanged(int)), phase_spinbox, SLOT(setValue(int)));
|
disconnect(phase_slider, SIGNAL(valueChanged(int)), phase_spinbox, SLOT(setValue(int)));
|
||||||
disconnect(phase_spinbox, SIGNAL(valueChanged(int)), phase_slider, SLOT(setValue(int)));
|
disconnect(phase_spinbox, SIGNAL(valueChanged(int)), phase_slider, SLOT(setValue(int)));
|
||||||
@ -85,10 +92,11 @@ void ConductorPropertiesWidget::destroyConnections() {
|
|||||||
disconnect(singleline, SIGNAL(toggled(bool)), this, SLOT(setSingleLine(bool)));
|
disconnect(singleline, SIGNAL(toggled(bool)), this, SLOT(setSingleLine(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Destructeur
|
||||||
ConductorPropertiesWidget::~ConductorPropertiesWidget() {
|
ConductorPropertiesWidget::~ConductorPropertiesWidget() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Met a jour les proprietes unifilaires
|
||||||
void ConductorPropertiesWidget::updateSingleLineConfig() {
|
void ConductorPropertiesWidget::updateSingleLineConfig() {
|
||||||
slp.hasGround = ground_checkbox -> isChecked();
|
slp.hasGround = ground_checkbox -> isChecked();
|
||||||
slp.hasNeutral = neutral_checkbox -> isChecked();
|
slp.hasNeutral = neutral_checkbox -> isChecked();
|
||||||
@ -96,6 +104,7 @@ void ConductorPropertiesWidget::updateSingleLineConfig() {
|
|||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Met a jour l'affichage des proprietes unifilaires
|
||||||
void ConductorPropertiesWidget::updateSingleLineDisplay() {
|
void ConductorPropertiesWidget::updateSingleLineDisplay() {
|
||||||
destroyConnections();
|
destroyConnections();
|
||||||
ground_checkbox -> setChecked(slp.hasGround);
|
ground_checkbox -> setChecked(slp.hasGround);
|
||||||
@ -107,6 +116,7 @@ void ConductorPropertiesWidget::updateSingleLineDisplay() {
|
|||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Met a jour la previsualisation des attributs unifilaires
|
||||||
void ConductorPropertiesWidget::updatePreview() {
|
void ConductorPropertiesWidget::updatePreview() {
|
||||||
const QRect pixmap_rect(0, 0, 96, 96);
|
const QRect pixmap_rect(0, 0, 96, 96);
|
||||||
QPixmap pixmap(pixmap_rect.width(), pixmap_rect.height());
|
QPixmap pixmap(pixmap_rect.width(), pixmap_rect.height());
|
||||||
@ -120,10 +130,15 @@ void ConductorPropertiesWidget::updatePreview() {
|
|||||||
preview -> setPixmap(pixmap);
|
preview -> setPixmap(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @return true si le widget est en mode unifilaire, false sinon
|
||||||
bool ConductorPropertiesWidget::isSingleLine() const {
|
bool ConductorPropertiesWidget::isSingleLine() const {
|
||||||
return(singleline -> isChecked());
|
return(singleline -> isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Passe le widget en mode unifilaire ou multifilaire
|
||||||
|
@param sl true pour passer le widget en mode "unifilaire", false sinon
|
||||||
|
*/
|
||||||
void ConductorPropertiesWidget::setSingleLine(bool sl) {
|
void ConductorPropertiesWidget::setSingleLine(bool sl) {
|
||||||
singleline -> setChecked(sl);
|
singleline -> setChecked(sl);
|
||||||
multiline -> setChecked(!sl);
|
multiline -> setChecked(!sl);
|
||||||
|
@ -29,7 +29,6 @@ ConductorSegment::~ConductorSegment() {
|
|||||||
if (hasNextSegment()) nextSegment() -> setPreviousSegment(previousSegment());
|
if (hasNextSegment()) nextSegment() -> setPreviousSegment(previousSegment());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Permet de savoir s'il est possible de deplacer le premier point du segment
|
Permet de savoir s'il est possible de deplacer le premier point du segment
|
||||||
sans creer d'incoherence. La valeur du mouvement maximum qu'il est possible de faire
|
sans creer d'incoherence. La valeur du mouvement maximum qu'il est possible de faire
|
||||||
@ -494,6 +493,7 @@ qreal ConductorSegment::length() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @return QET::Horizontal si le segment est horizontal, QET::Vertical sinon
|
||||||
QET::ConductorSegmentType ConductorSegment::type() const {
|
QET::ConductorSegmentType ConductorSegment::type() const {
|
||||||
return(isHorizontal() ? QET::Horizontal : QET::Vertical);
|
return(isHorizontal() ? QET::Horizontal : QET::Vertical);
|
||||||
}
|
}
|
||||||
|
@ -155,10 +155,12 @@ CustomElement::CustomElement(QString &nom_fichier, QGraphicsItem *qgi, Diagram *
|
|||||||
CustomElement::~CustomElement() {
|
CustomElement::~CustomElement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @return la liste des bornes de cet element
|
||||||
QList<Terminal *> CustomElement::terminals() const {
|
QList<Terminal *> CustomElement::terminals() const {
|
||||||
return(list_terminals);
|
return(list_terminals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @return la liste des conducteurs rattaches a cet element
|
||||||
QList<Conductor *> CustomElement::conductors() const {
|
QList<Conductor *> CustomElement::conductors() const {
|
||||||
QList<Conductor *> conductors;
|
QList<Conductor *> conductors;
|
||||||
foreach(Terminal *t, list_terminals) conductors << t -> conductors();
|
foreach(Terminal *t, list_terminals) conductors << t -> conductors();
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include "nameslist.h"
|
#include "nameslist.h"
|
||||||
class CustomElementPart;
|
class CustomElementPart;
|
||||||
// #include "customelementpart.h"
|
|
||||||
// #include "cep_line.h"
|
|
||||||
/**
|
/**
|
||||||
Cette classe represente un element electrique. Elle est utilisable
|
Cette classe represente un element electrique. Elle est utilisable
|
||||||
comme un element fixe. La difference est que l'element perso lit
|
comme un element fixe. La difference est que l'element perso lit
|
||||||
|
15
diagram.cpp
15
diagram.cpp
@ -74,7 +74,7 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gere le clavier
|
Gere les enfoncements de touches du clavier
|
||||||
@param e QKeyEvent decrivant l'evenement clavier
|
@param e QKeyEvent decrivant l'evenement clavier
|
||||||
*/
|
*/
|
||||||
void Diagram::keyPressEvent(QKeyEvent *e) {
|
void Diagram::keyPressEvent(QKeyEvent *e) {
|
||||||
@ -100,6 +100,10 @@ void Diagram::keyPressEvent(QKeyEvent *e) {
|
|||||||
QGraphicsScene::keyPressEvent(e);
|
QGraphicsScene::keyPressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gere les relachements de touches du clavier
|
||||||
|
@param e QKeyEvent decrivant l'evenement clavier
|
||||||
|
*/
|
||||||
void Diagram::keyReleaseEvent(QKeyEvent *e) {
|
void Diagram::keyReleaseEvent(QKeyEvent *e) {
|
||||||
// detecte le relachement d'une touche de direction ( = deplacement d'elements)
|
// detecte le relachement d'une touche de direction ( = deplacement d'elements)
|
||||||
if (
|
if (
|
||||||
@ -107,7 +111,7 @@ void Diagram::keyReleaseEvent(QKeyEvent *e) {
|
|||||||
e -> key() == Qt::Key_Up || e -> key() == Qt::Key_Down) &&\
|
e -> key() == Qt::Key_Up || e -> key() == Qt::Key_Down) &&\
|
||||||
!current_movement.isNull() && !e -> isAutoRepeat()
|
!current_movement.isNull() && !e -> isAutoRepeat()
|
||||||
) {
|
) {
|
||||||
// cree un object d'annulation pour le mouvement qui vient de se finir
|
// cree un objet d'annulation pour le mouvement qui vient de se finir
|
||||||
undoStack().push(
|
undoStack().push(
|
||||||
new MoveElementsCommand(
|
new MoveElementsCommand(
|
||||||
this,
|
this,
|
||||||
@ -492,6 +496,10 @@ void Diagram::fetchMovedElements() {
|
|||||||
moved_elements_fetched = true;
|
moved_elements_fetched = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Definit s'il faut afficher ou non les bornes
|
||||||
|
@param dt true pour afficher les bornes, false sinon
|
||||||
|
*/
|
||||||
void Diagram::setDrawTerminals(bool dt) {
|
void Diagram::setDrawTerminals(bool dt) {
|
||||||
foreach(QGraphicsItem *qgi, items()) {
|
foreach(QGraphicsItem *qgi, items()) {
|
||||||
if (Terminal *t = qgraphicsitem_cast<Terminal *>(qgi)) {
|
if (Terminal *t = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||||
@ -500,6 +508,9 @@ void Diagram::setDrawTerminals(bool dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return la liste des conducteurs selectionnes sur le schema
|
||||||
|
*/
|
||||||
QSet<Conductor *> Diagram::selectedConductors() const {
|
QSet<Conductor *> Diagram::selectedConductors() const {
|
||||||
QSet<Conductor *> conductors_set;
|
QSet<Conductor *> conductors_set;
|
||||||
foreach(QGraphicsItem *qgi, selectedItems()) {
|
foreach(QGraphicsItem *qgi, selectedItems()) {
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
class Element;
|
class Element;
|
||||||
class Terminal;
|
class Terminal;
|
||||||
class Conductor;
|
class Conductor;
|
||||||
|
/**
|
||||||
|
Cette classe represente un schema electrique.
|
||||||
|
Elle gere les differents elements et conducteurs qui le composent
|
||||||
|
et en effectue le rendu graphique.
|
||||||
|
*/
|
||||||
class Diagram : public QGraphicsScene {
|
class Diagram : public QGraphicsScene {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -202,6 +207,7 @@ inline QGIManager &Diagram::qgiManager() {
|
|||||||
return(qgi_manager);
|
return(qgi_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @return true si les bornes sont affichees, false sinon
|
||||||
inline bool Diagram::drawTerminals() const {
|
inline bool Diagram::drawTerminals() const {
|
||||||
return(draw_terminals);
|
return(draw_terminals);
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,7 @@ void AddElementCommand::redo() {
|
|||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param d Schema auquel on ajoute un conducteur
|
@param d Schema auquel on ajoute un conducteur
|
||||||
@param t1 Premiere borne du conducteur
|
@param c Conducteur ajoute
|
||||||
@param t2 Seconde borne du conducteur
|
|
||||||
@param parent QUndoCommand parent
|
@param parent QUndoCommand parent
|
||||||
*/
|
*/
|
||||||
AddConductorCommand::AddConductorCommand(
|
AddConductorCommand::AddConductorCommand(
|
||||||
@ -199,9 +198,9 @@ void PasteDiagramCommand::redo() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param dia Schema dont on supprime des elements et conducteurs
|
@param dia Schema dont on coupe des elements et conducteurs
|
||||||
@param elements Elements supprimes
|
@param elements Elements coupes
|
||||||
@param conductors Conducteurs supprimes
|
@param conductors Conducteurs coupes
|
||||||
@param parent QUndoCommand parent
|
@param parent QUndoCommand parent
|
||||||
*/
|
*/
|
||||||
CutDiagramCommand::CutDiagramCommand(
|
CutDiagramCommand::CutDiagramCommand(
|
||||||
@ -390,8 +389,7 @@ void ChangeConductorCommand::redo() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param c Conducteurs reinitialises
|
@param cp Conducteurs reinitialises, associes a leur ancien profil
|
||||||
@param p Anciens profils des conducteurs
|
|
||||||
@param parent QUndoCommand parent
|
@param parent QUndoCommand parent
|
||||||
*/
|
*/
|
||||||
ResetConductorCommand::ResetConductorCommand(
|
ResetConductorCommand::ResetConductorCommand(
|
||||||
@ -425,8 +423,8 @@ void ResetConductorCommand::redo() {
|
|||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param d Schema dont on modifie le cartouche
|
@param d Schema dont on modifie le cartouche
|
||||||
@param old_ip Anciennes proprietes du cartouches
|
@param old_ip Anciennes proprietes du cartouche
|
||||||
@param new_ip Nouvelles proprietes du cartouches
|
@param new_ip Nouvelles proprietes du cartouche
|
||||||
@param parent QUndoCommand parent
|
@param parent QUndoCommand parent
|
||||||
*/
|
*/
|
||||||
ChangeInsetCommand::ChangeInsetCommand(
|
ChangeInsetCommand::ChangeInsetCommand(
|
||||||
@ -499,14 +497,21 @@ void ChangeBorderCommand::applyChanges(int coeff) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Annule les changements apportes au schema
|
||||||
void ChangeBorderCommand::undo() {
|
void ChangeBorderCommand::undo() {
|
||||||
applyChanges(-1);
|
applyChanges(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Refait les changements apportes au schema
|
||||||
void ChangeBorderCommand::redo() {
|
void ChangeBorderCommand::redo() {
|
||||||
applyChanges(1);
|
applyChanges(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Constructeur
|
||||||
|
@param c Le conducteur dont on modifie les proprietes
|
||||||
|
@param parent QUndoCommand parent
|
||||||
|
*/
|
||||||
ChangeConductorPropertiesCommand::ChangeConductorPropertiesCommand(Conductor *c, QUndoCommand *parent) :
|
ChangeConductorPropertiesCommand::ChangeConductorPropertiesCommand(Conductor *c, QUndoCommand *parent) :
|
||||||
QUndoCommand(QObject::tr("modifier les propri\351t\351s d'un conducteur"), parent),
|
QUndoCommand(QObject::tr("modifier les propri\351t\351s d'un conducteur"), parent),
|
||||||
conductor(c),
|
conductor(c),
|
||||||
@ -515,9 +520,11 @@ ChangeConductorPropertiesCommand::ChangeConductorPropertiesCommand(Conductor *c,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Destructeur
|
||||||
ChangeConductorPropertiesCommand::~ChangeConductorPropertiesCommand() {
|
ChangeConductorPropertiesCommand::~ChangeConductorPropertiesCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// definit l'ancienne configuration
|
||||||
void ChangeConductorPropertiesCommand::setOldSettings(bool single, const QString &text, const SingleLineProperties &slp) {
|
void ChangeConductorPropertiesCommand::setOldSettings(bool single, const QString &text, const SingleLineProperties &slp) {
|
||||||
old_is_single_line = single;
|
old_is_single_line = single;
|
||||||
old_conductor_text = text;
|
old_conductor_text = text;
|
||||||
@ -525,6 +532,7 @@ void ChangeConductorPropertiesCommand::setOldSettings(bool single, const QString
|
|||||||
old_settings_set = true;
|
old_settings_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// definit la nouvelle configuration
|
||||||
void ChangeConductorPropertiesCommand::setNewSettings(bool single, const QString &text, const SingleLineProperties &slp) {
|
void ChangeConductorPropertiesCommand::setNewSettings(bool single, const QString &text, const SingleLineProperties &slp) {
|
||||||
new_is_single_line = single;
|
new_is_single_line = single;
|
||||||
new_conductor_text = text;
|
new_conductor_text = text;
|
||||||
@ -532,6 +540,10 @@ void ChangeConductorPropertiesCommand::setNewSettings(bool single, const QString
|
|||||||
new_settings_set = true;
|
new_settings_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Annule les changements - Attention : les anciens et nouveaux parametres
|
||||||
|
doivent avoir ete definis a l'aide de setNewSettings et setOldSettings
|
||||||
|
*/
|
||||||
void ChangeConductorPropertiesCommand::undo() {
|
void ChangeConductorPropertiesCommand::undo() {
|
||||||
if (old_settings_set && new_settings_set) {
|
if (old_settings_set && new_settings_set) {
|
||||||
conductor -> setSingleLine(old_is_single_line);
|
conductor -> setSingleLine(old_is_single_line);
|
||||||
@ -541,6 +553,10 @@ void ChangeConductorPropertiesCommand::undo() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Refait les changements - Attention : les anciens et nouveaux parametres
|
||||||
|
doivent avoir ete definis a l'aide de setNewSettings et setOldSettings
|
||||||
|
*/
|
||||||
void ChangeConductorPropertiesCommand::redo() {
|
void ChangeConductorPropertiesCommand::redo() {
|
||||||
if (old_settings_set && new_settings_set) {
|
if (old_settings_set && new_settings_set) {
|
||||||
conductor -> setSingleLine(new_is_single_line);
|
conductor -> setSingleLine(new_is_single_line);
|
||||||
|
@ -23,7 +23,7 @@ class AddElementCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Element ajoute
|
/// element ajoute
|
||||||
Element *element;
|
Element *element;
|
||||||
/// schema sur lequel on ajoute l'element
|
/// schema sur lequel on ajoute l'element
|
||||||
Diagram *diagram;
|
Diagram *diagram;
|
||||||
@ -49,7 +49,7 @@ class AddConductorCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Conducteur ajoute
|
/// conducteur ajoute
|
||||||
Conductor *conductor;
|
Conductor *conductor;
|
||||||
/// schema auquel on ajoute le conducteur
|
/// schema auquel on ajoute le conducteur
|
||||||
Diagram *diagram;
|
Diagram *diagram;
|
||||||
@ -74,9 +74,9 @@ class DeleteElementsCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Liste des elements enleves
|
/// liste des elements enleves
|
||||||
QSet<Element *> removed_elements;
|
QSet<Element *> removed_elements;
|
||||||
/// List des conducteurs enleves
|
/// liste des conducteurs enleves
|
||||||
QSet<Conductor *> removed_conductors;
|
QSet<Conductor *> removed_conductors;
|
||||||
/// schema dont on supprime des elements et conducteurs
|
/// schema dont on supprime des elements et conducteurs
|
||||||
Diagram *diagram;
|
Diagram *diagram;
|
||||||
@ -100,7 +100,7 @@ class PasteDiagramCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Elements ajoutes
|
/// elements ajoutes
|
||||||
QList<Element *> elements;
|
QList<Element *> elements;
|
||||||
/// conducteurs ajoutes
|
/// conducteurs ajoutes
|
||||||
QList<Conductor *> conductors;
|
QList<Conductor *> conductors;
|
||||||
@ -143,13 +143,13 @@ class MoveElementsCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Schema sur lequel on deplace les elements
|
/// schema sur lequel on deplace les elements
|
||||||
Diagram *diagram;
|
Diagram *diagram;
|
||||||
/// Elements a deplacer
|
/// elements a deplacer
|
||||||
QSet<Element *> elements_to_move;
|
QSet<Element *> elements_to_move;
|
||||||
/// Conducteurs a deplacer
|
/// conducteurs a deplacer
|
||||||
QSet<Conductor *> conductors_to_move;
|
QSet<Conductor *> conductors_to_move;
|
||||||
/// Conducteurs a actualiser
|
/// conducteurs a actualiser
|
||||||
QHash<Conductor *, Terminal *> conductors_to_update;
|
QHash<Conductor *, Terminal *> conductors_to_update;
|
||||||
/// mouvement effectue
|
/// mouvement effectue
|
||||||
QPointF movement;
|
QPointF movement;
|
||||||
@ -203,7 +203,7 @@ class RotateElementsCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// texte avant changement
|
/// elements pivotes associes a leur ancienne orientation
|
||||||
QHash<Element *, QET::Orientation> elements_to_rotate;
|
QHash<Element *, QET::Orientation> elements_to_rotate;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ class ChangeConductorCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Conducteur modifie
|
/// conducteur modifie
|
||||||
Conductor *conductor;
|
Conductor *conductor;
|
||||||
/// profil avant changement
|
/// profil avant changement
|
||||||
ConductorProfile old_profile;
|
ConductorProfile old_profile;
|
||||||
@ -253,7 +253,7 @@ class ResetConductorCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Conducteurs reinitialises et leurs anciens profils
|
/// conducteurs reinitialises associes a leur ancien profil
|
||||||
QHash<Conductor *, ConductorProfile> conductors_profiles;
|
QHash<Conductor *, ConductorProfile> conductors_profiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ class ChangeInsetCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Schema modifie
|
/// schema modifie
|
||||||
Diagram *diagram;
|
Diagram *diagram;
|
||||||
/// proprietes avant changement
|
/// proprietes avant changement
|
||||||
InsetProperties old_inset;
|
InsetProperties old_inset;
|
||||||
@ -307,16 +307,16 @@ class ChangeBorderCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Diagram modifie
|
/// schema modifie
|
||||||
Diagram *diagram;
|
Diagram *diagram;
|
||||||
public:
|
public:
|
||||||
/// Nombre de colonnes ajoutees / enlevees
|
/// nombre de colonnes ajoutees / enlevees
|
||||||
int columnsCountDifference;
|
int columnsCountDifference;
|
||||||
/// Delta pour la hauteur des colonnes
|
/// delta pour la hauteur des colonnes
|
||||||
qreal columnsHeightDifference;
|
qreal columnsHeightDifference;
|
||||||
/// Delta pour la largeur des colonnes
|
/// delta pour la largeur des colonnes
|
||||||
qreal columnsWidthDifference;
|
qreal columnsWidthDifference;
|
||||||
/// Delta pour la hauteur des entetes des colonnes
|
/// delta pour la hauteur des entetes des colonnes
|
||||||
qreal headersHeightDifference;
|
qreal headersHeightDifference;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ class ChangeConductorPropertiesCommand : public QUndoCommand {
|
|||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// Conducteur modifie
|
/// conducteur modifie
|
||||||
Conductor *conductor;
|
Conductor *conductor;
|
||||||
/// anciennes proprietes
|
/// anciennes proprietes
|
||||||
bool old_is_single_line;
|
bool old_is_single_line;
|
||||||
@ -350,6 +350,7 @@ class ChangeConductorPropertiesCommand : public QUndoCommand {
|
|||||||
bool new_is_single_line;
|
bool new_is_single_line;
|
||||||
QString new_conductor_text;
|
QString new_conductor_text;
|
||||||
SingleLineProperties new_slp;
|
SingleLineProperties new_slp;
|
||||||
|
/// booleens indiquant si les proprietes ont ete definies ou non
|
||||||
bool old_settings_set;
|
bool old_settings_set;
|
||||||
bool new_settings_set;
|
bool new_settings_set;
|
||||||
};
|
};
|
||||||
|
@ -48,6 +48,10 @@ void DiagramTextItem::focusOutEvent(QFocusEvent *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gere le relachement des touches du clavier.
|
||||||
|
Cette methode a ete reimplementee pour gerer la touche Suppr/Del
|
||||||
|
*/
|
||||||
void DiagramTextItem::keyReleaseEvent(QKeyEvent *e) {
|
void DiagramTextItem::keyReleaseEvent(QKeyEvent *e) {
|
||||||
if (e -> key() == Qt::Key_Delete) {
|
if (e -> key() == Qt::Key_Delete) {
|
||||||
QTextCursor text_cursor = textCursor();
|
QTextCursor text_cursor = textCursor();
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
#define DIAGRAM_TEXT_ITEM_H
|
#define DIAGRAM_TEXT_ITEM_H
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
|
/**
|
||||||
|
Cette classe represente un champ de texte editable sur le schema.
|
||||||
|
*/
|
||||||
class DiagramTextItem : public QGraphicsTextItem {
|
class DiagramTextItem : public QGraphicsTextItem {
|
||||||
// constructeurs, destructeur
|
// constructeurs, destructeur
|
||||||
public:
|
public:
|
||||||
|
@ -98,13 +98,13 @@ void DiagramView::deleteSelection() {
|
|||||||
Pivote les composants selectionnes
|
Pivote les composants selectionnes
|
||||||
*/
|
*/
|
||||||
void DiagramView::rotateSelection() {
|
void DiagramView::rotateSelection() {
|
||||||
if (scene -> selectedItems().isEmpty()) return;
|
|
||||||
QHash<Element *, QET::Orientation> elements_to_rotate;
|
QHash<Element *, QET::Orientation> elements_to_rotate;
|
||||||
foreach (QGraphicsItem *item, scene -> selectedItems()) {
|
foreach (QGraphicsItem *item, scene -> selectedItems()) {
|
||||||
if (Element *e = qgraphicsitem_cast<Element *>(item)) {
|
if (Element *e = qgraphicsitem_cast<Element *>(item)) {
|
||||||
elements_to_rotate.insert(e, e -> orientation().current());
|
elements_to_rotate.insert(e, e -> orientation().current());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (elements_to_rotate.isEmpty()) return;
|
||||||
scene -> undoStack().push(new RotateElementsCommand(elements_to_rotate));
|
scene -> undoStack().push(new RotateElementsCommand(elements_to_rotate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,6 +605,9 @@ void DiagramView::adjustSceneRect() {
|
|||||||
scene -> update(old_scene_rect.united(new_scene_rect));
|
scene -> update(old_scene_rect.united(new_scene_rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Met a jour le titre du widget
|
||||||
|
*/
|
||||||
void DiagramView::updateWindowTitle() {
|
void DiagramView::updateWindowTitle() {
|
||||||
QString window_title;
|
QString window_title;
|
||||||
if (file_name.isNull()) window_title += tr("nouveau sch\351ma");
|
if (file_name.isNull()) window_title += tr("nouveau sch\351ma");
|
||||||
@ -614,11 +617,17 @@ void DiagramView::updateWindowTitle() {
|
|||||||
setWindowModified(!(scene -> undoStack().isClean()));
|
setWindowModified(!(scene -> undoStack().isClean()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Active ou desactive le dessin de grille selon la quantite de pixels affichee
|
||||||
|
*/
|
||||||
void DiagramView::adjustGridToZoom() {
|
void DiagramView::adjustGridToZoom() {
|
||||||
QRectF viewed_scene = viewedSceneRect();
|
QRectF viewed_scene = viewedSceneRect();
|
||||||
scene -> setDisplayGrid(viewed_scene.width() < 2000 || viewed_scene.height() < 2000);
|
scene -> setDisplayGrid(viewed_scene.width() < 2000 || viewed_scene.height() < 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return le rectangle du schema (classe Diagram) visualise par ce DiagramView
|
||||||
|
*/
|
||||||
QRectF DiagramView::viewedSceneRect() const {
|
QRectF DiagramView::viewedSceneRect() const {
|
||||||
// recupere la taille du widget viewport
|
// recupere la taille du widget viewport
|
||||||
QSize viewport_size = viewport() -> size();
|
QSize viewport_size = viewport() -> size();
|
||||||
@ -634,6 +643,10 @@ QRectF DiagramView::viewedSceneRect() const {
|
|||||||
return(QRectF(scene_left_top, scene_right_bottom));
|
return(QRectF(scene_left_top, scene_right_bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Affiche un dialogue permettant d'editer le conducteur selectionne.
|
||||||
|
Ne fait rien s'il y a 0 ou plusieurs conducteurs selectionnes.
|
||||||
|
*/
|
||||||
void DiagramView::editConductor() {
|
void DiagramView::editConductor() {
|
||||||
QList<Conductor *> selected_conductors(scene -> selectedConductors().toList());
|
QList<Conductor *> selected_conductors(scene -> selectedConductors().toList());
|
||||||
|
|
||||||
|
11
element.cpp
11
element.cpp
@ -234,6 +234,12 @@ void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
|||||||
} else e -> ignore();
|
} else e -> ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Deplace les autres elements selectionnes en gerant au mieux les conducteurs
|
||||||
|
(seuls les conducteurs dont un seul des elements est deplace sont
|
||||||
|
recalcules, les autres sont deplaces).
|
||||||
|
@param diff Translation a effectuer
|
||||||
|
*/
|
||||||
void Element::moveOtherElements(const QPointF &diff) {
|
void Element::moveOtherElements(const QPointF &diff) {
|
||||||
// inutile de deplacer les autres elements s'il n'y a pas eu de mouvement concret
|
// inutile de deplacer les autres elements s'il n'y a pas eu de mouvement concret
|
||||||
if (diff.isNull()) return;
|
if (diff.isNull()) return;
|
||||||
@ -262,6 +268,11 @@ void Element::moveOtherElements(const QPointF &diff) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gere le relachement de souris
|
||||||
|
Cette methode a ete reimplementee pour tenir a jour la liste des elements
|
||||||
|
et conducteurs a deplacer au niveau du schema.
|
||||||
|
*/
|
||||||
void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||||
Diagram *diagram_ptr = diagram();
|
Diagram *diagram_ptr = diagram();
|
||||||
if (diagram_ptr) {
|
if (diagram_ptr) {
|
||||||
|
@ -1,14 +1,24 @@
|
|||||||
#include "elementdeleter.h"
|
#include "elementdeleter.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Constructeur
|
||||||
|
@param elmt_path Chemin du fichier representant l'element a supprimer
|
||||||
|
@param parent QWidget parent
|
||||||
|
*/
|
||||||
ElementDeleter::ElementDeleter(const QString &elmt_path, QWidget *parent) :
|
ElementDeleter::ElementDeleter(const QString &elmt_path, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
element_path(elmt_path)
|
element_path(elmt_path)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Destructeur
|
||||||
ElementDeleter::~ElementDeleter() {
|
ElementDeleter::~ElementDeleter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Supprime l'element : verifie l'existence du fichier, demande confirmation a
|
||||||
|
l'utilisateur et avertit ce dernier si la suppression a echoue.
|
||||||
|
*/
|
||||||
void ElementDeleter::exec() {
|
void ElementDeleter::exec() {
|
||||||
// verifie l'existence de l'element
|
// verifie l'existence de l'element
|
||||||
QFile elmt_file(element_path);
|
QFile elmt_file(element_path);
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
#define ELEMENT_DELETER_H
|
#define ELEMENT_DELETER_H
|
||||||
#include "elementscategory.h"
|
#include "elementscategory.h"
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
/**
|
||||||
|
Cette classe represente une couche d'abstraction pour supprimer
|
||||||
|
un element de la collection d'elements.
|
||||||
|
Elle demande notamment confirmation a l'utilisateur
|
||||||
|
*/
|
||||||
class ElementDeleter : public QWidget {
|
class ElementDeleter : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
// constructeurs, destructeur
|
// constructeurs, destructeur
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#include "elementscategorydeleter.h"
|
#include "elementscategorydeleter.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Constructeur
|
||||||
|
@param category_path Chemin du dossier representant la categorie a supprimer
|
||||||
|
@param parent QWidget parent
|
||||||
|
*/
|
||||||
ElementsCategoryDeleter::ElementsCategoryDeleter(const QString &category_path, QWidget *parent) :
|
ElementsCategoryDeleter::ElementsCategoryDeleter(const QString &category_path, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
cat(category_path),
|
cat(category_path),
|
||||||
@ -7,9 +12,15 @@ ElementsCategoryDeleter::ElementsCategoryDeleter(const QString &category_path, Q
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Destructeur
|
||||||
ElementsCategoryDeleter::~ElementsCategoryDeleter() {
|
ElementsCategoryDeleter::~ElementsCategoryDeleter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Supprime la categorie et ses elements : verifie l'existence du dossier,
|
||||||
|
demande deux fois confirmation a l'utilisateur et avertit ce dernier si la
|
||||||
|
suppression a echoue.
|
||||||
|
*/
|
||||||
void ElementsCategoryDeleter::exec() {
|
void ElementsCategoryDeleter::exec() {
|
||||||
// verifie l'existence de la categorie
|
// verifie l'existence de la categorie
|
||||||
if (!cat.exists() || empty_category_path) return;
|
if (!cat.exists() || empty_category_path) return;
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
#define ELEMENTS_CATEGORY_DELETER_H
|
#define ELEMENTS_CATEGORY_DELETER_H
|
||||||
#include "elementscategory.h"
|
#include "elementscategory.h"
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
/**
|
||||||
|
Cette ckasse represente une couche d'abstraction pour supprimer
|
||||||
|
une categorie d'elements et les elements qu'elle contient.
|
||||||
|
Elle demande notamment confirmation a l'utilisateur par deux fois.
|
||||||
|
*/
|
||||||
class ElementsCategoryDeleter : public QWidget {
|
class ElementsCategoryDeleter : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
// constructeurs, destructeur
|
// constructeurs, destructeur
|
||||||
|
@ -183,18 +183,27 @@ void ElementsPanel::reload() {
|
|||||||
addDir(invisibleRootItem(), QETApp::customElementsDir(), tr("Collection utilisateur"));
|
addDir(invisibleRootItem(), QETApp::customElementsDir(), tr("Collection utilisateur"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Edite la categorie selectionnee
|
||||||
|
*/
|
||||||
void ElementsPanel::editCategory() {
|
void ElementsPanel::editCategory() {
|
||||||
QFileInfo infos_file = selectedFile();
|
QFileInfo infos_file = selectedFile();
|
||||||
if (!infos_file.exists() || !infos_file.isDir()) return;
|
if (!infos_file.exists() || !infos_file.isDir()) return;
|
||||||
lauchCategoryEditor(infos_file.absoluteFilePath());
|
launchCategoryEditor(infos_file.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Edite l'element selectionne
|
||||||
|
*/
|
||||||
void ElementsPanel::editElement() {
|
void ElementsPanel::editElement() {
|
||||||
QFileInfo infos_file = selectedFile();
|
QFileInfo infos_file = selectedFile();
|
||||||
if (!infos_file.exists() || !infos_file.isFile()) return;
|
if (!infos_file.exists() || !infos_file.isFile()) return;
|
||||||
launchElementEditor(infos_file.absoluteFilePath());
|
launchElementEditor(infos_file.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Supprime la categorie selectionnee
|
||||||
|
*/
|
||||||
void ElementsPanel::deleteCategory() {
|
void ElementsPanel::deleteCategory() {
|
||||||
QFileInfo infos_file = selectedFile();
|
QFileInfo infos_file = selectedFile();
|
||||||
if (!infos_file.exists() || !infos_file.isDir()) return;
|
if (!infos_file.exists() || !infos_file.isDir()) return;
|
||||||
@ -208,7 +217,7 @@ void ElementsPanel::deleteCategory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
supprime l'element selectionne
|
Supprime l'element selectionne
|
||||||
*/
|
*/
|
||||||
void ElementsPanel::deleteElement() {
|
void ElementsPanel::deleteElement() {
|
||||||
QFileInfo infos_file = selectedFile();
|
QFileInfo infos_file = selectedFile();
|
||||||
@ -222,6 +231,10 @@ void ElementsPanel::deleteElement() {
|
|||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gere le double-clic sur un element. Permet de lancer l'editeur de
|
||||||
|
categorie ou d'element.
|
||||||
|
*/
|
||||||
void ElementsPanel::slot_doubleClick(QTreeWidgetItem *, int) {
|
void ElementsPanel::slot_doubleClick(QTreeWidgetItem *, int) {
|
||||||
// le fichier doit exister
|
// le fichier doit exister
|
||||||
QFileInfo infos_file = selectedFile();
|
QFileInfo infos_file = selectedFile();
|
||||||
@ -232,7 +245,7 @@ void ElementsPanel::slot_doubleClick(QTreeWidgetItem *, int) {
|
|||||||
launchElementEditor(infos_file.absoluteFilePath());
|
launchElementEditor(infos_file.absoluteFilePath());
|
||||||
} else if (infos_file.isDir()) {
|
} else if (infos_file.isDir()) {
|
||||||
// il s'agit d'une categorie
|
// il s'agit d'une categorie
|
||||||
lauchCategoryEditor(infos_file.absoluteFilePath());
|
launchCategoryEditor(infos_file.absoluteFilePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,13 +256,21 @@ QFileInfo ElementsPanel::selectedFile() const {
|
|||||||
return(QFileInfo(currentItem() -> data(0, 42).toString()));
|
return(QFileInfo(currentItem() -> data(0, 42).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Lance l'editeur d'element pour l'element filename
|
||||||
|
@param filename Chemin du fichier representant l'element
|
||||||
|
*/
|
||||||
void ElementsPanel::launchElementEditor(const QString &filename) {
|
void ElementsPanel::launchElementEditor(const QString &filename) {
|
||||||
QETElementEditor *editor = new QETElementEditor();
|
QETElementEditor *editor = new QETElementEditor();
|
||||||
editor -> fromFile(filename);
|
editor -> fromFile(filename);
|
||||||
editor -> show();
|
editor -> show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementsPanel::lauchCategoryEditor(const QString &filename) {
|
/**
|
||||||
|
Lance l'editeur de categorie pour la categorie filename
|
||||||
|
@param filename Chemin du dossier representant la categorie
|
||||||
|
*/
|
||||||
|
void ElementsPanel::launchCategoryEditor(const QString &filename) {
|
||||||
ElementsCategoryEditor ece(filename, true);
|
ElementsCategoryEditor ece(filename, true);
|
||||||
if (ece.exec() == QDialog::Accepted) reload();
|
if (ece.exec() == QDialog::Accepted) reload();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class ElementsPanel : public QTreeWidget {
|
|||||||
void addDir(QTreeWidgetItem *, QString, QString = QString());
|
void addDir(QTreeWidgetItem *, QString, QString = QString());
|
||||||
QFileInfo selectedFile() const;
|
QFileInfo selectedFile() const;
|
||||||
void launchElementEditor(const QString &);
|
void launchElementEditor(const QString &);
|
||||||
void lauchCategoryEditor(const QString &);
|
void launchCategoryEditor(const QString &);
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -65,6 +65,9 @@ void ElementsPanelWidget::newElement() {
|
|||||||
new_element_wizard.exec();
|
new_element_wizard.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Lance le gestionnaire de categories
|
||||||
|
*/
|
||||||
void ElementsPanelWidget::newCategory() {
|
void ElementsPanelWidget::newCategory() {
|
||||||
QDialog new_category_dialog;
|
QDialog new_category_dialog;
|
||||||
new_category_dialog.setFixedSize(480, 280);
|
new_category_dialog.setFixedSize(480, 280);
|
||||||
@ -86,6 +89,9 @@ void ElementsPanelWidget::newCategory() {
|
|||||||
elements_panel -> reload();
|
elements_panel -> reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Met a jour les boutons afin d'assurer la coherence de l'interface
|
||||||
|
*/
|
||||||
void ElementsPanelWidget::updateButtons() {
|
void ElementsPanelWidget::updateButtons() {
|
||||||
bool category_selected = elements_panel -> selectedItemIsACategory();
|
bool category_selected = elements_panel -> selectedItemIsACategory();
|
||||||
bool element_selected = elements_panel -> selectedItemIsAnElement();
|
bool element_selected = elements_panel -> selectedItemIsAnElement();
|
||||||
|
@ -412,6 +412,9 @@ void ExportDialog::slot_changeUseBorder() {
|
|||||||
slot_refreshPreview();
|
slot_refreshPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Rafraichit l'apercu de l'export
|
||||||
|
*/
|
||||||
void ExportDialog::slot_refreshPreview() {
|
void ExportDialog::slot_refreshPreview() {
|
||||||
|
|
||||||
// genere le nouvel apercu
|
// genere le nouvel apercu
|
||||||
|
@ -2,12 +2,22 @@
|
|||||||
#define INSET_PROPERTIES_H
|
#define INSET_PROPERTIES_H
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
/**
|
||||||
|
Cette classe est un conteneur pour les proprietes d'un cartouche de schema
|
||||||
|
: titre, auteur, date, nom de fichier et folio
|
||||||
|
*/
|
||||||
class InsetProperties {
|
class InsetProperties {
|
||||||
public:
|
public:
|
||||||
|
/// Constructeur
|
||||||
InsetProperties() {
|
InsetProperties() {
|
||||||
}
|
}
|
||||||
|
/// Destructeur
|
||||||
virtual ~InsetProperties() {
|
virtual ~InsetProperties() {
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
@param ip autre conteneur InsetProperties
|
||||||
|
@return true si ip et ce conteneur sont identiques, false sinon
|
||||||
|
*/
|
||||||
bool operator==(const InsetProperties &ip) {
|
bool operator==(const InsetProperties &ip) {
|
||||||
return(
|
return(
|
||||||
ip.title == title &&\
|
ip.title == title &&\
|
||||||
@ -17,6 +27,10 @@ class InsetProperties {
|
|||||||
ip.folio == folio
|
ip.folio == folio
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
@param ip autre conteneur InsetProperties
|
||||||
|
@return false si ip et ce conteneur sont identiques, true sinon
|
||||||
|
*/
|
||||||
bool operator!=(const InsetProperties &ip) {
|
bool operator!=(const InsetProperties &ip) {
|
||||||
return(!(*this == ip));
|
return(!(*this == ip));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
#ifndef NAMES_LIST_H
|
#ifndef NAMES_LIST_H
|
||||||
#define NAMES_LIST_H
|
#define NAMES_LIST_H
|
||||||
#include <QtXml>
|
#include <QtXml>
|
||||||
|
/**
|
||||||
|
Cette classe represente une liste de noms, utilisee
|
||||||
|
par les elements et categories pour embarquer un meme nom en plusieurs
|
||||||
|
langues.
|
||||||
|
Les langues sont representees par deux lettres (typiquement : les deux
|
||||||
|
premieres de la locale du systeme) ; exemples : en pour l'anglais, fr
|
||||||
|
pour le francais.
|
||||||
|
*/
|
||||||
class NamesList {
|
class NamesList {
|
||||||
// constructeurs, destructeur
|
// constructeurs, destructeur
|
||||||
public:
|
public:
|
||||||
|
@ -90,6 +90,9 @@ NamesList NamesListWidget::names() {
|
|||||||
return(hash_names);
|
return(hash_names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Definit les noms que le widget doit afficher
|
||||||
|
*/
|
||||||
void NamesListWidget::setNames(const NamesList &provided_names) {
|
void NamesListWidget::setNames(const NamesList &provided_names) {
|
||||||
foreach(QString lang, provided_names.langs()) {
|
foreach(QString lang, provided_names.langs()) {
|
||||||
QString value = provided_names[lang];
|
QString value = provided_names[lang];
|
||||||
@ -101,10 +104,18 @@ void NamesListWidget::setNames(const NamesList &provided_names) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Verifie qu'il y a au moins un nom de saisi - si c'est le cas, le signal
|
||||||
|
imputChecked() est emis.
|
||||||
|
*/
|
||||||
void NamesListWidget::check() {
|
void NamesListWidget::check() {
|
||||||
if (checkOneName()) emit(inputChecked());
|
if (checkOneName()) emit(inputChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Definit le mode d'edition du widget
|
||||||
|
@param ro true pour que la liste de noms soit en lecture seule, false sinon
|
||||||
|
*/
|
||||||
void NamesListWidget::setReadOnly(bool ro) {
|
void NamesListWidget::setReadOnly(bool ro) {
|
||||||
read_only = ro;
|
read_only = ro;
|
||||||
int names_count = tree_names -> topLevelItemCount() - 1;
|
int names_count = tree_names -> topLevelItemCount() - 1;
|
||||||
@ -115,6 +126,7 @@ void NamesListWidget::setReadOnly(bool ro) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @return true si la liste de noms est en lecture seule, false sinon
|
||||||
bool NamesListWidget::isReadOnly() const {
|
bool NamesListWidget::isReadOnly() const {
|
||||||
return(read_only);
|
return(read_only);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#include "orientationset.h"
|
#include "orientationset.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Constructeur
|
||||||
|
Par defaut, toutes les orientations sont autorisees. L'orientation courante
|
||||||
|
vaut l'orientation par defaut, c'est-a-dire Nord.
|
||||||
|
*/
|
||||||
OrientationSet::OrientationSet() :
|
OrientationSet::OrientationSet() :
|
||||||
north_ori(true),
|
north_ori(true),
|
||||||
east_ori(true),
|
east_ori(true),
|
||||||
@ -9,6 +14,10 @@ OrientationSet::OrientationSet() :
|
|||||||
current_ori(QET::North)
|
current_ori(QET::North)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param ori true pour autoriser l'orientation vers le Nord, false pour l'interdire
|
||||||
|
@return true si le changement d'autorisation a reussi, false sinon
|
||||||
|
*/
|
||||||
bool OrientationSet::setNorth (bool ori) {
|
bool OrientationSet::setNorth (bool ori) {
|
||||||
// pour desactiver une orientation, il doit y avoir au moins une autre orientation possible
|
// pour desactiver une orientation, il doit y avoir au moins une autre orientation possible
|
||||||
bool can_set_ori = ori ? true : east_ori || south_ori || west_ori;
|
bool can_set_ori = ori ? true : east_ori || south_ori || west_ori;
|
||||||
@ -23,6 +32,10 @@ bool OrientationSet::setNorth (bool ori) {
|
|||||||
return(can_set_ori);
|
return(can_set_ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param ori true pour autoriser l'orientation vers l'Est, false pour l'interdire
|
||||||
|
@return true si le changement d'autorisation a reussi, false sinon
|
||||||
|
*/
|
||||||
bool OrientationSet::setEast (bool ori) {
|
bool OrientationSet::setEast (bool ori) {
|
||||||
// pour desactiver une orientation, il doit y avoir au moins une autre orientation possible
|
// pour desactiver une orientation, il doit y avoir au moins une autre orientation possible
|
||||||
bool can_set_ori = ori ? true : south_ori || west_ori || north_ori;
|
bool can_set_ori = ori ? true : south_ori || west_ori || north_ori;
|
||||||
@ -37,6 +50,10 @@ bool OrientationSet::setEast (bool ori) {
|
|||||||
return(can_set_ori);
|
return(can_set_ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param ori true pour autoriser l'orientation vers le Sud, false pour l'interdire
|
||||||
|
@return true si le changement d'autorisation a reussi, false sinon
|
||||||
|
*/
|
||||||
bool OrientationSet::setSouth (bool ori) {
|
bool OrientationSet::setSouth (bool ori) {
|
||||||
// pour desactiver une orientation, il doit y avoir au moins une autre orientation possible
|
// pour desactiver une orientation, il doit y avoir au moins une autre orientation possible
|
||||||
bool can_set_ori = ori ? true : west_ori || north_ori || east_ori;
|
bool can_set_ori = ori ? true : west_ori || north_ori || east_ori;
|
||||||
@ -51,6 +68,10 @@ bool OrientationSet::setSouth (bool ori) {
|
|||||||
return(can_set_ori);
|
return(can_set_ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param ori true pour autoriser l'orientation vers l'Ouest, false pour l'interdire
|
||||||
|
@return true si le changement d'autorisation a reussi, false sinon
|
||||||
|
*/
|
||||||
bool OrientationSet::setWest (bool ori) {
|
bool OrientationSet::setWest (bool ori) {
|
||||||
// pour desactiver une orientation, il doit y avoir au moins une autre orientation possible
|
// pour desactiver une orientation, il doit y avoir au moins une autre orientation possible
|
||||||
bool can_set_ori = ori ? true : north_ori || east_ori || south_ori;
|
bool can_set_ori = ori ? true : north_ori || east_ori || south_ori;
|
||||||
@ -65,30 +86,49 @@ bool OrientationSet::setWest (bool ori) {
|
|||||||
return(can_set_ori);
|
return(can_set_ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Definit l'orientation courante
|
||||||
|
@param ori nouvelle orientation courante
|
||||||
|
@return true si le changement d'orientation a reussi, false sinon
|
||||||
|
*/
|
||||||
bool OrientationSet::setCurrent(QET::Orientation ori) {
|
bool OrientationSet::setCurrent(QET::Orientation ori) {
|
||||||
bool can_set_ori = accept(ori);
|
bool can_set_ori = accept(ori);
|
||||||
if (can_set_ori) current_ori = ori;
|
if (can_set_ori) current_ori = ori;
|
||||||
return(can_set_ori);
|
return(can_set_ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return l'orientation suivant l'orientation courante
|
||||||
|
*/
|
||||||
QET::Orientation OrientationSet::next() const {
|
QET::Orientation OrientationSet::next() const {
|
||||||
QET::Orientation result = current_ori;
|
QET::Orientation result = current_ori;
|
||||||
do result = QET::nextOrientation(result); while (!accept(result));
|
do result = QET::nextOrientation(result); while (!accept(result));
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return l'orientation precedant l'orientation courante
|
||||||
|
*/
|
||||||
QET::Orientation OrientationSet::previous() const {
|
QET::Orientation OrientationSet::previous() const {
|
||||||
QET::Orientation result = current_ori;
|
QET::Orientation result = current_ori;
|
||||||
do result = QET::previousOrientation(result); while (!accept(result));
|
do result = QET::previousOrientation(result); while (!accept(result));
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Equivaut a setNext()
|
||||||
|
@return l'OrientationSet precedent
|
||||||
|
*/
|
||||||
const OrientationSet OrientationSet::operator++(int) {
|
const OrientationSet OrientationSet::operator++(int) {
|
||||||
OrientationSet before(*this);
|
OrientationSet before(*this);
|
||||||
setNext();
|
setNext();
|
||||||
return(before);
|
return(before);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Equivaut a setPrevious()
|
||||||
|
@return l'OrientationSet precedent
|
||||||
|
*/
|
||||||
const OrientationSet OrientationSet::operator--(int) {
|
const OrientationSet OrientationSet::operator--(int) {
|
||||||
OrientationSet before(*this);
|
OrientationSet before(*this);
|
||||||
setPrevious();
|
setPrevious();
|
||||||
@ -111,26 +151,46 @@ bool OrientationSet::accept(QET::Orientation ori) const {
|
|||||||
return(accepted_ori);
|
return(accepted_ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Definit l'orientation suivante comme etant l'orientation courante
|
||||||
|
@return la nouvelle orientation courante
|
||||||
|
*/
|
||||||
QET::Orientation OrientationSet::setNext() {
|
QET::Orientation OrientationSet::setNext() {
|
||||||
setCurrent(next());
|
setCurrent(next());
|
||||||
return(current_ori);
|
return(current_ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Definit l'orientation precedente comme etant l'orientation courante
|
||||||
|
@return la nouvelle orientation courante
|
||||||
|
*/
|
||||||
QET::Orientation OrientationSet::setPrevious() {
|
QET::Orientation OrientationSet::setPrevious() {
|
||||||
setCurrent(previous());
|
setCurrent(previous());
|
||||||
return(current_ori);
|
return(current_ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Equivaut a setNext()
|
||||||
|
@return l'OrientationSet courant
|
||||||
|
*/
|
||||||
const OrientationSet OrientationSet::operator++() {
|
const OrientationSet OrientationSet::operator++() {
|
||||||
setNext();
|
setNext();
|
||||||
return(*this);
|
return(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Equivaut a setPrevious()
|
||||||
|
@return l'OrientationSet courant
|
||||||
|
*/
|
||||||
const OrientationSet OrientationSet::operator--() {
|
const OrientationSet OrientationSet::operator--() {
|
||||||
setPrevious();
|
setPrevious();
|
||||||
return(*this);
|
return(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param os autre OrientationSet
|
||||||
|
@return true si os et cet OrientationSet sont identiques, false sinon
|
||||||
|
*/
|
||||||
bool OrientationSet::operator==(const OrientationSet &os) const {
|
bool OrientationSet::operator==(const OrientationSet &os) const {
|
||||||
if (north_ori != os.north_ori) return(false);
|
if (north_ori != os.north_ori) return(false);
|
||||||
if (east_ori != os.east_ori) return(false);
|
if (east_ori != os.east_ori) return(false);
|
||||||
@ -141,10 +201,24 @@ bool OrientationSet::operator==(const OrientationSet &os) const {
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param os autre OrientationSet
|
||||||
|
@return false si os et cet OrientationSet sont identiques, true sinon
|
||||||
|
*/
|
||||||
bool OrientationSet::operator!=(const OrientationSet &os) const {
|
bool OrientationSet::operator!=(const OrientationSet &os) const {
|
||||||
return(!(this -> operator==(os)));
|
return(!(this -> operator==(os)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Charge l'orientationSet depuis une chaine de caractere.
|
||||||
|
Cette chaine doit faire 4 caracteres, representant respectivement
|
||||||
|
le Nord, l'Est, le Sud et l'Ouest. Le caractere y indique que l'orientation
|
||||||
|
est autorisee, le caractere n indique que l'orientation est interdite et le
|
||||||
|
caractere d designe l'orientation par defaut. L'orientation courante est
|
||||||
|
celle par defaut.
|
||||||
|
@param str Chaine de caracteres a analyser et charger
|
||||||
|
@return true si l'analyse a reussie, false sinon
|
||||||
|
*/
|
||||||
bool OrientationSet::fromString(const QString &str) {
|
bool OrientationSet::fromString(const QString &str) {
|
||||||
QRegExp osv("^([dyn])([dyn])([dyn])([dyn])$"); // osv : Orientation String Validator
|
QRegExp osv("^([dyn])([dyn])([dyn])([dyn])$"); // osv : Orientation String Validator
|
||||||
if (osv.indexIn(str) == -1) return(false);
|
if (osv.indexIn(str) == -1) return(false);
|
||||||
@ -166,6 +240,10 @@ bool OrientationSet::fromString(const QString &str) {
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return Une chaine de caracteres representant cet OrientationSet.
|
||||||
|
@see fromString
|
||||||
|
*/
|
||||||
QString OrientationSet::toString() const {
|
QString OrientationSet::toString() const {
|
||||||
bool ori_pointers[4] = { north_ori, east_ori, south_ori, west_ori };
|
bool ori_pointers[4] = { north_ori, east_ori, south_ori, west_ori };
|
||||||
QET::Orientation ori_ints[4] = { QET::North, QET::East, QET::South, QET::West };
|
QET::Orientation ori_ints[4] = { QET::North, QET::East, QET::South, QET::West };
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
#ifndef ORIENTATION_SET_H
|
#ifndef ORIENTATION_SET_H
|
||||||
#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
|
||||||
|
structure de donnees stockant une orientation par defaut, une orientation
|
||||||
|
courante et l'autorisation ou non d'utiliser les quatre autres orientations
|
||||||
|
: nord, est, sud, ouest.
|
||||||
|
Elle possede des methodes pour definir les autorisations. Le changement
|
||||||
|
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
|
// constructeurs, destructeur
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
#include "orientationsetwidget.h"
|
#include "orientationsetwidget.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Constructeur
|
||||||
|
@param parent QWidget parent
|
||||||
|
*/
|
||||||
OrientationSetWidget::OrientationSetWidget(QWidget *parent) : QWidget(parent) {
|
OrientationSetWidget::OrientationSetWidget(QWidget *parent) : QWidget(parent) {
|
||||||
|
|
||||||
default_radios = new QButtonGroup(this);
|
default_radios = new QButtonGroup(this);
|
||||||
@ -61,15 +65,26 @@ OrientationSetWidget::OrientationSetWidget(QWidget *parent) : QWidget(parent) {
|
|||||||
slot_defaultChanged(north_default);
|
slot_defaultChanged(north_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return l'OrientationSet
|
||||||
|
*/
|
||||||
OrientationSet OrientationSetWidget::orientationSet() const {
|
OrientationSet OrientationSetWidget::orientationSet() const {
|
||||||
return(ori);
|
return(ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param os l'OrientationSet a editer
|
||||||
|
*/
|
||||||
void OrientationSetWidget::setOrientationSet(const OrientationSet &os) {
|
void OrientationSetWidget::setOrientationSet(const OrientationSet &os) {
|
||||||
ori = os;
|
ori = os;
|
||||||
updateForm();
|
updateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Slot gerant le changement d'orientation par defaut.
|
||||||
|
L'orientation concernee affiche alors "Possible" et ce statut devient
|
||||||
|
impossible a modifier.
|
||||||
|
*/
|
||||||
void OrientationSetWidget::slot_defaultChanged(QAbstractButton *button) {
|
void OrientationSetWidget::slot_defaultChanged(QAbstractButton *button) {
|
||||||
if (button == north_default) north_orientation -> setCurrentIndex(0);
|
if (button == north_default) north_orientation -> setCurrentIndex(0);
|
||||||
else if (button == east_default) east_orientation -> setCurrentIndex(0);
|
else if (button == east_default) east_orientation -> setCurrentIndex(0);
|
||||||
@ -84,6 +99,9 @@ void OrientationSetWidget::slot_defaultChanged(QAbstractButton *button) {
|
|||||||
updateOrientationSet();
|
updateOrientationSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Met a jour les donnees de la classe a partir du dialogue
|
||||||
|
*/
|
||||||
void OrientationSetWidget::updateOrientationSet() {
|
void OrientationSetWidget::updateOrientationSet() {
|
||||||
ori.setNorth(!north_orientation -> currentIndex());
|
ori.setNorth(!north_orientation -> currentIndex());
|
||||||
ori.setEast (!east_orientation -> currentIndex());
|
ori.setEast (!east_orientation -> currentIndex());
|
||||||
@ -92,6 +110,9 @@ void OrientationSetWidget::updateOrientationSet() {
|
|||||||
ori.setDefaultOrientation(static_cast<QET::Orientation>(default_radios -> checkedId()));
|
ori.setDefaultOrientation(static_cast<QET::Orientation>(default_radios -> checkedId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Met a jour le dialogue a partir des donnees de la classe
|
||||||
|
*/
|
||||||
void OrientationSetWidget::updateForm() {
|
void OrientationSetWidget::updateForm() {
|
||||||
north_orientation -> setCurrentIndex(ori.north() ? 0 : 1);
|
north_orientation -> setCurrentIndex(ori.north() ? 0 : 1);
|
||||||
east_orientation -> setCurrentIndex(ori.east() ? 0 : 1);
|
east_orientation -> setCurrentIndex(ori.east() ? 0 : 1);
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
#define ORIENTATION_SET_WIDGET_H
|
#define ORIENTATION_SET_WIDGET_H
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include "orientationset.h"
|
#include "orientationset.h"
|
||||||
|
/**
|
||||||
|
Widget permettant d'editer un OrientationSet
|
||||||
|
*/
|
||||||
class OrientationSetWidget : public QWidget {
|
class OrientationSetWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
// constructeurs, destructeur
|
// constructeurs, destructeur
|
||||||
|
34
qetapp.cpp
34
qetapp.cpp
@ -468,3 +468,37 @@ void QETApp::fetchWindowStats(const QList<QETDiagramEditor *> &diagrams, const Q
|
|||||||
// determine si tous les elements sont reduits
|
// determine si tous les elements sont reduits
|
||||||
every_editor_reduced = every_element_reduced && every_diagram_reduced;
|
every_editor_reduced = every_element_reduced && every_diagram_reduced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gere les evenement
|
||||||
|
@param e Evenement a gerer
|
||||||
|
*/
|
||||||
|
bool QETApp::event(QEvent *e) {
|
||||||
|
// gere l'ouverture de fichiers (sous MacOs)
|
||||||
|
if (e -> type() == QEvent::FileOpen) {
|
||||||
|
// nom du fichier a ouvrir
|
||||||
|
QString filename = static_cast<QFileOpenEvent *>(e) -> file();
|
||||||
|
// liste des editeurs de schema ouverts
|
||||||
|
QList<QETDiagramEditor *> diagrams_editors = diagramEditors();
|
||||||
|
if (diagrams_editors.count()) {
|
||||||
|
// s'il y a des editeur de schemas ouvert, on cherche ceux qui sont visibles
|
||||||
|
QList<QETDiagramEditor *> visible_diagrams_editors;
|
||||||
|
foreach(QETDiagramEditor *de, diagrams_editors) {
|
||||||
|
if (de -> isVisible()) visible_diagrams_editors << de;
|
||||||
|
}
|
||||||
|
// ob choisit soit le premier visible soit le premier tout court
|
||||||
|
QETDiagramEditor *de_open;
|
||||||
|
if (visible_diagrams_editors.count()) {
|
||||||
|
de_open = visible_diagrams_editors.first();
|
||||||
|
} else {
|
||||||
|
de_open = diagrams_editors.first();
|
||||||
|
de_open -> setVisible(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
new QETDiagramEditor(QStringList() << filename);
|
||||||
|
}
|
||||||
|
return(true);
|
||||||
|
} else {
|
||||||
|
return(QApplication::event(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
2
qetapp.h
2
qetapp.h
@ -34,6 +34,8 @@ class QETApp : public QApplication {
|
|||||||
private:
|
private:
|
||||||
static QString common_elements_dir;
|
static QString common_elements_dir;
|
||||||
#endif
|
#endif
|
||||||
|
protected:
|
||||||
|
bool event(QEvent *);
|
||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
|
@ -127,7 +127,7 @@ void QETDiagramEditor::toggleFullScreen() {
|
|||||||
Le dialogue en question est cree lors du premier appel de cette fonction.
|
Le dialogue en question est cree lors du premier appel de cette fonction.
|
||||||
En consequence, sa premiere apparition n'est pas immediate. Par la suite,
|
En consequence, sa premiere apparition n'est pas immediate. Par la suite,
|
||||||
le dialogue n'a pas a etre recree et il apparait instantanement. Il est
|
le dialogue n'a pas a etre recree et il apparait instantanement. Il est
|
||||||
detruit en meme temps que son parent (ici, la QETDiagramEditor).
|
detruit en meme temps que son parent (ici, le QETDiagramEditor).
|
||||||
*/
|
*/
|
||||||
void QETDiagramEditor::aboutQET() {
|
void QETDiagramEditor::aboutQET() {
|
||||||
static AboutQET *apqet = new AboutQET(this);
|
static AboutQET *apqet = new AboutQET(this);
|
||||||
|
@ -7,8 +7,8 @@ class ElementsPanelWidget;
|
|||||||
Cette classe represente la fenetre principale de QElectroTech et,
|
Cette classe represente la fenetre principale de QElectroTech et,
|
||||||
ipso facto, la plus grande partie de l'interface graphique de QElectroTech.
|
ipso facto, la plus grande partie de l'interface graphique de QElectroTech.
|
||||||
Il s'agit d'un objet QMainWindow avec un QWorkSpace contenant des objets
|
Il s'agit d'un objet QMainWindow avec un QWorkSpace contenant des objets
|
||||||
« Diagram » en guise de widget central et un « Panel d'Appareils » en guise
|
« DiagramView » en guise de widget central et un « Panel d'Appareils » en
|
||||||
de widget « Dock ».
|
guise de widget « Dock ».
|
||||||
*/
|
*/
|
||||||
class QETDiagramEditor : public QMainWindow {
|
class QETDiagramEditor : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -3,6 +3,11 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
|
/**
|
||||||
|
Cette classe represente un gestionnaire de QGraphicsItem.
|
||||||
|
Elle permet de supprimer des QGraphicsItem lorsqu'il n'y a plus aucune
|
||||||
|
reference vers eux et qu'ils ne sont plus sur la scene.
|
||||||
|
*/
|
||||||
class QGIManager {
|
class QGIManager {
|
||||||
// constructeurs, destructeurs
|
// constructeurs, destructeurs
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user