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 @@
****************************************************************************/
#include "clangcodemodelplugin.h"
#include "clangprojectsettingspropertiespage.h"
#include "pchmanager.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 <projectexplorer/projectpanelfactory.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <QtPlugin>
namespace ClangCodeModel {
namespace Internal {
......@@ -55,32 +48,34 @@ bool ClangCodeModelPlugin::initialize(const QStringList &arguments, QString *err
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
// Register widget for project panel
auto panelFactory = new ProjectExplorer::ProjectPanelFactory();
panelFactory->setPriority(60);
panelFactory->setDisplayName(ClangProjectSettingsWidget::tr("Clang Settings"));
panelFactory->setSimpleCreateWidgetFunction<ClangProjectSettingsWidget>(QIcon());
ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory);
// Initialize Clang
ClangCodeModel::Internal::initializeClang();
PchManager *pchManager = new PchManager(this);
// Set up Indexer
auto cppModelManager = CppTools::CppModelManager::instance();
#ifdef CLANG_INDEXING
m_indexer.reset(new ClangIndexer);
CppTools::CppModelManager::instance()->setIndexingSupport(m_indexer->indexingSupport());
cppModelManager->setIndexingSupport(m_indexer->indexingSupport());
#endif // CLANG_INDEXING
// wire up the pch manager
QObject *session = ProjectExplorer::SessionManager::instance();
connect(session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
pchManager, SLOT(onAboutToRemoveProject(ProjectExplorer::Project*)));
connect(CppTools::CppModelManager::instance(), SIGNAL(projectPartsUpdated(ProjectExplorer::Project*)),
pchManager, SLOT(onProjectPartsUpdated(ProjectExplorer::Project*)));
// Set up PchManager
PchManager *pchManager = new PchManager(this);
ProjectExplorer::SessionManager *sessionManager = ProjectExplorer::SessionManager::instance();
connect(sessionManager, &ProjectExplorer::SessionManager::aboutToRemoveProject,
pchManager, &PchManager::onAboutToRemoveProject);
connect(cppModelManager, &CppTools::CppModelManager::projectPartsUpdated,
pchManager, &PchManager::onProjectPartsUpdated);
// Register ModelManagerSupport
m_modelManagerSupport.reset(new ModelManagerSupport);
CppTools::CppModelManager::instance()->addModelManagerSupport(
m_modelManagerSupport.data());
cppModelManager->addModelManagerSupport(m_modelManagerSupport.data());
return true;
}
......
......@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGPLUGIN_H
#define CLANGPLUGIN_H
#ifndef CLANGCODEMODELPLUGIN_H
#define CLANGCODEMODELPLUGIN_H
#include "clangmodelmanagersupport.h"
......@@ -39,6 +39,8 @@
#include <extensionsystem/iplugin.h>
#include <QScopedPointer>
namespace ClangCodeModel {
namespace Internal {
......@@ -49,7 +51,6 @@ class ClangCodeModelPlugin: public ExtensionSystem::IPlugin
public:
bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized();
private:
......@@ -72,4 +73,4 @@ private slots:
} // namespace Internal
} // 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