QbsProjectManager: Avoid use of global object pool

Change-Id: I6cce96dafda1694c46a4302ae121f7c08a9c82d8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2018-02-06 16:36:01 +01:00
parent c685dd1d83
commit 0c3aed2549
2 changed files with 25 additions and 15 deletions

View File

@@ -65,7 +65,6 @@
#include <utils/qtcassert.h>
#include <QAction>
#include <QtPlugin>
using namespace ProjectExplorer;
@@ -84,11 +83,31 @@ static QbsProject *currentEditorProject()
return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath())) : nullptr;
}
class QbsProjectManagerPluginPrivate
{
public:
QbsManager manager;
QbsBuildConfigurationFactory buildConfigFactory;
QbsBuildStepFactory buildStepFactory;
QbsCleanStepFactory cleanStepFactory;
QbsInstallStepFactory installStepFactory;
QbsDeployConfigurationFactory deployConfigFactory;
QbsRunConfigurationFactory runConfigFactory;
QbsProfilesSettingsPage profilesSetttingsPage;
};
QbsProjectManagerPlugin::~QbsProjectManagerPlugin()
{
delete d;
}
bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments);
Q_UNUSED(errorMessage);
d = new QbsProjectManagerPluginPrivate;
const Core::Context projectContext(::QbsProjectManager::Constants::PROJECT_ID);
Core::FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_QT, "qbs");
@@ -97,16 +116,6 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *
ProjectManager::registerProjectType<QbsProject>(QmlJSTools::Constants::QBS_MIMETYPE);
KitManager::registerKitInformation(new QbsKitInformation);
//create and register objects
addAutoReleasedObject(new QbsManager);
addAutoReleasedObject(new QbsBuildConfigurationFactory);
addAutoReleasedObject(new QbsBuildStepFactory);
addAutoReleasedObject(new QbsCleanStepFactory);
addAutoReleasedObject(new QbsInstallStepFactory);
addAutoReleasedObject(new QbsDeployConfigurationFactory);
addAutoReleasedObject(new QbsRunConfigurationFactory);
addAutoReleasedObject(new QbsProfilesSettingsPage);
//menus
// Build Menu:
Core::ActionContainer *mbuild =

View File

@@ -35,18 +35,18 @@ namespace QbsProjectManager {
namespace Internal {
class QbsProject;
class QbsProjectManagerPluginPrivate;
class QbsProjectManagerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QbsProjectManager.json")
public:
bool initialize(const QStringList &arguments, QString *errorMessage);
~QbsProjectManagerPlugin() final;
void extensionsInitialized();
bool initialize(const QStringList &arguments, QString *errorMessage) final;
void extensionsInitialized() final;
private:
void projectWasAdded(ProjectExplorer::Project *project);
void projectChanged();
@@ -84,6 +84,7 @@ private:
void runStepsForProducts(QbsProject *project, const QStringList &products,
const QList<Core::Id> &stepTypes);
QbsProjectManagerPluginPrivate *d = nullptr;
QAction *m_reparseQbs = nullptr;
QAction *m_reparseQbsCtx = nullptr;
QAction *m_buildFileCtx = nullptr;