Logo Search packages:      
Sourcecode: qelectrotech version File versions  Download package

void QETDiagramEditor::addProjectView ( ProjectView project_view  ) 

Ajoute un projet dans l'espace de travail

Parameters:
project_view Le projet a ajouter dans l'espace de travail

Definition at line 1198 of file qetdiagrameditor.cpp.

References diagramIsAboutToBeRemoved(), diagramOrderChanged(), diagramWasAdded(), diagramWasRemoved(), findElementInPanel(), pa, projectWasClosed(), slot_updateActions(), and slot_updateWindowsMenu().

Referenced by addProject().

                                                               {
      if (!project_view) return;
      
      // on maximise la nouvelle fenetre si la fenetre en cours est inexistante ou bien maximisee
      QWidget *current_window = workspace.activeSubWindow();
      bool maximise = ((!current_window) || (current_window -> windowState() & Qt::WindowMaximized));
      
      // ajoute la fenetre
      QMdiSubWindow *sub_window = workspace.addSubWindow(project_view);
      sub_window -> setWindowIcon(project_view -> windowIcon());
      
      // lie les schemas du projet a l'editeur :
      // quand on change de schemas a l'interieur d'un projet, on met a jour les menus
      connect(project_view, SIGNAL(diagramActivated(DiagramView *)), this, SLOT(slot_updateWindowsMenu()));
      connect(project_view, SIGNAL(diagramActivated(DiagramView *)), this, SLOT(slot_updateActions()));
      foreach(DiagramView *dv, project_view -> diagrams()) {
            diagramWasAdded(dv);
      }
      
      // gere la fermeture du projet
      connect(project_view, SIGNAL(projectClosed(ProjectView*)), this, SLOT(projectWasClosed(ProjectView *)));
      
      // gere l'ajout et le retrait de schema du projet
      connect(project_view, SIGNAL(diagramAdded(DiagramView *)),   this, SLOT(diagramWasAdded(DiagramView *)));
      connect(project_view, SIGNAL(diagramAdded(DiagramView *)),   this, SLOT(slot_updateActions()));
      connect(project_view, SIGNAL(diagramAboutToBeRemoved(DiagramView *)), this, SLOT(diagramIsAboutToBeRemoved(DiagramView *)));
      connect(project_view, SIGNAL(diagramRemoved(DiagramView *)), this, SLOT(diagramWasRemoved(DiagramView *)));
      connect(project_view, SIGNAL(diagramRemoved(DiagramView *)), this, SLOT(slot_updateActions()));
      if (QETProject *project = project_view -> project()) {
            connect(project, SIGNAL(diagramAdded  (QETProject *, Diagram*)), &(pa -> elementsPanel()), SLOT(diagramWasAdded  (QETProject *, Diagram*)));
            connect(project, SIGNAL(diagramRemoved(QETProject *, Diagram*)), &(pa -> elementsPanel()), SLOT(diagramWasRemoved(QETProject *, Diagram*)));
            
            // on met aussi les menus a jour quand un projet passe en lecture seule ou non
            connect(project, SIGNAL(readOnlyChanged(QETProject *, bool)), this, SLOT(slot_updateActions()));
      }
      
      // gere les changements de l'ordre des schemas dans le projet
      connect(project_view, SIGNAL(diagramOrderChanged(ProjectView *, int, int)), this, SLOT(diagramOrderChanged(ProjectView *, int, int)));
      
      // gere les demandes consistant a retrouver un element dans le panel
      connect(project_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SLOT(findElementInPanel(const ElementsLocation &)));
      
      // affiche la fenetre
      if (maximise) project_view -> showMaximized();
      else project_view -> show();
}


Generated by  Doxygen 1.6.0   Back to index