Handles saving of Zrythm projects to disk.
More...
#include <src/controllers/project_saver.h>
|
| static QFuture< QString > | save (const structure::project::Project &project, const structure::project::ProjectUiState &ui_state, const undo::UndoStack &undo_stack, utils::Version app_version, const fs::path &path, bool is_backup) |
| | Saves the project asynchronously to the specified directory.
|
| 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 or decompresses project data using zstd.
|
| 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.
|
Handles saving of Zrythm projects to disk.
This class provides static methods for project saving operations.
Definition at line 35 of file project_saver.h.
◆ autosave_cb()
| int zrythm::controllers::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::controllers::ProjectSaver::compress |
( |
char ** | _dest, |
|
|
size_t * | _dest_size, |
|
|
const QByteArray & | src ) |
|
inlinestatic |
◆ compress_or_decompress()
| void zrythm::controllers::ProjectSaver::compress_or_decompress |
( |
bool | compress, |
|
|
char ** | _dest, |
|
|
size_t * | _dest_size, |
|
|
const QByteArray & | src ) |
|
static |
Compresses or decompresses project data using zstd.
- Parameters
-
| compress | True to compress, false to decompress. |
| [out] | _dest | Pointer to a location to allocate memory. |
| [out] | _dest_size | Pointer to a location to store the size of the allocated memory. |
| src | Input bytes to compress/decompress. |
- Exceptions
-
◆ decompress()
| void zrythm::controllers::ProjectSaver::decompress |
( |
char ** | _dest, |
|
|
size_t * | _dest_size, |
|
|
const QByteArray & | src ) |
|
inlinestatic |
◆ get_existing_uncompressed_text()
| std::string zrythm::controllers::ProjectSaver::get_existing_uncompressed_text |
( |
const fs::path & | project_dir | ) |
|
|
static |
Returns the uncompressed text representation of the saved project file.
- Parameters
-
| project_dir | The project directory. |
- Exceptions
-
◆ make_project_dirs()
| void zrythm::controllers::ProjectSaver::make_project_dirs |
( |
const fs::path & | project_directory | ) |
|
|
static |
Creates the project directories.
- Parameters
-
| project_directory | The root project directory. |
- Exceptions
-
◆ save()
Saves the project asynchronously to the specified directory.
- Parameters
-
| project | The core project data to save. |
| ui_state | The UI state to save. |
| undo_stack | The undo history to save. |
| app_version | Version of the application. |
| path | The directory to save the project in (including the title). |
| is_backup | True if this is a backup. Backups will be saved as <original filename>.bak<num>. |
- Returns
- A QFuture that resolves to the project path on success.
- Exceptions
-
- Warning
- The returned QFuture uses continuations that run on the main thread. Do NOT call waitForFinished() on the main thread without processing Qt events, as this will cause a deadlock. Instead:
- Use QFutureWatcher with signals/slots, or
- Process events while waiting (e.g., QEventLoop), or
- Wait from a non-main thread
The documentation for this class was generated from the following file: