CMakeProjectManager: Fix connection to save tools settings

Amends 4e23f2a6eb.

This should actually not be needed in the end, and rather steered
by the auto registration and settings page apply.

Change-Id: I7f94e776fec4394f539e32e5c527c367251654a8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-08-23 10:16:28 +02:00
parent 6e6587c528
commit 55b5b8a975
4 changed files with 36 additions and 7 deletions

View File

@@ -1283,23 +1283,44 @@ KitAspect *CMakeConfigurationKitAspectFactory::createKitAspect(Kit *k) const
// Factory instances; // Factory instances;
const CMakeKitAspectFactory theCMakeKitAspectFactory; CMakeKitAspectFactory &cmakeKitAspectFactory()
const CMakeGeneratorKitAspectFactory theCMakeGeneratorKitAspectFactory; {
const CMakeConfigurationKitAspectFactory theCMakeConfigurationKitAspectFactory; static CMakeKitAspectFactory theCMakeKitAspectFactory;
return theCMakeKitAspectFactory;
}
CMakeGeneratorKitAspectFactory &cmakeGeneratorKitAspectFactory()
{
static CMakeGeneratorKitAspectFactory theCMakeGeneratorKitAspectFactory;
return theCMakeGeneratorKitAspectFactory;
}
static CMakeConfigurationKitAspectFactory &cmakeConfigurationKitAspectFactory()
{
static CMakeConfigurationKitAspectFactory theCMakeConfigurationKitAspectFactory;
return theCMakeConfigurationKitAspectFactory;
}
KitAspect *CMakeKitAspect::createKitAspect(Kit *k) KitAspect *CMakeKitAspect::createKitAspect(Kit *k)
{ {
return theCMakeKitAspectFactory.createKitAspect(k); return cmakeKitAspectFactory().createKitAspect(k);
} }
KitAspect *CMakeGeneratorKitAspect::createKitAspect(Kit *k) KitAspect *CMakeGeneratorKitAspect::createKitAspect(Kit *k)
{ {
return theCMakeGeneratorKitAspectFactory.createKitAspect(k); return cmakeGeneratorKitAspectFactory().createKitAspect(k);
} }
KitAspect *CMakeConfigurationKitAspect::createKitAspect(Kit *k) KitAspect *CMakeConfigurationKitAspect::createKitAspect(Kit *k)
{ {
return theCMakeConfigurationKitAspectFactory.createKitAspect(k); return cmakeConfigurationKitAspectFactory().createKitAspect(k);
}
void CMakeKitAspect::createFactories()
{
cmakeKitAspectFactory();
cmakeGeneratorKitAspectFactory();
cmakeConfigurationKitAspectFactory();
} }
} // namespace CMakeProjectManager } // namespace CMakeProjectManager

View File

@@ -24,6 +24,10 @@ public:
static QString msgUnsupportedVersion(const QByteArray &versionString); static QString msgUnsupportedVersion(const QByteArray &versionString);
static ProjectExplorer::KitAspect *createKitAspect(ProjectExplorer::Kit *k); static ProjectExplorer::KitAspect *createKitAspect(ProjectExplorer::Kit *k);
private:
friend class CMakeToolManager;
static void createFactories();
}; };
class CMAKE_EXPORT CMakeGeneratorKitAspect class CMAKE_EXPORT CMakeGeneratorKitAspect

View File

@@ -43,7 +43,8 @@ namespace CMakeProjectManager::Internal {
class CMakeProjectPluginPrivate : public QObject class CMakeProjectPluginPrivate : public QObject
{ {
public: public:
CMakeToolManager cmakeToolManager; // have that before the first CMakeKitAspect // This can't be stand-alone yet as it registers in the plugin object pool
CMakeToolManager cmakeToolManager;
ParameterAction buildTargetContextAction{ ParameterAction buildTargetContextAction{
Tr::tr("Build"), Tr::tr("Build"),

View File

@@ -3,6 +3,7 @@
#include "cmaketoolmanager.h" #include "cmaketoolmanager.h"
#include "cmakekitaspect.h"
#include "cmakeprojectmanagertr.h" #include "cmakeprojectmanagertr.h"
#include "cmakespecificsettings.h" #include "cmakespecificsettings.h"
#include "cmaketoolsettingsaccessor.h" #include "cmaketoolsettingsaccessor.h"
@@ -49,6 +50,8 @@ CMakeToolManager::CMakeToolManager()
setObjectName("CMakeToolManager"); setObjectName("CMakeToolManager");
ExtensionSystem::PluginManager::addObject(this); ExtensionSystem::PluginManager::addObject(this);
CMakeKitAspect::createFactories();
} }
CMakeToolManager::~CMakeToolManager() CMakeToolManager::~CMakeToolManager()