Zrythm v2.0.0-alpha.1
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/clip_operator.h"
9#include "actions/file_importer.h"
10#include "actions/plugin_importer.h"
11#include "actions/plugin_operator.h"
12#include "actions/track_creator.h"
13#include "actions/uuid_property_operator.h"
14#include "controllers/recording_coordinator.h"
15#include "controllers/recording_materializer.h"
16#include "controllers/transport_controller.h"
17#include "gui/qquick/qfuture_qml_wrapper.h"
18#include "structure/project/project.h"
19#include "structure/project/project_ui_state.h"
20#include "undo/undo_stack.h"
21
22#include <QtQmlIntegration/qqmlintegration.h>
23
24namespace zrythm::gui::old_dsp
25{
26class QuantizeOptions;
27}
28
29namespace zrythm::gui
30{
31
44class ProjectSession : public QObject
45{
46 Q_OBJECT
47 Q_PROPERTY (QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
48 Q_PROPERTY (
49 zrythm::structure::project::Project * project READ project CONSTANT FINAL)
50 Q_PROPERTY (
51 zrythm::structure::project::ProjectUiState * uiState READ uiState CONSTANT
52 FINAL)
53 Q_PROPERTY (zrythm::undo::UndoStack * undoStack READ undoStack CONSTANT FINAL)
54 Q_PROPERTY (
55 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator READ
56 arrangerObjectCreator CONSTANT FINAL)
57 Q_PROPERTY (
58 zrythm::actions::ClipOperator * clipOperator READ clipOperator CONSTANT FINAL)
59 Q_PROPERTY (
60 zrythm::actions::TrackCreator * trackCreator READ trackCreator CONSTANT FINAL)
61 Q_PROPERTY (
62 zrythm::actions::PluginImporter * pluginImporter READ pluginImporter
63 CONSTANT FINAL)
64 Q_PROPERTY (
65 zrythm::actions::PluginOperator * pluginOperator READ pluginOperator
66 CONSTANT FINAL)
67 Q_PROPERTY (
68 zrythm::actions::FileImporter * fileImporter READ fileImporter CONSTANT FINAL)
69 Q_PROPERTY (
70 zrythm::actions::UuidPropertyOperator * uuidPropertyOperator READ
71 uuidPropertyOperator CONSTANT FINAL)
72 Q_PROPERTY (
73 zrythm::controllers::TransportController * transportController READ
74 transportController CONSTANT FINAL)
75 Q_PROPERTY (
76 QString projectDirectory READ projectDirectory WRITE setProjectDirectory
77 NOTIFY projectDirectoryChanged FINAL)
78 QML_ELEMENT
79 QML_UNCREATABLE ("")
80
81public:
82 ProjectSession (
83 utils::AppSettings &app_settings,
85
86 ~ProjectSession () override;
87
88 QString title () const;
89 void setTitle (const QString &title);
90 QString projectDirectory () const;
91 void setProjectDirectory (const QString &directory);
92 structure::project::Project * project () const;
93 structure::project::ProjectUiState * uiState () const;
94 undo::UndoStack * undoStack () const;
95 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator () const;
96 zrythm::actions::ClipOperator * clipOperator () const;
97 zrythm::actions::TrackCreator * trackCreator () const;
98 actions::PluginImporter * pluginImporter () const;
99 actions::PluginOperator * pluginOperator () const;
100 actions::FileImporter * fileImporter () const;
101 actions::UuidPropertyOperator * uuidPropertyOperator () const;
102 controllers::TransportController * transportController () const;
103 controllers::RecordingCoordinator * recordingCoordinator () const;
104
106 createArrangerObjectSelectionOperator (
107 QItemSelectionModel * selectionModel) const;
108
116 Q_INVOKABLE qquick::QFutureQmlWrapper * save ();
127 Q_INVOKABLE qquick::QFutureQmlWrapper * saveAs (const QString &path);
128
135 std::optional<std::filesystem::path> get_newer_backup ();
136
137Q_SIGNALS:
138 void titleChanged (const QString &title);
139 void projectDirectoryChanged (const QString &directory);
140
141private:
148 void wire_midi_input_selections_to_tracks ();
149
153 void wire_chord_track_to_pad_bank ();
154
155 utils::AppSettings &app_settings_;
156
157 // Project title and directory
158 utils::Utf8String title_;
159 std::filesystem::path project_directory_;
160
161 // Core project data
163
164 // Serializable UI state (tool, clipEditor, timeline, snapGrids)
166
167 // Undo/redo history
169
170 // Quantize options for MIDI editing
171 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_editor_;
172 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_timeline_;
173
174 // Action handlers for user operations
176 arranger_object_creator_;
185 recording_coordinator_;
187 recording_materializer_;
188};
189
190} // namespace zrythm::gui
QML-facing operator for edits on a single clip (the clip-editor scope), mirroring the ArrangerObjectC...
QML-accessible operator for undoable property changes on UUID-identifiable objects.
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:55
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