forked from qt-creator/qt-creator
QmlProfiler: Dissolve plugin pimpl
... by using the new setup for QmlProfilerTool. Also, move the class definition to the .cpp. Change-Id: I3bc93f4960823914da9820fb2cb18de44f1c60c2 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -49,7 +49,7 @@ set(QMLPROFILER_CPP_SOURCES
|
|||||||
qmlprofilereventtypes.h
|
qmlprofilereventtypes.h
|
||||||
qmlprofilermodelmanager.cpp qmlprofilermodelmanager.h
|
qmlprofilermodelmanager.cpp qmlprofilermodelmanager.h
|
||||||
qmlprofilernotesmodel.cpp qmlprofilernotesmodel.h
|
qmlprofilernotesmodel.cpp qmlprofilernotesmodel.h
|
||||||
qmlprofilerplugin.cpp qmlprofilerplugin.h
|
qmlprofilerplugin.cpp
|
||||||
qmlprofilerrangemodel.cpp qmlprofilerrangemodel.h
|
qmlprofilerrangemodel.cpp qmlprofilerrangemodel.h
|
||||||
qmlprofilerrunconfigurationaspect.cpp qmlprofilerrunconfigurationaspect.h
|
qmlprofilerrunconfigurationaspect.cpp qmlprofilerrunconfigurationaspect.h
|
||||||
qmlprofilerruncontrol.cpp qmlprofilerruncontrol.h
|
qmlprofilerruncontrol.cpp qmlprofilerruncontrol.h
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ QtcPlugin {
|
|||||||
"qmlprofilereventtypes.h",
|
"qmlprofilereventtypes.h",
|
||||||
"qmlprofilermodelmanager.cpp", "qmlprofilermodelmanager.h",
|
"qmlprofilermodelmanager.cpp", "qmlprofilermodelmanager.h",
|
||||||
"qmlprofilernotesmodel.cpp", "qmlprofilernotesmodel.h",
|
"qmlprofilernotesmodel.cpp", "qmlprofilernotesmodel.h",
|
||||||
"qmlprofilerplugin.cpp", "qmlprofilerplugin.h",
|
"qmlprofilerplugin.cpp",
|
||||||
"qmlprofilerrunconfigurationaspect.cpp", "qmlprofilerrunconfigurationaspect.h",
|
"qmlprofilerrunconfigurationaspect.cpp", "qmlprofilerrunconfigurationaspect.h",
|
||||||
"qmlprofilerrangemodel.cpp", "qmlprofilerrangemodel.h",
|
"qmlprofilerrangemodel.cpp", "qmlprofilerrangemodel.h",
|
||||||
"qmlprofilerruncontrol.cpp", "qmlprofilerruncontrol.h",
|
"qmlprofilerruncontrol.cpp", "qmlprofilerruncontrol.h",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "qmlprofilerplugin.h"
|
|
||||||
#include "qmlprofilerrunconfigurationaspect.h"
|
#include "qmlprofilerrunconfigurationaspect.h"
|
||||||
#include "qmlprofilerruncontrol.h"
|
#include "qmlprofilerruncontrol.h"
|
||||||
#include "qmlprofilersettings.h"
|
#include "qmlprofilersettings.h"
|
||||||
@@ -48,65 +47,64 @@
|
|||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace QmlProfiler::Internal {
|
namespace QmlProfiler::Internal {
|
||||||
|
|
||||||
class QmlProfilerPluginPrivate
|
class QmlProfilerPlugin final : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
public:
|
Q_OBJECT
|
||||||
QmlProfilerTool m_profilerTool;
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlProfiler.json")
|
||||||
};
|
|
||||||
|
|
||||||
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
|
bool initialize(const QStringList &arguments, QString *errorString) final
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
|
|
||||||
setupQmlProfilerRunning();
|
setupQmlProfilerTool();
|
||||||
|
setupQmlProfilerRunning();
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
addTest<DebugMessagesModelTest>();
|
addTest<DebugMessagesModelTest>();
|
||||||
addTest<FlameGraphModelTest>();
|
addTest<FlameGraphModelTest>();
|
||||||
addTest<FlameGraphViewTest>();
|
addTest<FlameGraphViewTest>();
|
||||||
addTest<InputEventsModelTest>();
|
addTest<InputEventsModelTest>();
|
||||||
addTest<LocalQmlProfilerRunnerTest>();
|
addTest<LocalQmlProfilerRunnerTest>();
|
||||||
addTest<MemoryUsageModelTest>();
|
addTest<MemoryUsageModelTest>();
|
||||||
addTest<PixmapCacheModelTest>();
|
addTest<PixmapCacheModelTest>();
|
||||||
addTest<QmlEventTest>();
|
addTest<QmlEventTest>();
|
||||||
addTest<QmlEventLocationTest>();
|
addTest<QmlEventLocationTest>();
|
||||||
addTest<QmlEventTypeTest>();
|
addTest<QmlEventTypeTest>();
|
||||||
addTest<QmlNoteTest>();
|
addTest<QmlNoteTest>();
|
||||||
addTest<QmlProfilerAnimationsModelTest>();
|
addTest<QmlProfilerAnimationsModelTest>();
|
||||||
addTest<QmlProfilerAttachDialogTest>();
|
addTest<QmlProfilerAttachDialogTest>();
|
||||||
addTest<QmlProfilerBindingLoopsRenderPassTest>();
|
addTest<QmlProfilerBindingLoopsRenderPassTest>();
|
||||||
addTest<QmlProfilerClientManagerTest>();
|
addTest<QmlProfilerClientManagerTest>();
|
||||||
addTest<QmlProfilerDetailsRewriterTest>();
|
addTest<QmlProfilerDetailsRewriterTest>();
|
||||||
addTest<QmlProfilerToolTest>();
|
addTest<QmlProfilerToolTest>();
|
||||||
addTest<QmlProfilerTraceClientTest>();
|
addTest<QmlProfilerTraceClientTest>();
|
||||||
addTest<QmlProfilerTraceViewTest>();
|
addTest<QmlProfilerTraceViewTest>();
|
||||||
|
|
||||||
addTest<QQmlEngine>(); // Trigger debug connector to be started
|
addTest<QQmlEngine>(); // Trigger debug connector to be started
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Utils::HostOsInfo::canCreateOpenGLContext(errorString);
|
return Utils::HostOsInfo::canCreateOpenGLContext(errorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerPlugin::extensionsInitialized()
|
void extensionsInitialized() final
|
||||||
{
|
{
|
||||||
d = new QmlProfilerPluginPrivate;
|
RunConfiguration::registerAspect<QmlProfilerRunConfigurationAspect>();
|
||||||
|
}
|
||||||
|
|
||||||
RunConfiguration::registerAspect<QmlProfilerRunConfigurationAspect>();
|
ShutdownFlag aboutToShutdown() final
|
||||||
}
|
{
|
||||||
|
destroyQmlProfilerTool();
|
||||||
|
|
||||||
ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()
|
return SynchronousShutdown;
|
||||||
{
|
}
|
||||||
delete d;
|
};
|
||||||
d = nullptr;
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // QmlProfiler::Internal
|
} // QmlProfiler::Internal
|
||||||
|
|
||||||
|
#include "qmlprofilerplugin.moc"
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
|
||||||
|
|
||||||
namespace QmlProfiler::Internal {
|
|
||||||
|
|
||||||
class QmlProfilerPlugin : public ExtensionSystem::IPlugin
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlProfiler.json")
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool initialize(const QStringList &arguments, QString *errorString) final;
|
|
||||||
void extensionsInitialized() final;
|
|
||||||
ShutdownFlag aboutToShutdown() final;
|
|
||||||
|
|
||||||
class QmlProfilerPluginPrivate *d = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // QmlProfiler::Internal
|
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "qmlprofilerclientmanager.h"
|
#include "qmlprofilerclientmanager.h"
|
||||||
#include "qmlprofilerconstants.h"
|
#include "qmlprofilerconstants.h"
|
||||||
#include "qmlprofilermodelmanager.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
#include "qmlprofilerplugin.h"
|
|
||||||
#include "qmlprofilerrunconfigurationaspect.h"
|
#include "qmlprofilerrunconfigurationaspect.h"
|
||||||
#include "qmlprofilerruncontrol.h"
|
#include "qmlprofilerruncontrol.h"
|
||||||
#include "qmlprofilersettings.h"
|
#include "qmlprofilersettings.h"
|
||||||
@@ -75,8 +74,7 @@ using namespace QmlProfiler::Constants;
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
static QmlProfilerTool *m_instance = nullptr;
|
static QmlProfilerTool *m_instance = nullptr;
|
||||||
|
|
||||||
@@ -919,8 +917,17 @@ void QmlProfilerTool::toggleVisibleFeature(QAction *action)
|
|||||||
d->m_profilerModelManager->visibleFeatures() | (1ULL << feature));
|
d->m_profilerModelManager->visibleFeatures() | (1ULL << feature));
|
||||||
else
|
else
|
||||||
d->m_profilerModelManager->setVisibleFeatures(
|
d->m_profilerModelManager->setVisibleFeatures(
|
||||||
d->m_profilerModelManager->visibleFeatures() & (~(1ULL << feature)));
|
d->m_profilerModelManager->visibleFeatures() & (~(1ULL << feature)));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
void setupQmlProfilerTool()
|
||||||
} // namespace QmlProfiler
|
{
|
||||||
|
(void) new QmlProfilerTool;
|
||||||
|
}
|
||||||
|
|
||||||
|
void destroyQmlProfilerTool()
|
||||||
|
{
|
||||||
|
delete m_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // QmlProfiler::Internal
|
||||||
|
|||||||
@@ -89,5 +89,8 @@ private:
|
|||||||
QmlProfilerToolPrivate *d;
|
QmlProfilerToolPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void setupQmlProfilerTool();
|
||||||
|
void destroyQmlProfilerTool();
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QmlProfiler
|
} // namespace QmlProfiler
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "qmlprofileranimationsmodel.h"
|
#include "qmlprofileranimationsmodel.h"
|
||||||
#include "qmlprofilermodelmanager.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
#include "qmlprofilernotesmodel.h"
|
#include "qmlprofilernotesmodel.h"
|
||||||
#include "qmlprofilerplugin.h"
|
|
||||||
#include "qmlprofilerrangemodel.h"
|
#include "qmlprofilerrangemodel.h"
|
||||||
#include "qmlprofilerstatemanager.h"
|
#include "qmlprofilerstatemanager.h"
|
||||||
#include "qmlprofilertool.h"
|
#include "qmlprofilertool.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user