Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
project_saver.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <filesystem>
7#include <string>
8
9#include "utils/version.h"
10
11#include <QByteArray>
12#include <QFuture>
13
14namespace zrythm::structure::project
15{
16class Project;
17class ProjectUiState;
18}
19
20namespace zrythm::undo
21{
22class UndoStack;
23}
24
25namespace zrythm::controllers
26{
27
34{
35public:
57 [[nodiscard]] static QFuture<QString> save (
58 const structure::project::Project &project,
60 const undo::UndoStack &undo_stack,
61 utils::Version app_version,
62 const std::filesystem::path &path,
63 bool is_backup);
64
72 static int autosave_cb (void * data);
73
80 static void
81 make_project_dirs (const std::filesystem::path &project_directory);
82
95 bool compress,
96 char ** _dest,
97 size_t * _dest_size,
98 const QByteArray &src);
99
100 static void
101 compress (char ** _dest, size_t * _dest_size, const QByteArray &src)
102 {
103 compress_or_decompress (true, _dest, _dest_size, src);
104 }
105
106 static void
107 decompress (char ** _dest, size_t * _dest_size, const QByteArray &src)
108 {
109 compress_or_decompress (false, _dest, _dest_size, src);
110 }
111
119 static std::string
120 get_existing_uncompressed_text (const std::filesystem::path &project_dir);
121
122private:
129 static void set_and_create_next_available_backup_dir ();
130};
131
132}
Handles saving of Zrythm projects to disk.
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 std::filesystem::path &path, bool is_backup)
Saves the project asynchronously to the specified directory.
static std::string get_existing_uncompressed_text(const std::filesystem::path &project_dir)
Returns the uncompressed text representation of the saved project file.
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 make_project_dirs(const std::filesystem::path &project_directory)
Creates the project directories.
static int autosave_cb(void *data)
Autosave callback.
Serializable UI state for a project.
Core functionality of a Zrythm project.
Definition project.h:51
Represents a semantic version with major, minor, and optional patch.
Definition version.h:29