qmlprofiler: simplify plugin construction

Change-Id: I26fe148669656637a82a30012e8632b105d4f073
Reviewed-on: http://codereview.qt.nokia.com/1050
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-06-30 14:39:15 +02:00
committed by hjk
parent 99d9f065b3
commit daefb0c83a
3 changed files with 3 additions and 28 deletions

View File

@@ -221,7 +221,6 @@ public:
void saveToolSettings(IAnalyzerTool *tool); void saveToolSettings(IAnalyzerTool *tool);
void loadToolSettings(IAnalyzerTool *tool); void loadToolSettings(IAnalyzerTool *tool);
void registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory);
ProjectExplorer::RunControl *createRunControl ProjectExplorer::RunControl *createRunControl
(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode); (ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
@@ -286,7 +285,7 @@ AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager
connect(m_toolBox, SIGNAL(currentIndexChanged(int)), SLOT(selectTool(int))); connect(m_toolBox, SIGNAL(currentIndexChanged(int)), SLOT(selectTool(int)));
m_runControlFactory = new AnalyzerRunControlFactory(); m_runControlFactory = new AnalyzerRunControlFactory();
registerRunControlFactory(m_runControlFactory); AnalyzerPlugin::instance()->addAutoReleasedObject(m_runControlFactory);
setupActions(); setupActions();
@@ -307,12 +306,6 @@ AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
} }
} }
void AnalyzerManager::AnalyzerManagerPrivate::registerRunControlFactory
(ProjectExplorer::IRunControlFactory *factory)
{
AnalyzerPlugin::instance()->addAutoReleasedObject(factory);
}
void AnalyzerManager::AnalyzerManagerPrivate::setupActions() void AnalyzerManager::AnalyzerManagerPrivate::setupActions()
{ {
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();

View File

@@ -45,27 +45,14 @@ using namespace QmlProfiler::Internal;
bool QmlProfilerPlugin::debugOutput = false; bool QmlProfilerPlugin::debugOutput = false;
class QmlProfilerPlugin::QmlProfilerPluginPrivate
{
public:
QmlProjectAnalyzerRunControlFactory *m_runControlFactory;
};
QmlProfilerPlugin::QmlProfilerPlugin() QmlProfilerPlugin::QmlProfilerPlugin()
: d(new QmlProfilerPluginPrivate())
{} {}
QmlProfilerPlugin::~QmlProfilerPlugin()
{
delete d;
}
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString) bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
{ {
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(errorString) Q_UNUSED(errorString)
d->m_runControlFactory = new QmlProjectAnalyzerRunControlFactory(); addAutoReleasedObject(new QmlProjectAnalyzerRunControlFactory());
AnalyzerManager::registerRunControlFactory(d->m_runControlFactory);
AnalyzerManager::addTool(new QmlProfilerTool(true, this)); AnalyzerManager::addTool(new QmlProfilerTool(true, this));
AnalyzerManager::addTool(new QmlProfilerTool(false, this)); AnalyzerManager::addTool(new QmlProfilerTool(false, this));
return true; return true;

View File

@@ -46,18 +46,13 @@ class QmlProfilerPlugin : public ExtensionSystem::IPlugin
Q_OBJECT Q_OBJECT
public: public:
QmlProfilerPlugin(); QmlProfilerPlugin() {}
~QmlProfilerPlugin();
bool initialize(const QStringList &arguments, QString *errorString); bool initialize(const QStringList &arguments, QString *errorString);
void extensionsInitialized(); void extensionsInitialized();
ShutdownFlag aboutToShutdown(); ShutdownFlag aboutToShutdown();
static bool debugOutput; static bool debugOutput;
private:
class QmlProfilerPluginPrivate;
QmlProfilerPluginPrivate *d;
}; };
} // namespace Internal } // namespace Internal