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/transport_controller.h"
13#include "gui/dsp/quantize_options.h"
14#include "gui/qquick/qfuture_qml_wrapper.h"
15#include "structure/project/project.h"
16#include "structure/project/project_ui_state.h"
17#include "undo/undo_stack.h"
18
19#include <QtQmlIntegration/qqmlintegration.h>
20
21namespace zrythm::gui
22{
23
36class ProjectSession : public QObject
37{
38 Q_OBJECT
39 Q_PROPERTY (QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
40 Q_PROPERTY (
41 zrythm::structure::project::Project * project READ project CONSTANT FINAL)
42 Q_PROPERTY (
43 zrythm::structure::project::ProjectUiState * uiState READ uiState CONSTANT
44 FINAL)
45 Q_PROPERTY (zrythm::undo::UndoStack * undoStack READ undoStack CONSTANT FINAL)
46 Q_PROPERTY (
47 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator READ
48 arrangerObjectCreator CONSTANT FINAL)
49 Q_PROPERTY (
50 zrythm::actions::TrackCreator * trackCreator READ trackCreator CONSTANT FINAL)
51 Q_PROPERTY (
52 zrythm::actions::PluginImporter * pluginImporter READ pluginImporter
53 CONSTANT FINAL)
54 Q_PROPERTY (
55 zrythm::actions::PluginOperator * pluginOperator READ pluginOperator
56 CONSTANT FINAL)
57 Q_PROPERTY (
58 zrythm::actions::FileImporter * fileImporter READ fileImporter CONSTANT FINAL)
59 Q_PROPERTY (
60 zrythm::controllers::TransportController * transportController READ
61 transportController CONSTANT FINAL)
62 Q_PROPERTY (
63 QString projectDirectory READ projectDirectory WRITE setProjectDirectory
64 NOTIFY projectDirectoryChanged FINAL)
65 QML_ELEMENT
66 QML_UNCREATABLE ("")
67
68public:
69 ProjectSession (
70 utils::AppSettings &app_settings,
72
73 QString title () const;
74 void setTitle (const QString &title);
75 QString projectDirectory () const;
76 void setProjectDirectory (const QString &directory);
77 structure::project::Project * project () const;
78 structure::project::ProjectUiState * uiState () const;
79 undo::UndoStack * undoStack () const;
80 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator () const;
81 zrythm::actions::TrackCreator * trackCreator () const;
82 actions::PluginImporter * pluginImporter () const;
83 actions::PluginOperator * pluginOperator () const;
84 actions::FileImporter * fileImporter () const;
85 controllers::TransportController * transportController () const;
86
88 createArrangerObjectSelectionOperator (
89 QItemSelectionModel * selectionModel) const;
90
98 Q_INVOKABLE qquick::QFutureQmlWrapper * save ();
99
109 Q_INVOKABLE qquick::QFutureQmlWrapper * saveAs (const QString &path);
110
117 std::optional<fs::path> get_newer_backup ();
118
119Q_SIGNALS:
120 void titleChanged (const QString &title);
121 void projectDirectoryChanged (const QString &directory);
122
123private:
124 utils::AppSettings &app_settings_;
125
126 // Project title and directory
127 utils::Utf8String title_;
128 fs::path project_directory_;
129
130 // Core project data
132
133 // Serializable UI state (tool, clipEditor, timeline, snapGrids)
135
136 // Undo/redo history
138
139 // Quantize options for MIDI editing
140 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_editor_;
141 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_timeline_;
142
143 // Action handlers for user operations
145 arranger_object_creator_;
151};
152
153} // namespace zrythm::gui
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< fs::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:48
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:38
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:38