summaryrefslogtreecommitdiff
path: root/src/plugins/qmldesigner/components/contentlibrary/contentlibrarytexturescategory.h
blob: 91ecaaac969d2251efa2971f4c5769dd698f3854 (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
45
46
47
48
49
50
51
52
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <QObject>

QT_BEGIN_NAMESPACE
class QFileInfo;
class QSize;
QT_END_NAMESPACE

namespace QmlDesigner {

class ContentLibraryTexture;

class ContentLibraryTexturesCategory : public QObject
{
    Q_OBJECT

    Q_PROPERTY(QString bundleCategoryName MEMBER m_name CONSTANT)
    Q_PROPERTY(bool bundleCategoryVisible MEMBER m_visible NOTIFY categoryVisibleChanged)
    Q_PROPERTY(bool bundleCategoryExpanded MEMBER m_expanded NOTIFY categoryExpandChanged)
    Q_PROPERTY(QList<ContentLibraryTexture *> bundleCategoryTextures MEMBER m_categoryTextures
               NOTIFY bundleTexturesModelChanged)

public:
    ContentLibraryTexturesCategory(QObject *parent, const QString &name);

    void addTexture(const QFileInfo &tex, const QString &subPath, const QString &webUrl,
                    const QString &fileExt, const QSize &dimensions, const qint64 sizeInBytes);
    bool filter(const QString &searchText);

    QString name() const;
    bool visible() const;
    bool expanded() const;
    QList<ContentLibraryTexture *> categoryTextures() const;

signals:
    void categoryVisibleChanged();
    void categoryExpandChanged();
    void bundleTexturesModelChanged();

private:
    QString m_name;
    bool m_visible = true;
    bool m_expanded = true;

    QList<ContentLibraryTexture *> m_categoryTextures;
};

} // namespace QmlDesigner