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

The GuiApplication class. More...

#include <guiapplication.h>

Inherits QObject.

+ Collaboration diagram for GuiApplication:

Public Member Functions

 GuiApplication ()=delete
 
 GuiApplication (const GuiApplication &other)=delete
 
 GuiApplication (Workspace &ws, bool fileFormatIsOutdated, QObject *parent=nullptr) noexcept
 
 ~GuiApplication () noexcept
 
WorkspacegetWorkspace () noexcept
 
NotificationsModelgetNotifications () noexcept
 
QuickAccessModelgetQuickAccess () noexcept
 
LibrariesModelgetLocalLibraries () noexcept
 
LibrariesModelgetRemoteLibraries () noexcept
 
void openFile (const FilePath &fp, QWidget *parent) noexcept
 
void switchWorkspace (QWidget *parent) noexcept
 
void execWorkspaceSettingsDialog (QWidget *parent) noexcept
 
void addExampleProjects (QWidget *parent) noexcept
 
void createProject (const FilePath &parentDir, bool eagleImport, QWidget *parent) noexcept
 
ProjectEditoropenProject (FilePath filepath, QWidget *parent) noexcept
 Open a project with the editor (or bring an already opened editor to front)
 
void createNewWindow (int id=-1) noexcept
 
bool requestClosingWindow (QWidget *parent) noexcept
 
void exec ()
 
void quit (QPointer< QWidget > parent) noexcept
 
GuiApplicationoperator= (const GuiApplication &rhs)=delete
 

Protected Member Functions

bool eventFilter (QObject *watched, QEvent *event) noexcept override
 

Private Member Functions

void openProjectsPassedByCommandLine () noexcept
 
void openProjectPassedByOs (const QString &file, bool silent=false) noexcept
 
ProjectEditorgetOpenProject (const FilePath &filepath) const noexcept
 Get the pointer to an already open project editor by its project filepath.
 
bool closeAllProjects (bool askForSave, QWidget *parent) noexcept
 Close all open project editors.
 
void projectEditorClosed () noexcept
 
void openProjectLibraryUpdater (const FilePath &project) noexcept
 
void openLibraryEditor (const FilePath &libDir) noexcept
 
void libraryEditorDestroyed () noexcept
 
bool closeAllLibraryEditors (bool askForSave) noexcept
 Close all open library editors.
 
std::shared_ptr< MainWindowgetCurrentWindow () noexcept
 
void updateNoLibrariesInstalledNotification () noexcept
 
void updateDesktopIntegrationNotification () noexcept
 

Static Private Member Functions

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

Private Attributes

WorkspacemWorkspace
 
std::shared_ptr< NotificationsModelmNotifications
 
std::shared_ptr< NotificationmNotificationNoLibrariesInstalled
 
std::shared_ptr< NotificationmNotificationDesktopIntegration
 
std::shared_ptr< QuickAccessModelmQuickAccessModel
 
std::shared_ptr< LibrariesModelmLocalLibraries
 
std::shared_ptr< LibrariesModelmRemoteLibraries
 
std::unique_ptr< SlintKeyEventTextBuildermLibrariesFilter
 
QHash< QString, ProjectEditor * > mOpenProjectEditors
 
QHash< FilePath, LibraryEditor * > mOpenLibraryEditors
 
std::unique_ptr< ProjectLibraryUpdatermProjectLibraryUpdater
 
QList< std::shared_ptr< MainWindow > > mWindows
 
QTimer mSaveOpenedWindowsCountdown
 

Detailed Description

The GuiApplication class.

Constructor & Destructor Documentation

◆ GuiApplication() [1/3]

GuiApplication ( )
delete

◆ GuiApplication() [2/3]

GuiApplication ( const GuiApplication other)
delete

◆ GuiApplication() [3/3]

GuiApplication ( Workspace ws,
bool  fileFormatIsOutdated,
QObject *  parent = nullptr 
)
explicitnoexcept
+ Here is the call graph for this function:

◆ ~GuiApplication()

~GuiApplication ( )
noexcept

Member Function Documentation

◆ getWorkspace()

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

◆ getNotifications()

NotificationsModel & getNotifications ( )
inlinenoexcept
+ Here is the caller graph for this function:

◆ getQuickAccess()

QuickAccessModel & getQuickAccess ( )
inlinenoexcept

◆ getLocalLibraries()

LibrariesModel & getLocalLibraries ( )
inlinenoexcept

◆ getRemoteLibraries()

LibrariesModel & getRemoteLibraries ( )
inlinenoexcept

◆ openFile()

void openFile ( const FilePath fp,
QWidget *  parent 
)
noexcept
+ Here is the call graph for this function:

◆ switchWorkspace()

void switchWorkspace ( QWidget *  parent)
noexcept
+ Here is the call graph for this function:

◆ execWorkspaceSettingsDialog()

void execWorkspaceSettingsDialog ( QWidget *  parent)
noexcept

◆ addExampleProjects()

void addExampleProjects ( QWidget *  parent)
noexcept
+ Here is the call graph for this function:

◆ createProject()

void createProject ( const FilePath parentDir,
bool  eagleImport,
QWidget *  parent 
)
noexcept
+ Here is the call graph for this function:

◆ openProject()

ProjectEditor * openProject ( FilePath  filepath,
QWidget *  parent 
)
noexcept

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, a file dialog will be shown to select it.
parentParent widget for dialogs.
Returns
The pointer to the opened project editor (nullptr on error)
+ Here is the call graph for this function:

◆ createNewWindow()

void createNewWindow ( int  id = -1)
noexcept
+ Here is the call graph for this function:

◆ requestClosingWindow()

bool requestClosingWindow ( QWidget *  parent)
noexcept
+ Here is the caller graph for this function:

◆ exec()

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

◆ quit()

void quit ( QPointer< QWidget >  parent)
noexcept

◆ operator=()

GuiApplication & operator= ( const GuiApplication rhs)
delete

◆ eventFilter()

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

◆ openProjectsPassedByCommandLine()

void openProjectsPassedByCommandLine ( )
privatenoexcept

◆ openProjectPassedByOs()

void openProjectPassedByOs ( const QString &  file,
bool  silent = false 
)
privatenoexcept
+ Here is the call 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

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

◆ closeAllProjects()

bool closeAllProjects ( bool  askForSave,
QWidget *  parent 
)
privatenoexcept

Close all open project editors.

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

◆ projectEditorClosed()

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

◆ openProjectLibraryUpdater()

void openProjectLibraryUpdater ( const FilePath project)
privatenoexcept

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

◆ getCurrentWindow()

std::shared_ptr< MainWindow > getCurrentWindow ( )
privatenoexcept

◆ updateNoLibrariesInstalledNotification()

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

◆ updateDesktopIntegrationNotification()

void updateDesktopIntegrationNotification ( )
privatenoexcept

Member Data Documentation

◆ mWorkspace

Workspace& mWorkspace
private

◆ mNotifications

std::shared_ptr<NotificationsModel> mNotifications
private

◆ mNotificationNoLibrariesInstalled

std::shared_ptr<Notification> mNotificationNoLibrariesInstalled
private

◆ mNotificationDesktopIntegration

std::shared_ptr<Notification> mNotificationDesktopIntegration
private

◆ mQuickAccessModel

std::shared_ptr<QuickAccessModel> mQuickAccessModel
private

◆ mLocalLibraries

std::shared_ptr<LibrariesModel> mLocalLibraries
private

◆ mRemoteLibraries

std::shared_ptr<LibrariesModel> mRemoteLibraries
private

◆ mLibrariesFilter

std::unique_ptr<SlintKeyEventTextBuilder> mLibrariesFilter
private

◆ mOpenProjectEditors

QHash<QString, ProjectEditor*> mOpenProjectEditors
private

◆ mOpenLibraryEditors

QHash<FilePath, LibraryEditor*> mOpenLibraryEditors
private

◆ mProjectLibraryUpdater

std::unique_ptr<ProjectLibraryUpdater> mProjectLibraryUpdater
private

◆ mWindows

QList<std::shared_ptr<MainWindow> > mWindows
private

◆ mSaveOpenedWindowsCountdown

QTimer mSaveOpenedWindowsCountdown
private

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