ProjectExplorer: Use setup function for CustomToolChain

Change-Id: I05eeaad0914285c31928e9fad126b27ad78a0fa6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-18 14:23:16 +01:00
parent c75e55c090
commit 3526d38be8
3 changed files with 18 additions and 17 deletions

View File

@@ -13,6 +13,7 @@
#include "projectexplorerconstants.h"
#include "projectexplorertr.h"
#include "projectmacro.h"
#include "toolchain.h"
#include "toolchainconfigwidget.h"
#include <utils/algorithm.h>
@@ -555,17 +556,24 @@ std::unique_ptr<ToolchainConfigWidget> CustomToolChain::createConfigurationWidge
return std::make_unique<CustomToolChainConfigWidget>(this);
}
// --------------------------------------------------------------------------
// CustomToolChainFactory
// --------------------------------------------------------------------------
CustomToolchainFactory::CustomToolchainFactory()
class CustomToolchainFactory final : public ToolchainFactory
{
public:
CustomToolchainFactory()
{
setDisplayName(Tr::tr("Custom"));
setSupportedToolchainType(Constants::CUSTOM_TOOLCHAIN_TYPEID);
setSupportsAllLanguages(true);
setToolchainConstructor([] { return new CustomToolChain; });
setUserCreatable(true);
}
};
void setupCustomToolchain()
{
static CustomToolchainFactory theCustomToolchainFactory;
}
} // ProjectExplorer::Internal

View File

@@ -3,14 +3,8 @@
#pragma once
#include "toolchain.h"
namespace ProjectExplorer::Internal {
class CustomToolchainFactory : public ToolchainFactory
{
public:
CustomToolchainFactory();
};
void setupCustomToolchain();
} // ProjectExplorer::Interna;

View File

@@ -647,8 +647,6 @@ public:
WinDebugInterface m_winDebugInterface;
#endif
CustomToolchainFactory m_customToolChainFactory;
DesktopDeviceFactory m_desktopDeviceFactory;
ToolChainOptionsPage m_toolChainOptionsPage;
@@ -818,6 +816,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
setupGccToolchains();
setupMsvcToolchain();
setupClangClToolchain();
setupCustomToolchain();
setupProjectTreeWidgetFactory();