AbstractProjectManager
// The core and its managers are located in this header
#include "CoreInterface.h"
// Use this global function to access the project manager
mv::project()->...
Related
Project models
Qualified name: mv::AbstractProjectManager
-
class AbstractProjectManager : public mv::AbstractManager
Abstract project manager class.
Base abstract plugin manager class for managing projects.
- Author
Thomas Kroes
Public Types
-
enum class State
The project manager is currently.
Values:
-
enumerator Idle
-
enumerator OpeningProject
Not doing anything.
-
enumerator ImportingProject
Opening a project.
-
enumerator SavingProject
Importing a project.
-
enumerator PublishingProject
Saving a project.
Publishing a project
-
enumerator Idle
Public Functions
-
inline AbstractProjectManager(QObject *parent)
Construct manager with pointer to
parentobject.- Parameters:
parent – Pointer to parent object
-
virtual void newProject(const QString &workspaceFilePath = "") = 0
Creates a new project, possibly also loading a workspace located at
workspaceFilePath.- Parameters:
workspaceFilePath – File path of the workspace to load (will not attempt to load workspace if empty)
-
virtual void newProject(const Qt::AlignmentFlag &alignment, bool logging = false) = 0
Creates a new project with default system view plugins (either on the left or right, other alignments are ignored)
- Parameters:
alignment – Alignment of the default plugins
logging – Whether to add a logging view at the bottom
-
virtual void newBlankProject() = 0
Creates a new blank project (without any view plugins or data)
-
virtual void openProject(QString filePath = "", bool importDataOnly = false, bool loadWorkspace = true) = 0
Open project from
filePath.- Parameters:
filePath – File path of the project (choose file path when empty)
importDataOnly – Whether to only import the data from the project
loadWorkspace – Whether to load the workspace which is accompanied by the project
-
virtual void openProject(QUrl url, const QString &targetDirectory = "", bool importDataOnly = false, bool loadWorkspace = true) = 0
Download project from
url, store it intargetDirand open it.- Parameters:
url – URL of the project
targetDirectory – Directory where the project is stored (temporary directory when empty)
importDataOnly – Whether to only import the data from the project
loadWorkspace – Whether to load the workspace which is accompanied by the project
-
virtual void openProject(util::ProjectsModelProjectSharedPtr project, const QString &targetDirectory = "", bool importDataOnly = false, bool loadWorkspace = true) = 0
Download project from
projectmodel, store it intargetDirand open it.- Parameters:
project – Shared pointer to the project model project
targetDirectory – Directory where the project is stored (temporary directory when empty)
importDataOnly – Whether to only import the data from the project
loadWorkspace – Whether to load the workspace which is accompanied by the project
-
virtual void importProject(QString filePath = "") = 0
Import project from
filePath(only import the data)- Parameters:
filePath – File path of the project (choose file path when empty)
-
virtual void saveProject(QString filePath = "", const QString &password = "") = 0
Save a project to
filePath.- Parameters:
filePath – File path of the project (choose file path when empty)
password – Encryption password
-
virtual void saveProjectAs() = 0
Save project to different file (user is prompted to choose the file location)
-
virtual void publishProject(QString filePath = "") = 0
Publish project to
filePath.- Parameters:
filePath – File path of the published project
-
virtual bool hasProject() const = 0
Get whether a project exists.
- Returns:
Boolean determining whether a project exists
-
virtual const Project *getCurrentProject() const = 0
Get current project.
- Returns:
Pointer to current project (nullptr if no project is loaded)
-
virtual Project *getCurrentProject() = 0
Get current project.
- Returns:
Pointer to current project (nullptr if no project is loaded)
-
virtual const ProjectsListModel &getProjectsListModel() const = 0
Get projects list model.
- Returns:
Reference to the projects list model
-
virtual const ProjectsTreeModel &getProjectsTreeModel() const = 0
Get projects tree model.
- Returns:
Reference to the projects tree model
-
virtual QFuture<QString> downloadProjectAsync(QUrl url, const QString &targetDirectory = "", Task *task = nullptr) = 0
Download project from
urland store it in the default downloaded projects directory.- Parameters:
url – URL of the project to download
targetDirectory – Directory where the project is stored (default is empty, which means the default downloaded projects directory)
task – Optional task to associate with the download operation (must live in the main/GUI thread)
- Returns:
Future containing the path to the downloaded project file
-
virtual QFuture<bool> isDownloadedProjectStaleAsync(QUrl url) const = 0
Establish asynchronously whether the project at
urlis updated with respect to the last downloaded version.- Returns:
Future containing a boolean determining whether the project is stale (true) or not (false)
-
virtual QDir getDownloadedProjectsDir() const = 0
Get the directory where downloaded projects are stored.
- Returns:
Directory where downloaded projects are stored
-
inline QString getTemporaryDirPath(const TemporaryDirType &temporaryDirType) const
Get path to the temporary directory of
temporaryDirTypeThrows an exception if not found and returns the path to the application temporary directory as a fall-back.- Parameters:
temporaryDirType – Type of temporary directory, see AbstractProjectManager::TemporaryDirType
- Returns:
Path of the temporary directory
-
virtual QString extractFileFromManiVaultProject(const QString &maniVaultFilePath, const QTemporaryDir &temporaryDir, const QString &filePath) = 0
Extract
filePathfrom compressed ManiVault project inmaniVaultFilePath.- Parameters:
maniVaultFilePath – File path of the compressed ManiVault file
temporaryDir – Temporary directory where the extracted file resides
filePath – Relative file path of the file that needs to be extracted
- Returns:
File path of the extracted file, empty string if extraction failed
-
virtual QImage getWorkspacePreview(const QString &projectFilePath, const QSize &targetSize = QSize(500, 500)) const = 0
Get preview image of the project workspace.
- Parameters:
projectFilePath – Path of the project file
- Returns:
Preview image
-
inline ProjectSerializationTask &getProjectSerializationTask()
Get task for project serialization.
-
virtual QMenu &getNewProjectMenu() = 0
Get new project menu.
- Returns:
Pointer to new project menu
-
virtual QMenu &getImportDataMenu() = 0
Get import data menu.
- Returns:
Pointer to import data menu
-
inline State getState() const
Get the state of the project manager.
- Returns:
State of the project manager
-
inline void setState(const State &state)
Set the state of the serializable object to
state.- Parameters:
state – State of the serializable object
-
inline bool isOpeningProject() const
Get whether the project manager is opening a project.
- Returns:
Boolean determining whether the project manager is opening a project
-
inline bool isImportingProject() const
Get whether the project manager is importing a project.
- Returns:
Boolean determining whether the project manager is importing a project
-
inline bool isSavingProject() const
Get whether the project manager is saving a project.
- Returns:
Boolean determining whether the project manager is saving a project
-
inline bool isPublishingProject() const
Get whether the project manager is publishing a project.
- Returns:
Boolean determining whether the project manager is publishing a project
-
virtual ProjectMetaAction *getProjectMetaAction(const QString &projectFilePath) = 0
Get project meta action for the project with
projectFilePath.- Parameters:
projectFilePath – File path of the project for which to get the meta action
- Returns:
Pointer to the project meta action, or nullptr if no action is found
-
inline const Task &getProjectDownloadTask() const
Get the task for project download.
- Returns:
Reference to the project download task
-
void projectAboutToBeCreated()
Signals that a new project is about to be created.
-
void projectCreated(const mv::Project &project)
Signals that
projectis created.- Parameters:
project – Reference to the created project
-
void projectDestroyed(const QString &projectId)
Signals that project with
projectIdis destroyed.- Parameters:
projectId – Globally unique identifier of the project that is destroyed
-
void projectAboutToBeOpened(const mv::Project &project)
Signals that
projectis about to be opened.- Parameters:
project – Reference to the project that is about to be opened
-
void projectOpened(const mv::Project &project)
Signals that
projectis opened.- Parameters:
project – Reference to the project that is opened
-
void projectAboutToBeImported(const QString &filePath)
Signals that a project is about to be imported from
filePath.- Parameters:
filePath – Path of the project file which is about to be imported
-
void projectImported(const QString &filePath)
Signals that a project is imported from
filePath.- Parameters:
filePath – Path of the project file which is imported
-
void projectAboutToBeSaved(const mv::Project &project)
Signals that
projectis about to be saved.- Parameters:
project – Reference to the project that is about to be saved
-
void projectSaved(const mv::Project &project)
Signals that
projectis saved.- Parameters:
project – Reference to the saved project
-
void projectAboutToBePublished(const mv::Project &project)
Signals that
projectis about to be published.- Parameters:
project – Reference to the project that is about to be published
-
void projectPublished(const mv::Project &project)
Signals that
projectis published.- Parameters:
project – Reference to the published project
-
void projectAboutToBeDestroyed(const mv::Project &project)
Signals that
projectis about to be destroyed.- Parameters:
project – Reference to the project that is about to be destroyed
Public Static Functions
-
static inline QString getTemporaryDirTypeName(const TemporaryDirType &temporaryDirType)
Get temporary dir type name.
- Parameters:
temporaryDirType – Temporary directory type
- Returns:
Temporary directory type name for
temporaryDirType
Protected Functions
-
inline void setTemporaryDirPath(const TemporaryDirType &temporaryDirType, const QString &temporaryDirPath)
Set path to the temporary directory of
temporaryDirTypetotemporaryDirPath.- Parameters:
temporaryDirType – Type of temporary directory, see AbstractProjectManager::TemporaryDirType
temporaryDirPath – Path of the temporary directory
-
inline void unsetTemporaryDirPath(const TemporaryDirType &temporaryDirType)
Unset path to the temporary directory of
temporaryDirType.- Parameters:
temporaryDirType – Type of temporary directory, see AbstractProjectManager::TemporaryDirType
-
class ProjectDownloadException : public mv::util::BaseException
Exception class for file project download issue.
-
class ScopedState
Set state for the duration of the enveloping scope, reverts to idle when the object gets out of scope.
Public Functions
-
inline ScopedState(AbstractProjectManager *projectManager, const State &state)
Construct with initialization state.
- Parameters:
projectManager – Pointer to project manager for which to set the state
state – State at scope begin (reverts to idle when the object gets out of scope)
-
inline ~ScopedState()
Revert to idle when object goes out of scope.
-
inline ScopedState(AbstractProjectManager *projectManager, const State &state)