Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
project_ui_state.h
1// SPDX-FileCopyrightText: © 2018-2025 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 "gui/backend/arranger_tool.h"
12#include "gui/backend/backend/clip_editor.h"
13#include "gui/dsp/quantize_options.h"
14#include "structure/arrangement/timeline.h"
15#include "structure/project/project.h"
16#include "undo/undo_stack.h"
17
18#include <QtQmlIntegration/qqmlintegration.h>
19
20namespace zrythm::gui
21{
27class ProjectUiState : public QObject
28{
29 Q_OBJECT
30 Q_PROPERTY (
31 QString title READ getTitle WRITE setTitle NOTIFY titleChanged FINAL)
32 Q_PROPERTY (
33 zrythm::structure::arrangement::Timeline * timeline READ timeline CONSTANT
34 FINAL)
35 Q_PROPERTY (zrythm::gui::backend::ArrangerTool * tool READ tool CONSTANT FINAL)
36 Q_PROPERTY (ClipEditor * clipEditor READ clipEditor CONSTANT FINAL)
37 Q_PROPERTY (
38 zrythm::structure::project::Project * project READ project CONSTANT FINAL)
39 Q_PROPERTY (zrythm::undo::UndoStack * undoStack READ undoStack CONSTANT FINAL)
40 Q_PROPERTY (
41 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator READ
42 arrangerObjectCreator CONSTANT FINAL)
43 Q_PROPERTY (
44 zrythm::actions::TrackCreator * trackCreator READ trackCreator CONSTANT FINAL)
45 Q_PROPERTY (
46 zrythm::actions::PluginImporter * pluginImporter READ pluginImporter
47 CONSTANT FINAL)
48 Q_PROPERTY (
49 zrythm::actions::FileImporter * fileImporter READ fileImporter CONSTANT FINAL)
50 Q_PROPERTY (
51 QString projectDirectory READ projectDirectory WRITE setProjectDirectory
52 NOTIFY projectDirectoryChanged FINAL)
53 QML_ELEMENT
54 QML_UNCREATABLE ("")
55
56public:
57 using QuantizeOptions = old_dsp::QuantizeOptions;
58
59 ProjectUiState (
61
62 // =========================================================
63 // QML interface
64 // =========================================================
65
66 QString getTitle () const;
67 void setTitle (const QString &title);
68 structure::project::Project * project () const;
69 gui::backend::ArrangerTool * tool () const;
70 ClipEditor * clipEditor () const;
71 structure::arrangement::Timeline * timeline () const;
72 zrythm::actions::ArrangerObjectCreator * arrangerObjectCreator () const;
73 zrythm::actions::TrackCreator * trackCreator () const;
74 actions::FileImporter * fileImporter () const;
75 actions::PluginImporter * pluginImporter () const;
76 undo::UndoStack * undoStack () const;
77
78 QString projectDirectory () const;
79 void setProjectDirectory (const QString &directory);
80
82 createArrangerObjectSelectionOperator (
83 QItemSelectionModel * selectionModel) const;
85 Q_SIGNAL void titleChanged (const QString &title);
86 Q_SIGNAL void projectDirectoryChanged (const QString &directory);
87
88 // =========================================================
89
96 std::optional<fs::path> get_newer_backup ();
97
98private:
99 static constexpr auto kClipEditorKey = "clipEditor"sv;
100 static constexpr auto kTimelineKey = "timeline"sv;
101 static constexpr auto kQuantizeOptsTimelineKey = "quantizeOptsTimeline"sv;
102 static constexpr auto kQuantizeOptsEditorKey = "quantizeOptsEditor"sv;
103 static constexpr auto kUndoStackKey = "undoStack"sv;
104
105private:
107 utils::Utf8String title_;
108
110 fs::path project_directory_;
111
113
118
121
124
126 std::unique_ptr<QuantizeOptions> quantize_opts_editor_;
127
129 std::unique_ptr<QuantizeOptions> quantize_opts_timeline_;
130
132
134 arranger_object_creator_;
138};
139}
Backend for the clip editor part of the UI.
Definition clip_editor.h:27
std::optional< fs::path > get_newer_backup()
Returns the filepath of a backup (directory), if any, if it has a newer timestamp than main project f...
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:38
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:38