QElectroTech  0.8-dev
Public Slots | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
ProjectView Class Reference

The ProjectView class This class provides a widget displaying the diagrams of a particular project using tabs. More...

#include <projectview.h>

Inherits QWidget.

Collaboration diagram for ProjectView:
Collaboration graph

Public Slots

void removeDiagram (DiagramView *)
 ProjectView::removeDiagram Remove a diagram (folio) of the project. More...
 
void removeDiagram (Diagram *)
 
void showDiagram (DiagramView *)
 
void showDiagram (Diagram *)
 
void editProjectProperties ()
 
void editCurrentDiagramProperties ()
 
void editDiagramProperties (DiagramView *)
 
void editDiagramProperties (Diagram *)
 
void moveDiagramUp (DiagramView *)
 
void moveDiagramUp (Diagram *)
 
void moveDiagramDown (DiagramView *)
 
void moveDiagramDown (Diagram *)
 
void moveDiagramUpTop (DiagramView *)
 
void moveDiagramUpTop (Diagram *)
 
void moveDiagramUpx10 (DiagramView *)
 
void moveDiagramUpx10 (Diagram *)
 
void moveDiagramDownx10 (DiagramView *)
 
void moveDiagramDownx10 (Diagram *)
 
void printProject ()
 
void exportProject ()
 
QETResult save ()
 
QETResult saveAs ()
 
QETResult doSave ()
 
int cleanProject ()
 
void updateWindowTitle ()
 ProjectView::updateWindowTitle Update the project view title. More...
 
void updateTabTitle (DiagramView *)
 ProjectView::updateTabTitle Update the title of the tab which display the diagram view. More...
 
void updateAllTabsTitle ()
 ProjectView::updateAllTabsTitle Update all tabs title. More...
 
void tabMoved (int, int)
 

Signals

void diagramAdded (DiagramView *)
 
void diagramRemoved (DiagramView *)
 
void diagramActivated (DiagramView *)
 
void projectClosed (ProjectView *)
 
void errorEncountered (const QString &)
 
void findElementRequired (const ElementsLocation &)
 
void editElementRequired (const ElementsLocation &)
 

Public Member Functions

 ProjectView (QETProject *, QWidget *=nullptr)
 
 ~ProjectView () override
 
QETProjectproject ()
 
void setProject (QETProject *)
 ProjectView::setProject Set the project display by the project view. More...
 
QList< DiagramView * > diagram_views () const
 
DiagramViewcurrentDiagram () const
 ProjectView::currentDiagram. More...
 
void closeEvent (QCloseEvent *) override
 
void changeTabUp ()
 change current diagramview to previous tab More...
 
void changeTabDown ()
 change current diagramview to next folio More...
 
void changeFirstTab ()
 change current diagramview to first tab More...
 
void changeLastTab ()
 change current diagramview to last tab More...
 

Private Slots

void tabChanged (int)
 ProjectView::tabChanged Manage the tab change. If tab_id == -1 (there is no diagram opened), we display the fallback widget. More...
 
void tabDoubleClicked (int)
 
void setDisplayFallbackWidget (bool)
 
void adjustReadOnlyState ()
 
void diagramAdded (Diagram *diagram)
 ProjectView::diagramAdded Slot called when qetproject emit diagramAdded. More...
 

Private Member Functions

 ProjectView (const ProjectView &)
 
void initActions ()
 
void initWidgets ()
 
void initLayout ()
 
void loadDiagrams ()
 ProjectView::loadDiagrams Load diagrams of project. We create a diagram view for each diagram, and add it to the project view. More...
 
DiagramViewfindDiagram (Diagram *)
 
DiagramViewnextDiagram ()
 
DiagramViewpreviousDiagram ()
 
DiagramViewfirstDiagram ()
 
DiagramViewlastDiagram ()
 
void rebuildDiagramsMap ()
 
bool tryClosing ()
 
bool tryClosingElementEditors ()
 
int tryClosingDiagrams ()
 ProjectView::tryClosingDiagrams try to close this project, if diagram or project option are changed a dialog ask if user want to save the modification. More...
 
QString askUserForFilePath (bool=true)
 
QETResult noProjectResult () const
 

Private Attributes

QAction * m_add_new_diagram
 
QAction * m_first_view
 
QAction * m_end_view
 
QETProjectm_project
 
QVBoxLayout * layout_
 
QWidget * fallback_widget_
 
QLabel * fallback_label_
 
QTabWidget * m_tab
 
QMap< int, DiagramView * > m_diagram_ids
 
int m_previous_tab_index = -1
 
QList< DiagramView * > m_diagram_view_list
 

Detailed Description

The ProjectView class This class provides a widget displaying the diagrams of a particular project using tabs.

Constructor & Destructor Documentation

◆ ProjectView() [1/2]

ProjectView::ProjectView ( QETProject project,
QWidget *  parent = nullptr 
)

Constructeur

Parameters
projectprojet a visualiser
parentWidget parent
Here is the call graph for this function:

◆ ~ProjectView()

ProjectView::~ProjectView ( )
override

Destructeur Supprime les DiagramView embarquees

◆ ProjectView() [2/2]

ProjectView::ProjectView ( const ProjectView )
private

Member Function Documentation

◆ adjustReadOnlyState

void ProjectView::adjustReadOnlyState ( )
privateslot

Effectue les actions necessaires lorsque le projet visualise entre ou sort du mode lecture seule.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ askUserForFilePath()

QString ProjectView::askUserForFilePath ( bool  assign = true)
private

Ask the user to provide a file path in which the currently edited project will be saved.

Parameters
assignWhen true, assign the provided filepath to the project through setFilePath(). Defaults to true.
Returns
the file path, or an empty string if none were provided
Here is the caller graph for this function:

◆ changeFirstTab()

void ProjectView::changeFirstTab ( )

change current diagramview to first tab

Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeLastTab()

void ProjectView::changeLastTab ( )

change current diagramview to last tab

Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeTabDown()

void ProjectView::changeTabDown ( )

change current diagramview to next folio

Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeTabUp()

void ProjectView::changeTabUp ( )

change current diagramview to previous tab

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanProject

int ProjectView::cleanProject ( )
slot

Allow the user to clean the project, which includes: deleting unused title block templates deleting unused elements deleting empty categories

Returns
an integer value above zero if elements and/or categories were cleaned.
Here is the call graph for this function:

◆ closeEvent()

void ProjectView::closeEvent ( QCloseEvent *  qce)
override

Gere la fermeture du schema.

Parameters
qceLe QCloseEvent decrivant l'evenement
Here is the call graph for this function:

◆ currentDiagram()

DiagramView * ProjectView::currentDiagram ( ) const

ProjectView::currentDiagram.

Returns
The current active diagram view or nullptr if there isn't diagramView in this project view.
Here is the caller graph for this function:

◆ diagram_views()

QList< DiagramView * > ProjectView::diagram_views ( ) const
Returns
la liste des schemas ouverts dans le projet
Here is the caller graph for this function:

◆ diagramActivated

void ProjectView::diagramActivated ( DiagramView )
signal
Here is the caller graph for this function:

◆ diagramAdded [1/2]

void ProjectView::diagramAdded ( Diagram diagram)
privateslot

ProjectView::diagramAdded Slot called when qetproject emit diagramAdded.

Parameters
diagram
Here is the call graph for this function:

◆ diagramAdded [2/2]

void ProjectView::diagramAdded ( DiagramView )
signal
Here is the caller graph for this function:

◆ diagramRemoved

void ProjectView::diagramRemoved ( DiagramView )
signal
Here is the caller graph for this function:

◆ doSave

QETResult ProjectView::doSave ( )
slot

Save project content, then write the project file. May call saveAs if no filepath was provided before.

Returns
a QETResult object reflecting the situation; note that a valid QETResult object is returned if the operation was cancelled.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ editCurrentDiagramProperties

void ProjectView::editCurrentDiagramProperties ( )
slot

Edite les proprietes du schema courant

Here is the call graph for this function:

◆ editDiagramProperties [1/2]

void ProjectView::editDiagramProperties ( Diagram diagram)
slot

Edite les proprietes du schema diagram

Here is the call graph for this function:

◆ editDiagramProperties [2/2]

void ProjectView::editDiagramProperties ( DiagramView diagram_view)
slot

Edite les proprietes du schema diagram_view

Here is the call graph for this function:
Here is the caller graph for this function:

◆ editElementRequired

void ProjectView::editElementRequired ( const ElementsLocation )
signal
Here is the caller graph for this function:

◆ editProjectProperties

void ProjectView::editProjectProperties ( )
slot

Enable the user to edit properties of the current project through a configuration dialog.

Here is the call graph for this function:

◆ errorEncountered

void ProjectView::errorEncountered ( const QString &  )
signal
Here is the caller graph for this function:

◆ exportProject

void ProjectView::exportProject ( )
slot

Exporte le schema.

◆ findDiagram()

DiagramView * ProjectView::findDiagram ( Diagram diagram)
private
Parameters
diagramSchema a trouver
Returns
le DiagramView correspondant au schema passe en parametre, ou 0 si le schema n'est pas trouve
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findElementRequired

void ProjectView::findElementRequired ( const ElementsLocation )
signal
Here is the caller graph for this function:

◆ firstDiagram()

DiagramView * ProjectView::firstDiagram ( )
private
Returns
first folio of current project
Here is the caller graph for this function:

◆ initActions()

void ProjectView::initActions ( )
private

Initialize actions for this widget.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initLayout()

void ProjectView::initLayout ( )
private

Initialize layout for this widget.

Here is the caller graph for this function:

◆ initWidgets()

void ProjectView::initWidgets ( )
private

Initialize child widgets for this widget.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lastDiagram()

DiagramView * ProjectView::lastDiagram ( )
private
Returns
last folio of current project
Here is the caller graph for this function:

◆ loadDiagrams()

void ProjectView::loadDiagrams ( )
private

ProjectView::loadDiagrams Load diagrams of project. We create a diagram view for each diagram, and add it to the project view.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ moveDiagramDown [1/2]

void ProjectView::moveDiagramDown ( Diagram diagram)
slot

Deplace le schema diagram vers le bas / la droite

Here is the call graph for this function:

◆ moveDiagramDown [2/2]

void ProjectView::moveDiagramDown ( DiagramView diagram_view)
slot

Deplace le schema diagram_view vers le bas / la droite

Here is the caller graph for this function:

◆ moveDiagramDownx10 [1/2]

void ProjectView::moveDiagramDownx10 ( Diagram diagram)
slot

Deplace le schema diagram vers le bas / la droite x10

Here is the call graph for this function:

◆ moveDiagramDownx10 [2/2]

void ProjectView::moveDiagramDownx10 ( DiagramView diagram_view)
slot

Deplace le schema diagram_view vers le bas / la droite x10

Here is the caller graph for this function:

◆ moveDiagramUp [1/2]

void ProjectView::moveDiagramUp ( Diagram diagram)
slot

Deplace le schema diagram vers le haut / la gauche

Here is the call graph for this function:

◆ moveDiagramUp [2/2]

void ProjectView::moveDiagramUp ( DiagramView diagram_view)
slot

Deplace le schema diagram_view vers le haut / la gauche

Here is the caller graph for this function:

◆ moveDiagramUpTop [1/2]

void ProjectView::moveDiagramUpTop ( Diagram diagram)
slot
Here is the call graph for this function:

◆ moveDiagramUpTop [2/2]

void ProjectView::moveDiagramUpTop ( DiagramView diagram_view)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ moveDiagramUpx10 [1/2]

void ProjectView::moveDiagramUpx10 ( Diagram diagram)
slot

Deplace le schema diagram vers le haut / la gauche x10

Here is the call graph for this function:

◆ moveDiagramUpx10 [2/2]

void ProjectView::moveDiagramUpx10 ( DiagramView diagram_view)
slot

Deplace le schema diagram_view vers le haut / la gauche x10

Here is the caller graph for this function:

◆ nextDiagram()

DiagramView * ProjectView::nextDiagram ( )
private
Returns
next folio of current diagramview
Here is the caller graph for this function:

◆ noProjectResult()

QETResult ProjectView::noProjectResult ( ) const
private
Returns
the QETResult object to be returned when it appears this project view is not associated to any project.
Here is the caller graph for this function:

◆ previousDiagram()

DiagramView * ProjectView::previousDiagram ( )
private
Returns
previous folio of current diagramview
Here is the caller graph for this function:

◆ printProject

void ProjectView::printProject ( )
slot

Ce slot demarre un dialogue permettant a l'utilisateur de parametrer et de lancer l'impression de toute ou partie du projet.

Here is the call graph for this function:

◆ project()

QETProject * ProjectView::project ( )
Returns
le projet actuellement visualise par le ProjectView
Here is the caller graph for this function:

◆ projectClosed

void ProjectView::projectClosed ( ProjectView )
signal
Here is the caller graph for this function:

◆ rebuildDiagramsMap()

void ProjectView::rebuildDiagramsMap ( )
private

Reconstruit la map associant les index des onglets avec les DiagramView

Here is the caller graph for this function:

◆ removeDiagram [1/2]

void ProjectView::removeDiagram ( Diagram diagram)
slot

Enleve un schema du ProjectView

Parameters
diagramSchema a enlever
Here is the call graph for this function:

◆ removeDiagram [2/2]

void ProjectView::removeDiagram ( DiagramView diagram_view)
slot

ProjectView::removeDiagram Remove a diagram (folio) of the project.

Parameters
diagram_view: diagram view to remove
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save

QETResult ProjectView::save ( )
slot

Save project properties along with all modified diagrams.

See also
filePath()
setFilePath()
Returns
a QETResult object reflecting the situation
Here is the call graph for this function:

◆ saveAs

QETResult ProjectView::saveAs ( )
slot

Ask users for a filepath in order to save the project.

Parameters
optionsMay be used to specify what should be saved; defaults to all modified diagrams.
Returns
a QETResult object reflecting the situation; note that a valid QETResult object is returned if the operation was cancelled.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDisplayFallbackWidget

void ProjectView::setDisplayFallbackWidget ( bool  fallback)
privateslot
Parameters
fallbacktrue pour afficher le widget de fallback, false pour afficher les onglets. Le widget de Fallback est le widget affiche lorsque le projet ne comporte aucun schema.
Here is the caller graph for this function:

◆ setProject()

void ProjectView::setProject ( QETProject project)

ProjectView::setProject Set the project display by the project view.

Parameters
project
Here is the call graph for this function:
Here is the caller graph for this function:

◆ showDiagram [1/2]

void ProjectView::showDiagram ( Diagram diagram)
slot

Active l'onglet adequat pour afficher le schema passe en parametre

Parameters
diagramSchema a afficher
Here is the call graph for this function:

◆ showDiagram [2/2]

void ProjectView::showDiagram ( DiagramView diagram)
slot

Active l'onglet adequat pour afficher le schema passe en parametre

Parameters
diagramSchema a afficher
Here is the caller graph for this function:

◆ tabChanged

void ProjectView::tabChanged ( int  tab_id)
privateslot

ProjectView::tabChanged Manage the tab change. If tab_id == -1 (there is no diagram opened), we display the fallback widget.

Parameters
tab_id
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tabDoubleClicked

void ProjectView::tabDoubleClicked ( int  tab_id)
privateslot

Gere le double-clic sur un onglet : edite les proprietes du schema

Parameters
tab_idIndex de l'onglet concerne
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tabMoved

void ProjectView::tabMoved ( int  from,
int  to 
)
slot
Parameters
fromIndex de l'onglet avant le deplacement
toIndex de l'onglet apres le deplacement
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tryClosing()

bool ProjectView::tryClosing ( )
private

Cette methode essaye de fermer successivement les editeurs d'element puis les schemas du projet. L'utilisateur peut refuser de fermer un schema ou un editeur.

Returns
true si tout a pu etre ferme, false sinon
See also
tryClosingElementEditors()
tryClosingDiagrams()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tryClosingDiagrams()

int ProjectView::tryClosingDiagrams ( )
private

ProjectView::tryClosingDiagrams try to close this project, if diagram or project option are changed a dialog ask if user want to save the modification.

Returns
the answer of dialog or discard if no change.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tryClosingElementEditors()

bool ProjectView::tryClosingElementEditors ( )
private

Un projet comporte des elements integres. Cette methode ferme les editeurs d'elements associes a ce projet. L'utilisateur peut refuser la fermeture d'un editeur d'element.

Returns
true si tous les editeurs d'element ont pu etre fermes, false sinon
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateAllTabsTitle

void ProjectView::updateAllTabsTitle ( )
slot

ProjectView::updateAllTabsTitle Update all tabs title.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTabTitle

void ProjectView::updateTabTitle ( DiagramView diagram_view)
slot

ProjectView::updateTabTitle Update the title of the tab which display the diagram view.

Parameters
diagram_view: The diagram view.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateWindowTitle

void ProjectView::updateWindowTitle ( )
slot

ProjectView::updateWindowTitle Update the project view title.

Here is the caller graph for this function:

Member Data Documentation

◆ fallback_label_

QLabel* ProjectView::fallback_label_
private

◆ fallback_widget_

QWidget* ProjectView::fallback_widget_
private

◆ layout_

QVBoxLayout* ProjectView::layout_
private

◆ m_add_new_diagram

QAction* ProjectView::m_add_new_diagram
private

◆ m_diagram_ids

QMap<int, DiagramView *> ProjectView::m_diagram_ids
private

◆ m_diagram_view_list

QList<DiagramView *> ProjectView::m_diagram_view_list
private

◆ m_end_view

QAction * ProjectView::m_end_view
private

◆ m_first_view

QAction * ProjectView::m_first_view
private

◆ m_previous_tab_index

int ProjectView::m_previous_tab_index = -1
private

◆ m_project

QETProject* ProjectView::m_project
private

◆ m_tab

QTabWidget* ProjectView::m_tab
private

The documentation for this class was generated from the following files: