Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::project::ProjectSaver Class Reference

Public Member Functions

 ProjectSaver (const Project &project, utils::Version app_version)
QFuture< utils::Utf8Stringsave (const fs::path &path, bool is_backup)
 Saves the project asynchronously to the directory set previously in Project.
bool has_unsaved_changes () const

Static Public Member Functions

static int autosave_cb (void *data)
 Autosave callback.
static void make_project_dirs (const fs::path &project_directory)
 Creates the project directories.
static void compress_or_decompress (bool compress, char **_dest, size_t *_dest_size, const QByteArray &src)
 Compresses/decompress a project from a file/data to a file/data.
static void compress (char **_dest, size_t *_dest_size, const QByteArray &src)
static void decompress (char **_dest, size_t *_dest_size, const QByteArray &src)
static std::string get_existing_uncompressed_text (const fs::path &project_dir)
 Returns the uncompressed text representation of the saved project file.

Detailed Description

Definition at line 15 of file project_saver.h.

Member Function Documentation

◆ autosave_cb()

int zrythm::structure::project::ProjectSaver::autosave_cb ( void * data)
static

Autosave callback.

This will keep getting called at regular short intervals, and if enough time has passed and it's okay to save it will autosave, otherwise it will wait until the next interval and check again.

◆ compress()

void zrythm::structure::project::ProjectSaver::compress ( char ** _dest,
size_t * _dest_size,
const QByteArray & src )
inlinestatic

Definition at line 66 of file project_saver.h.

◆ compress_or_decompress()

void zrythm::structure::project::ProjectSaver::compress_or_decompress ( bool compress,
char ** _dest,
size_t * _dest_size,
const QByteArray & src )
static

Compresses/decompress a project from a file/data to a file/data.

Parameters
compressTrue to compress, false to decompress.
[out]_destPointer to a location to allocate memory.
[out]_dest_sizePointer to a location to store the size of the allocated memory.
srcInput bytes to compress/decompress.
Exceptions
ZrythmExceptionIf the compression/decompression fails.

◆ decompress()

void zrythm::structure::project::ProjectSaver::decompress ( char ** _dest,
size_t * _dest_size,
const QByteArray & src )
inlinestatic

Definition at line 72 of file project_saver.h.

◆ get_existing_uncompressed_text()

std::string zrythm::structure::project::ProjectSaver::get_existing_uncompressed_text ( const fs::path & project_dir)
static

Returns the uncompressed text representation of the saved project file.

Parameters
backupWhether to use the project file from the most recent backup.
Exceptions
ZrythmExceptionIf an error occurs.

◆ make_project_dirs()

void zrythm::structure::project::ProjectSaver::make_project_dirs ( const fs::path & project_directory)
static

Creates the project directories.

Exceptions
ZrythmExceptionIf the directories cannot be created.

◆ save()

QFuture< utils::Utf8String > zrythm::structure::project::ProjectSaver::save ( const fs::path & path,
bool is_backup )
nodiscard

Saves the project asynchronously to the directory set previously in Project.

Parameters
pathThe directory to save the project in (including the title).
is_backup1 if this is a backup. Backups will be saved as <original filename>.bak<num>.
Exceptions
ZrythmExceptionIf any step failed.

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