2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 Alexis Jeandet.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2020-05-01 18:20:56 +02:00
|
|
|
|
|
|
|
|
#include "mesonprojectnodes.h"
|
2020-10-29 10:20:14 +01:00
|
|
|
|
2022-10-06 16:58:18 +02:00
|
|
|
#include "mesonbuildconfiguration.h"
|
|
|
|
|
#include "mesonbuildsystem.h"
|
2020-10-29 10:20:14 +01:00
|
|
|
#include "mesonpluginconstants.h"
|
|
|
|
|
|
2020-05-01 18:20:56 +02:00
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
#include <projectexplorer/target.h>
|
2020-10-29 10:20:14 +01:00
|
|
|
|
2023-06-13 14:07:24 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace Utils;
|
2020-05-01 18:20:56 +02:00
|
|
|
|
2023-06-13 14:07:24 +02:00
|
|
|
namespace MesonProjectManager::Internal {
|
|
|
|
|
|
|
|
|
|
MesonProjectNode::MesonProjectNode(const FilePath &directory)
|
|
|
|
|
: ProjectNode(directory)
|
2020-05-01 18:20:56 +02:00
|
|
|
{
|
|
|
|
|
setPriority(Node::DefaultProjectPriority + 1000);
|
2021-04-08 16:31:31 +02:00
|
|
|
setIcon(Constants::Icons::MESON);
|
2020-05-01 18:20:56 +02:00
|
|
|
setListInProject(false);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:07:24 +02:00
|
|
|
MesonFileNode::MesonFileNode(const FilePath &file)
|
|
|
|
|
: ProjectNode(file)
|
2020-05-01 18:20:56 +02:00
|
|
|
{
|
2023-06-13 14:07:24 +02:00
|
|
|
setIcon(DirectoryIcon(Constants::Icons::MESON));
|
2020-05-01 18:20:56 +02:00
|
|
|
setListInProject(true);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:07:24 +02:00
|
|
|
MesonTargetNode::MesonTargetNode(const FilePath &directory, const QString &name)
|
|
|
|
|
: ProjectNode(directory)
|
|
|
|
|
, m_name(name)
|
2020-05-01 18:20:56 +02:00
|
|
|
{
|
|
|
|
|
setPriority(Node::DefaultProjectPriority + 900);
|
2021-04-08 16:31:31 +02:00
|
|
|
setIcon(":/projectexplorer/images/build.png");
|
2020-05-01 18:20:56 +02:00
|
|
|
setListInProject(false);
|
|
|
|
|
setShowWhenEmpty(true);
|
2023-06-13 14:07:24 +02:00
|
|
|
setProductType(ProductType::Other);
|
2020-05-01 18:20:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MesonTargetNode::build()
|
|
|
|
|
{
|
2023-06-13 14:07:24 +02:00
|
|
|
Project *p = getProject();
|
2020-05-01 18:20:56 +02:00
|
|
|
ProjectExplorer::Target *t = p ? p->activeTarget() : nullptr;
|
|
|
|
|
if (t)
|
2023-06-13 10:56:40 +02:00
|
|
|
static_cast<MesonBuildConfiguration *>(t->buildSystem()->buildConfiguration())->build(m_name);
|
2020-05-01 18:20:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString MesonTargetNode::tooltip() const
|
|
|
|
|
{
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString MesonTargetNode::buildKey() const
|
|
|
|
|
{
|
|
|
|
|
return m_name;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 14:07:24 +02:00
|
|
|
} // MesonProjectManager::Internal
|