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