forked from qt-creator/qt-creator
QmlProfiler: Partially dissolve QmlProfilerRunControlFactory
Change-Id: Id902cfa6387bcb6ad96da0cd36f3114f795afd99 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -28,7 +28,6 @@ SOURCES += \
|
||||
qmlprofilerrangemodel.cpp \
|
||||
qmlprofilerrunconfigurationaspect.cpp \
|
||||
qmlprofilerruncontrol.cpp \
|
||||
qmlprofilerruncontrolfactory.cpp \
|
||||
qmlprofilersettings.cpp \
|
||||
qmlprofilerstatemanager.cpp \
|
||||
qmlprofilerstatewidget.cpp \
|
||||
@@ -72,7 +71,6 @@ HEADERS += \
|
||||
qmlprofilerrangemodel.h \
|
||||
qmlprofilerrunconfigurationaspect.h \
|
||||
qmlprofilerruncontrol.h \
|
||||
qmlprofilerruncontrolfactory.h \
|
||||
qmlprofilersettings.h \
|
||||
qmlprofilerstatemanager.h \
|
||||
qmlprofilerstatewidget.h \
|
||||
|
||||
@@ -45,7 +45,6 @@ QtcPlugin {
|
||||
"qmlprofileroptionspage.cpp", "qmlprofileroptionspage.h",
|
||||
"qmlprofilerplugin.cpp", "qmlprofilerplugin.h",
|
||||
"qmlprofilerrunconfigurationaspect.cpp", "qmlprofilerrunconfigurationaspect.h",
|
||||
"qmlprofilerruncontrolfactory.cpp", "qmlprofilerruncontrolfactory.h",
|
||||
"qmlprofilerrangemodel.cpp", "qmlprofilerrangemodel.h",
|
||||
"qmlprofilerruncontrol.cpp", "qmlprofilerruncontrol.h",
|
||||
"qmlprofilersettings.cpp", "qmlprofilersettings.h",
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qmlprofilerruncontrolfactory.h"
|
||||
#include "qmlprofilerruncontrol.h"
|
||||
#include "qmlprofilerrunconfigurationaspect.h"
|
||||
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
static bool isLocal(RunConfiguration *runConfiguration)
|
||||
{
|
||||
Target *target = runConfiguration ? runConfiguration->target() : 0;
|
||||
Kit *kit = target ? target->kit() : 0;
|
||||
return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
}
|
||||
|
||||
QmlProfilerRunControlFactory::QmlProfilerRunControlFactory(QObject *parent) :
|
||||
IRunControlFactory(parent)
|
||||
{
|
||||
RunControl::registerWorkerCreator(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
|
||||
[this](RunControl *runControl) { return new QmlProfilerRunner(runControl); });
|
||||
}
|
||||
|
||||
bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
|
||||
{
|
||||
return mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE && isLocal(runConfiguration);
|
||||
}
|
||||
|
||||
RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *)
|
||||
{
|
||||
auto runControl = new RunControl(runConfiguration, mode);
|
||||
(void) new LocalQmlProfilerSupport(runControl);
|
||||
return runControl;
|
||||
}
|
||||
|
||||
ProjectExplorer::IRunConfigurationAspect *
|
||||
QmlProfilerRunControlFactory::createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc)
|
||||
{
|
||||
return new QmlProfilerRunConfigurationAspect(rc);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
@@ -1,52 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
class QmlProfilerRunControlFactory : public ProjectExplorer::IRunControlFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef ProjectExplorer::RunConfiguration RunConfiguration;
|
||||
|
||||
explicit QmlProfilerRunControlFactory(QObject *parent = 0);
|
||||
|
||||
// IRunControlFactory implementation
|
||||
bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const override;
|
||||
|
||||
ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, Core::Id mode,
|
||||
QString *errorMessage) override;
|
||||
|
||||
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(
|
||||
ProjectExplorer::RunConfiguration *rc) override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
Reference in New Issue
Block a user