mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 17:50:52 +01:00
Integrated the "Default conductor properties" dialog into the "Diagram properties" one.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1139 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -414,6 +414,7 @@ void DiagramView::editDiagramProperties() {
|
|||||||
// recupere le cartouche et les dimensions du schema
|
// recupere le cartouche et les dimensions du schema
|
||||||
TitleBlockProperties titleblock = scene -> border_and_titleblock.exportTitleBlock();
|
TitleBlockProperties titleblock = scene -> border_and_titleblock.exportTitleBlock();
|
||||||
BorderProperties border = scene -> border_and_titleblock.exportBorder();
|
BorderProperties border = scene -> border_and_titleblock.exportBorder();
|
||||||
|
ConductorProperties conductors = scene -> defaultConductorProperties;
|
||||||
|
|
||||||
// construit le dialogue
|
// construit le dialogue
|
||||||
QDialog popup(diagramEditor());
|
QDialog popup(diagramEditor());
|
||||||
@@ -421,7 +422,8 @@ void DiagramView::editDiagramProperties() {
|
|||||||
popup.setWindowFlags(Qt::Sheet);
|
popup.setWindowFlags(Qt::Sheet);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
popup.setMinimumWidth(400);
|
popup.setMinimumWidth(786);
|
||||||
|
popup.setMinimumHeight(500);
|
||||||
popup.setWindowTitle(tr("Propri\351t\351s du sch\351ma", "window title"));
|
popup.setWindowTitle(tr("Propri\351t\351s du sch\351ma", "window title"));
|
||||||
|
|
||||||
BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup);
|
BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup);
|
||||||
@@ -437,21 +439,35 @@ void DiagramView::editDiagramProperties() {
|
|||||||
}
|
}
|
||||||
titleblock_infos -> setReadOnly(diagram_is_read_only);
|
titleblock_infos -> setReadOnly(diagram_is_read_only);
|
||||||
|
|
||||||
|
ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors);
|
||||||
|
cpw -> setReadOnly(diagram_is_read_only);
|
||||||
|
|
||||||
// boutons
|
// boutons
|
||||||
QDialogButtonBox boutons(diagram_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
QDialogButtonBox boutons(diagram_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
connect(&boutons, SIGNAL(accepted()), &popup, SLOT(accept()));
|
connect(&boutons, SIGNAL(accepted()), &popup, SLOT(accept()));
|
||||||
connect(&boutons, SIGNAL(rejected()), &popup, SLOT(reject()));
|
connect(&boutons, SIGNAL(rejected()), &popup, SLOT(reject()));
|
||||||
|
|
||||||
|
// usual layout for these three widgets
|
||||||
|
QHBoxLayout *hlayout1 = new QHBoxLayout();
|
||||||
|
QVBoxLayout *vlayout2 = new QVBoxLayout();
|
||||||
|
|
||||||
|
vlayout2 -> addWidget(border_infos);
|
||||||
|
vlayout2 -> addWidget(titleblock_infos);
|
||||||
|
vlayout2 -> setSpacing(5);
|
||||||
|
hlayout1 -> addLayout(vlayout2);
|
||||||
|
hlayout1 -> addWidget(cpw);
|
||||||
|
hlayout1 -> setAlignment(cpw, Qt::AlignTop);
|
||||||
|
|
||||||
// ajout dans une disposition verticale
|
// ajout dans une disposition verticale
|
||||||
QVBoxLayout layout_v(&popup);
|
QVBoxLayout layout_v(&popup);
|
||||||
layout_v.addWidget(border_infos);
|
layout_v.addLayout(hlayout1);
|
||||||
layout_v.addWidget(titleblock_infos);
|
|
||||||
layout_v.addStretch();
|
layout_v.addStretch();
|
||||||
layout_v.addWidget(&boutons);
|
layout_v.addWidget(&boutons);
|
||||||
// si le dialogue est accepte
|
// si le dialogue est accepte
|
||||||
if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
|
if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
|
||||||
TitleBlockProperties new_titleblock = titleblock_infos -> titleBlockProperties();
|
TitleBlockProperties new_titleblock = titleblock_infos -> titleBlockProperties();
|
||||||
BorderProperties new_border = border_infos -> borderProperties();
|
BorderProperties new_border = border_infos -> borderProperties();
|
||||||
|
ConductorProperties new_conductors = cpw -> conductorProperties();
|
||||||
// s'il y a des modifications au cartouche
|
// s'il y a des modifications au cartouche
|
||||||
if (new_titleblock != titleblock) {
|
if (new_titleblock != titleblock) {
|
||||||
scene -> undoStack().push(new ChangeTitleBlockCommand(scene, titleblock, new_titleblock));
|
scene -> undoStack().push(new ChangeTitleBlockCommand(scene, titleblock, new_titleblock));
|
||||||
@@ -461,6 +477,12 @@ void DiagramView::editDiagramProperties() {
|
|||||||
if (new_border != border) {
|
if (new_border != border) {
|
||||||
scene -> undoStack().push(new ChangeBorderCommand(scene, border, new_border));
|
scene -> undoStack().push(new ChangeBorderCommand(scene, border, new_border));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if modifcations have been made to the conductors properties
|
||||||
|
if (new_conductors != conductors) {
|
||||||
|
/// TODO implement an undo command to allow the user to undo/redo this action
|
||||||
|
scene -> defaultConductorProperties = new_conductors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,37 +882,6 @@ void DiagramView::resetConductors() {
|
|||||||
scene -> undoStack().push(new ResetConductorCommand(conductors_and_profiles));
|
scene -> undoStack().push(new ResetConductorCommand(conductors_and_profiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Lance un dialogue permettant de modifier les proprietes par defaut des
|
|
||||||
futurs nouveaux conducteurs
|
|
||||||
*/
|
|
||||||
void DiagramView::editDefaultConductorProperties() {
|
|
||||||
bool diagram_is_read_only = scene -> isReadOnly();
|
|
||||||
|
|
||||||
// initialise l'editeur de proprietes pour le conducteur
|
|
||||||
ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(scene -> defaultConductorProperties);
|
|
||||||
cpw -> setReadOnly(diagram_is_read_only);
|
|
||||||
|
|
||||||
// l'insere dans un dialogue
|
|
||||||
QDialog conductor_dialog(diagramEditor());
|
|
||||||
#ifdef Q_WS_MAC
|
|
||||||
conductor_dialog.setWindowFlags(Qt::Sheet);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
conductor_dialog.setWindowTitle(tr("\311diter les propri\351t\351s par d\351faut des conducteurs", "window title"));
|
|
||||||
QVBoxLayout *dialog_layout = new QVBoxLayout(&conductor_dialog);
|
|
||||||
dialog_layout -> addWidget(cpw);
|
|
||||||
QDialogButtonBox *dbb = new QDialogButtonBox(diagram_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
|
||||||
dialog_layout -> addWidget(dbb);
|
|
||||||
connect(dbb, SIGNAL(accepted()), &conductor_dialog, SLOT(accept()));
|
|
||||||
connect(dbb, SIGNAL(rejected()), &conductor_dialog, SLOT(reject()));
|
|
||||||
|
|
||||||
// execute le dialogue et met a jour le conducteur
|
|
||||||
if (conductor_dialog.exec() == QDialog::Accepted && !diagram_is_read_only) {
|
|
||||||
scene -> defaultConductorProperties = cpw -> conductorProperties();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gere les evenements de la DiagramView
|
Gere les evenements de la DiagramView
|
||||||
@param e Evenement
|
@param e Evenement
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ class DiagramView : public QGraphicsView {
|
|||||||
void editConductor();
|
void editConductor();
|
||||||
void editConductor(Conductor *);
|
void editConductor(Conductor *);
|
||||||
void resetConductors();
|
void resetConductors();
|
||||||
void editDefaultConductorProperties();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addDroppedElement();
|
void addDroppedElement();
|
||||||
|
|||||||
@@ -201,7 +201,6 @@ void QETDiagramEditor::actions() {
|
|||||||
rotate_texts = new QAction(QET::Icons::ObjectRotateRight, tr("Orienter les textes"), this);
|
rotate_texts = new QAction(QET::Icons::ObjectRotateRight, tr("Orienter les textes"), this);
|
||||||
selection_prop = new QAction(QET::Icons::DialogInformation, tr("Propri\351t\351s de la s\351lection"), this);
|
selection_prop = new QAction(QET::Icons::DialogInformation, tr("Propri\351t\351s de la s\351lection"), this);
|
||||||
conductor_reset = new QAction(QET::Icons::ConductorSettings, tr("R\351initialiser les conducteurs"), this);
|
conductor_reset = new QAction(QET::Icons::ConductorSettings, tr("R\351initialiser les conducteurs"), this);
|
||||||
conductor_default = new QAction(QET::Icons::DefaultConductor, tr("Conducteurs par d\351faut"), this);
|
|
||||||
infos_diagram = new QAction(QET::Icons::DialogInformation, tr("Propri\351t\351s du sch\351ma"), this);
|
infos_diagram = new QAction(QET::Icons::DialogInformation, tr("Propri\351t\351s du sch\351ma"), this);
|
||||||
add_text = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), this);
|
add_text = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), this);
|
||||||
add_column = new QAction(QET::Icons::AddColumn, tr("Ajouter une colonne"), this);
|
add_column = new QAction(QET::Icons::AddColumn, tr("Ajouter une colonne"), this);
|
||||||
@@ -266,7 +265,6 @@ void QETDiagramEditor::actions() {
|
|||||||
selection_prop -> setShortcut(QKeySequence(tr("Ctrl+J")));
|
selection_prop -> setShortcut(QKeySequence(tr("Ctrl+J")));
|
||||||
conductor_reset -> setShortcut(QKeySequence(tr("Ctrl+K")));
|
conductor_reset -> setShortcut(QKeySequence(tr("Ctrl+K")));
|
||||||
infos_diagram -> setShortcut(QKeySequence(tr("Ctrl+L")));
|
infos_diagram -> setShortcut(QKeySequence(tr("Ctrl+L")));
|
||||||
conductor_default -> setShortcut(QKeySequence(tr("Ctrl+D")));
|
|
||||||
|
|
||||||
prj_add_diagram -> setShortcut(QKeySequence(tr("Ctrl+T")));
|
prj_add_diagram -> setShortcut(QKeySequence(tr("Ctrl+T")));
|
||||||
|
|
||||||
@@ -305,7 +303,6 @@ void QETDiagramEditor::actions() {
|
|||||||
rotate_texts -> setStatusTip(tr("Pivote les textes s\351lectionn\351s \320 un angle pr\351cis", "status bar tip"));
|
rotate_texts -> setStatusTip(tr("Pivote les textes s\351lectionn\351s \320 un angle pr\351cis", "status bar tip"));
|
||||||
selection_prop -> setStatusTip(tr("\311dite les propri\351t\351s des objets s\351lectionn\351", "status bar tip"));
|
selection_prop -> setStatusTip(tr("\311dite les propri\351t\351s des objets s\351lectionn\351", "status bar tip"));
|
||||||
conductor_reset -> setStatusTip(tr("Recalcule les chemins des conducteurs sans tenir compte des modifications", "status bar tip"));
|
conductor_reset -> setStatusTip(tr("Recalcule les chemins des conducteurs sans tenir compte des modifications", "status bar tip"));
|
||||||
conductor_default -> setStatusTip(tr("Sp\351cifie les propri\351t\351s par d\351faut des conducteurs", "status bar tip"));
|
|
||||||
infos_diagram -> setStatusTip(tr("\311dite les informations affich\351es par le cartouche", "status bar tip"));
|
infos_diagram -> setStatusTip(tr("\311dite les informations affich\351es par le cartouche", "status bar tip"));
|
||||||
add_column -> setStatusTip(tr("Ajoute une colonne au sch\351ma", "status bar tip"));
|
add_column -> setStatusTip(tr("Ajoute une colonne au sch\351ma", "status bar tip"));
|
||||||
remove_column -> setStatusTip(tr("Enl\350ve une colonne au sch\351ma", "status bar tip"));
|
remove_column -> setStatusTip(tr("Enl\350ve une colonne au sch\351ma", "status bar tip"));
|
||||||
@@ -394,7 +391,6 @@ void QETDiagramEditor::actions() {
|
|||||||
connect(prev_window, SIGNAL(triggered()), &workspace, SLOT(activatePreviousSubWindow()) );
|
connect(prev_window, SIGNAL(triggered()), &workspace, SLOT(activatePreviousSubWindow()) );
|
||||||
connect(selection_prop, SIGNAL(triggered()), this, SLOT(editSelectionProperties()) );
|
connect(selection_prop, SIGNAL(triggered()), this, SLOT(editSelectionProperties()) );
|
||||||
connect(conductor_reset, SIGNAL(triggered()), this, SLOT(slot_resetConductors()) );
|
connect(conductor_reset, SIGNAL(triggered()), this, SLOT(slot_resetConductors()) );
|
||||||
connect(conductor_default, SIGNAL(triggered()), this, SLOT(slot_editDefaultConductors()));
|
|
||||||
connect(infos_diagram, SIGNAL(triggered()), this, SLOT(editCurrentDiagramProperties()));
|
connect(infos_diagram, SIGNAL(triggered()), this, SLOT(editCurrentDiagramProperties()));
|
||||||
connect(add_text, SIGNAL(triggered()), this, SLOT(slot_addText()) );
|
connect(add_text, SIGNAL(triggered()), this, SLOT(slot_addText()) );
|
||||||
connect(add_column, SIGNAL(triggered()), this, SLOT(slot_addColumn()) );
|
connect(add_column, SIGNAL(triggered()), this, SLOT(slot_addColumn()) );
|
||||||
@@ -482,7 +478,6 @@ void QETDiagramEditor::menus() {
|
|||||||
menu_edition -> addAction(selection_prop);
|
menu_edition -> addAction(selection_prop);
|
||||||
menu_edition -> addSeparator();
|
menu_edition -> addSeparator();
|
||||||
menu_edition -> addAction(conductor_reset);
|
menu_edition -> addAction(conductor_reset);
|
||||||
menu_edition -> addAction(conductor_default);
|
|
||||||
menu_edition -> addSeparator();
|
menu_edition -> addSeparator();
|
||||||
menu_edition -> addAction(infos_diagram);
|
menu_edition -> addAction(infos_diagram);
|
||||||
menu_edition -> addAction(add_column);
|
menu_edition -> addAction(add_column);
|
||||||
@@ -577,7 +572,6 @@ void QETDiagramEditor::toolbar() {
|
|||||||
view_bar -> addAction(zoom_reset);
|
view_bar -> addAction(zoom_reset);
|
||||||
|
|
||||||
diagram_bar -> addAction(infos_diagram);
|
diagram_bar -> addAction(infos_diagram);
|
||||||
diagram_bar -> addAction(conductor_default);
|
|
||||||
diagram_bar -> addAction(conductor_reset);
|
diagram_bar -> addAction(conductor_reset);
|
||||||
diagram_bar -> addAction(add_text);
|
diagram_bar -> addAction(add_text);
|
||||||
|
|
||||||
@@ -1113,7 +1107,6 @@ void QETDiagramEditor::slot_updateActions() {
|
|||||||
zoom_out -> setEnabled(opened_diagram);
|
zoom_out -> setEnabled(opened_diagram);
|
||||||
zoom_fit -> setEnabled(opened_diagram);
|
zoom_fit -> setEnabled(opened_diagram);
|
||||||
zoom_reset -> setEnabled(opened_diagram);
|
zoom_reset -> setEnabled(opened_diagram);
|
||||||
conductor_default -> setEnabled(opened_diagram);
|
|
||||||
infos_diagram -> setEnabled(opened_diagram);
|
infos_diagram -> setEnabled(opened_diagram);
|
||||||
add_text -> setEnabled(editable_diagram);
|
add_text -> setEnabled(editable_diagram);
|
||||||
add_column -> setEnabled(editable_diagram);
|
add_column -> setEnabled(editable_diagram);
|
||||||
@@ -1442,15 +1435,6 @@ void QETDiagramEditor::slot_resetConductors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Edite les proprietes par defaut des conducteurs
|
|
||||||
*/
|
|
||||||
void QETDiagramEditor::slot_editDefaultConductors() {
|
|
||||||
if (DiagramView *dv = currentDiagram()) {
|
|
||||||
dv -> editDefaultConductorProperties();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ajoute un texte au schema courant
|
Ajoute un texte au schema courant
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ class QETDiagramEditor : public QMainWindow {
|
|||||||
void editSelectionProperties();
|
void editSelectionProperties();
|
||||||
void slot_editConductor();
|
void slot_editConductor();
|
||||||
void slot_resetConductors();
|
void slot_resetConductors();
|
||||||
void slot_editDefaultConductors();
|
|
||||||
void slot_addText();
|
void slot_addText();
|
||||||
void setWindowedMode();
|
void setWindowedMode();
|
||||||
void setTabbedMode();
|
void setTabbedMode();
|
||||||
|
|||||||
Reference in New Issue
Block a user