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

The Workspace class represents a workspace with all its data (library, projects, settings, ...) More...

#include <workspace.h>

Inherits QObject.

+ Collaboration diagram for Workspace:

Public Member Functions

 Workspace ()=delete
 
 Workspace (const Workspace &other)=delete
 
 Workspace (const FilePath &wsPath)
 Constructor to open an existing workspace. More...
 
 ~Workspace () noexcept
 
const FilePathgetPath () const
 Get the filepath to the workspace directory. More...
 
const FilePathgetProjectsPath () const
 Get the filepath to the "projects" directory in the workspace. More...
 
const FilePathgetMetadataPath () const
 Get the filepath to the version directory (v#) in the workspace. More...
 
const FilePathgetLibrariesPath () const
 Get the filepath to the "v#/libraries" directory in the workspace. More...
 
FilePath getLocalLibrariesPath () const
 Get the filepath to the "v#/libraries/local" directory. More...
 
FilePath getRemoteLibrariesPath () const
 Get the filepath to the "v#/libraries/remote" directory. More...
 
ProjectTreeModelgetProjectTreeModel () const noexcept
 
RecentProjectsModelgetRecentProjectsModel () const noexcept
 
FavoriteProjectsModelgetFavoriteProjectsModel () const noexcept
 
WorkspaceSettingsgetSettings () const
 Get the workspace settings. More...
 
WorkspaceLibraryDbgetLibraryDb () const
 Get the workspace library database. More...
 
void setLastRecentlyUsedProject (const FilePath &filepath) noexcept
 setLastRecentlyUsedProject More...
 
bool isFavoriteProject (const FilePath &filepath) const noexcept
 Check whether a project is in the favorite project list or not. More...
 
void addFavoriteProject (const FilePath &filepath) noexcept
 Add a project to the favorite projects list. More...
 
void removeFavoriteProject (const FilePath &filepath) noexcept
 Remove a project from the favorite projects list. More...
 
Workspaceoperator= (const Workspace &rhs)=delete
 

Static Public Member Functions

static bool isValidWorkspacePath (const FilePath &path) noexcept
 Check whether a filepath points to a valid workspace directory or not. More...
 
static QList< VersiongetFileFormatVersionsOfWorkspace (const FilePath &path) noexcept
 getFileFormatVersionsOfWorkspace More...
 
static tl::optional< VersiongetHighestFileFormatVersionOfWorkspace (const FilePath &path) noexcept
 getHighestFileFormatVersionOfWorkspace More...
 
static void createNewWorkspace (const FilePath &path)
 Create a new workspace. More...
 
static FilePath getMostRecentlyUsedWorkspacePath () noexcept
 Get the most recently used workspace path. More...
 
static void setMostRecentlyUsedWorkspacePath (const FilePath &path) noexcept
 Set the most recently used workspace path. More...
 
static FilePath chooseWorkspacePath () noexcept
 Let the user choose a workspace path (with a directory chooser dialog) More...
 
static Version FILE_FORMAT_VERSION () noexcept
 Current workspace file format version (constant) More...
 

Private Attributes

FilePath mPath
 a FilePath object which represents the workspace directory More...
 
FilePath mProjectsPath
 the directory "projects" More...
 
FilePath mMetadataPath
 the subdirectory of the current file format version More...
 
FilePath mLibrariesPath
 the directory "v#/libraries" More...
 
DirectoryLock mLock
 to lock the version directory (#mVersionPath) More...
 
QScopedPointer< WorkspaceSettingsmWorkspaceSettings
 the WorkspaceSettings object More...
 
QScopedPointer
< WorkspaceLibraryDb
mLibraryDb
 the library database More...
 
QScopedPointer< ProjectTreeModelmProjectTreeModel
 a tree model for the whole projects directory More...
 
QScopedPointer
< RecentProjectsModel
mRecentProjectsModel
 a list model of all recent projects More...
 
QScopedPointer
< FavoriteProjectsModel
mFavoriteProjectsModel
 a list model of all favorite projects More...
 

Detailed Description

The Workspace class represents a workspace with all its data (library, projects, settings, ...)

To access the settings of the workspace, use the method getSettings().

Constructor & Destructor Documentation

Workspace ( )
delete
Workspace ( const Workspace other)
delete
Workspace ( const FilePath wsPath)
explicit

Constructor to open an existing workspace.

Parameters
wsPathThe filepath to the workspace directory
Exceptions
ExceptionIf the workspace could not be opened, this constructor throws an exception.

+ Here is the call graph for this function:

~Workspace ( )
noexcept

The destructor

Member Function Documentation

const FilePath& getPath ( ) const
inline

Get the filepath to the workspace directory.

+ Here is the caller graph for this function:

const FilePath& getProjectsPath ( ) const
inline

Get the filepath to the "projects" directory in the workspace.

const FilePath& getMetadataPath ( ) const
inline

Get the filepath to the version directory (v#) in the workspace.

const FilePath& getLibrariesPath ( ) const
inline

Get the filepath to the "v#/libraries" directory in the workspace.

+ Here is the caller graph for this function:

FilePath getLocalLibrariesPath ( ) const
inline

Get the filepath to the "v#/libraries/local" directory.

+ Here is the call graph for this function:

FilePath getRemoteLibrariesPath ( ) const
inline

Get the filepath to the "v#/libraries/remote" directory.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ProjectTreeModel & getProjectTreeModel ( ) const
noexcept
RecentProjectsModel & getRecentProjectsModel ( ) const
noexcept
FavoriteProjectsModel & getFavoriteProjectsModel ( ) const
noexcept
WorkspaceSettings& getSettings ( ) const
inline

Get the workspace settings.

+ Here is the caller graph for this function:

WorkspaceLibraryDb& getLibraryDb ( ) const
inline

Get the workspace library database.

+ Here is the caller graph for this function:

void setLastRecentlyUsedProject ( const FilePath filepath)
noexcept

setLastRecentlyUsedProject

Parameters
filepath
bool isFavoriteProject ( const FilePath filepath) const
noexcept

Check whether a project is in the favorite project list or not.

Parameters
filepathThe filepath to a *.lpp project file
Returns
True if the specified project is in the favorites list, false otherwise
void addFavoriteProject ( const FilePath filepath)
noexcept

Add a project to the favorite projects list.

Parameters
filepathThe filepath to a *.lpp project file
void removeFavoriteProject ( const FilePath filepath)
noexcept

Remove a project from the favorite projects list.

Parameters
filepathThe filepath to a *.lpp project file
Workspace& operator= ( const Workspace rhs)
delete
bool isValidWorkspacePath ( const FilePath path)
staticnoexcept

Check whether a filepath points to a valid workspace directory or not.

Parameters
pathA path to a directory
Returns
True if the path is a valid workspace directory, false otherwise

+ Here is the caller graph for this function:

QList< Version > getFileFormatVersionsOfWorkspace ( const FilePath path)
staticnoexcept

getFileFormatVersionsOfWorkspace

Parameters
path
Returns

+ Here is the call graph for this function:

tl::optional< Version > getHighestFileFormatVersionOfWorkspace ( const FilePath path)
staticnoexcept

getHighestFileFormatVersionOfWorkspace

Parameters
path
Returns

+ Here is the caller graph for this function:

void createNewWorkspace ( const FilePath path)
static

Create a new workspace.

Parameters
pathA path to a directory where to create the new workspace
Exceptions
Exceptionon error.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FilePath getMostRecentlyUsedWorkspacePath ( )
staticnoexcept

Get the most recently used workspace path.

Returns
The filepath to the last recently used workspace (may be invalid)

+ Here is the caller graph for this function:

void setMostRecentlyUsedWorkspacePath ( const FilePath path)
staticnoexcept

Set the most recently used workspace path.

Parameters
pathThe filepath to the workspace directory

+ Here is the caller graph for this function:

FilePath chooseWorkspacePath ( )
staticnoexcept

Let the user choose a workspace path (with a directory chooser dialog)

Returns
The choosen filepath (is invalid on error or user cancel)

+ Here is the call graph for this function:

static Version FILE_FORMAT_VERSION ( )
inlinestaticnoexcept

Current workspace file format version (constant)

Warning
Don't change this value unless you know exactly what you're doing!
Returns
File format version

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

FilePath mPath
private

a FilePath object which represents the workspace directory

FilePath mProjectsPath
private

the directory "projects"

FilePath mMetadataPath
private

the subdirectory of the current file format version

FilePath mLibrariesPath
private

the directory "v#/libraries"

DirectoryLock mLock
private

to lock the version directory (#mVersionPath)

QScopedPointer<WorkspaceSettings> mWorkspaceSettings
private

the WorkspaceSettings object

QScopedPointer<WorkspaceLibraryDb> mLibraryDb
private

the library database

QScopedPointer<ProjectTreeModel> mProjectTreeModel
private

a tree model for the whole projects directory

QScopedPointer<RecentProjectsModel> mRecentProjectsModel
private

a list model of all recent projects

QScopedPointer<FavoriteProjectsModel> mFavoriteProjectsModel
private

a list model of all favorite projects


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