1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25 
26 #pragma once
27 
28 #include "qmakeprojectmanager_global.h"
29 #include "qmakeparsernodes.h"
30 
31 #include <projectexplorer/buildsystem.h>
32 #include <projectexplorer/projectnodes.h>
33 
34 namespace Utils { class FilePath; }
35 
36 namespace QmakeProjectManager {
37 class QmakeProFileNode;
38 class QmakeProject;
39 
40 // Implements ProjectNode for qmake .pri files
41 class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::ProjectNode
42 {
43 public:
44     QmakePriFileNode(QmakeBuildSystem *buildSystem, QmakeProFileNode *qmakeProFileNode,
45                      const Utils::FilePath &filePath, QmakePriFile *pf);
46 
47     QmakePriFile *priFile() const;
48 
showInSimpleTree()49     bool showInSimpleTree() const override { return false; }
50 
51     bool canAddSubProject(const QString &proFilePath) const override;
52     bool addSubProject(const QString &proFilePath) override;
53     bool removeSubProject(const QString &proFilePath) override;
54     QStringList subProjectFileNamePatterns() const override;
55 
56     AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
57 
58     bool deploysFolder(const QString &folder) const override;
59 
60     QmakeProFileNode *proFileNode() const;
61 
62 protected:
63     QPointer<QmakeBuildSystem> m_buildSystem;
64 
65 private:
66     QmakeProFileNode *m_qmakeProFileNode = nullptr;
67     QmakePriFile *m_qmakePriFile = nullptr;
68 };
69 
70 // Implements ProjectNode for qmake .pro files
71 class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode
72 {
73 public:
74     QmakeProFileNode(QmakeBuildSystem *buildSystem, const Utils::FilePath &filePath, QmakeProFile *pf);
75 
76     QmakeProFile *proFile() const;
77 
78     QString makefile() const;
79     QString objectsDirectory() const;
80     QString objectExtension() const;
81 
82     bool isDebugAndRelease() const;
83     bool isObjectParallelToSource() const;
84     bool isQtcRunnable() const;
85     bool includedInExactParse() const;
86 
87     bool showInSimpleTree() const override;
88 
89     QString buildKey() const override;
90     bool parseInProgress() const override;
91     bool validParse() const override;
92 
93     void build() override;
94 
95     QStringList targetApplications() const override;
96     AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
97     QVariant data(Utils::Id role) const override;
98     bool setData(Utils::Id role, const QVariant &value) const override;
99 
100     QmakeProjectManager::ProjectType projectType() const;
101 
102     QStringList variableValue(const Variable var) const;
103     QString singleVariableValue(const Variable var) const;
104 
105     TargetInformation targetInformation() const;
106 
107     bool showInSimpleTree(ProjectType projectType) const;
108 };
109 
110 } // namespace QmakeProjectManager
111