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
|
||||
qmlprofilermodelmanager.cpp qmlprofilermodelmanager.h
|
||||
qmlprofilernotesmodel.cpp qmlprofilernotesmodel.h
|
||||
qmlprofilerplugin.cpp qmlprofilerplugin.h
|
||||
qmlprofilerplugin.cpp
|
||||
qmlprofilerrangemodel.cpp qmlprofilerrangemodel.h
|
||||
qmlprofilerrunconfigurationaspect.cpp qmlprofilerrunconfigurationaspect.h
|
||||
qmlprofilerruncontrol.cpp qmlprofilerruncontrol.h
|
||||
|
||||
@@ -40,7 +40,7 @@ QtcPlugin {
|
||||
"qmlprofilereventtypes.h",
|
||||
"qmlprofilermodelmanager.cpp", "qmlprofilermodelmanager.h",
|
||||
"qmlprofilernotesmodel.cpp", "qmlprofilernotesmodel.h",
|
||||
"qmlprofilerplugin.cpp", "qmlprofilerplugin.h",
|
||||
"qmlprofilerplugin.cpp",
|
||||
"qmlprofilerrunconfigurationaspect.cpp", "qmlprofilerrunconfigurationaspect.h",
|
||||
"qmlprofilerrangemodel.cpp", "qmlprofilerrangemodel.h",
|
||||
"qmlprofilerruncontrol.cpp", "qmlprofilerruncontrol.h",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilerrunconfigurationaspect.h"
|
||||
#include "qmlprofilerruncontrol.h"
|
||||
#include "qmlprofilersettings.h"
|
||||
@@ -48,20 +47,22 @@
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace QmlProfiler::Internal {
|
||||
|
||||
class QmlProfilerPluginPrivate
|
||||
class QmlProfilerPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
QmlProfilerTool m_profilerTool;
|
||||
};
|
||||
Q_OBJECT
|
||||
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)
|
||||
|
||||
setupQmlProfilerTool();
|
||||
setupQmlProfilerRunning();
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
@@ -89,24 +90,21 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
|
||||
#endif
|
||||
|
||||
return Utils::HostOsInfo::canCreateOpenGLContext(errorString);
|
||||
}
|
||||
|
||||
void QmlProfilerPlugin::extensionsInitialized()
|
||||
{
|
||||
d = new QmlProfilerPluginPrivate;
|
||||
}
|
||||
|
||||
void extensionsInitialized() final
|
||||
{
|
||||
RunConfiguration::registerAspect<QmlProfilerRunConfigurationAspect>();
|
||||
}
|
||||
}
|
||||
|
||||
ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()
|
||||
{
|
||||
delete d;
|
||||
d = nullptr;
|
||||
ShutdownFlag aboutToShutdown() final
|
||||
{
|
||||
destroyQmlProfilerTool();
|
||||
|
||||
// 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
|
||||
|
||||
#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 "qmlprofilerconstants.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilerrunconfigurationaspect.h"
|
||||
#include "qmlprofilerruncontrol.h"
|
||||
#include "qmlprofilersettings.h"
|
||||
@@ -75,8 +74,7 @@ using namespace QmlProfiler::Constants;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
namespace QmlProfiler::Internal {
|
||||
|
||||
static QmlProfilerTool *m_instance = nullptr;
|
||||
|
||||
@@ -922,5 +920,14 @@ void QmlProfilerTool::toggleVisibleFeature(QAction *action)
|
||||
d->m_profilerModelManager->visibleFeatures() & (~(1ULL << feature)));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
void setupQmlProfilerTool()
|
||||
{
|
||||
(void) new QmlProfilerTool;
|
||||
}
|
||||
|
||||
void destroyQmlProfilerTool()
|
||||
{
|
||||
delete m_instance;
|
||||
}
|
||||
|
||||
} // QmlProfiler::Internal
|
||||
|
||||
@@ -89,5 +89,8 @@ private:
|
||||
QmlProfilerToolPrivate *d;
|
||||
};
|
||||
|
||||
void setupQmlProfilerTool();
|
||||
void destroyQmlProfilerTool();
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "qmlprofileranimationsmodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilernotesmodel.h"
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilerrangemodel.h"
|
||||
#include "qmlprofilerstatemanager.h"
|
||||
#include "qmlprofilertool.h"
|
||||
|
||||
Reference in New Issue
Block a user