aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprojectmanager/qmlprojectexporter/exporter.cpp
blob: 0763f2a442c9443008c5dbc24e6d9204d94e4d4f (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "exporter.h"

#include "../buildsystem/qmlbuildsystem.h"
#include "../buildsystem/projectitem/qmlprojectitem.h"

namespace QmlProjectManager {
namespace QmlProjectExporter {

Exporter::Exporter(QmlBuildSystem *bs)
    : QObject(bs)
    , m_cmakeGen(new CMakeGenerator(bs))
    , m_pythonGen(new PythonGenerator(bs))
{}

void Exporter::updateMenuAction()
{
    m_cmakeGen->updateMenuAction();
    m_pythonGen->updateMenuAction();
}

void Exporter::updateProject(QmlProject *project)
{
    m_cmakeGen->updateProject(project);
    m_pythonGen->updateProject(project);
}

void Exporter::updateProjectItem(QmlProjectItem *item, bool updateEnabled)
{
    connect(item, &QmlProjectItem::filesChanged, m_cmakeGen, &CMakeGenerator::update);
    connect(item, &QmlProjectItem::filesChanged, m_pythonGen, &PythonGenerator::update);
    connect(item, &QmlProjectItem::fileModified, m_cmakeGen, &CMakeGenerator::updateModifiedFile);

    if (updateEnabled) {
        m_cmakeGen->setEnabled(item->enableCMakeGeneration());
        m_pythonGen->setEnabled(item->enablePythonGeneration());
    }
}

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