diff --git a/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.cpp b/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.cpp index 25e77b58a04..fc791fe6522 100644 --- a/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.cpp +++ b/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.cpp @@ -29,15 +29,23 @@ #include #include +#include "pchmanagerprojectupdater.h" #include "preprocessormacrocollector.h" #include "preprocessormacrowidget.h" +#include "qtcreatorprojectupdater.h" namespace ClangPchManager { -ClangIndexingProjectSettingsWidget::ClangIndexingProjectSettingsWidget(ClangIndexingProjectSettings *settings) +ClangIndexingProjectSettingsWidget::ClangIndexingProjectSettingsWidget( + ClangIndexingProjectSettings *settings, + ProjectExplorer::Project *project, + QtCreatorProjectUpdater &projectUpdater) : ui(new Ui::ClangIndexingProjectSettingsWidget) + , m_project(project) + , m_projectUpdater(projectUpdater) { ui->setupUi(this); ui->preprocessorMacrosWidget->setSettings(settings); + connect(ui->reindexButton, &QPushButton::clicked, this, &ClangIndexingProjectSettingsWidget::reindex); } ClangIndexingProjectSettingsWidget::~ClangIndexingProjectSettingsWidget() @@ -58,4 +66,9 @@ void ClangIndexingProjectSettingsWidget::onProjectPartsUpdated(ProjectExplorer:: ui->preprocessorMacrosWidget->setBasePreprocessorMacros(collector.macros()); } +void ClangIndexingProjectSettingsWidget::reindex() +{ + m_projectUpdater.projectPartsUpdated(m_project); +} + } // namespace ClangPchManager diff --git a/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.h b/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.h index d46d8119384..2a3b4293b51 100644 --- a/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.h +++ b/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.h @@ -37,6 +37,10 @@ class ClangIndexingProjectSettingsWidget; namespace ClangPchManager { +template +class QtCreatorProjectUpdater; +class PchManagerProjectUpdater; + class ClangIndexingProjectSettings; class ClangIndexingProjectSettingsWidget : public QWidget @@ -44,13 +48,19 @@ class ClangIndexingProjectSettingsWidget : public QWidget Q_OBJECT public: - explicit ClangIndexingProjectSettingsWidget(ClangIndexingProjectSettings *settings); + explicit ClangIndexingProjectSettingsWidget( + ClangIndexingProjectSettings *settings, + ProjectExplorer::Project *project, + QtCreatorProjectUpdater &projectUpdater); ~ClangIndexingProjectSettingsWidget(); void onProjectPartsUpdated(ProjectExplorer::Project *project); + void reindex(); private: Ui::ClangIndexingProjectSettingsWidget *ui; + ProjectExplorer::Project *m_project; + QtCreatorProjectUpdater &m_projectUpdater; }; } // namespace ClangPchManager diff --git a/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.ui b/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.ui index e54a2a7a91d..b10fd91beee 100644 --- a/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.ui +++ b/src/plugins/clangpchmanager/clangindexingprojectsettingswidget.ui @@ -15,7 +15,50 @@ - + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + Reindex + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + + 0 + 0 + + + diff --git a/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp b/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp index 98e455b0ea8..606e12b98e8 100644 --- a/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp +++ b/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp @@ -62,13 +62,16 @@ QString backendProcessPath() + QStringLiteral(QTC_HOST_EXE_SUFFIX); } -void addIndexingProjectPaneWidget(ClangIndexingSettingsManager &settingsManager) +void addIndexingProjectPaneWidget(ClangIndexingSettingsManager &settingsManager, + QtCreatorProjectUpdater &projectUpdater) { auto factory = new ProjectExplorer::ProjectPanelFactory; factory->setPriority(120); factory->setDisplayName(ClangIndexingProjectSettingsWidget::tr("Clang Indexing")); factory->setCreateWidgetFunction([&](ProjectExplorer::Project *project) { - auto widget = new ClangIndexingProjectSettingsWidget(settingsManager.settings(project)); + auto widget = new ClangIndexingProjectSettingsWidget(settingsManager.settings(project), + project, + projectUpdater); widget->onProjectPartsUpdated(project); @@ -108,11 +111,11 @@ public: PchManagerClient pchManagerClient{pchCreationProgressManager, dependencyCreationProgressManager}; PchManagerConnectionClient connectionClient{&pchManagerClient}; ClangIndexingSettingsManager settingsManager; - QtCreatorProjectUpdater projectUpdate{connectionClient.serverProxy(), - pchManagerClient, - filePathCache, - projectPartsStorage, - settingsManager}; + QtCreatorProjectUpdater projectUpdater{connectionClient.serverProxy(), + pchManagerClient, + filePathCache, + projectPartsStorage, + settingsManager}; }; std::unique_ptr ClangPchManagerPlugin::d; @@ -128,7 +131,7 @@ bool ClangPchManagerPlugin::initialize(const QStringList & /*arguments*/, QStrin startBackend(); - addIndexingProjectPaneWidget(d->settingsManager); + addIndexingProjectPaneWidget(d->settingsManager, d->projectUpdater); return true; }