Zrythm v2.0.0-alpha.1+31.4967fd053471
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
chord_preset_manager.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/chord_preset.h"
7#include "utils/qt.h"
8
9#include <QAbstractListModel>
10#include <QtQmlIntegration/qqmlintegration.h>
11
37class ChordPresetManager : public QAbstractListModel
38{
39 Q_OBJECT
40 QML_ELEMENT
41 QML_UNCREATABLE ("")
42
43public:
44 enum Roles
45 {
46 PresetRole = Qt::UserRole + 1,
47 NameRole,
48 CategoryRole,
49 IsBuiltinRole,
50 };
51
52 explicit ChordPresetManager (QObject * parent = nullptr);
53
54 // ========================================================================
55 // QAbstractListModel interface
56 // ========================================================================
57
58 QHash<int, QByteArray> roleNames () const override;
59 int rowCount (const QModelIndex &parent = {}) const override;
60 QVariant data (const QModelIndex &index, int role) const override;
61
62 // ========================================================================
63 // QML Interface
64 // ========================================================================
65
66 Q_INVOKABLE QStringList categories () const;
67
68 Q_INVOKABLE QVariantList presetsInCategory (const QString &category) const;
69
70 // ========================================================================
71
72 void load_user_presets ();
73
74private:
75 void add_builtin_presets ();
76
77 static std::filesystem::path get_user_presets_path ();
78
79 std::vector<zrythm::utils::QObjectUniquePtr<ChordPreset>> presets_;
80};