aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/effectmakernew/effectmakernodesmodel.h
blob: 28a4e8484f0dc88e8e291028d6773fd8b7189db4 (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
39
40
41
42
43
44
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "effectnodescategory.h"

#include <utils/filepath.h>

#include <QStandardItemModel>

namespace EffectMaker {

class EffectMakerNodesModel : public QAbstractListModel
{
    Q_OBJECT

    enum Roles {
        CategoryNameRole = Qt::UserRole + 1,
        CategoryNodesRole
    };

public:
    EffectMakerNodesModel(QObject *parent = nullptr);

    QHash<int, QByteArray> roleNames() const override;
    int rowCount(const QModelIndex & parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

    void loadModel();
    void resetModel();

    QList<EffectNodesCategory *> categories() const { return  m_categories; }

private:
    void findNodesPath();

    QList<EffectNodesCategory *> m_categories;
    Utils::FilePath m_nodesPath;
    bool m_probeNodesDir = false;
};

} // namespace EffectMaker