Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
tempo_object_manager.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "structure/arrangement/arranger_object_owner.h"
7#include "structure/arrangement/tempo_object.h"
8#include "structure/arrangement/time_signature_object.h"
9#include "utils/uuid_identifiable_object.h"
10
11namespace zrythm::structure::arrangement
12{
13
17class TempoObjectManager final
18 : public utils::UuidIdentifiableObject<TempoObjectManager>,
19 public ArrangerObjectOwner<TempoObject>,
20 public ArrangerObjectOwner<TimeSignatureObject>
21{
22 Q_OBJECT
23 QML_ELEMENT
24 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (
25 TempoObjectManager,
26 tempoObjects,
28 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (
29 TempoObjectManager,
30 timeSignatureObjects,
32 QML_UNCREATABLE ("")
33
34public:
35 TempoObjectManager (
36 utils::IObjectRegistry &registry,
37 QObject * parent = nullptr);
38
39 friend void init_from (
40 TempoObjectManager &obj,
41 const TempoObjectManager &other,
42 utils::ObjectCloneType clone_type);
43
44 std::string
45 get_field_name_for_serialization (const TempoObject *) const override
46 {
47 return std::string{ kTempoObjectsKey };
48 }
49
50 std::string
51 get_field_name_for_serialization (const TimeSignatureObject *) const override
52 {
53 return std::string{ kTimeSignatureObjectsKey };
54 }
55
56private:
57 static constexpr auto kTempoObjectsKey = "tempoObjects"sv;
58 static constexpr auto kTimeSignatureObjectsKey = "timeSignatureObjects"sv;
59 friend void to_json (nlohmann::json &j, const TempoObjectManager &manager);
60 friend void from_json (const nlohmann::json &j, TempoObjectManager &manager);
61};
62
63} // namespace zrythm::structure::arrangement
Abstract interface for a UUID-keyed object registry.
CRTP base that adds a typed UUID strong-typedef to a class hierarchy.