QtSupportPlugin: Pimpl partially to remove uses of global object pool

Change-Id: I6c23d6220e8ca212f3785a7aff7915d7979f01eb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-02-08 10:08:14 +01:00
parent 0363e4f58b
commit f89691a235
2 changed files with 34 additions and 18 deletions

View File

@@ -46,14 +46,31 @@
#include <utils/macroexpander.h>
#include <QtPlugin>
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

View File

@@ -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: