forked from qt-creator/qt-creator
QbsProjectManager: Avoid use of global object pool
Change-Id: I6cce96dafda1694c46a4302ae121f7c08a9c82d8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -65,7 +65,6 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QtPlugin>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
@@ -84,11 +83,31 @@ static QbsProject *currentEditorProject()
|
|||||||
return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath())) : nullptr;
|
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)
|
bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments);
|
Q_UNUSED(arguments);
|
||||||
Q_UNUSED(errorMessage);
|
Q_UNUSED(errorMessage);
|
||||||
|
|
||||||
|
d = new QbsProjectManagerPluginPrivate;
|
||||||
|
|
||||||
const Core::Context projectContext(::QbsProjectManager::Constants::PROJECT_ID);
|
const Core::Context projectContext(::QbsProjectManager::Constants::PROJECT_ID);
|
||||||
|
|
||||||
Core::FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_QT, "qbs");
|
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);
|
ProjectManager::registerProjectType<QbsProject>(QmlJSTools::Constants::QBS_MIMETYPE);
|
||||||
KitManager::registerKitInformation(new QbsKitInformation);
|
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
|
//menus
|
||||||
// Build Menu:
|
// Build Menu:
|
||||||
Core::ActionContainer *mbuild =
|
Core::ActionContainer *mbuild =
|
||||||
|
@@ -35,18 +35,18 @@ namespace QbsProjectManager {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QbsProject;
|
class QbsProject;
|
||||||
|
class QbsProjectManagerPluginPrivate;
|
||||||
|
|
||||||
class QbsProjectManagerPlugin : public ExtensionSystem::IPlugin
|
class QbsProjectManagerPlugin : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QbsProjectManager.json")
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QbsProjectManager.json")
|
||||||
|
|
||||||
public:
|
~QbsProjectManagerPlugin() final;
|
||||||
bool initialize(const QStringList &arguments, QString *errorMessage);
|
|
||||||
|
|
||||||
void extensionsInitialized();
|
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||||
|
void extensionsInitialized() final;
|
||||||
|
|
||||||
private:
|
|
||||||
void projectWasAdded(ProjectExplorer::Project *project);
|
void projectWasAdded(ProjectExplorer::Project *project);
|
||||||
void projectChanged();
|
void projectChanged();
|
||||||
|
|
||||||
@@ -84,6 +84,7 @@ private:
|
|||||||
void runStepsForProducts(QbsProject *project, const QStringList &products,
|
void runStepsForProducts(QbsProject *project, const QStringList &products,
|
||||||
const QList<Core::Id> &stepTypes);
|
const QList<Core::Id> &stepTypes);
|
||||||
|
|
||||||
|
QbsProjectManagerPluginPrivate *d = nullptr;
|
||||||
QAction *m_reparseQbs = nullptr;
|
QAction *m_reparseQbs = nullptr;
|
||||||
QAction *m_reparseQbsCtx = nullptr;
|
QAction *m_reparseQbsCtx = nullptr;
|
||||||
QAction *m_buildFileCtx = nullptr;
|
QAction *m_buildFileCtx = nullptr;
|
||||||
|
Reference in New Issue
Block a user