blob: a21b859a8d4fd0ceeec23a53cc9f836667a3ffad (
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
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright (C) 2020 Alexis Jeandet.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "mesonprojectnodes.h"
#include "project/mesonbuildconfiguration.h"
#include "project/mesonbuildsystem.h"
#include "mesonpluginconstants.h"
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
namespace MesonProjectManager {
namespace Internal {
MesonProjectNode::MesonProjectNode(const Utils::FilePath &directory)
: ProjectExplorer::ProjectNode{directory}
{
setPriority(Node::DefaultProjectPriority + 1000);
setIcon(Constants::Icons::MESON);
setListInProject(false);
}
MesonFileNode::MesonFileNode(const Utils::FilePath &file)
: ProjectExplorer::ProjectNode{file}
{
setIcon(ProjectExplorer::DirectoryIcon(Constants::Icons::MESON));
setListInProject(true);
}
MesonTargetNode::MesonTargetNode(const Utils::FilePath &directory, const QString &name)
: ProjectExplorer::ProjectNode{directory}
, m_name{name}
{
setPriority(Node::DefaultProjectPriority + 900);
setIcon(":/projectexplorer/images/build.png");
setListInProject(false);
setShowWhenEmpty(true);
setProductType(ProjectExplorer::ProductType::Other);
}
void MesonTargetNode::build()
{
ProjectExplorer::Project *p = getProject();
ProjectExplorer::Target *t = p ? p->activeTarget() : nullptr;
if (t)
static_cast<MesonBuildSystem *>(t->buildSystem())->mesonBuildConfiguration()->build(m_name);
}
QString MesonTargetNode::tooltip() const
{
return {};
}
QString MesonTargetNode::buildKey() const
{
return m_name;
}
} // namespace Internal
} // namespace MesonProjectManager
|