[qet] [1139] Integrated the "Default conductor properties" dialog into the " Diagram properties" one.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 1139
Author:   xavier
Date:     2010-12-28 09:21:45 +0100 (Tue, 28 Dec 2010)
Log Message:
-----------
Integrated the "Default conductor properties" dialog into the "Diagram properties" one.

Modified Paths:
--------------
    branches/0.3/sources/diagramview.cpp
    branches/0.3/sources/diagramview.h
    branches/0.3/sources/qetdiagrameditor.cpp
    branches/0.3/sources/qetdiagrameditor.h

Modified: branches/0.3/sources/diagramview.cpp
===================================================================
--- branches/0.3/sources/diagramview.cpp	2010-12-28 07:05:31 UTC (rev 1138)
+++ branches/0.3/sources/diagramview.cpp	2010-12-28 08:21:45 UTC (rev 1139)
@@ -414,6 +414,7 @@
 	// recupere le cartouche et les dimensions du schema
 	TitleBlockProperties  titleblock  = scene -> border_and_titleblock.exportTitleBlock();
 	BorderProperties border = scene -> border_and_titleblock.exportBorder();
+	ConductorProperties conductors = scene -> defaultConductorProperties;
 	
 	// construit le dialogue
 	QDialog popup(diagramEditor());
@@ -421,7 +422,8 @@
 	popup.setWindowFlags(Qt::Sheet);
 #endif
 	
-	popup.setMinimumWidth(400);
+	popup.setMinimumWidth(786);
+	popup.setMinimumHeight(500);
 	popup.setWindowTitle(tr("Propri\351t\351s du sch\351ma", "window title"));
 	
 	BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup);
@@ -437,21 +439,35 @@
 	}
 	titleblock_infos -> setReadOnly(diagram_is_read_only);
 	
+	ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors);
+	cpw -> setReadOnly(diagram_is_read_only);
+	
 	// boutons
 	QDialogButtonBox boutons(diagram_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
 	connect(&boutons, SIGNAL(accepted()), &popup, SLOT(accept()));
 	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
 	QVBoxLayout layout_v(&popup);
-	layout_v.addWidget(border_infos);
-	layout_v.addWidget(titleblock_infos);
+	layout_v.addLayout(hlayout1);
 	layout_v.addStretch();
 	layout_v.addWidget(&boutons);
 	// si le dialogue est accepte
 	if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
 		TitleBlockProperties new_titleblock   = titleblock_infos  -> titleBlockProperties();
 		BorderProperties new_border = border_infos -> borderProperties();
+		ConductorProperties new_conductors = cpw -> conductorProperties();
 		// s'il y a des modifications au cartouche
 		if (new_titleblock != titleblock) {
 			scene -> undoStack().push(new ChangeTitleBlockCommand(scene, titleblock, new_titleblock));
@@ -461,6 +477,12 @@
 		if (new_border != 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;
+		}
 	}
 }
 
@@ -861,37 +883,6 @@
 }
 
 /**
-	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
 	@param e Evenement
 */

Modified: branches/0.3/sources/diagramview.h
===================================================================
--- branches/0.3/sources/diagramview.h	2010-12-28 07:05:31 UTC (rev 1138)
+++ branches/0.3/sources/diagramview.h	2010-12-28 08:21:45 UTC (rev 1139)
@@ -122,7 +122,6 @@
 	void editConductor();
 	void editConductor(Conductor *);
 	void resetConductors();
-	void editDefaultConductorProperties();
 	
 	private slots:
 	void addDroppedElement();

Modified: branches/0.3/sources/qetdiagrameditor.cpp
===================================================================
--- branches/0.3/sources/qetdiagrameditor.cpp	2010-12-28 07:05:31 UTC (rev 1138)
+++ branches/0.3/sources/qetdiagrameditor.cpp	2010-12-28 08:21:45 UTC (rev 1139)
@@ -201,7 +201,6 @@
 	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);
 	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);
 	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);
@@ -266,7 +265,6 @@
 	selection_prop    -> setShortcut(QKeySequence(tr("Ctrl+J")));
 	conductor_reset   -> setShortcut(QKeySequence(tr("Ctrl+K")));
 	infos_diagram     -> setShortcut(QKeySequence(tr("Ctrl+L")));
-	conductor_default -> setShortcut(QKeySequence(tr("Ctrl+D")));
 	
 	prj_add_diagram   -> setShortcut(QKeySequence(tr("Ctrl+T")));
 	
@@ -305,7 +303,6 @@
 	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"));
 	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"));
 	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"));
@@ -394,7 +391,6 @@
 	connect(prev_window,        SIGNAL(triggered()), &workspace, SLOT(activatePreviousSubWindow()) );
 	connect(selection_prop,     SIGNAL(triggered()), this,       SLOT(editSelectionProperties())   );
 	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(add_text,           SIGNAL(triggered()), this,       SLOT(slot_addText())              );
 	connect(add_column,         SIGNAL(triggered()), this,       SLOT(slot_addColumn())            );
@@ -482,7 +478,6 @@
 	menu_edition -> addAction(selection_prop);
 	menu_edition -> addSeparator();
 	menu_edition -> addAction(conductor_reset);
-	menu_edition -> addAction(conductor_default);
 	menu_edition -> addSeparator();
 	menu_edition -> addAction(infos_diagram);
 	menu_edition -> addAction(add_column);
@@ -577,7 +572,6 @@
 	view_bar -> addAction(zoom_reset);
 	
 	diagram_bar -> addAction(infos_diagram);
-	diagram_bar -> addAction(conductor_default);
 	diagram_bar -> addAction(conductor_reset);
 	diagram_bar -> addAction(add_text);
 	
@@ -1113,7 +1107,6 @@
 	zoom_out          -> setEnabled(opened_diagram);
 	zoom_fit          -> setEnabled(opened_diagram);
 	zoom_reset        -> setEnabled(opened_diagram);
-	conductor_default -> setEnabled(opened_diagram);
 	infos_diagram     -> setEnabled(opened_diagram);
 	add_text          -> setEnabled(editable_diagram);
 	add_column        -> setEnabled(editable_diagram);
@@ -1443,15 +1436,6 @@
 }
 
 /**
-	Edite les proprietes par defaut des conducteurs
-*/
-void QETDiagramEditor::slot_editDefaultConductors() {
-	if (DiagramView *dv = currentDiagram()) {
-		dv -> editDefaultConductorProperties();
-	}
-}
-
-/**
 	Ajoute un texte au schema courant
 */
 void QETDiagramEditor::slot_addText() {

Modified: branches/0.3/sources/qetdiagrameditor.h
===================================================================
--- branches/0.3/sources/qetdiagrameditor.h	2010-12-28 07:05:31 UTC (rev 1138)
+++ branches/0.3/sources/qetdiagrameditor.h	2010-12-28 08:21:45 UTC (rev 1139)
@@ -120,7 +120,6 @@
 	void editSelectionProperties();
 	void slot_editConductor();
 	void slot_resetConductors();
-	void slot_editDefaultConductors();
 	void slot_addText();
 	void setWindowedMode();
 	void setTabbedMode();


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/