Commit aa5dbe77 authored by Nikolai Kosjar's avatar Nikolai Kosjar Committed by Nikolai Kosjar

Clang: Clean up ClangCodeModelPlugin

Change-Id: I4a5a91ff91cb0ec2f8eec647c45c42d8c8faa758
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@theqtcompany.com>
parent 2cfbf20a
...@@ -29,24 +29,17 @@ ...@@ -29,24 +29,17 @@
****************************************************************************/ ****************************************************************************/
#include "clangcodemodelplugin.h" #include "clangcodemodelplugin.h"
#include "clangprojectsettingspropertiespage.h" #include "clangprojectsettingspropertiespage.h"
#include "pchmanager.h" #include "pchmanager.h"
#include "utils.h" #include "utils.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/imode.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/id.h>
#include <cpptools/cppmodelmanager.h> #include <cpptools/cppmodelmanager.h>
#include <projectexplorer/projectpanelfactory.h> #include <projectexplorer/projectpanelfactory.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <QtPlugin>
namespace ClangCodeModel { namespace ClangCodeModel {
namespace Internal { namespace Internal {
...@@ -55,32 +48,34 @@ bool ClangCodeModelPlugin::initialize(const QStringList &arguments, QString *err ...@@ -55,32 +48,34 @@ bool ClangCodeModelPlugin::initialize(const QStringList &arguments, QString *err
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(errorMessage) Q_UNUSED(errorMessage)
// Register widget for project panel
auto panelFactory = new ProjectExplorer::ProjectPanelFactory(); auto panelFactory = new ProjectExplorer::ProjectPanelFactory();
panelFactory->setPriority(60); panelFactory->setPriority(60);
panelFactory->setDisplayName(ClangProjectSettingsWidget::tr("Clang Settings")); panelFactory->setDisplayName(ClangProjectSettingsWidget::tr("Clang Settings"));
panelFactory->setSimpleCreateWidgetFunction<ClangProjectSettingsWidget>(QIcon()); panelFactory->setSimpleCreateWidgetFunction<ClangProjectSettingsWidget>(QIcon());
ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory); ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory);
// Initialize Clang
ClangCodeModel::Internal::initializeClang(); ClangCodeModel::Internal::initializeClang();
PchManager *pchManager = new PchManager(this); // Set up Indexer
auto cppModelManager = CppTools::CppModelManager::instance();
#ifdef CLANG_INDEXING #ifdef CLANG_INDEXING
m_indexer.reset(new ClangIndexer); m_indexer.reset(new ClangIndexer);
CppTools::CppModelManager::instance()->setIndexingSupport(m_indexer->indexingSupport()); cppModelManager->setIndexingSupport(m_indexer->indexingSupport());
#endif // CLANG_INDEXING #endif // CLANG_INDEXING
// wire up the pch manager // Set up PchManager
QObject *session = ProjectExplorer::SessionManager::instance(); PchManager *pchManager = new PchManager(this);
connect(session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)), ProjectExplorer::SessionManager *sessionManager = ProjectExplorer::SessionManager::instance();
pchManager, SLOT(onAboutToRemoveProject(ProjectExplorer::Project*))); connect(sessionManager, &ProjectExplorer::SessionManager::aboutToRemoveProject,
connect(CppTools::CppModelManager::instance(), SIGNAL(projectPartsUpdated(ProjectExplorer::Project*)), pchManager, &PchManager::onAboutToRemoveProject);
pchManager, SLOT(onProjectPartsUpdated(ProjectExplorer::Project*))); connect(cppModelManager, &CppTools::CppModelManager::projectPartsUpdated,
pchManager, &PchManager::onProjectPartsUpdated);
// Register ModelManagerSupport
m_modelManagerSupport.reset(new ModelManagerSupport); m_modelManagerSupport.reset(new ModelManagerSupport);
CppTools::CppModelManager::instance()->addModelManagerSupport( cppModelManager->addModelManagerSupport(m_modelManagerSupport.data());
m_modelManagerSupport.data());
return true; return true;
} }
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef CLANGPLUGIN_H #ifndef CLANGCODEMODELPLUGIN_H
#define CLANGPLUGIN_H #define CLANGCODEMODELPLUGIN_H
#include "clangmodelmanagersupport.h" #include "clangmodelmanagersupport.h"
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <QScopedPointer>
namespace ClangCodeModel { namespace ClangCodeModel {
namespace Internal { namespace Internal {
...@@ -49,7 +51,6 @@ class ClangCodeModelPlugin: public ExtensionSystem::IPlugin ...@@ -49,7 +51,6 @@ class ClangCodeModelPlugin: public ExtensionSystem::IPlugin
public: public:
bool initialize(const QStringList &arguments, QString *errorMessage); bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized(); void extensionsInitialized();
private: private:
...@@ -72,4 +73,4 @@ private slots: ...@@ -72,4 +73,4 @@ private slots:
} // namespace Internal } // namespace Internal
} // namespace Clang } // namespace Clang
#endif // CLANGPLUGIN_H #endif // CLANGCODEMODELPLUGIN_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment