Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
project_loader.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/utf8_string.h"
10
11#include <QFuture>
12
13#include <nlohmann/json.hpp>
14
15namespace zrythm::structure::project
16{
17class Project;
18class ProjectUiState;
19}
20
21namespace zrythm::undo
22{
23class UndoStack;
24}
25
26namespace zrythm::controllers
27{
28
41{
42public:
47 {
48 nlohmann::json json;
50 fs::path project_directory;
51 };
52
60 [[nodiscard]] static QFuture<LoadResult>
61 load_from_directory (const fs::path &project_dir);
62
70 static std::string
71 get_uncompressed_project_text (const fs::path &project_dir);
72
80 static nlohmann::json parse_and_validate (const std::string &json_str);
81
88 static utils::Utf8String extract_title (const nlohmann::json &j);
89
99 static void deserialize (
100 const nlohmann::json &j,
103 undo::UndoStack &undo_stack);
104};
105
106}
Handles loading of Zrythm projects from disk.
static std::string get_uncompressed_project_text(const fs::path &project_dir)
Reads and decompresses the project file.
static nlohmann::json parse_and_validate(const std::string &json_str)
Parses JSON string and validates against schema.
static void deserialize(const nlohmann::json &j, structure::project::Project &project, structure::project::ProjectUiState &ui_state, undo::UndoStack &undo_stack)
Deserializes the project data into the given objects.
static utils::Utf8String extract_title(const nlohmann::json &j)
Extracts the project title from JSON metadata.
static QFuture< LoadResult > load_from_directory(const fs::path &project_dir)
Loads and validates a project from the specified directory.
Serializable UI state for a project.
Core functionality of a Zrythm project.
Definition project.h:48
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:38
Result of a project load operation.