LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ProjectEditor Class Referencefinal

The ProjectEditor class. More...

#include <projecteditor.h>

Inherits QObject.

+ Collaboration diagram for ProjectEditor:

Public Slots

void showAllRequiredEditors () noexcept
 Open the schematic and/or the board editor window. More...
 
void showSchematicEditor () noexcept
 Open the schematic editor window and bring it to the front. More...
 
void showBoardEditor () noexcept
 Open the board editor window and bring it to the front. More...
 
void execProjectSettingsDialog (QWidget *parent=nullptr) noexcept
 Execute the project settings dialog (blocking!) More...
 
void execNetClassesEditorDialog (QWidget *parent=nullptr) noexcept
 Execute the netclasses editor dialog (blocking!) More...
 
bool saveProject () noexcept
 Save the whole project to the harddisc. More...
 
bool autosaveProject () noexcept
 Make a automatic backup of the project (save to temporary files) More...
 
bool closeAndDestroy (bool askForSave, QWidget *msgBoxParent=0) noexcept
 Close the project (this will destroy this object!) More...
 

Signals

void showControlPanelClicked ()
 
void openProjectLibraryUpdaterClicked (const FilePath &fp)
 
void projectEditorClosed ()
 

Public Member Functions

 ProjectEditor ()=delete
 
 ProjectEditor (const Project &other)=delete
 
 ProjectEditor (workspace::Workspace &workspace, Project &project)
 The constructor. More...
 
 ~ProjectEditor () noexcept
 The destructor. More...
 
workspace::WorkspacegetWorkspace () const noexcept
 
ProjectgetProject () const noexcept
 
UndoStackgetUndoStack () const noexcept
 Get a reference to the undo stack of the project. More...
 
bool windowIsAboutToClose (QMainWindow &window) noexcept
 Inform the editor that a project related window is about to close. More...
 
ProjectEditoroperator= (const Project &rhs)=delete
 

Private Member Functions

int getCountOfVisibleEditorWindows () const noexcept
 

Private Attributes

workspace::WorkspacemWorkspace
 
ProjectmProject
 
QTimer mAutoSaveTimer
 
UndoStackmUndoStack
 See The undo/redo system (Command Design Pattern). More...
 
SchematicEditormSchematicEditor
 The schematic editor (GUI) More...
 
BoardEditormBoardEditor
 The board editor (GUI) More...
 

Detailed Description

The ProjectEditor class.

Author
ubruhin
Date
2015-06-28

Constructor & Destructor Documentation

ProjectEditor ( )
delete
ProjectEditor ( const Project other)
delete
ProjectEditor ( workspace::Workspace workspace,
Project project 
)

The constructor.

+ Here is the call graph for this function:

~ProjectEditor ( )
noexcept

The destructor.

+ Here is the call graph for this function:

Member Function Documentation

workspace::Workspace& getWorkspace ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

Project& getProject ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

UndoStack& getUndoStack ( ) const
inlinenoexcept

Get a reference to the undo stack of the project.

Returns
A reference to the UndoStack object

+ Here is the caller graph for this function:

bool windowIsAboutToClose ( QMainWindow &  window)
noexcept

Inform the editor that a project related window is about to close.

The project must be closed and destroyed automatically after the last opened window of the project is closed, because without a window the user is no longer able to close the project himself. So, every project related window have to "ask" the ProjectEditor object whether it is allowed to close or not. If the last opened window wants to close, the editor will first ask the user if unsaved changes should be written to the harddisc. Only if the user accepts this question and the project is saved successfully, the method will return true to allow the last window to close. Then it will also close the whole project.

Parameters
windowA reference to the window which is about to close
Returns
true if the window can be closed, false if closing the window is denied
ProjectEditor& operator= ( const Project rhs)
delete
void showAllRequiredEditors ( )
slotnoexcept

Open the schematic and/or the board editor window.

Which editors this will open depends on whether the project has schematics and/or boards. If there aren't any boards or schematics, the schematic editor will be shown anyway (otherwise the whole project editor would be invisible).

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void showSchematicEditor ( )
slotnoexcept

Open the schematic editor window and bring it to the front.

+ Here is the caller graph for this function:

void showBoardEditor ( )
slotnoexcept

Open the board editor window and bring it to the front.

+ Here is the caller graph for this function:

void execProjectSettingsDialog ( QWidget *  parent = nullptr)
slotnoexcept

Execute the project settings dialog (blocking!)

Parameters
parentparent widget of the settings dialog (optional)
void execNetClassesEditorDialog ( QWidget *  parent = nullptr)
slotnoexcept

Execute the netclasses editor dialog (blocking!)

Parameters
parentparent widget of the dialog (optional)
bool saveProject ( )
slotnoexcept

Save the whole project to the harddisc.

Note
The whole save procedere is described in Saving Procedere / Automatic Periodically Saving.
Returns
true on success, false on failure

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool autosaveProject ( )
slotnoexcept

Make a automatic backup of the project (save to temporary files)

Note
The whole save procedere is described in Saving Procedere / Automatic Periodically Saving.
Returns
true on success, false on failure

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool closeAndDestroy ( bool  askForSave,
QWidget *  msgBoxParent = 0 
)
slotnoexcept

Close the project (this will destroy this object!)

If there are unsaved changes to the project, this method will ask the user whether the changes should be saved or not. If the user clicks on "cancel" or the project could not be saved successfully, this method will return false. If there was no such error, this method will call QObject::deleteLater() which means that this object will be deleted in the Qt's event loop.

Warning
This method can be called both from within this class and from outside this class (for example from the #ControlPanel). But if you call this method from outside this class, you may have to delete the object yourself afterwards! In special cases, the deleteLater() mechanism could lead in fatal errors otherwise!
Parameters
askForSaveIf true and there are unsaved changes, this method shows a message box to ask whether the project should be saved or not. If false, the project will NOT be saved.
msgBoxParentHere you can specify a parent window for the message box
Returns
true on success (project closed), false on failure (project stays open)

+ Here is the caller graph for this function:

void showControlPanelClicked ( )
signal
void openProjectLibraryUpdaterClicked ( const FilePath fp)
signal
void projectEditorClosed ( )
signal

+ Here is the caller graph for this function:

int getCountOfVisibleEditorWindows ( ) const
privatenoexcept

+ Here is the caller graph for this function:

Member Data Documentation

workspace::Workspace& mWorkspace
private
Project& mProject
private
QTimer mAutoSaveTimer
private

the timer for the periodically automatic saving functionality (see also Saving Procedere / Automatic Periodically Saving)

SchematicEditor* mSchematicEditor
private

The schematic editor (GUI)

BoardEditor* mBoardEditor
private

The board editor (GUI)


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