[qet] [3565] Read only is no more managed for each diagram but for the whole project

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


Revision: 3565
Author:   blacksun
Date:     2014-12-21 14:17:35 +0100 (Sun, 21 Dec 2014)
Log Message:
-----------
Read only is no more managed for each diagram but for the whole project

Modified Paths:
--------------
    trunk/sources/diagram.cpp
    trunk/sources/diagram.h
    trunk/sources/diagramview.cpp
    trunk/sources/qetproject.cpp

Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp	2014-12-21 12:50:26 UTC (rev 3564)
+++ trunk/sources/diagram.cpp	2014-12-21 13:17:35 UTC (rev 3565)
@@ -54,8 +54,7 @@
 	draw_grid_               (true),
 	use_border_              (true),
 	draw_terminals_          (true),
-	draw_colored_conductors_ (true),
-	read_only_               (false)
+	draw_colored_conductors_ (true)
 {
 	setProject(project);
 	qgi_manager_ = new QGIManager(this);
@@ -1246,23 +1245,16 @@
 }
 
 /**
-	@return true si le schema est en lecture seule
-*/
-bool Diagram::isReadOnly() const {
-	return(read_only_);
+ * @brief Diagram::isReadOnly
+ * @return  true if this diagram is read only.
+ * This method is same has call Diagram::project() -> isReadOnly()
+ */
+bool Diagram::isReadOnly() const
+{
+	return project_ -> isReadOnly();
 }
 
 /**
-	@param read_only true pour passer le schema en lecture seule, false sinon
-*/
-void Diagram::setReadOnly(bool read_only) {
-	if (read_only_ != read_only) {
-		read_only_ = read_only;
-		emit(readOnlyChanged(read_only_));
-	}
-}
-
-/**
 	@return Le contenu du schema. Les conducteurs sont tous places dans
 	conductorsToMove.
 */

Modified: trunk/sources/diagram.h
===================================================================
--- trunk/sources/diagram.h	2014-12-21 12:50:26 UTC (rev 3564)
+++ trunk/sources/diagram.h	2014-12-21 13:17:35 UTC (rev 3565)
@@ -97,7 +97,6 @@
 		bool use_border_;
 		bool draw_terminals_;
 		bool draw_colored_conductors_;
-		bool read_only_;
 
 		QString m_conductors_autonum_name;
 	
@@ -120,15 +119,12 @@
 	
 		// methods related to parent project
 		QETProject *project() const;
-		void setProject(QETProject *);
-		int folioIndex() const;
-		qreal declaredQElectroTechVersion(bool = true) const;
-		void showMe() {emit showDiagram(this);}
+		void        setProject(QETProject *);
+		int         folioIndex() const;
+		qreal       declaredQElectroTechVersion(bool = true) const;
+		void        showMe() {emit showDiagram(this);}
+		bool        isReadOnly() const;
 	
-	// methods related to read only mode
-	bool isReadOnly() const;
-	void setReadOnly(bool);
-	
 	// methods related to conductor creation
 	void setConductor(bool);
 	void setConductorStart (QPointF);
@@ -213,17 +209,14 @@
 	void invertSelection();
 	
 	signals:
-	void showDiagram (Diagram *);
-	void written();
-	void readOnlyChanged(bool);
-	void usedTitleBlockTemplateChanged(const QString &);
-	void diagramTitleChanged(Diagram *, const QString &);
-	/// Signal emitted when users wish to locate an element from the diagram within elements collection
-	void findElementRequired(const ElementsLocation &);
-	/// Signal emitted when users wish to edit an element from the diagram
-	void editElementRequired(const ElementsLocation &);
-	void reportPropertiesChanged(QString);
-	void XRefPropertiesChanged();
+		void showDiagram (Diagram *);
+		void written();
+		void usedTitleBlockTemplateChanged(const QString &);
+		void diagramTitleChanged(Diagram *, const QString &);
+		void findElementRequired(const ElementsLocation &);		/// Signal emitted when users wish to locate an element from the diagram within elements collection
+		void editElementRequired(const ElementsLocation &);		/// Signal emitted when users wish to edit an element from the diagram
+		void reportPropertiesChanged(QString);
+		void XRefPropertiesChanged();
 };
 Q_DECLARE_METATYPE(Diagram *)
 

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2014-12-21 12:50:26 UTC (rev 3564)
+++ trunk/sources/diagramview.cpp	2014-12-21 13:17:35 UTC (rev 3565)
@@ -86,7 +86,6 @@
 	
 	connect(scene, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*)));
 	connect(scene, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
-	connect(scene, SIGNAL(readOnlyChanged(bool)), this, SLOT(applyReadOnly()));
 	connect(&(scene -> border_and_titleblock), SIGNAL(borderChanged(QRectF, QRectF)), this, SLOT(adjustSceneRect()));
 	connect(&(scene -> border_and_titleblock), SIGNAL(displayChanged()),              this, SLOT(adjustSceneRect()));
 	connect(&(scene -> border_and_titleblock), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle()));

Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp	2014-12-21 12:50:26 UTC (rev 3564)
+++ trunk/sources/qetproject.cpp	2014-12-21 13:17:35 UTC (rev 3565)
@@ -607,19 +607,16 @@
 }
 
 /**
-	@param read_only true pour passer le projet (schemas et collection)
-	en mode Read Only, false sinon.
-*/
-void QETProject::setReadOnly(bool read_only) {
-	if (read_only_ != read_only) {
-		// memorise le fichier pour lequel ce projet est en lecture seule
-		read_only_file_path_ = file_path_;
-		
-		// applique le nouveau mode aux schemas
-		foreach(Diagram *diagram, diagrams()) {
-			diagram -> setReadOnly(read_only);
-		}
-		
+ * @brief QETProject::setReadOnly
+ * Set this project to read only if @read_only = true
+ * @param read_only
+ */
+void QETProject::setReadOnly(bool read_only)
+{
+	if (read_only_ != read_only)
+	{
+			//keep the file to which this project is read-only
+		read_only_file_path_ = file_path_;		
 		read_only_ = read_only;
 		emit(readOnlyChanged(this, read_only));
 	}


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