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 <string_view>
7
8#include "dsp/snap_grid.h"
9#include "structure/arrangement/timeline.h"
10#include "structure/project/arranger_tool.h"
11#include "structure/project/clip_editor.h"
12#include "structure/project/project.h"
13
14#include <QtQmlIntegration/qqmlintegration.h>
15
16#include <nlohmann/json_fwd.hpp>
17
18namespace zrythm::structure::project
19{
20
33class ProjectUiState : public QObject
34{
35 Q_OBJECT
36 Q_PROPERTY (
37 zrythm::structure::arrangement::Timeline * timeline READ timeline CONSTANT
38 FINAL)
39 Q_PROPERTY (
40 zrythm::structure::project::ArrangerTool * tool READ tool CONSTANT FINAL)
41 Q_PROPERTY (
42 zrythm::structure::project::ClipEditor * clipEditor READ clipEditor CONSTANT
43 FINAL)
44 Q_PROPERTY (
45 zrythm::dsp::SnapGrid * snapGridTimeline READ snapGridTimeline CONSTANT FINAL)
46 Q_PROPERTY (
47 zrythm::dsp::SnapGrid * snapGridEditor READ snapGridEditor CONSTANT FINAL)
48 QML_ELEMENT
49 QML_UNCREATABLE ("")
50
51public:
58 ProjectUiState (Project &project, utils::AppSettings &app_settings);
59
60 structure::project::ArrangerTool * tool () const;
61 structure::project::ClipEditor * clipEditor () const;
62 structure::arrangement::Timeline * timeline () const;
63 dsp::SnapGrid * snapGridTimeline () const;
64 dsp::SnapGrid * snapGridEditor () const;
65
66private:
67 static constexpr auto kSnapGridTimelineKey = "snapGridTimeline"sv;
68 static constexpr auto kSnapGridEditorKey = "snapGridEditor"sv;
69 friend void to_json (nlohmann::json &j, const ProjectUiState &p);
70 friend void from_json (const nlohmann::json &j, ProjectUiState &p);
71
72private:
73 utils::AppSettings &app_settings_;
74
76 utils::QObjectUniquePtr<structure::project::ArrangerTool> tool_;
77
79 utils::QObjectUniquePtr<structure::project::ClipEditor> clip_editor_;
80
82 utils::QObjectUniquePtr<structure::arrangement::Timeline> timeline_;
83
85 utils::QObjectUniquePtr<dsp::SnapGrid> snap_grid_timeline_;
86
88 utils::QObjectUniquePtr<dsp::SnapGrid> snap_grid_editor_;
89};
90
91} // namespace zrythm::structure::project
Snap/grid information.
Definition snap_grid.h:22
Backend for the clip editor part of the UI.
Definition clip_editor.h:22
ProjectUiState(Project &project, utils::AppSettings &app_settings)
Constructs ProjectUiState with references from the given Project.
Core functionality of a Zrythm project.
Definition project.h:48
String utilities.
Definition algorithms.h:12