LibrePCB Developers Documentation
ControlPanel Class Referencefinal

The ControlPanel class. More...

#include <controlpanel.h>

Inherits QMainWindow.

+ Collaboration diagram for ControlPanel:

Public Slots

void showControlPanel () noexcept
 
void openProjectLibraryUpdater (const FilePath &project) noexcept
 

Public Member Functions

 ControlPanel (workspace::Workspace &workspace)
 
 ~ControlPanel ()
 

Protected Member Functions

virtual void closeEvent (QCloseEvent *event)
 

Private Slots

void openProjectsPassedByCommandLine () noexcept
 
void projectEditorClosed () noexcept
 
void on_actionNew_Project_triggered ()
 
void on_actionOpen_Project_triggered ()
 
void on_actionOpen_Library_Manager_triggered ()
 
void on_actionClose_all_open_projects_triggered ()
 
void on_actionSwitch_Workspace_triggered ()
 
void on_actionWorkspace_Settings_triggered ()
 
void on_projectTreeView_clicked (const QModelIndex &index)
 
void on_projectTreeView_doubleClicked (const QModelIndex &index)
 
void on_projectTreeView_customContextMenuRequested (const QPoint &pos)
 
void on_recentProjectsListView_entered (const QModelIndex &index)
 
void on_favoriteProjectsListView_entered (const QModelIndex &index)
 
void on_recentProjectsListView_clicked (const QModelIndex &index)
 
void on_favoriteProjectsListView_clicked (const QModelIndex &index)
 
void on_recentProjectsListView_customContextMenuRequested (const QPoint &pos)
 
void on_favoriteProjectsListView_customContextMenuRequested (const QPoint &pos)
 
void on_actionRescanLibraries_triggered ()
 

Private Member Functions

 ControlPanel ()
 
 ControlPanel (const ControlPanel &other)
 
ControlPaneloperator= (const ControlPanel &rhs)
 
void saveSettings ()
 
void loadSettings ()
 
void updateNoLibrariesWarningVisibility () noexcept
 
void showProjectReadmeInBrowser (const FilePath &projectFilePath) noexcept
 
project::editor::ProjectEditornewProject (const FilePath &parentDir) noexcept
 
project::editor::ProjectEditoropenProject (project::Project &project) noexcept
 Open a project with the editor (or bring an already opened editor to front) More...
 
project::editor::ProjectEditoropenProject (const FilePath &filepath) noexcept
 Open a project with the editor (or bring an already opened editor to front) More...
 
bool closeProject (project::editor::ProjectEditor &editor, bool askForSave) noexcept
 Close an opened project editor. More...
 
bool closeProject (const FilePath &filepath, bool askForSave) noexcept
 Close an opened project editor. More...
 
bool closeAllProjects (bool askForSave) noexcept
 Close all open project editors. More...
 
project::editor::ProjectEditorgetOpenProject (const FilePath &filepath) const noexcept
 Get the pointer to an already open project editor by its project filepath. More...
 
void openLibraryEditor (const FilePath &libDir) noexcept
 
void libraryEditorDestroyed () noexcept
 
bool closeAllLibraryEditors (bool askForSave) noexcept
 Close all open library editors. More...
 

Static Private Member Functions

static bool askForRestoringBackup (const FilePath &dir)
 Ask the user whether to restore a backup of a project. More...
 

Private Attributes

workspace::WorkspacemWorkspace
 
QScopedPointer< Ui::ControlPanel > mUi
 
QScopedPointer< library::manager::LibraryManagermLibraryManager
 
QHash< QString, project::editor::ProjectEditor * > mOpenProjectEditors
 
QHash< FilePath, library::editor::LibraryEditor * > mOpenLibraryEditors
 
QScopedPointer< ProjectLibraryUpdatermProjectLibraryUpdater
 

Friends

class ProjectLibraryUpdater
 

Detailed Description

The ControlPanel class.

Constructor & Destructor Documentation

◆ ControlPanel() [1/3]

ControlPanel ( workspace::Workspace workspace)
explicit
+ Here is the call graph for this function:

◆ ~ControlPanel()

+ Here is the call graph for this function:

◆ ControlPanel() [2/3]

ControlPanel ( )
private

◆ ControlPanel() [3/3]

ControlPanel ( const ControlPanel other)
private

Member Function Documentation

◆ showControlPanel

void showControlPanel ( )
slotnoexcept
+ Here is the caller graph for this function:

◆ openProjectLibraryUpdater

void openProjectLibraryUpdater ( const FilePath project)
slotnoexcept
+ Here is the caller graph for this function:

◆ closeEvent()

void closeEvent ( QCloseEvent *  event)
protectedvirtual
+ Here is the call graph for this function:

◆ openProjectsPassedByCommandLine

void openProjectsPassedByCommandLine ( )
privateslotnoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ projectEditorClosed

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

◆ on_actionNew_Project_triggered

void on_actionNew_Project_triggered ( )
privateslot
+ Here is the call graph for this function:

◆ on_actionOpen_Project_triggered

void on_actionOpen_Project_triggered ( )
privateslot
+ Here is the call graph for this function:

◆ on_actionOpen_Library_Manager_triggered

void on_actionOpen_Library_Manager_triggered ( )
privateslot
+ Here is the caller graph for this function:

◆ on_actionClose_all_open_projects_triggered

void on_actionClose_all_open_projects_triggered ( )
privateslot
+ Here is the call graph for this function:

◆ on_actionSwitch_Workspace_triggered

void on_actionSwitch_Workspace_triggered ( )
privateslot
+ Here is the call graph for this function:

◆ on_actionWorkspace_Settings_triggered

void on_actionWorkspace_Settings_triggered ( )
privateslot
+ Here is the call graph for this function:

◆ on_projectTreeView_clicked

void on_projectTreeView_clicked ( const QModelIndex &  index)
privateslot
+ Here is the call graph for this function:

◆ on_projectTreeView_doubleClicked

void on_projectTreeView_doubleClicked ( const QModelIndex &  index)
privateslot
+ Here is the call graph for this function:

◆ on_projectTreeView_customContextMenuRequested

void on_projectTreeView_customContextMenuRequested ( const QPoint &  pos)
privateslot
+ Here is the call graph for this function:

◆ on_recentProjectsListView_entered

void on_recentProjectsListView_entered ( const QModelIndex &  index)
privateslot
+ Here is the call graph for this function:

◆ on_favoriteProjectsListView_entered

void on_favoriteProjectsListView_entered ( const QModelIndex &  index)
privateslot
+ Here is the call graph for this function:

◆ on_recentProjectsListView_clicked

void on_recentProjectsListView_clicked ( const QModelIndex &  index)
privateslot
+ Here is the call graph for this function:

◆ on_favoriteProjectsListView_clicked

void on_favoriteProjectsListView_clicked ( const QModelIndex &  index)
privateslot
+ Here is the call graph for this function:

◆ on_recentProjectsListView_customContextMenuRequested

void on_recentProjectsListView_customContextMenuRequested ( const QPoint &  pos)
privateslot
+ Here is the call graph for this function:

◆ on_favoriteProjectsListView_customContextMenuRequested

void on_favoriteProjectsListView_customContextMenuRequested ( const QPoint &  pos)
privateslot
+ Here is the call graph for this function:

◆ on_actionRescanLibraries_triggered

void on_actionRescanLibraries_triggered ( )
privateslot
+ Here is the call graph for this function:

◆ operator=()

ControlPanel& operator= ( const ControlPanel rhs)
private

◆ saveSettings()

void saveSettings ( )
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadSettings()

void loadSettings ( )
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateNoLibrariesWarningVisibility()

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

◆ showProjectReadmeInBrowser()

void showProjectReadmeInBrowser ( const FilePath projectFilePath)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newProject()

ProjectEditor * newProject ( const FilePath parentDir)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openProject() [1/2]

ProjectEditor * openProject ( project::Project project)
privatenoexcept

Open a project with the editor (or bring an already opened editor to front)

Parameters
projectAn already opened project (but without the editor)
Returns
The pointer to the opened project editor (nullptr on error)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openProject() [2/2]

ProjectEditor * openProject ( const FilePath filepath)
privatenoexcept

Open a project with the editor (or bring an already opened editor to front)

Parameters
filepathThe filepath to the *.lpp project file to open
Returns
The pointer to the opened project editor (nullptr on error)
+ Here is the call graph for this function:

◆ closeProject() [1/2]

bool closeProject ( project::editor::ProjectEditor editor,
bool  askForSave 
)
privatenoexcept

Close an opened project editor.

Parameters
editorThe reference to the open project editor
askForSaveIf true, the user will be asked to save the projects
Return values
trueif the project was successfully closed, false otherwise
+ Here is the caller graph for this function:

◆ closeProject() [2/2]

bool closeProject ( const FilePath filepath,
bool  askForSave 
)
privatenoexcept

Close an opened project editor.

Parameters
filepathThe filepath to the *.lpp project file to close
askForSaveIf true, the user will be asked to save the projects
Return values
trueif the project was successfully closed, false otherwise
+ Here is the call graph for this function:

◆ closeAllProjects()

bool closeAllProjects ( bool  askForSave)
privatenoexcept

Close all open project editors.

Parameters
askForSaveIf true, the user will be asked to save all modified projects
Return values
trueif all projects successfully closed, false otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOpenProject()

ProjectEditor * getOpenProject ( const FilePath filepath) const
privatenoexcept

Get the pointer to an already open project editor by its project filepath.

This method can also be used to check whether a project (by its filepath) is already open or not.

Parameters
filepathThe filepath to a *.lpp project file
Returns
The pointer to the open project editor, or nullptr if the project is not open
+ Here is the caller graph for this function:

◆ askForRestoringBackup()

bool askForRestoringBackup ( const FilePath dir)
staticprivate

Ask the user whether to restore a backup of a project.

Parameters
dirThe project directory to be restored.
Return values
trueRestore backup.
falseDo not restore backup.
Exceptions
Exceptionto abort opening the project.
+ Here is the caller graph for this function:

◆ openLibraryEditor()

void openLibraryEditor ( const FilePath libDir)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ libraryEditorDestroyed()

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

◆ closeAllLibraryEditors()

bool closeAllLibraryEditors ( bool  askForSave)
privatenoexcept

Close all open library editors.

Parameters
askForSaveIf true, the user will be asked to save all modified libraries
Return values
trueif all library editors successfully closed, false otherwise
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ProjectLibraryUpdater

friend class ProjectLibraryUpdater
friend

Member Data Documentation

◆ mWorkspace

workspace::Workspace& mWorkspace
private

◆ mUi

QScopedPointer<Ui::ControlPanel> mUi
private

◆ mLibraryManager

QScopedPointer<library::manager::LibraryManager> mLibraryManager
private

◆ mOpenProjectEditors

QHash<QString, project::editor::ProjectEditor*> mOpenProjectEditors
private

◆ mOpenLibraryEditors

QHash<FilePath, library::editor::LibraryEditor*> mOpenLibraryEditors
private

◆ mProjectLibraryUpdater

QScopedPointer<ProjectLibraryUpdater> mProjectLibraryUpdater
private

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