mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Read only is no more managed for each diagram but for the whole project
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3565 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -54,8 +54,7 @@ Diagram::Diagram(QETProject *project) :
|
||||
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,20 +1245,13 @@ qreal Diagram::declaredQElectroTechVersion(bool fallback_to_project) const {
|
||||
}
|
||||
|
||||
/**
|
||||
@return true si le schema est en lecture seule
|
||||
*/
|
||||
bool Diagram::isReadOnly() const {
|
||||
return(read_only_);
|
||||
}
|
||||
|
||||
/**
|
||||
@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_));
|
||||
}
|
||||
* @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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -97,7 +97,6 @@ class Diagram : public QGraphicsScene
|
||||
bool use_border_;
|
||||
bool draw_terminals_;
|
||||
bool draw_colored_conductors_;
|
||||
bool read_only_;
|
||||
|
||||
QString m_conductors_autonum_name;
|
||||
|
||||
@@ -120,14 +119,11 @@ class Diagram : public QGraphicsScene
|
||||
|
||||
// methods related to parent project
|
||||
QETProject *project() const;
|
||||
void setProject(QETProject *);
|
||||
int folioIndex() const;
|
||||
qreal declaredQElectroTechVersion(bool = true) const;
|
||||
void showMe() {emit showDiagram(this);}
|
||||
|
||||
// methods related to read only mode
|
||||
bool isReadOnly() const;
|
||||
void setReadOnly(bool);
|
||||
void setProject(QETProject *);
|
||||
int folioIndex() const;
|
||||
qreal declaredQElectroTechVersion(bool = true) const;
|
||||
void showMe() {emit showDiagram(this);}
|
||||
bool isReadOnly() const;
|
||||
|
||||
// methods related to conductor creation
|
||||
void setConductor(bool);
|
||||
@@ -213,17 +209,14 @@ class Diagram : public QGraphicsScene
|
||||
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 *)
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) :
|
||||
|
||||
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()));
|
||||
|
||||
@@ -607,19 +607,16 @@ bool QETProject::isReadOnly() const {
|
||||
}
|
||||
|
||||
/**
|
||||
@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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user