QmlProfiler: Partially dissolve QmlProfilerRunControlFactory

Change-Id: Id902cfa6387bcb6ad96da0cd36f3114f795afd99
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-07-11 18:32:40 +02:00
parent c8affd6e74
commit 611f373df6
5 changed files with 35 additions and 132 deletions

View File

@@ -24,7 +24,7 @@
****************************************************************************/
#include "qmlprofilerplugin.h"
#include "qmlprofilerruncontrolfactory.h"
#include "qmlprofilerrunconfigurationaspect.h"
#include "qmlprofileroptionspage.h"
#include "qmlprofilertool.h"
#include "qmlprofilertimelinemodel.h"
@@ -57,15 +57,34 @@
#endif // WITH_TESTS
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/environmentaspect.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/target.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QtPlugin>
using namespace ProjectExplorer;
namespace QmlProfiler {
namespace Internal {
Q_GLOBAL_STATIC(QmlProfilerSettings, qmlProfilerGlobalSettings)
class QmlProfilerRunControlFactory : public IRunControlFactory
{
public:
IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc) override
{
return new QmlProfilerRunConfigurationAspect(rc);
}
};
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
{
Q_UNUSED(arguments)
@@ -80,8 +99,21 @@ void QmlProfilerPlugin::extensionsInitialized()
{
(void) new QmlProfilerTool(this);
addAutoReleasedObject(new QmlProfilerRunControlFactory());
addAutoReleasedObject(new Internal::QmlProfilerOptionsPage());
addAutoReleasedObject(new QmlProfilerOptionsPage);
addAutoReleasedObject(new QmlProfilerRunControlFactory);
auto constraint = [](RunConfiguration *runConfiguration) {
Target *target = runConfiguration ? runConfiguration->target() : nullptr;
Kit *kit = target ? target->kit() : nullptr;
return DeviceTypeKitInformation::deviceTypeId(kit)
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
};
RunControl::registerWorkerCreator(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
[this](RunControl *runControl) { return new QmlProfilerRunner(runControl); });
RunControl::registerWorker<LocalQmlProfilerSupport>
(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint);
}
ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()