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/track_creator.h"
11#include "controllers/transport_controller.h"
12#include "gui/dsp/quantize_options.h"
13#include "gui/qquick/qfuture_qml_wrapper.h"
14#include "structure/project/project.h"
15#include "structure/project/project_ui_state.h"
16#include "undo/undo_stack.h"
17
18#include <QtQmlIntegration/qqmlintegration.h>
19
20namespace zrythm::gui
21{
22
35class ProjectSession : public QObject
36{
37 Q_OBJECT
38 Q_PROPERTY (QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
39 Q_PROPERTY (
40 zrythm::structure::project::Project * project READ project CONSTANT FINAL)
41 Q_PROPERTY (
42 zrythm::structure::project::ProjectUiState * uiState READ uiState CONSTANT
43 FINAL)
44 Q_PROPERTY (zrythm::undo::UndoStack * undoStack READ undoStack CONSTANT FINAL)
45 Q_PROPERTY (
46 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator READ
47 arrangerObjectCreator CONSTANT FINAL)
48 Q_PROPERTY (
49 zrythm::actions::TrackCreator * trackCreator READ trackCreator CONSTANT FINAL)
50 Q_PROPERTY (
51 zrythm::actions::PluginImporter * pluginImporter READ pluginImporter
52 CONSTANT FINAL)
53 Q_PROPERTY (
54 zrythm::actions::FileImporter * fileImporter READ fileImporter CONSTANT FINAL)
55 Q_PROPERTY (
56 zrythm::controllers::TransportController * transportController READ
57 transportController CONSTANT FINAL)
58 Q_PROPERTY (
59 QString projectDirectory READ projectDirectory WRITE setProjectDirectory
60 NOTIFY projectDirectoryChanged FINAL)
61 QML_ELEMENT
62 QML_UNCREATABLE ("")
63
64public:
65 ProjectSession (
66 utils::AppSettings &app_settings,
68
69 QString title () const;
70 void setTitle (const QString &title);
71 QString projectDirectory () const;
72 void setProjectDirectory (const QString &directory);
73 structure::project::Project * project () const;
74 structure::project::ProjectUiState * uiState () const;
75 undo::UndoStack * undoStack () const;
76 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator () const;
77 zrythm::actions::TrackCreator * trackCreator () const;
78 actions::PluginImporter * pluginImporter () const;
79 actions::FileImporter * fileImporter () const;
80 controllers::TransportController * transportController () const;
81
83 createArrangerObjectSelectionOperator (
84 QItemSelectionModel * selectionModel) const;
85
93 Q_INVOKABLE qquick::QFutureQmlWrapper * save ();
94
104 Q_INVOKABLE qquick::QFutureQmlWrapper * saveAs (const QString &path);
105
112 std::optional<fs::path> get_newer_backup ();
113
114Q_SIGNALS:
115 void titleChanged (const QString &title);
116 void projectDirectoryChanged (const QString &directory);
117
118private:
119 utils::AppSettings &app_settings_;
120
121 // Project title and directory
122 utils::Utf8String title_;
123 fs::path project_directory_;
124
125 // Core project data
127
128 // Serializable UI state (tool, clipEditor, timeline, snapGrids)
130
131 // Undo/redo history
133
134 // Quantize options for MIDI editing
135 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_editor_;
136 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_timeline_;
137
138 // Action handlers for user operations
140 arranger_object_creator_;
145};
146
147} // 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