Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
chord_preset.h
1// SPDX-FileCopyrightText: © 2022, 2024-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/chord_descriptor.h"
7#include "structure/arrangement/chord_editor.h"
8#include "utils/utf8_string.h"
9
10#include <QtQmlIntegration/qqmlintegration.h>
11
12class ChordPresetPack;
13
17class ChordPreset : public QObject
18{
19 Q_OBJECT
20 Q_PROPERTY (QString name READ getName WRITE setName NOTIFY nameChanged)
21 QML_ELEMENT
22
23public:
24 using NameT = QString;
25 ChordPreset (QObject * parent = nullptr);
26 ChordPreset (const NameT &name, QObject * parent = nullptr);
27
28 // =================================================================
29 // QML Interface
30 // =================================================================
31
32 NameT getName () const;
33 void setName (const NameT &name);
34 Q_SIGNAL void nameChanged (const NameT &name);
35
36 // =================================================================
37
42
43 // GMenuModel * generate_context_menu () const;
44
45 friend void init_from (
46 ChordPreset &obj,
47 const ChordPreset &other,
49
50private:
51 static constexpr std::string_view kNameKey = "name";
52 static constexpr std::string_view kDescriptorsKey = "descriptors";
53 friend void to_json (nlohmann::json &j, const ChordPreset &preset);
54 friend void from_json (const nlohmann::json &j, ChordPreset &preset);
55
56public:
58 NameT name_;
59
61 std::vector<zrythm::dsp::ChordDescriptor> descr_;
62
65};
66
67inline bool
68operator== (const ChordPreset &lhs, const ChordPreset &rhs)
69{
70 return lhs.name_ == rhs.name_ && lhs.descr_ == rhs.descr_;
71}
Chord preset pack.
A preset of chord descriptors.
ChordPresetPack * pack_
Pointer to owner pack.
zrythm::utils::Utf8String get_info_text() const
Gets informational text.
std::vector< zrythm::dsp::ChordDescriptor > descr_
Chord descriptors.
NameT name_
Preset name.
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:37