LibrePCB Developers Documentation
ProjectEditor Class Referencefinal

The ProjectEditor class. More...

#include <projecteditor.h>

Inherits QObject.

+ Collaboration diagram for ProjectEditor:

Public Slots

void showUpgradeMessages (QWidget *parent) noexcept
 Show a dialog with all project file format upgrade messages. More...
 
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 execLppzExportDialog (QWidget *parent=nullptr) noexcept
 Execute the *.lppz export dialog (blocking!) More...
 
void execOrderPcbDialog (QWidget *parent=nullptr) noexcept
 Execute the PCB order 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...
 
void setManualModificationsMade () noexcept
 Set the flag that manual modifications (no undo stack) are made. More...
 
void setErcMessageApproved (const RuleCheckMessage &msg, bool approve) noexcept
 Approve/unapprove an ERC message. More...
 
std::shared_ptr< const QSet< const NetSignal * > > getHighlightedNetSignals () const noexcept
 
void setHighlightedNetSignals (const QSet< const NetSignal * > &netSignals) noexcept
 
void clearHighlightedNetSignals () noexcept
 

Signals

void ercFinished (const RuleCheckMessageList &messages)
 
void highlightedNetSignalsChanged ()
 
void projectAboutToBeSaved ()
 
void projectSavedToDisk ()
 
void showControlPanelClicked ()
 
void openProjectLibraryUpdaterClicked (const FilePath &fp)
 
void projectEditorClosed ()
 
void showTemporaryStatusBarMessage (const QString &message, int timeoutMs)
 

Public Member Functions

 ProjectEditor ()=delete
 
 ProjectEditor (const Project &other)=delete
 
 ProjectEditor (Workspace &workspace, Project &project, const tl::optional< QList< FileFormatMigration::Message > > &upgradeMessages)
 The constructor. More...
 
 ~ProjectEditor () noexcept
 The destructor. More...
 
WorkspacegetWorkspace () const noexcept
 
ProjectgetProject () const noexcept
 
const QString & getUpgradeMessageLabelText () const noexcept
 
const LengthUnitgetDefaultLengthUnit () const noexcept
 
UndoStackgetUndoStack () const noexcept
 Get a reference to the undo stack of the project. More...
 
void abortBlockingToolsInOtherEditors (QWidget *editor) noexcept
 Abort any active (blocking) tools in other editors. 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

void runErc () noexcept
 
void saveErcMessageApprovals (const QSet< SExpression > &approvals) noexcept
 
int getCountOfVisibleEditorWindows () const noexcept
 

Private Attributes

WorkspacemWorkspace
 
ProjectmProject
 
QList< FileFormatMigration::MessagemUpgradeMessages
 
QString mUpgradeMessageLabelText
 
QTimer mAutoSaveTimer
 
QSet< SExpressionmSupportedErcApprovals
 
QSet< SExpressionmDisappearedErcApprovals
 
RuleCheckMessageList mErcMessages
 
std::shared_ptr< QSet< const NetSignal * > > mHighlightedNetSignals
 
UndoStackmUndoStack
 See The undo/redo system (Command Design Pattern). More...
 
SchematicEditormSchematicEditor
 The schematic editor (GUI) More...
 
BoardEditormBoardEditor
 The board editor (GUI) More...
 
uint mLastAutosaveStateId
 The UndoStack state ID of the last successful project (auto)save. More...
 
bool mManualModificationsMade
 Modifications bypassing the undo stack. More...
 

Detailed Description

The ProjectEditor class.

Constructor & Destructor Documentation

◆ ProjectEditor() [1/3]

ProjectEditor ( )
delete

◆ ProjectEditor() [2/3]

ProjectEditor ( const Project other)
delete

◆ ProjectEditor() [3/3]

ProjectEditor ( Workspace workspace,
Project project,
const tl::optional< QList< FileFormatMigration::Message > > &  upgradeMessages 
)

The constructor.

+ Here is the call graph for this function:

◆ ~ProjectEditor()

~ProjectEditor ( )
noexcept

The destructor.

+ Here is the call graph for this function:

Member Function Documentation

◆ getWorkspace()

Workspace & getWorkspace ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getProject()

Project & getProject ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getUpgradeMessageLabelText()

const QString & getUpgradeMessageLabelText ( ) const
inlinenoexcept

◆ getDefaultLengthUnit()

const LengthUnit & getDefaultLengthUnit ( ) const
noexcept
+ Here is the call graph for this function:

◆ getUndoStack()

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:

◆ abortBlockingToolsInOtherEditors()

void abortBlockingToolsInOtherEditors ( QWidget *  editor)
noexcept

Abort any active (blocking) tools in other editors.

If an undo command group is already active while starting a new tool, try to abort any active tool in other editors since it is annoying to block one editor by another editor (an error message would appear). However, do NOT abort tools in the own editor since this could lead to unexpected/wrong behavior (e.g. recursion)!

Parameters
editorThe calling editor, which will not be aborted.

◆ windowIsAboutToClose()

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 librepcb::editor::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

◆ operator=()

ProjectEditor & operator= ( const Project rhs)
delete

◆ showUpgradeMessages

void showUpgradeMessages ( QWidget *  parent)
slotnoexcept

Show a dialog with all project file format upgrade messages.

Parameters
parentParent widget.
+ Here is the call graph for this function:

◆ showAllRequiredEditors

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:

◆ showSchematicEditor

void showSchematicEditor ( )
slotnoexcept

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

+ Here is the caller graph for this function:

◆ showBoardEditor

void showBoardEditor ( )
slotnoexcept

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

+ Here is the caller graph for this function:

◆ execLppzExportDialog

void execLppzExportDialog ( QWidget *  parent = nullptr)
slotnoexcept

Execute the *.lppz export dialog (blocking!)

Parameters
parentparent widget of the dialog (optional)
+ Here is the call graph for this function:

◆ execOrderPcbDialog

void execOrderPcbDialog ( QWidget *  parent = nullptr)
slotnoexcept

Execute the PCB order dialog (blocking!)

Parameters
parentParent widget of the dialog (optional)
+ Here is the call graph for this function:

◆ saveProject

bool saveProject ( )
slotnoexcept

Save the whole project to the harddisc.

Note
The whole save procedere is described in Atomic Saving Procedure.
Returns
true on success, false on failure
+ Here is the call graph for this function:

◆ autosaveProject

bool autosaveProject ( )
slotnoexcept

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

Note
The whole save procedere is described in Atomic Saving Procedure.
Returns
true on success, false on failure
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeAndDestroy

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 control panel). 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:

◆ setManualModificationsMade

void setManualModificationsMade ( )
inlineslotnoexcept

Set the flag that manual modifications (no undo stack) are made.

◆ setErcMessageApproved

void setErcMessageApproved ( const RuleCheckMessage msg,
bool  approve 
)
slotnoexcept

Approve/unapprove an ERC message.

Parameters
msgThe message to modify
approveThe new approval state

◆ getHighlightedNetSignals

std::shared_ptr< const QSet< const NetSignal * > > getHighlightedNetSignals ( ) const
inlineslotnoexcept

◆ setHighlightedNetSignals

void setHighlightedNetSignals ( const QSet< const NetSignal * > &  netSignals)
slotnoexcept
+ Here is the caller graph for this function:

◆ clearHighlightedNetSignals

void clearHighlightedNetSignals ( )
slotnoexcept
+ Here is the call graph for this function:

◆ ercFinished

void ercFinished ( const RuleCheckMessageList messages)
signal
+ Here is the caller graph for this function:

◆ highlightedNetSignalsChanged

void highlightedNetSignalsChanged ( )
signal

◆ projectAboutToBeSaved

void projectAboutToBeSaved ( )
signal
+ Here is the caller graph for this function:

◆ projectSavedToDisk

void projectSavedToDisk ( )
signal
+ Here is the caller graph for this function:

◆ showControlPanelClicked

void showControlPanelClicked ( )
signal

◆ openProjectLibraryUpdaterClicked

void openProjectLibraryUpdaterClicked ( const FilePath fp)
signal

◆ projectEditorClosed

void projectEditorClosed ( )
signal
+ Here is the caller graph for this function:

◆ showTemporaryStatusBarMessage

void showTemporaryStatusBarMessage ( const QString &  message,
int  timeoutMs 
)
signal
+ Here is the caller graph for this function:

◆ runErc()

void runErc ( )
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveErcMessageApprovals()

void saveErcMessageApprovals ( const QSet< SExpression > &  approvals)
privatenoexcept
+ Here is the caller graph for this function:

◆ getCountOfVisibleEditorWindows()

int getCountOfVisibleEditorWindows ( ) const
privatenoexcept
+ Here is the caller graph for this function:

Member Data Documentation

◆ mWorkspace

Workspace& mWorkspace
private

◆ mProject

Project& mProject
private

◆ mUpgradeMessages

QList<FileFormatMigration::Message> mUpgradeMessages
private

◆ mUpgradeMessageLabelText

QString mUpgradeMessageLabelText
private

◆ mAutoSaveTimer

QTimer mAutoSaveTimer
private

The timer for the periodically automatic saving functionality (see also Atomic Saving Procedure)

◆ mSupportedErcApprovals

QSet<SExpression> mSupportedErcApprovals
private

◆ mDisappearedErcApprovals

QSet<SExpression> mDisappearedErcApprovals
private

◆ mErcMessages

RuleCheckMessageList mErcMessages
private

◆ mHighlightedNetSignals

std::shared_ptr<QSet<const NetSignal*> > mHighlightedNetSignals
private

◆ mUndoStack

◆ mSchematicEditor

SchematicEditor* mSchematicEditor
private

The schematic editor (GUI)

◆ mBoardEditor

BoardEditor* mBoardEditor
private

The board editor (GUI)

◆ mLastAutosaveStateId

uint mLastAutosaveStateId
private

The UndoStack state ID of the last successful project (auto)save.

◆ mManualModificationsMade

bool mManualModificationsMade
private

Modifications bypassing the undo stack.


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