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-10-29 10:20:14 +01:00
|
|
|
|
2020-05-01 18:20:56 +02:00
|
|
|
#pragma once
|
2020-10-29 10:20:14 +01:00
|
|
|
|
2020-05-01 18:20:56 +02:00
|
|
|
#include "toolwrapper.h"
|
|
|
|
|
|
|
|
|
|
#include <utils/algorithm.h>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
namespace MesonProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class MesonTools : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
MesonTools() {}
|
|
|
|
|
~MesonTools() {}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
using Tool_t = std::shared_ptr<ToolWrapper>;
|
|
|
|
|
|
|
|
|
|
static bool isMesonWrapper(const Tool_t &tool);
|
|
|
|
|
static bool isNinjaWrapper(const Tool_t &tool);
|
|
|
|
|
|
2024-07-22 17:49:58 +02:00
|
|
|
static void addTool(const Utils::Id &itemId,
|
|
|
|
|
const QString &name,
|
|
|
|
|
const Utils::FilePath &exe);
|
2020-05-01 18:20:56 +02:00
|
|
|
|
2024-07-22 17:49:58 +02:00
|
|
|
static void addTool(Tool_t meson);
|
2020-05-01 18:20:56 +02:00
|
|
|
|
|
|
|
|
static void setTools(std::vector<Tool_t> &&tools);
|
|
|
|
|
|
|
|
|
|
static inline const std::vector<Tool_t> &tools() { return instance()->m_tools; }
|
|
|
|
|
|
2024-07-22 17:49:58 +02:00
|
|
|
static void updateTool(const Utils::Id &itemId,
|
|
|
|
|
const QString &name,
|
|
|
|
|
const Utils::FilePath &exe);
|
|
|
|
|
static void removeTool(const Utils::Id &id);
|
2020-05-01 18:20:56 +02:00
|
|
|
|
2024-07-22 17:27:50 +02:00
|
|
|
static std::shared_ptr<ToolWrapper> ninjaWrapper(const Utils::Id &id);
|
|
|
|
|
static std::shared_ptr<ToolWrapper> mesonWrapper(const Utils::Id &id);
|
2020-05-01 18:20:56 +02:00
|
|
|
|
2024-07-22 17:27:50 +02:00
|
|
|
static std::shared_ptr<ToolWrapper> autoDetectedNinja();
|
|
|
|
|
static std::shared_ptr<ToolWrapper> autoDetectedMeson();
|
2020-05-01 18:20:56 +02:00
|
|
|
|
|
|
|
|
Q_SIGNAL void toolAdded(const Tool_t &tool);
|
|
|
|
|
Q_SIGNAL void toolRemoved(const Tool_t &tool);
|
|
|
|
|
|
|
|
|
|
static MesonTools *instance()
|
|
|
|
|
{
|
|
|
|
|
static MesonTools inst;
|
|
|
|
|
return &inst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::vector<Tool_t> m_tools;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace MesonProjectManager
|