Analyzer: Dissolve IAnalyzerTool

Change-Id: I1fd90cf00d6b9dff54b4555a14747282830a4b93
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-02-18 14:35:20 +01:00
parent ca04d009f2
commit 73e2b0c579
17 changed files with 179 additions and 153 deletions

View File

@@ -52,7 +52,13 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
Q_UNUSED(arguments)
Q_UNUSED(errorString)
IAnalyzerTool *tool = new QmlProfilerTool(this);
auto tool = new QmlProfilerTool(this);
auto toolStarter = [tool](StartMode mode) { return tool->startTool(mode); };
auto widgetCreator = [tool] { return tool->createWidgets(); };
auto runControlCreator = [tool](const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration) {
return tool->createRunControl(sp, runConfiguration);
};
AnalyzerAction *action = 0;
@@ -61,8 +67,11 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
"applications using QML.");
action = new AnalyzerAction(this);
action->setId("QmlProfiler.Local");
action->setTool(tool);
action->setActionId("QmlProfiler.Local");
action->setToolId(QmlProfilerToolId);
action->setWidgetCreator(widgetCreator);
action->setRunControlCreator(runControlCreator);
action->setToolStarter(toolStarter);
action->setRunMode(ProjectExplorer::QmlProfilerRunMode);
action->setText(tr("QML Profiler"));
action->setToolTip(description);
@@ -71,8 +80,11 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
AnalyzerManager::addAction(action);
action = new AnalyzerAction(this);
action->setId("QmlProfiler.Remote");
action->setTool(tool);
action->setActionId("QmlProfiler.Remote");
action->setToolId(QmlProfilerToolId);
action->setWidgetCreator(widgetCreator);
action->setRunControlCreator(runControlCreator);
action->setToolStarter(toolStarter);
action->setRunMode(ProjectExplorer::QmlProfilerRunMode);
action->setText(tr("QML Profiler (External)"));
action->setToolTip(description);

View File

@@ -121,7 +121,7 @@ public:
};
QmlProfilerTool::QmlProfilerTool(QObject *parent)
: IAnalyzerTool(parent), d(new QmlProfilerToolPrivate)
: QObject(parent), d(new QmlProfilerToolPrivate)
{
setObjectName(QLatin1String("QmlProfilerTool"));
@@ -486,7 +486,7 @@ void QmlProfilerTool::clearDisplay()
updateTimeDisplay();
}
static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
static void startRemoteTool(QmlProfilerTool *tool, StartMode mode)
{
Id kitId;
quint16 port;
@@ -601,7 +601,7 @@ void QmlProfilerTool::showLoadDialog()
if (ModeManager::currentMode()->id() != MODE_ANALYZE)
AnalyzerManager::showMode();
AnalyzerManager::selectTool(this, StartRemote);
AnalyzerManager::selectTool("QmlProfiler", StartRemote);
QString filename = QFileDialog::getOpenFileName(ICore::mainWindow(), tr("Load QML Trace"), QString(),
tr("QML traces (*%1)").arg(QLatin1String(TraceFileExtension)));

View File

@@ -42,7 +42,9 @@ QT_END_NAMESPACE
namespace QmlProfiler {
namespace Internal {
class QmlProfilerTool : public Analyzer::IAnalyzerTool
const char QmlProfilerToolId[] = "QmlProfiler";
class QmlProfilerTool : public QObject
{
Q_OBJECT

View File

@@ -77,7 +77,7 @@ public:
QmlProfilerTraceView *q;
QmlProfilerStateManager *m_profilerState;
Analyzer::IAnalyzerTool *m_profilerTool;
QmlProfilerTool *m_profilerTool;
QmlProfilerViewManager *m_viewContainer;
QSize m_sizeHint;
@@ -90,7 +90,7 @@ public:
Timeline::TimelineZoomControl *m_zoomControl;
};
QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState)
QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState)
: QWidget(parent), d(new QmlProfilerTraceViewPrivate(this))
{
setObjectName(QLatin1String("QML Profiler"));

View File

@@ -35,14 +35,13 @@
#include <QWidget>
#include <QTimer>
namespace Analyzer { class IAnalyzerTool; }
namespace QmlProfiler {
class QmlProfilerModelManager;
namespace Internal {
class QmlProfilerStateManager;
class QmlProfilerTool;
class QmlProfilerViewManager;
class QmlProfilerTraceView : public QWidget
@@ -50,7 +49,7 @@ class QmlProfilerTraceView : public QWidget
Q_OBJECT
public:
explicit QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool,
explicit QmlProfilerTraceView(QWidget *parent, QmlProfilerTool *profilerTool,
QmlProfilerViewManager *container,
QmlProfilerModelManager *modelManager,
QmlProfilerStateManager *profilerState);

View File

@@ -124,11 +124,11 @@ void QmlProfilerViewManager::createViews()
d->v8profilerView, SLOT(selectBySourceLocation(QString,int,int)));
QDockWidget *eventsDock = AnalyzerManager::createDockWidget
(d->profilerTool, d->eventsView);
(QmlProfilerToolId, d->eventsView);
QDockWidget *timelineDock = AnalyzerManager::createDockWidget
(d->profilerTool, d->traceView);
(QmlProfilerToolId, d->traceView);
QDockWidget *v8profilerDock = AnalyzerManager::createDockWidget
(d->profilerTool, d->v8profilerView);
(QmlProfilerToolId, d->v8profilerView);
eventsDock->show();
timelineDock->show();

View File

@@ -104,7 +104,7 @@ public:
QV8ProfilerEventsWidget *q;
Analyzer::IAnalyzerTool *m_profilerTool;
QmlProfilerTool *m_profilerTool;
QmlProfilerViewManager *m_viewContainer;
QV8ProfilerEventsMainView *m_eventTree;
@@ -115,7 +115,7 @@ public:
};
QV8ProfilerEventsWidget::QV8ProfilerEventsWidget(QWidget *parent,
Analyzer::IAnalyzerTool *profilerTool,
QmlProfilerTool *profilerTool,
QmlProfilerViewManager *container,
QmlProfilerModelManager *profilerModelManager )
: QWidget(parent), d(new QV8ProfilerEventsWidgetPrivate(this))

View File

@@ -55,7 +55,7 @@ class QV8ProfilerEventsWidget : public QWidget
Q_OBJECT
public:
explicit QV8ProfilerEventsWidget(QWidget *parent,
Analyzer::IAnalyzerTool *profilerTool,
QmlProfilerTool *profilerTool,
QmlProfilerViewManager *container,
QmlProfilerModelManager *profilerModelManager );
~QV8ProfilerEventsWidget();