aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprojectmanager/qmlprojectgen/qmlprojectgenerator.h
blob: 7d02f15d18283e6e84de2fd3e0268df31a7f0f29 (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
// Copyright (C) 2022 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 <utils/filepath.h>

namespace QmlProjectManager {
namespace GenerateQmlProject {

class QmlProjectFileGenerator {
public:
    bool prepare(const Utils::FilePath &targetDir);
    bool prepareForUiQmlFile(const Utils::FilePath &uiFilePath);
    bool execute();

    const Utils::FilePath targetDir() const;
    const Utils::FilePath targetFile() const;

private:
    const QString createFilteredDirEntries(const QStringList &suffixes) const;
    const QString createDirArrayEntry(const QString &arrayName, const QStringList &relativePaths) const;
    const Utils::FilePath selectTargetFile(const Utils::FilePath &uiFilePath = {});
    bool isStandardStructure(const Utils::FilePath &projectDir) const;
    bool isDirAcceptable(const Utils::FilePath &dir, const Utils::FilePath &uiFile);
    const QString createContentDirEntries(const QString &containerName,
                                          const QStringList &suffixes) const;
    const Utils::FilePath findInDirTree(const Utils::FilePath &dir,
                                        const QStringList &suffixes,
                                        int currentSearchDepth = 0) const;
    const QStringList findContentDirs(const QStringList &suffixes) const;

private:
    Utils::FilePath m_targetDir;
    Utils::FilePath m_targetFile;
};

} // GenerateQmlProject
} // QmlProjectManager