CppTools: Use a normal plugin pimpl member for CppModelManager

Change-Id: Id2c4b098084808070ef91de13c8338184e52141d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-02-04 17:23:27 +01:00
parent 67f66a39be
commit e3e6cece89
3 changed files with 11 additions and 15 deletions

View File

@@ -465,14 +465,6 @@ CppModelManager *CppModelManager::instance()
return m_instance; return m_instance;
} }
void CppModelManager::createCppModelManager(Internal::CppToolsPlugin *parent)
{
QTC_ASSERT(!m_instance, return;);
m_instance = new CppModelManager();
m_instance->initCppTools();
m_instance->setParent(parent);
}
void CppModelManager::initCppTools() void CppModelManager::initCppTools()
{ {
// Objects // Objects
@@ -512,6 +504,8 @@ CppModelManager::CppModelManager()
: CppModelManagerBase(nullptr) : CppModelManagerBase(nullptr)
, d(new CppModelManagerPrivate) , d(new CppModelManagerPrivate)
{ {
m_instance = this;
// Used for weak dependency in VcsBaseSubmitEditor // Used for weak dependency in VcsBaseSubmitEditor
setObjectName("CppModelManager"); setObjectName("CppModelManager");
ExtensionSystem::PluginManager::addObject(this); ExtensionSystem::PluginManager::addObject(this);
@@ -562,6 +556,8 @@ CppModelManager::CppModelManager()
initializeBuiltinModelManagerSupport(); initializeBuiltinModelManagerSupport();
d->m_internalIndexingSupport = new BuiltinIndexingSupport; d->m_internalIndexingSupport = new BuiltinIndexingSupport;
initCppTools();
} }
CppModelManager::~CppModelManager() CppModelManager::~CppModelManager()

View File

@@ -68,7 +68,7 @@ class WorkingCopy;
namespace Internal { namespace Internal {
class CppSourceProcessor; class CppSourceProcessor;
class CppModelManagerPrivate; class CppModelManagerPrivate;
class CppToolsPlugin; class CppToolsPluginPrivate;
} }
namespace Tests { namespace Tests {
@@ -88,15 +88,15 @@ class CPPTOOLS_EXPORT CppModelManager final : public CPlusPlus::CppModelManagerB
{ {
Q_OBJECT Q_OBJECT
public: private:
using Document = CPlusPlus::Document; friend class Internal::CppToolsPluginPrivate;
public:
CppModelManager(); CppModelManager();
~CppModelManager() override; ~CppModelManager() override;
public:
using Document = CPlusPlus::Document;
static CppModelManager *instance(); static CppModelManager *instance();
static void createCppModelManager(Internal::CppToolsPlugin *parent);
// Documented in source file. // Documented in source file.
enum ProgressNotificationMode { enum ProgressNotificationMode {

View File

@@ -82,7 +82,6 @@ class CppToolsPluginPrivate
public: public:
CppToolsPluginPrivate() CppToolsPluginPrivate()
{ {
CppModelManager::createCppModelManager(m_instance);
m_settings = new CppToolsSettings(m_instance); // force registration of cpp tools settings m_settings = new CppToolsSettings(m_instance); // force registration of cpp tools settings
m_codeModelSettings.fromSettings(ICore::settings()); m_codeModelSettings.fromSettings(ICore::settings());
m_cppCodeStyleSettingsPage = new CppCodeStyleSettingsPage; m_cppCodeStyleSettingsPage = new CppCodeStyleSettingsPage;
@@ -96,6 +95,7 @@ public:
} }
StringTable stringTable; StringTable stringTable;
CppModelManager modelManager;
CppCodeModelSettings m_codeModelSettings; CppCodeModelSettings m_codeModelSettings;
CppToolsSettings *m_settings = nullptr; CppToolsSettings *m_settings = nullptr;
CppFileSettings m_fileSettings; CppFileSettings m_fileSettings;