Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
project_session.h
1// SPDX-FileCopyrightText: © 2025-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "actions/arranger_object_creator.h"
7#include "actions/arranger_object_selection_operator.h"
8#include "actions/file_importer.h"
9#include "actions/plugin_importer.h"
10#include "actions/plugin_operator.h"
11#include "actions/track_creator.h"
12#include "controllers/recording_coordinator.h"
13#include "controllers/recording_materializer.h"
14#include "controllers/transport_controller.h"
15#include "gui/qquick/qfuture_qml_wrapper.h"
16#include "structure/project/project.h"
17#include "structure/project/project_ui_state.h"
18#include "undo/undo_stack.h"
19
20#include <QtQmlIntegration/qqmlintegration.h>
21
22namespace zrythm::gui::old_dsp
23{
24class QuantizeOptions;
25}
26
27namespace zrythm::gui
28{
29
42class ProjectSession : public QObject
43{
44 Q_OBJECT
45 Q_PROPERTY (QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
46 Q_PROPERTY (
47 zrythm::structure::project::Project * project READ project CONSTANT FINAL)
48 Q_PROPERTY (
49 zrythm::structure::project::ProjectUiState * uiState READ uiState CONSTANT
50 FINAL)
51 Q_PROPERTY (zrythm::undo::UndoStack * undoStack READ undoStack CONSTANT FINAL)
52 Q_PROPERTY (
53 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator READ
54 arrangerObjectCreator CONSTANT FINAL)
55 Q_PROPERTY (
56 zrythm::actions::TrackCreator * trackCreator READ trackCreator CONSTANT FINAL)
57 Q_PROPERTY (
58 zrythm::actions::PluginImporter * pluginImporter READ pluginImporter
59 CONSTANT FINAL)
60 Q_PROPERTY (
61 zrythm::actions::PluginOperator * pluginOperator READ pluginOperator
62 CONSTANT FINAL)
63 Q_PROPERTY (
64 zrythm::actions::FileImporter * fileImporter READ fileImporter CONSTANT FINAL)
65 Q_PROPERTY (
66 zrythm::controllers::TransportController * transportController READ
67 transportController CONSTANT FINAL)
68 Q_PROPERTY (
69 QString projectDirectory READ projectDirectory WRITE setProjectDirectory
70 NOTIFY projectDirectoryChanged FINAL)
71 QML_ELEMENT
72 QML_UNCREATABLE ("")
73
74public:
75 ProjectSession (
76 utils::AppSettings &app_settings,
78
79 ~ProjectSession () override;
80
81 QString title () const;
82 void setTitle (const QString &title);
83 QString projectDirectory () const;
84 void setProjectDirectory (const QString &directory);
85 structure::project::Project * project () const;
86 structure::project::ProjectUiState * uiState () const;
87 undo::UndoStack * undoStack () const;
88 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator () const;
89 zrythm::actions::TrackCreator * trackCreator () const;
90 actions::PluginImporter * pluginImporter () const;
91 actions::PluginOperator * pluginOperator () const;
92 actions::FileImporter * fileImporter () const;
93 controllers::TransportController * transportController () const;
94 controllers::RecordingCoordinator * recordingCoordinator () const;
95
97 createArrangerObjectSelectionOperator (
98 QItemSelectionModel * selectionModel) const;
99
107 Q_INVOKABLE qquick::QFutureQmlWrapper * save ();
108
118 Q_INVOKABLE qquick::QFutureQmlWrapper * saveAs (const QString &path);
119
126 std::optional<std::filesystem::path> get_newer_backup ();
127
128Q_SIGNALS:
129 void titleChanged (const QString &title);
130 void projectDirectoryChanged (const QString &directory);
131
132private:
133 utils::AppSettings &app_settings_;
134
135 // Project title and directory
136 utils::Utf8String title_;
137 std::filesystem::path project_directory_;
138
139 // Core project data
141
142 // Serializable UI state (tool, clipEditor, timeline, snapGrids)
144
145 // Undo/redo history
147
148 // Quantize options for MIDI editing
149 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_editor_;
150 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_timeline_;
151
152 // Action handlers for user operations
154 arranger_object_creator_;
161 recording_coordinator_;
163 recording_materializer_;
164};
165
166} // namespace zrythm::gui
Orchestrates the recording lifecycle across all armed tracks.
Controller for transport navigation.
Q_INVOKABLE qquick::QFutureQmlWrapper * save()
Saves the project to the current project directory.
Q_INVOKABLE qquick::QFutureQmlWrapper * saveAs(const QString &path)
Saves the project to a new directory.
std::optional< std::filesystem::path > get_newer_backup()
Finds a backup directory newer than the main project file.
QML-exposed wrapper over a QFuture that provides properties for binding.
Serializable UI state for a project.
Core functionality of a Zrythm project.
Definition project.h:52
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:36
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:37