20 #ifndef LIBREPCB_CORE_WORKSPACE_H 21 #define LIBREPCB_CORE_WORKSPACE_H 26 #include "../fileio/directorylock.h" 27 #include "../types/version.h" 40 class TransactionalFileSystem;
41 class WorkspaceLibraryDb;
42 class WorkspaceSettings;
157 QString* errorMsg =
nullptr);
185 QString& copyFromDir,
186 QString& copyToDir) noexcept;
static void setMostRecentlyUsedWorkspacePath(const FilePath &path) noexcept
Set the most recently used workspace path.
Definition: workspace.cpp:268
WorkspaceLibraryDb & getLibraryDb() const
Get the workspace library database.
Definition: workspace.h:132
The Version class represents a version number in the format "1.42.7".
Definition: version.h:58
static FilePath getMostRecentlyUsedWorkspacePath() noexcept
Get the most recently used workspace path.
Definition: workspace.cpp:262
const FilePath & getLibrariesPath() const
Get the filepath to the "data/libraries" directory in the workspace.
Definition: workspace.h:103
Definition: occmodel.cpp:76
static bool checkCompatibility(const FilePath &wsRoot, QString *errorMsg=nullptr)
Check the existence & compatibility of a workspace directory.
Definition: workspace.cpp:149
const FilePath & getDataPath() const
Get the filepath to the data directory in the workspace.
Definition: workspace.h:98
static QMap< QString, Version > findDataDirectories(const FilePath &wsRoot)
Find all data directories of a workspace.
Definition: workspace.cpp:175
~Workspace() noexcept
Definition: workspace.cpp:132
Container for all workspace related settings.
Definition: workspacesettings.h:60
FilePath getRemoteLibrariesPath() const
Get the filepath to the "data/libraries/remote" directory.
Definition: workspace.h:115
void saveSettingsToTransactionalFileSystem()
Save the workspace settings to the transactional file system.
Definition: workspace.cpp:278
WorkspaceSettings & getSettings()
Get the workspace settings.
Definition: workspace.h:122
std::function< bool(const FilePath &dir, LockStatus status, const QString &user)> LockHandlerCallback
Callback type used to determine whether a lock should be overridden or not.
Definition: directorylock.h:193
const FilePath & getPath() const
Get the filepath to the workspace directory.
Definition: workspace.h:88
const FilePath & getProjectsPath() const
Get the filepath to the "projects" directory in the workspace.
Definition: workspace.h:93
FilePath mProjectsPath
the directory "projects"
Definition: workspace.h:233
static Version FILE_FORMAT_VERSION() noexcept
Current workspace file format version (constant)
Definition: workspace.h:218
QScopedPointer< WorkspaceSettings > mWorkspaceSettings
the WorkspaceSettings object
Definition: workspace.h:245
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:127
FilePath getLocalLibrariesPath() const
Get the filepath to the "data/libraries/local" directory.
Definition: workspace.h:108
FilePath mDataPath
the subdirectory of the current file format version
Definition: workspace.h:236
std::shared_ptr< TransactionalFileSystem > mFileSystem
to lock the version directory (mDataPath)
Definition: workspace.h:242
QScopedPointer< WorkspaceLibraryDb > mLibraryDb
the library database
Definition: workspace.h:248
FilePath getPathTo(const QString &filename) const noexcept
Get the filepath to a file or directory which is relative to this filepath.
Definition: filepath.cpp:176
static void createNewWorkspace(const FilePath &path)
Create a new workspace.
Definition: workspace.cpp:256
void saveSettings()
Save all (modified) settings to disk.
Definition: workspace.cpp:139
const WorkspaceSettings & getSettings() const
Get the workspace settings.
Definition: workspace.h:127
static QString determineDataDirectory(const QMap< QString, Version > &dataDirs, QString ©FromDir, QString ©ToDir) noexcept
Decide which data directory to open, and how to do it.
Definition: workspace.cpp:208
Workspace & operator=(const Workspace &rhs)=delete
FilePath mPath
a FilePath object which represents the workspace directory
Definition: workspace.h:230
static Version fromString(const QString &str)
Create a Version object from a string.
Definition: version.cpp:90
The WorkspaceLibraryDb class.
Definition: workspacelibrarydb.h:57
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:54
FilePath mLibrariesPath
the directory "data/libraries"
Definition: workspace.h:239