summaryrefslogtreecommitdiffstats
path: root/src/skin/qml/qmlvisibleeffectsmodel.h
blob: b061471a3590289bf02ee64328b388977bd05699 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include <QAbstractListModel>
#include <memory>

#include "effects/effectsmanager.h"

namespace mixxx {
namespace skin {
namespace qml {

class QmlVisibleEffectsModel : public QAbstractListModel {
    Q_OBJECT
  public:
    enum Roles {
        EffectIdRole = Qt::UserRole + 1,
    };
    Q_ENUM(Roles)

    explicit QmlVisibleEffectsModel(
            std::shared_ptr<EffectsManager> pEffectsManager,
            QObject* parent = nullptr);

    QVariant data(const QModelIndex& index, int role) const override;
    int rowCount(const QModelIndex& parent) const override;
    QHash<int, QByteArray> roleNames() const override;
    Q_INVOKABLE QVariant get(int row) const;

  private slots:
    void slotVisibleEffectsUpdated();

  private:
    const std::shared_ptr<EffectsManager> m_pEffectsManager;
    QList<EffectManifestPointer> m_visibleEffectManifests;
};

} // namespace qml
} // namespace skin
} // namespace mixxx