[qet] [867] Les proprietes des projets et schemas sont desormais accessibles en mode lecture seule .

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


Revision: 867
Author:   xavier
Date:     2010-02-28 00:33:10 +0100 (Sun, 28 Feb 2010)
Log Message:
-----------
Les proprietes des projets et schemas sont desormais accessibles en mode lecture seule.

Modified Paths:
--------------
    trunk/sources/borderpropertieswidget.cpp
    trunk/sources/borderpropertieswidget.h
    trunk/sources/conductorpropertieswidget.cpp
    trunk/sources/conductorpropertieswidget.h
    trunk/sources/diagramview.cpp
    trunk/sources/insetpropertieswidget.cpp
    trunk/sources/insetpropertieswidget.h
    trunk/sources/projectview.cpp
    trunk/sources/qetdiagrameditor.cpp

Modified: trunk/sources/borderpropertieswidget.cpp
===================================================================
--- trunk/sources/borderpropertieswidget.cpp	2010-02-27 21:42:28 UTC (rev 866)
+++ trunk/sources/borderpropertieswidget.cpp	2010-02-27 23:33:10 UTC (rev 867)
@@ -40,7 +40,7 @@
 }
 
 /**
-	@return the border properties edited and modified by
+	@return Les proprietes editees par ce widget
 */
 const BorderProperties &BorderPropertiesWidget::borderProperties() {
 	border_.columns_count   = columns_count   -> value();
@@ -53,6 +53,25 @@
 }
 
 /**
+	@return true si ce widget est en lecture seule, false sinon
+*/
+bool BorderPropertiesWidget::isReadOnly() const {
+	return(columns_count -> isReadOnly());
+}
+
+/**
+	@param ro true pour passer ce widget en lecture seule, false sinon
+*/
+void BorderPropertiesWidget::setReadOnly(bool ro) {
+	columns_count   -> setReadOnly(ro);
+	columns_width   -> setReadOnly(ro);
+	display_columns -> setDisabled(ro);
+	rows_count      -> setReadOnly(ro);
+	rows_height     -> setReadOnly(ro);
+	display_rows    -> setDisabled(ro);
+}
+
+/**
 	Definit les proprietes a editer
 	@param bp Nouvelles proprietes
 */

Modified: trunk/sources/borderpropertieswidget.h
===================================================================
--- trunk/sources/borderpropertieswidget.h	2010-02-27 21:42:28 UTC (rev 866)
+++ trunk/sources/borderpropertieswidget.h	2010-02-27 23:33:10 UTC (rev 867)
@@ -39,6 +39,8 @@
 	// methodes
 	public:
 	const BorderProperties &borderProperties();
+	bool isReadOnly() const;
+	void setReadOnly(bool);
 	
 	private:
 	void setEditedBorder(const BorderProperties &);

Modified: trunk/sources/conductorpropertieswidget.cpp
===================================================================
--- trunk/sources/conductorpropertieswidget.cpp	2010-02-27 21:42:28 UTC (rev 866)
+++ trunk/sources/conductorpropertieswidget.cpp	2010-02-27 23:33:10 UTC (rev 867)
@@ -268,3 +268,26 @@
 ConductorProperties ConductorPropertiesWidget::conductorProperties() const {
 	return(properties_);
 }
+
+/**
+	@return true si ce widget est en lecture seule, false sinon
+*/
+bool ConductorPropertiesWidget::isReadOnly() const {
+	return(text_field -> isReadOnly());
+}
+
+/**
+	@param ro true pour passer ce widget en lecture seule, false sinon
+*/
+void ConductorPropertiesWidget::setReadOnly(bool ro) {
+	simple    -> setDisabled(ro);
+	multiline -> setDisabled(ro);
+	singleline -> setDisabled(ro);
+	text_field -> setReadOnly(ro);
+	phase_checkbox -> setDisabled(ro);
+	phase_spinbox -> setReadOnly(ro);
+	ground_checkbox -> setDisabled(ro);
+	neutral_checkbox -> setDisabled(ro);
+	color_button -> setDisabled(ro);
+	dashed_checkbox -> setDisabled(ro);
+}

Modified: trunk/sources/conductorpropertieswidget.h
===================================================================
--- trunk/sources/conductorpropertieswidget.h	2010-02-27 21:42:28 UTC (rev 866)
+++ trunk/sources/conductorpropertieswidget.h	2010-02-27 23:33:10 UTC (rev 867)
@@ -40,6 +40,8 @@
 	public:
 	void setConductorProperties(const ConductorProperties &);
 	ConductorProperties conductorProperties() const;
+	bool isReadOnly() const;
+	void setReadOnly(bool);
 	
 	private:
 	void setConductorType(ConductorProperties::ConductorType);

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2010-02-27 21:42:28 UTC (rev 866)
+++ trunk/sources/diagramview.cpp	2010-02-27 23:33:10 UTC (rev 867)
@@ -337,7 +337,7 @@
 	Edite les informations du schema.
 */
 void DiagramView::editDiagramProperties() {
-	if (scene -> isReadOnly()) return;
+	bool diagram_is_read_only = scene -> isReadOnly();
 	
 	// recupere le cartouche et les dimensions du schema
 	InsetProperties  inset  = scene -> border_and_inset.exportInset();
@@ -353,10 +353,12 @@
 	popup.setWindowTitle(tr("Propri\351t\351s du sch\351ma", "window title"));
 	
 	BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup);
+	border_infos -> setReadOnly(diagram_is_read_only);
 	InsetPropertiesWidget  *inset_infos  = new InsetPropertiesWidget(inset, false, &popup);
+	inset_infos -> setReadOnly(diagram_is_read_only);
 	
 	// boutons
-	QDialogButtonBox boutons(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(rejected()), &popup, SLOT(reject()));
 	
@@ -367,7 +369,7 @@
 	layout_v.addStretch();
 	layout_v.addWidget(&boutons);
 	// si le dialogue est accepte
-	if (popup.exec() == QDialog::Accepted) {
+	if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
 		InsetProperties new_inset   = inset_infos  -> insetProperties();
 		BorderProperties new_border = border_infos -> borderProperties();
 		// s'il y a des modifications au cartouche
@@ -750,9 +752,11 @@
 	futurs nouveaux conducteurs
 */
 void DiagramView::editDefaultConductorProperties() {
-	if (scene -> isReadOnly()) return;
+	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());
@@ -763,13 +767,13 @@
 	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(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+	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) {
+	if (conductor_dialog.exec() == QDialog::Accepted && !diagram_is_read_only) {
 		scene -> defaultConductorProperties = cpw -> conductorProperties();
 	}
 }

Modified: trunk/sources/insetpropertieswidget.cpp
===================================================================
--- trunk/sources/insetpropertieswidget.cpp	2010-02-27 21:42:28 UTC (rev 866)
+++ trunk/sources/insetpropertieswidget.cpp	2010-02-27 23:33:10 UTC (rev 867)
@@ -153,3 +153,24 @@
 bool InsetPropertiesWidget::displayCurrentDate() const {
 	return(display_current_date);
 }
+
+/**
+	@return true si ce widget est en lecture seule, false sinon
+*/
+bool InsetPropertiesWidget::isReadOnly() const {
+	return(inset_title -> isReadOnly());
+}
+
+/**
+	@param ro true pour passer ce widget en lecture seule, false sinon
+*/
+void InsetPropertiesWidget::setReadOnly(bool ro) {
+	inset_title        -> setReadOnly(ro);
+	inset_author       -> setReadOnly(ro);
+	inset_date         -> setReadOnly(ro);
+	inset_filename     -> setReadOnly(ro);
+	inset_folio        -> setReadOnly(ro);
+	inset_no_date      -> setDisabled(ro);
+	inset_current_date -> setDisabled(ro);
+	inset_fixed_date   -> setDisabled(ro);
+}

Modified: trunk/sources/insetpropertieswidget.h
===================================================================
--- trunk/sources/insetpropertieswidget.h	2010-02-27 21:42:28 UTC (rev 866)
+++ trunk/sources/insetpropertieswidget.h	2010-02-27 23:33:10 UTC (rev 867)
@@ -37,6 +37,8 @@
 	InsetProperties insetProperties() const;
 	void setInsetProperties(const InsetProperties &);
 	bool displayCurrentDate() const;
+	bool isReadOnly() const;
+	void setReadOnly(bool);
 	
 	// attributs
 	private:

Modified: trunk/sources/projectview.cpp
===================================================================
--- trunk/sources/projectview.cpp	2010-02-27 21:42:28 UTC (rev 866)
+++ trunk/sources/projectview.cpp	2010-02-27 23:33:10 UTC (rev 867)
@@ -399,6 +399,8 @@
 void ProjectView::editProjectProperties() {
 	if (!project_) return;
 	
+	bool project_is_read_only = project_ -> isReadOnly();
+	
 	// dialogue d'edition des proprietes du projet
 	QDialog properties_dialog(parentWidget());
 #ifdef Q_WS_MAC
@@ -412,22 +414,26 @@
 	// titre du projet
 	QLabel *title_label = new QLabel(tr("Titre du projet :"));
 	QLineEdit *title_field = new QLineEdit(project_ -> title());
+	title_field -> setReadOnly(project_is_read_only);
 	
 	// proprietes des nouveaux schemas
 	QLabel *new_diagrams_prop = new QLabel(tr("Propri\351t\351s \340 utiliser lors de l'ajout d'un nouveau sch\351ma au projet :"));
 	
 	// dimensions par defaut d'un schema
 	BorderPropertiesWidget *bpw = new BorderPropertiesWidget(project_ -> defaultBorderProperties());
+	bpw -> setReadOnly(project_is_read_only);
 	
 	// proprietes par defaut d'un cartouche
 	InsetPropertiesWidget *ipw = new InsetPropertiesWidget(project_ -> defaultInsetProperties(), true);
+	ipw -> setReadOnly(project_is_read_only);
 	
 	// proprietes par defaut des conducteurs
 	ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(project_ -> defaultConductorProperties());
 	cpw -> setContentsMargins(0, 0, 0, 0);
+	cpw -> setReadOnly(project_is_read_only);
 	
 	// boutons pour valider le dialogue
-	QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+	QDialogButtonBox *buttons = new QDialogButtonBox(project_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
 	
 	connect(buttons, SIGNAL(accepted()), &properties_dialog, SLOT(accept()));
 	connect(buttons, SIGNAL(rejected()), &properties_dialog, SLOT(reject()));
@@ -460,7 +466,7 @@
 	vert_layout -> addWidget(buttons);
 	
 	// si le dialogue est accepte
-	if (properties_dialog.exec() == QDialog::Accepted && !project_ -> isReadOnly()) {
+	if (properties_dialog.exec() == QDialog::Accepted && !project_is_read_only) {
 		project_ -> setTitle(title_field -> text());
 		project_ -> setDefaultBorderProperties(bpw -> borderProperties());
 		project_ -> setDefaultInsetProperties(ipw -> insetProperties());

Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp	2010-02-27 21:42:28 UTC (rev 866)
+++ trunk/sources/qetdiagrameditor.cpp	2010-02-27 23:33:10 UTC (rev 867)
@@ -572,9 +572,9 @@
 	view_bar -> addAction(zoom_reset);
 	
 	diagram_bar -> addAction(infos_diagram);
-	diagram_bar -> addAction(add_text);
 	diagram_bar -> addAction(conductor_default);
 	diagram_bar -> addAction(conductor_reset);
+	diagram_bar -> addAction(add_text);
 	
 	// ajout de la barre d'outils a la fenetre principale
 	addToolBar(Qt::TopToolBarArea, main_bar);
@@ -1084,10 +1084,10 @@
 	
 	// actions ayant juste besoin d'un document ouvert
 	close_file        -> setEnabled(opened_project);
-	save_file         -> setEnabled(opened_project && editable_project);
+	save_file         -> setEnabled(editable_project);
 	save_file_sous    -> setEnabled(opened_project);
-	save_all          -> setEnabled(opened_diagram && editable_diagram);
-	prj_edit_prop     -> setEnabled(editable_project);
+	save_all          -> setEnabled(editable_diagram);
+	prj_edit_prop     -> setEnabled(opened_project);
 	prj_add_diagram   -> setEnabled(editable_project);
 	prj_del_diagram   -> setEnabled(editable_project);
 	prj_clean         -> setEnabled(editable_project);
@@ -1101,8 +1101,8 @@
 	zoom_out          -> setEnabled(opened_diagram);
 	zoom_fit          -> setEnabled(opened_diagram);
 	zoom_reset        -> setEnabled(opened_diagram);
-	conductor_default -> setEnabled(editable_diagram);
-	infos_diagram     -> setEnabled(editable_diagram);
+	conductor_default -> setEnabled(opened_diagram);
+	infos_diagram     -> setEnabled(opened_diagram);
 	add_text          -> setEnabled(editable_diagram);
 	add_column        -> setEnabled(editable_diagram);
 	remove_column     -> setEnabled(editable_diagram);


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