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/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::old_dsp
21{
22class QuantizeOptions;
23}
24
25namespace zrythm::gui
26{
27
40class ProjectSession : public QObject
41{
42 Q_OBJECT
43 Q_PROPERTY (QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
44 Q_PROPERTY (
45 zrythm::structure::project::Project * project READ project CONSTANT FINAL)
46 Q_PROPERTY (
47 zrythm::structure::project::ProjectUiState * uiState READ uiState CONSTANT
48 FINAL)
49 Q_PROPERTY (zrythm::undo::UndoStack * undoStack READ undoStack CONSTANT FINAL)
50 Q_PROPERTY (
51 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator READ
52 arrangerObjectCreator CONSTANT FINAL)
53 Q_PROPERTY (
54 zrythm::actions::TrackCreator * trackCreator READ trackCreator CONSTANT FINAL)
55 Q_PROPERTY (
56 zrythm::actions::PluginImporter * pluginImporter READ pluginImporter
57 CONSTANT FINAL)
58 Q_PROPERTY (
59 zrythm::actions::PluginOperator * pluginOperator READ pluginOperator
60 CONSTANT FINAL)
61 Q_PROPERTY (
62 zrythm::actions::FileImporter * fileImporter READ fileImporter CONSTANT FINAL)
63 Q_PROPERTY (
64 zrythm::controllers::TransportController * transportController READ
65 transportController CONSTANT FINAL)
66 Q_PROPERTY (
67 QString projectDirectory READ projectDirectory WRITE setProjectDirectory
68 NOTIFY projectDirectoryChanged FINAL)
69 QML_ELEMENT
70 QML_UNCREATABLE ("")
71
72public:
73 ProjectSession (
74 utils::AppSettings &app_settings,
76
77 ~ProjectSession () override;
78
79 QString title () const;
80 void setTitle (const QString &title);
81 QString projectDirectory () const;
82 void setProjectDirectory (const QString &directory);
83 structure::project::Project * project () const;
84 structure::project::ProjectUiState * uiState () const;
85 undo::UndoStack * undoStack () const;
86 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator () const;
87 zrythm::actions::TrackCreator * trackCreator () const;
88 actions::PluginImporter * pluginImporter () const;
89 actions::PluginOperator * pluginOperator () const;
90 actions::FileImporter * fileImporter () const;
91 controllers::TransportController * transportController () const;
92
94 createArrangerObjectSelectionOperator (
95 QItemSelectionModel * selectionModel) const;
96
104 Q_INVOKABLE qquick::QFutureQmlWrapper * save ();
105
115 Q_INVOKABLE qquick::QFutureQmlWrapper * saveAs (const QString &path);
116
123 std::optional<std::filesystem::path> get_newer_backup ();
124
125Q_SIGNALS:
126 void titleChanged (const QString &title);
127 void projectDirectoryChanged (const QString &directory);
128
129private:
130 utils::AppSettings &app_settings_;
131
132 // Project title and directory
133 utils::Utf8String title_;
134 std::filesystem::path project_directory_;
135
136 // Core project data
138
139 // Serializable UI state (tool, clipEditor, timeline, snapGrids)
141
142 // Undo/redo history
144
145 // Quantize options for MIDI editing
146 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_editor_;
147 std::unique_ptr<old_dsp::QuantizeOptions> quantize_opts_timeline_;
148
149 // Action handlers for user operations
151 arranger_object_creator_;
157};
158
159} // 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< 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:51
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