analyzer: refactoring of analyzer manager

Change-Id: I60268b8bc86e439beb3fca8f4b6a87ea03925bad
Reviewed-on: http://codereview.qt.nokia.com/1049
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-06-30 13:44:22 +02:00
committed by hjk
parent 343ac57943
commit 99d9f065b3
31 changed files with 461 additions and 512 deletions

View File

@@ -32,98 +32,59 @@
**************************************************************************/
#include "qmlprofilerplugin.h"
#include "qmlprofilerconstants.h"
#include "qmlprojectanalyzerruncontrolfactory.h"
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/coreconstants.h>
#include "qmlprofilertool.h"
#include "qmlprojectanalyzerruncontrolfactory.h"
#include <analyzerbase/analyzermanager.h>
#include <QtGui/QAction>
#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtCore/QtPlugin>
#include "qmlprofilertool.h"
using namespace Analyzer;
using namespace QmlProfiler::Internal;
QmlProfilerPlugin *QmlProfilerPlugin::m_instance = 0;
bool QmlProfilerPlugin::debugOutput = false;
class QmlProfilerPlugin::QmlProfilerPluginPrivate
{
public:
QmlProfilerPluginPrivate(QmlProfilerPlugin *qq):
q(qq)
{}
void initialize(const QStringList &arguments, QString *errorString);
QmlProjectAnalyzerRunControlFactory *m_runControlFactory;
QmlProfilerPlugin *q;
};
void QmlProfilerPlugin::QmlProfilerPluginPrivate::initialize(const QStringList &arguments, QString *errorString)
{
Q_UNUSED(arguments)
Q_UNUSED(errorString)
m_runControlFactory = new QmlProjectAnalyzerRunControlFactory();
Analyzer::AnalyzerManager::instance()->registerRunControlFactory(m_runControlFactory);
}
QmlProfilerPlugin::QmlProfilerPlugin()
: d(new QmlProfilerPluginPrivate(this))
{
m_instance = this;
}
: d(new QmlProfilerPluginPrivate())
{}
QmlProfilerPlugin::~QmlProfilerPlugin()
{
delete d;
m_instance = 0;
}
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
{
d->initialize(arguments, errorString);
AnalyzerManager::instance()->addTool(new QmlProfilerTool(this));
Q_UNUSED(arguments)
Q_UNUSED(errorString)
d->m_runControlFactory = new QmlProjectAnalyzerRunControlFactory();
AnalyzerManager::registerRunControlFactory(d->m_runControlFactory);
AnalyzerManager::addTool(new QmlProfilerTool(true, this));
AnalyzerManager::addTool(new QmlProfilerTool(false, this));
return true;
}
void QmlProfilerPlugin::extensionsInitialized()
{
// Retrieve objects from the plugin manager's object pool
// Retrieve objects from the plugin manager's object pool.
// "In the extensionsInitialized method, a plugin can be sure that all
// plugins that depend on it are completely initialized."
}
ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()
{
// Save settings
// Save settings.
// Disconnect from signals that are not needed during shutdown
// Hide UI (if you add UI that is not in the main window directly)
return SynchronousShutdown;
}
QmlProfilerPlugin *QmlProfilerPlugin::instance()
{
return m_instance;
}
Q_EXPORT_PLUGIN(QmlProfilerPlugin)