aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprojectmanager/qmlprojectexporter/filegenerator.h
blob: 7914aee527e06c4107aeb16884954ee5b9a82be7 (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
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once

#include <projectexplorer/taskhub.h>
#include <utils/id.h>

namespace QmlProjectManager {

class QmlProject;
class QmlProjectItem;
class QmlBuildSystem;

namespace QmlProjectExporter {

class FileGenerator : public QObject
{
    Q_OBJECT

public:
    static QAction *createMenuAction(QObject *parent, const QString &name, const Utils::Id &id);
    static void logIssue(
        ProjectExplorer::Task::TaskType type, const QString &text, const Utils::FilePath &file);

    FileGenerator(QmlBuildSystem *bs = nullptr);
    virtual ~FileGenerator() = default;

    virtual void updateMenuAction() = 0;
    virtual void updateProject(QmlProject *project) = 0;

    const QmlProject *qmlProject() const;
    const QmlBuildSystem *buildSystem() const;

    bool isEnabled() const;
    bool isActive() const;
    void setEnabled(bool enabled);

    bool standaloneApp() const;
    void setStandaloneApp(bool value);

protected:
    void updateMenuAction(const Utils::Id &id, std::function<bool(void)> isEnabled);

private:
    bool m_enabled = false;
    QmlBuildSystem *m_buildSystem = nullptr;
};

} // namespace QmlProjectExporter.
} // namespace QmlProjectManager.