From f89691a2355f4cc39fd987a437a29537e3844e59 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 8 Feb 2018 10:08:14 +0100 Subject: [PATCH] QtSupportPlugin: Pimpl partially to remove uses of global object pool Change-Id: I6c23d6220e8ca212f3785a7aff7915d7979f01eb Reviewed-by: Christian Stenger --- src/plugins/qtsupport/qtsupportplugin.cpp | 41 +++++++++++++++-------- src/plugins/qtsupport/qtsupportplugin.h | 11 +++--- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp index e1adeb3a056..30ac0e21e88 100644 --- a/src/plugins/qtsupport/qtsupportplugin.cpp +++ b/src/plugins/qtsupport/qtsupportplugin.cpp @@ -46,14 +46,31 @@ #include -#include - -static const char kHostBins[] = "CurrentProject:QT_HOST_BINS"; -static const char kInstallBins[] = "CurrentProject:QT_INSTALL_BINS"; +const char kHostBins[] = "CurrentProject:QT_HOST_BINS"; +const char kInstallBins[] = "CurrentProject:QT_INSTALL_BINS"; using namespace Core; -using namespace QtSupport; -using namespace QtSupport::Internal; + +namespace QtSupport { +namespace Internal { + +class QtSupportPluginPrivate +{ +public: + QtVersionManager qtVersionManager; + DesktopQtVersionFactory desktopQtVersionFactory; + + CodeGenSettingsPage codeGenSettingsPage; + QtOptionsPage qtOptionsPage; + + ExamplesWelcomePage examplesPage{true}; + ExamplesWelcomePage tutorialPage{false}; +}; + +QtSupportPlugin::~QtSupportPlugin() +{ + delete d; +} bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMessage) { @@ -65,14 +82,7 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes JsExpander::registerQObjectForJs(QLatin1String("QtSupport"), new CodeGenerator); - addAutoReleasedObject(new QtVersionManager); - addAutoReleasedObject(new DesktopQtVersionFactory); - - addAutoReleasedObject(new CodeGenSettingsPage); - addAutoReleasedObject(new QtOptionsPage); - - addAutoReleasedObject(new ExamplesWelcomePage(true)); // Examples - addAutoReleasedObject(new ExamplesWelcomePage(false)); // Tutorials + d = new QtSupportPluginPrivate; ProjectExplorer::KitManager::registerKitInformation(new QtKitInformation); @@ -109,3 +119,6 @@ void QtSupportPlugin::extensionsInitialized() "You probably want %1 instead.").arg(QString::fromLatin1(kHostBins)), []() { return qmakeProperty("QT_INSTALL_BINS"); }); } + +} // Internal +} // QtSupport diff --git a/src/plugins/qtsupport/qtsupportplugin.h b/src/plugins/qtsupport/qtsupportplugin.h index 1756b2a1c45..b5e950733b0 100644 --- a/src/plugins/qtsupport/qtsupportplugin.h +++ b/src/plugins/qtsupport/qtsupportplugin.h @@ -30,16 +30,19 @@ namespace QtSupport { namespace Internal { -class ExamplesWelcomePage; - class QtSupportPlugin : public ExtensionSystem::IPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QtSupport.json") public: - bool initialize(const QStringList &arguments, QString *errorMessage); - void extensionsInitialized(); + ~QtSupportPlugin() final; + +private: + bool initialize(const QStringList &arguments, QString *errorMessage) final; + void extensionsInitialized() final; + + class QtSupportPluginPrivate *d = nullptr; #ifdef WITH_TESTS private slots: