20#ifndef LIBREPCB_CORE_WORKSPACE_H
21#define LIBREPCB_CORE_WORKSPACE_H
26#include "../fileio/directorylock.h"
27#include "../types/version.h"
40class TransactionalFileSystem;
41class WorkspaceLibraryDb;
42class WorkspaceSettings;
157 QString* errorMsg =
nullptr);
185 QString& copyFromDir,
186 QString& copyToDir)
noexcept;
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
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
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
The Version class represents a version number in the format "1.42.7".
Definition: version.h:58
static Version fromString(const QString &str)
Create a Version object from a string.
Definition: version.cpp:91
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition: workspace.h:54
void saveSettingsToTransactionalFileSystem()
Save the workspace settings to the transactional file system.
Definition: workspace.cpp:278
QScopedPointer< WorkspaceSettings > mWorkspaceSettings
the WorkspaceSettings object
Definition: workspace.h:245
FilePath getLocalLibrariesPath() const
Get the filepath to the "data/libraries/local" directory.
Definition: workspace.h:108
WorkspaceSettings & getSettings()
Get the workspace settings.
Definition: workspace.h:122
Workspace & operator=(const Workspace &rhs)=delete
static void createNewWorkspace(const FilePath &path)
Create a new workspace.
Definition: workspace.cpp:256
static bool checkCompatibility(const FilePath &wsRoot, QString *errorMsg=nullptr)
Check the existence & compatibility of a workspace directory.
Definition: workspace.cpp:149
const FilePath & getProjectsPath() const
Get the filepath to the "projects" directory in the workspace.
Definition: workspace.h:93
static void setMostRecentlyUsedWorkspacePath(const FilePath &path) noexcept
Set the most recently used workspace path.
Definition: workspace.cpp:268
QScopedPointer< WorkspaceLibraryDb > mLibraryDb
the library database
Definition: workspace.h:248
FilePath mDataPath
the subdirectory of the current file format version
Definition: workspace.h:236
FilePath mProjectsPath
the directory "projects"
Definition: workspace.h:233
FilePath mPath
a FilePath object which represents the workspace directory
Definition: workspace.h:230
const FilePath & getLibrariesPath() const
Get the filepath to the "data/libraries" directory in the workspace.
Definition: workspace.h:103
static QMap< QString, Version > findDataDirectories(const FilePath &wsRoot)
Find all data directories of a workspace.
Definition: workspace.cpp:175
FilePath mLibrariesPath
the directory "data/libraries"
Definition: workspace.h:239
static FilePath getMostRecentlyUsedWorkspacePath() noexcept
Get the most recently used workspace path.
Definition: workspace.cpp:262
std::shared_ptr< TransactionalFileSystem > mFileSystem
to lock the version directory (mDataPath)
Definition: workspace.h:242
WorkspaceLibraryDb & getLibraryDb() const
Get the workspace library database.
Definition: workspace.h:132
const FilePath & getDataPath() const
Get the filepath to the data directory in the workspace.
Definition: workspace.h:98
void saveSettings()
Save all (modified) settings to disk.
Definition: workspace.cpp:139
static Version FILE_FORMAT_VERSION() noexcept
Current workspace file format version (constant)
Definition: workspace.h:218
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(const Workspace &other)=delete
const WorkspaceSettings & getSettings() const
Get the workspace settings.
Definition: workspace.h:127
~Workspace() noexcept
Definition: workspace.cpp:132
FilePath getRemoteLibrariesPath() const
Get the filepath to the "data/libraries/remote" directory.
Definition: workspace.h:115
const FilePath & getPath() const
Get the filepath to the workspace directory.
Definition: workspace.h:88
The WorkspaceLibraryDb class.
Definition: workspacelibrarydb.h:58
Container for all workspace related settings.
Definition: workspacesettings.h:60
Definition: occmodel.cpp:77