NDEVR
API Documentation
ProjectFileManager

Manages writing to the NDV file and any folder operations for projects. More...

Collaboration diagram for ProjectFileManager:
[legend]

Public Types

enum  PathChangeMode { e_move , e_copy , e_new }
 Describes how the project folder path is being changed. More...

Public Member Functions

 ProjectFileManager (QTModelManager *manager)
 Constructs the project file manager for the given model manager.
virtual File activeBackupFile () const
 Gets the file path for the active backup file.
virtual File activeLogFolder () const
 Gets the folder path for storing project logs.
virtual File activeScreenshotFolder () const
 Gets the folder path for storing project screenshots.
virtual File activeVideoFolder () const
 Gets the folder path for storing project videos.
ThreadautoSaveThread ()
 Gets the background thread used for auto-save operations.
void clearAll ()
 Clears all project data and resets to the default state.
void clearBackupInformation ()
 Clears all stored backup timestamps and file references.
virtual bool copyProject (const SaveOptions &options)
 Copies the current project to a new location.
virtual File defaultBrowseDirectory (bool is_project) const
 Gets the default browse directory for file dialogs.
void exportPathAboutToChangeSignal (const File &new_path, PathChangeMode mode)
 Emitted before the export folder path changes.
void exportPathChangedSignal (const File &path)
 Emitted after the export folder path has changed.
virtual INIFactory getINI ()
 Gets the INI factory for reading and writing project configuration.
void imagePathAboutToChangeSignal (const File &new_path, PathChangeMode mode)
 Emitted before the image folder path changes.
void imagePathChangedSignal (const File &path)
 Emitted after the image folder path has changed.
Time lastSaveTime () const
 Gets the time of the last successful save.
void logPathAboutToChangeSignal (const File &new_path, PathChangeMode mode)
 Emitted before the log folder path changes.
void logPathChangedSignal (const File &path)
 Emitted after the log folder path has changed.
virtual bool moveProject (const SaveOptions &options)
 Moves the current project to a new location.
virtual bool optimizeUserSaveProject ()
 Performs an optimized save that only writes changed data.
File previousBackupFile () const
 Gets the file path of the previous backup.
virtual File projectDirectory () const
 Gets the project directory path.
virtual File projectFile () const
 Gets the project file path.
virtual String projectName () const
 Gets the name of the current project.
virtual File projectParentDirectory () const
 Gets the parent directory of the project directory.
void projectSavedSignal ()
 Emitted after the project is saved successfully.
void readINIOptions ()
 Reads project file manager options from the INI configuration.
void saveINIOptions ()
 Saves project file manager options to the INI configuration.
virtual bool saveProject (const SaveOptions &options=SaveOptions())
 Saves the project to disk without user interaction.
void update (Time current_time)
 Called periodically to check if an auto-save should be performed.
virtual void updateActiveProjectFolder (PathChangeMode mode, Log *log=nullptr)
 Updates the active project folder paths and emits path change signals.
void updateLastBackupTime ()
 Updates the timestamp of the last backup operation.
virtual void userDiscardProject (QTModelManager *manager, bool is_blocking)
 Discards the current project without saving, optionally blocking until complete.
virtual bool userSaveProject (const SaveOptions &options=SaveOptions())
 Saves the project with user-facing dialogs and confirmation prompts.
void videoPathAboutToChangeSignal (const File &new_path, PathChangeMode mode)
 Emitted before the video folder path changes.
void videoPathChangedSignal (const File &path)
 Emitted after the video folder path has changed.
void writeIconFile (const String &id)
 Writes a preview icon image file for the project.

Protected Attributes

BasicThreadm_auto_save_thread
 The background thread for auto-save operations.
bool m_is_last_save_backup
 Whether the last save was an auto-save backup.
Time m_last_backup_time
 The timestamp of the last backup operation.
Time m_last_project_file_check_time
 The timestamp of the last project file integrity check.
File m_last_save_file
 The file path of the last save operation.
Time m_last_save_time
 The timestamp of the last save operation.
QTModelManagerm_manager
 The model manager owning the project data.
String m_project_name
 The current project name.
File m_project_parent_directory
 The parent directory of the project folder.
String m_runtime_log_folder
 The folder for runtime log files.

Detailed Description

Manages writing to the NDV file and any folder operations for projects.


Also responsible for creating auto-save backup files at given intervals.

Definition at line 35 of file ProjectFileManager.h.

Member Enumeration Documentation

◆ PathChangeMode

Describes how the project folder path is being changed.

Enumerator
e_move 

The project is being moved to a new location.

e_copy 

The project is being copied to a new location.

e_new 

A new project is being created at the location.

Definition at line 42 of file ProjectFileManager.h.

Constructor & Destructor Documentation

◆ ProjectFileManager()

ProjectFileManager::ProjectFileManager ( QTModelManager * manager)

Constructs the project file manager for the given model manager.

Parameters
[in]managerThe model manager that owns the project data.

References ProjectFileManager().

Referenced by ProjectFileManager().

Member Function Documentation

◆ activeBackupFile()

virtual File ProjectFileManager::activeBackupFile ( ) const
virtual

Gets the file path for the active backup file.

Returns
The backup file path.

◆ activeLogFolder()

virtual File ProjectFileManager::activeLogFolder ( ) const
virtual

Gets the folder path for storing project logs.

Returns
The log folder path.

◆ activeScreenshotFolder()

virtual File ProjectFileManager::activeScreenshotFolder ( ) const
virtual

Gets the folder path for storing project screenshots.

Returns
The screenshot folder path.

◆ activeVideoFolder()

virtual File ProjectFileManager::activeVideoFolder ( ) const
virtual

Gets the folder path for storing project videos.

Returns
The video folder path.

◆ autoSaveThread()

Thread * ProjectFileManager::autoSaveThread ( )

Gets the background thread used for auto-save operations.

Returns
A pointer to the auto-save thread.

◆ copyProject()

virtual bool ProjectFileManager::copyProject ( const SaveOptions & options)
virtual

Copies the current project to a new location.

Parameters
[in]optionsThe save options specifying the destination.
Returns
True if the copy was successful.

◆ defaultBrowseDirectory()

virtual File ProjectFileManager::defaultBrowseDirectory ( bool is_project) const
virtual

Gets the default browse directory for file dialogs.

Parameters
[in]is_projectWhether browsing for a project file versus a general file.
Returns
The default browse directory path.

◆ getINI()

virtual INIFactory ProjectFileManager::getINI ( )
virtual

Gets the INI factory for reading and writing project configuration.

Returns
The INI factory for the current project.

◆ lastSaveTime()

Time ProjectFileManager::lastSaveTime ( ) const
inline

Gets the time of the last successful save.

Returns
The timestamp of the last save.

Definition at line 117 of file ProjectFileManager.h.

References m_last_save_time.

◆ moveProject()

virtual bool ProjectFileManager::moveProject ( const SaveOptions & options)
virtual

Moves the current project to a new location.

Parameters
[in]optionsThe save options specifying the destination.
Returns
True if the move was successful.

◆ optimizeUserSaveProject()

virtual bool ProjectFileManager::optimizeUserSaveProject ( )
virtual

Performs an optimized save that only writes changed data.

Returns
True if the save was successful.

◆ previousBackupFile()

File ProjectFileManager::previousBackupFile ( ) const

Gets the file path of the previous backup.

Returns
The file path of the previous backup.

◆ projectDirectory()

virtual File ProjectFileManager::projectDirectory ( ) const
virtual

Gets the project directory path.

Returns
The directory containing the project file.

◆ projectFile()

virtual File ProjectFileManager::projectFile ( ) const
virtual

Gets the project file path.

Returns
The full path to the project file.

◆ projectName()

virtual String ProjectFileManager::projectName ( ) const
virtual

Gets the name of the current project.

Returns
The project name string.

◆ projectParentDirectory()

virtual File ProjectFileManager::projectParentDirectory ( ) const
virtual

Gets the parent directory of the project directory.

Returns
The parent directory path.

◆ saveProject()

virtual bool ProjectFileManager::saveProject ( const SaveOptions & options = SaveOptions())
virtual

Saves the project to disk without user interaction.

Parameters
[in]optionsThe save options.
Returns
True if the save was successful.

◆ update()

void ProjectFileManager::update ( Time current_time)

Called periodically to check if an auto-save should be performed.

Parameters
[in]current_timeThe current time for scheduling decisions.

◆ updateActiveProjectFolder()

virtual void ProjectFileManager::updateActiveProjectFolder ( PathChangeMode mode,
Log * log = nullptr )
virtual

Updates the active project folder paths and emits path change signals.

Parameters
[in]modeHow the path is being changed.
[in]logOptional log for recording the operation.

◆ userDiscardProject()

virtual void ProjectFileManager::userDiscardProject ( QTModelManager * manager,
bool is_blocking )
virtual

Discards the current project without saving, optionally blocking until complete.

Parameters
[in]managerThe model manager owning the project.
[in]is_blockingWhether to block until the discard is complete.

◆ userSaveProject()

virtual bool ProjectFileManager::userSaveProject ( const SaveOptions & options = SaveOptions())
virtual

Saves the project with user-facing dialogs and confirmation prompts.

Parameters
[in]optionsThe save options.
Returns
True if the save was successful.

◆ writeIconFile()

void ProjectFileManager::writeIconFile ( const String & id)

Writes a preview icon image file for the project.

Parameters
[in]idThe identifier for the icon to write.

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