aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/assetexporterplugin/filepathmodel.h
blob: 4658b65eb4d4e56c38a719b0e67a38727bf03b47 (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
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include <QAbstractListModel>
#include <QFutureWatcher>

#include "utils/fileutils.h"

#include <memory>
#include <unordered_set>

namespace ProjectExplorer {
class Project;
}

namespace QmlDesigner {
class FilePathModel : public QAbstractListModel
{
    Q_DECLARE_TR_FUNCTIONS(QmlDesigner::FilePathModel)

public:
    FilePathModel(ProjectExplorer::Project *project, QObject *parent = nullptr);
    ~FilePathModel() override;

    Qt::ItemFlags flags(const QModelIndex &index) const override;
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
    bool setData(const QModelIndex &index, const QVariant &value, int role) override;

    Utils::FilePaths files() const;
private:
    void processProject();

    ProjectExplorer::Project *m_project = nullptr;
    std::unique_ptr<QFutureWatcher<Utils::FilePath>> m_preprocessWatcher;
    std::unordered_set<Utils::FilePath> m_skipped;
    Utils::FilePaths m_files;
};

}