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 ()=delete
 
 ControlPanel (const ControlPanel &other)=delete
 
 ControlPanel (Workspace &workspace, bool fileFormatIsOutdated)
 
virtual ~ControlPanel () noexcept
 
ControlPaneloperator= (const ControlPanel &rhs)=delete
 

Protected Member Functions

virtual void closeEvent (QCloseEvent *event) override
 
virtual bool eventFilter (QObject *watched, QEvent *event) override
 

Private Slots

void openProjectsPassedByCommandLine () noexcept
 
void openProjectPassedByOs (const QString &file, bool silent=false) noexcept
 
void projectEditorClosed () noexcept
 
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)
 

Private Member Functions

void createActions () noexcept
 
void createMenus () noexcept
 
void saveSettings ()
 
void loadSettings ()
 
void updateDesktopIntegrationMessage () noexcept
 
void openLibraryManager () noexcept
 
void addExampleProjects () noexcept
 
void switchWorkspace () noexcept
 
void showProjectReadmeInBrowser (const FilePath &projectFilePath) noexcept
 
void removeProjectsTreeItem (const FilePath &fp) noexcept
 
ProjectEditornewProject (bool eagleImport=false, FilePath parentDir=FilePath()) noexcept
 
ProjectEditoropenProject (FilePath filepath=FilePath()) noexcept
 Open a project with the editor (or bring an already opened editor to front) More...
 
bool closeProject (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...
 
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

WorkspacemWorkspace
 
QScopedPointer< Ui::ControlPanel > mUi
 
QScopedPointer< StandardEditorCommandHandlermStandardCommandHandler
 
QScopedPointer< ProjectTreeModelmProjectTreeModel
 
QScopedPointer< RecentProjectsModelmRecentProjectsModel
 
QScopedPointer< FavoriteProjectsModelmFavoriteProjectsModel
 
QScopedPointer< LibraryManagermLibraryManager
 
QHash< QString, ProjectEditor * > mOpenProjectEditors
 
QHash< FilePath, LibraryEditor * > mOpenLibraryEditors
 
QScopedPointer< ProjectLibraryUpdatermProjectLibraryUpdater
 
QScopedPointer< QAction > mActionLibraryManager
 
QScopedPointer< QAction > mActionWorkspaceSettings
 
QScopedPointer< QAction > mActionRescanLibraries
 
QScopedPointer< QAction > mActionSwitchWorkspace
 
QScopedPointer< QAction > mActionNewProject
 
QScopedPointer< QAction > mActionOpenProject
 
QScopedPointer< QAction > mActionCloseAllProjects
 
QScopedPointer< QAction > mActionAddExampleProjects
 
QScopedPointer< QAction > mActionImportEagleProject
 
QScopedPointer< QAction > mActionAboutLibrePcb
 
QScopedPointer< QAction > mActionAboutQt
 
QScopedPointer< QAction > mActionOnlineDocumentation
 
QScopedPointer< QAction > mActionKeyboardShortcutsReference
 
QScopedPointer< QAction > mActionWebsite
 
QScopedPointer< QAction > mActionQtQuickTest
 
QScopedPointer< QAction > mActionQuit
 

Friends

class ProjectLibraryUpdater
 

Detailed Description

The ControlPanel class.

Constructor & Destructor Documentation

◆ ControlPanel() [1/3]

ControlPanel ( )
delete

◆ ControlPanel() [2/3]

ControlPanel ( const ControlPanel other)
delete

◆ ControlPanel() [3/3]

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

◆ ~ControlPanel()

~ControlPanel ( )
virtualnoexcept

Member Function Documentation

◆ operator=()

ControlPanel & operator= ( const ControlPanel rhs)
delete

◆ showControlPanel

void showControlPanel ( )
slotnoexcept

◆ openProjectLibraryUpdater

void openProjectLibraryUpdater ( const FilePath project)
slotnoexcept

◆ closeEvent()

void closeEvent ( QCloseEvent *  event)
overrideprotectedvirtual

◆ eventFilter()

bool eventFilter ( QObject *  watched,
QEvent *  event 
)
overrideprotectedvirtual

◆ openProjectsPassedByCommandLine

void openProjectsPassedByCommandLine ( )
privateslotnoexcept

◆ openProjectPassedByOs

void openProjectPassedByOs ( const QString &  file,
bool  silent = false 
)
privateslotnoexcept
+ Here is the call graph for this function:

◆ projectEditorClosed

void projectEditorClosed ( )
privateslotnoexcept
+ 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

◆ on_favoriteProjectsListView_clicked

void on_favoriteProjectsListView_clicked ( const QModelIndex &  index)
privateslot

◆ 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:

◆ createActions()

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

◆ createMenus()

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

◆ saveSettings()

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

◆ loadSettings()

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

◆ updateDesktopIntegrationMessage()

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

◆ openLibraryManager()

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

◆ addExampleProjects()

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

◆ switchWorkspace()

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

◆ showProjectReadmeInBrowser()

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

◆ removeProjectsTreeItem()

void removeProjectsTreeItem ( const FilePath fp)
privatenoexcept
+ Here is the call graph for this function:

◆ newProject()

ProjectEditor * newProject ( bool  eagleImport = false,
FilePath  parentDir = FilePath() 
)
privatenoexcept
+ Here is the call graph for this function:

◆ openProject()

ProjectEditor * openProject ( FilePath  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. If invalid (the default), a file dialog will be shown to select it.
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:

◆ closeProject() [1/2]

bool closeProject ( 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

◆ 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

◆ 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

◆ 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.

◆ openLibraryEditor()

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

◆ libraryEditorDestroyed()

void libraryEditorDestroyed ( )
privatenoexcept
+ Here is the call 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 call graph for this function:

Friends And Related Function Documentation

◆ ProjectLibraryUpdater

friend class ProjectLibraryUpdater
friend

Member Data Documentation

◆ mWorkspace

Workspace& mWorkspace
private

◆ mUi

QScopedPointer<Ui::ControlPanel> mUi
private

◆ mStandardCommandHandler

QScopedPointer<StandardEditorCommandHandler> mStandardCommandHandler
private

◆ mProjectTreeModel

QScopedPointer<ProjectTreeModel> mProjectTreeModel
private

◆ mRecentProjectsModel

QScopedPointer<RecentProjectsModel> mRecentProjectsModel
private

◆ mFavoriteProjectsModel

QScopedPointer<FavoriteProjectsModel> mFavoriteProjectsModel
private

◆ mLibraryManager

QScopedPointer<LibraryManager> mLibraryManager
private

◆ mOpenProjectEditors

QHash<QString, ProjectEditor*> mOpenProjectEditors
private

◆ mOpenLibraryEditors

QHash<FilePath, LibraryEditor*> mOpenLibraryEditors
private

◆ mProjectLibraryUpdater

QScopedPointer<ProjectLibraryUpdater> mProjectLibraryUpdater
private

◆ mActionLibraryManager

QScopedPointer<QAction> mActionLibraryManager
private

◆ mActionWorkspaceSettings

QScopedPointer<QAction> mActionWorkspaceSettings
private

◆ mActionRescanLibraries

QScopedPointer<QAction> mActionRescanLibraries
private

◆ mActionSwitchWorkspace

QScopedPointer<QAction> mActionSwitchWorkspace
private

◆ mActionNewProject

QScopedPointer<QAction> mActionNewProject
private

◆ mActionOpenProject

QScopedPointer<QAction> mActionOpenProject
private

◆ mActionCloseAllProjects

QScopedPointer<QAction> mActionCloseAllProjects
private

◆ mActionAddExampleProjects

QScopedPointer<QAction> mActionAddExampleProjects
private

◆ mActionImportEagleProject

QScopedPointer<QAction> mActionImportEagleProject
private

◆ mActionAboutLibrePcb

QScopedPointer<QAction> mActionAboutLibrePcb
private

◆ mActionAboutQt

QScopedPointer<QAction> mActionAboutQt
private

◆ mActionOnlineDocumentation

QScopedPointer<QAction> mActionOnlineDocumentation
private

◆ mActionKeyboardShortcutsReference

QScopedPointer<QAction> mActionKeyboardShortcutsReference
private

◆ mActionWebsite

QScopedPointer<QAction> mActionWebsite
private

◆ mActionQtQuickTest

QScopedPointer<QAction> mActionQtQuickTest
private

◆ mActionQuit

QScopedPointer<QAction> mActionQuit
private

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