forked from qt-creator/qt-creator
CMakeProjectManager: Use setup function for CMakeToolManager
Change-Id: I66078250029f87d64b7b31aba9049a8b0b68f3a5 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -46,9 +46,6 @@ namespace CMakeProjectManager::Internal {
|
||||
class CMakeProjectPluginPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
// This can't be stand-alone yet as it registers in the plugin object pool
|
||||
CMakeToolManager cmakeToolManager;
|
||||
|
||||
Action buildTargetContextAction{
|
||||
Tr::tr("Build"),
|
||||
Tr::tr("Build \"%1\""),
|
||||
@@ -79,6 +76,8 @@ class CMakeProjectPlugin final : public ExtensionSystem::IPlugin
|
||||
|
||||
void initialize() final
|
||||
{
|
||||
setupCMakeToolManager(this);
|
||||
|
||||
d = new CMakeProjectPluginPrivate;
|
||||
|
||||
setupCMakeManager();
|
||||
|
||||
@@ -170,13 +170,10 @@ public:
|
||||
};
|
||||
|
||||
static CMakeToolManagerPrivate *d = nullptr;
|
||||
CMakeToolManager *CMakeToolManager::m_instance = nullptr;
|
||||
static CMakeToolManager *m_instance = nullptr;
|
||||
|
||||
CMakeToolManager::CMakeToolManager()
|
||||
{
|
||||
QTC_ASSERT(!m_instance, return);
|
||||
m_instance = this;
|
||||
|
||||
qRegisterMetaType<QString *>();
|
||||
|
||||
d = new CMakeToolManagerPrivate;
|
||||
@@ -224,7 +221,7 @@ bool CMakeToolManager::registerCMakeTool(std::unique_ptr<CMakeTool> &&tool)
|
||||
|
||||
d->m_cmakeTools.emplace_back(std::move(tool));
|
||||
|
||||
emit CMakeToolManager::m_instance->cmakeAdded(toolId);
|
||||
emit m_instance->cmakeAdded(toolId);
|
||||
|
||||
ensureDefaultCMakeToolIsValid();
|
||||
|
||||
@@ -438,4 +435,10 @@ void CMakeToolManager::ensureDefaultCMakeToolIsValid()
|
||||
emit m_instance->defaultCMakeChanged();
|
||||
}
|
||||
|
||||
void Internal::setupCMakeToolManager(QObject *guard)
|
||||
{
|
||||
m_instance = new CMakeToolManager;
|
||||
m_instance->setParent(guard);
|
||||
}
|
||||
|
||||
} // CMakeProjectManager
|
||||
|
||||
@@ -64,10 +64,10 @@ signals:
|
||||
private:
|
||||
static void saveCMakeTools();
|
||||
static void ensureDefaultCMakeToolIsValid();
|
||||
|
||||
static CMakeToolManager *m_instance;
|
||||
};
|
||||
|
||||
namespace Internal { void setupCMakeToolManager(QObject *guard); }
|
||||
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
Q_DECLARE_METATYPE(QString *)
|
||||
|
||||
Reference in New Issue
Block a user