Meson: Merge two ToolWrapper constructors

Change-Id: I4a9fcc211e2718ff26f4e03c71ed89095db099ec
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-07-25 14:35:18 +02:00
parent c4fbd6a3f7
commit 96b508c84a
2 changed files with 4 additions and 21 deletions

View File

@@ -35,19 +35,6 @@ ToolWrapper::ToolWrapper(const Store &data)
m_autoDetected = data[Constants::ToolsSettings::AUTO_DETECTED_KEY].toBool();
}
ToolWrapper::ToolWrapper(ToolType toolType,
const QString &name,
const FilePath &path,
bool autoDetected)
: m_toolType(toolType)
, m_version(read_version(path))
, m_isValid{path.exists() && !m_version.isNull()}
, m_autoDetected{autoDetected}
, m_id{Id::generate()}
, m_exe{path}
, m_name{name}
{}
ToolWrapper::ToolWrapper(ToolType toolType,
const QString &name,
const FilePath &path,
@@ -57,7 +44,7 @@ ToolWrapper::ToolWrapper(ToolType toolType,
, m_version(read_version(path))
, m_isValid{path.exists() && !m_version.isNull()}
, m_autoDetected{autoDetected}
, m_id{id}
, m_id{id.isValid() ? id : Id::generate()}
, m_exe{path}
, m_name{name}
{
@@ -251,13 +238,13 @@ static void fixAutoDetected(ToolType toolType)
if (std::optional<FilePath> path = findTool(toolType)) {
s_tools.emplace_back(
std::make_shared<ToolWrapper>(toolType,
QString("System %1 at %2").arg("Meson").arg(path->toString()), *path, true));
QString("System %1 at %2").arg("Meson").arg(path->toString()), *path, Id{}, true));
}
} else if (toolType == ToolType::Ninja) {
if (std::optional<FilePath> path = findTool(toolType)) {
s_tools.emplace_back(
std::make_shared<ToolWrapper>(toolType,
QString("System %1 at %2").arg("Ninja").arg(path->toString()), *path, true));
QString("System %1 at %2").arg("Ninja").arg(path->toString()), *path, Id{}, true));
}
}
}

View File

@@ -26,11 +26,7 @@ public:
ToolWrapper(ToolType toolType,
const QString &name,
const Utils::FilePath &path,
bool autoDetected = false);
ToolWrapper(ToolType toolType,
const QString &name,
const Utils::FilePath &path,
const Utils::Id &id,
const Utils::Id &id = {},
bool autoDetected = false);
~ToolWrapper();