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

Public Types

enum class  CompressionFlag { PROJECT_COMPRESS_FILE = 0 , PROJECT_DECOMPRESS_FILE = 0 , PROJECT_COMPRESS_DATA = 1 , PROJECT_DECOMPRESS_DATA = 1 }
 Flag to pass to project_compress() and project_decompress(). More...

Public Member Functions

 ProjectSaver (const Project &project)
QFuture< void > save_async (bool for_backup)
void save (bool is_backup, bool show_notification, bool async)
 Saves the project to the directory set previously in Project.
std::string get_existing_uncompressed_text (bool backup)
 Returns the uncompressed text representation of the saved project file.
bool has_unsaved_changes () const

Static Public Member Functions

static int autosave_cb (void *data)
 Autosave callback.
static void make_project_dirs (const Project &project, bool is_backup)
 Creates the project directories.
static void compress_or_decompress (bool compress, char **_dest, size_t *_dest_size, CompressionFlag dest_type, const QByteArray &src)
 Compresses/decompress a project from a file/data to a file/data.
static void compress (char **_dest, size_t *_dest_size, CompressionFlag dest_type, const QByteArray &src)
static void decompress (char **_dest, size_t *_dest_size, CompressionFlag dest_type, const QByteArray &src)

Detailed Description

Definition at line 14 of file project_saver.h.

Member Enumeration Documentation

◆ CompressionFlag

Flag to pass to project_compress() and project_decompress().

Definition at line 54 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,
CompressionFlag dest_type,
const QByteArray & src )
inlinestatic

Definition at line 80 of file project_saver.h.

◆ compress_or_decompress()

void zrythm::structure::project::ProjectSaver::compress_or_decompress ( bool compress,
char ** _dest,
size_t * _dest_size,
CompressionFlag dest_type,
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,
CompressionFlag dest_type,
const QByteArray & src )
inlinestatic

Definition at line 89 of file project_saver.h.

◆ get_existing_uncompressed_text()

std::string zrythm::structure::project::ProjectSaver::get_existing_uncompressed_text ( bool backup)

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 Project & project,
bool is_backup )
static

Creates the project directories.

Parameters
is_backup
Exceptions
ZrythmExceptionIf the directories cannot be created.

◆ save()

void zrythm::structure::project::ProjectSaver::save ( bool is_backup,
bool show_notification,
bool async )

Saves the project to the directory set previously in Project.

Parameters
is_backup1 if this is a backup. Backups will be saved as <original filename>.bak<num>.
show_notificationShow a notification in the UI that the project was saved.
asyncSave asynchronously in another thread.
Exceptions
ZrythmExceptionIf the project cannot be saved.

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