Analyzer: Rework the dock widget layout generation

Decouple layout generation from widget generation and
separate analyzer action description from menu action creation.

Tool specific layouts are named "Perspective" now.

Change-Id: I774efe77a07640c4cc26e4e566662c8a673c8831
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2016-02-26 14:14:49 +01:00
parent 04cbf8b818
commit 931ee3382c
32 changed files with 645 additions and 679 deletions

View File

@@ -58,38 +58,35 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
return tool->createRunControl(runConfiguration);
};
AnalyzerAction *action = 0;
QString description = QmlProfilerTool::tr(
"The QML Profiler can be used to find performance bottlenecks in "
"applications using QML.");
action = new AnalyzerAction(this);
action->setActionId(Constants::QmlProfilerLocalActionId);
action->setToolId(Constants::QmlProfilerToolId);
action->setWidgetCreator(widgetCreator);
action->setRunControlCreator(runControlCreator);
action->setToolPreparer([tool] { return tool->prepareTool(); });
action->setRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
action->setText(tr("QML Profiler"));
action->setToolTip(description);
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
AnalyzerManager::addAction(action);
ActionDescription desc;
desc.setText(tr("QML Profiler"));
desc.setToolTip(description);
desc.setActionId(Constants::QmlProfilerLocalActionId);
desc.setPerspectiveId(Constants::QmlProfilerPerspective);
desc.setWidgetCreator(widgetCreator);
desc.setRunControlCreator(runControlCreator);
desc.setToolPreparer([tool] { return tool->prepareTool(); });
desc.setRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
desc.setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
AnalyzerManager::addAction(desc);
action = new AnalyzerAction(this);
action->setActionId(Constants::QmlProfilerRemoteActionId);
action->setToolId(Constants::QmlProfilerToolId);
action->setWidgetCreator(widgetCreator);
action->setRunControlCreator(runControlCreator);
action->setCustomToolStarter([tool](ProjectExplorer::RunConfiguration *rc) {
desc.setText(tr("QML Profiler (External)"));
desc.setToolTip(description);
desc.setActionId(Constants::QmlProfilerRemoteActionId);
desc.setPerspectiveId(Constants::QmlProfilerPerspective);
desc.setWidgetCreator(widgetCreator);
desc.setRunControlCreator(runControlCreator);
desc.setCustomToolStarter([tool](ProjectExplorer::RunConfiguration *rc) {
tool->startRemoteTool(rc);
});
action->setToolPreparer([tool] { return tool->prepareTool(); });
action->setRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
action->setText(tr("QML Profiler (External)"));
action->setToolTip(description);
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS);
AnalyzerManager::addAction(action);
desc.setToolPreparer([tool] { return tool->prepareTool(); });
desc.setRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
desc.setMenuGroup(Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS);
AnalyzerManager::addAction(desc);
addAutoReleasedObject(new QmlProfilerRunControlFactory());
addAutoReleasedObject(new Internal::QmlProfilerOptionsPage());