diff --git a/src/plugins/qmlprofiler/CMakeLists.txt b/src/plugins/qmlprofiler/CMakeLists.txt index 304c69dd35a..7dc0cecb9dc 100644 --- a/src/plugins/qmlprofiler/CMakeLists.txt +++ b/src/plugins/qmlprofiler/CMakeLists.txt @@ -1,54 +1,5 @@ -add_qtc_plugin(QmlProfiler - CONDITION TARGET Tracing - DEPENDS QmlDebug QmlJS Tracing Qt5::QuickWidgets - PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport TextEditor - SOURCES - debugmessagesmodel.cpp debugmessagesmodel.h - flamegraphmodel.cpp flamegraphmodel.h - flamegraphview.cpp flamegraphview.h - inputeventsmodel.cpp inputeventsmodel.h - memoryusagemodel.cpp memoryusagemodel.h - pixmapcachemodel.cpp pixmapcachemodel.h - qml/qmlprofiler.qrc - qmlevent.cpp qmlevent.h - qmleventlocation.cpp qmleventlocation.h - qmleventtype.cpp qmleventtype.h - qmlnote.cpp qmlnote.h - qmlprofiler_global.h - qmlprofileractions.cpp qmlprofileractions.h - qmlprofileranimationsmodel.cpp qmlprofileranimationsmodel.h - qmlprofilerattachdialog.cpp qmlprofilerattachdialog.h - qmlprofilerbindingloopsrenderpass.cpp qmlprofilerbindingloopsrenderpass.h - qmlprofilerclientmanager.cpp qmlprofilerclientmanager.h - qmlprofilerconstants.h - qmlprofilerdetailsrewriter.cpp qmlprofilerdetailsrewriter.h - qmlprofilereventsview.h - qmlprofilereventtypes.h - qmlprofilermodelmanager.cpp qmlprofilermodelmanager.h - qmlprofilernotesmodel.cpp qmlprofilernotesmodel.h - qmlprofilerplugin.cpp qmlprofilerplugin.h - qmlprofilerrangemodel.cpp qmlprofilerrangemodel.h - qmlprofilerrunconfigurationaspect.cpp qmlprofilerrunconfigurationaspect.h - qmlprofilerruncontrol.cpp qmlprofilerruncontrol.h - qmlprofilersettings.cpp qmlprofilersettings.h - qmlprofilerstatemanager.cpp qmlprofilerstatemanager.h - qmlprofilerstatewidget.cpp qmlprofilerstatewidget.h - qmlprofilerstatisticsmodel.cpp qmlprofilerstatisticsmodel.h - qmlprofilerstatisticsview.cpp qmlprofilerstatisticsview.h - qmlprofilertextmark.cpp qmlprofilertextmark.h - qmlprofilertimelinemodel.cpp qmlprofilertimelinemodel.h - qmlprofilertool.cpp qmlprofilertool.h - qmlprofilertraceclient.cpp qmlprofilertraceclient.h - qmlprofilertracefile.cpp qmlprofilertracefile.h - qmlprofilertraceview.cpp qmlprofilertraceview.h - qmlprofilerviewmanager.cpp qmlprofilerviewmanager.h - qmltypedevent.cpp qmltypedevent.h - scenegraphtimelinemodel.cpp scenegraphtimelinemodel.h -) - -extend_qtc_plugin(QmlProfiler - CONDITION WITH_TESTS - SOURCES +if(WITH_TESTS) + set(TEST_SOURCES tests/debugmessagesmodel_test.cpp tests/debugmessagesmodel_test.h tests/fakedebugserver.cpp tests/fakedebugserver.h tests/flamegraphmodel_test.cpp tests/flamegraphmodel_test.h @@ -70,4 +21,91 @@ extend_qtc_plugin(QmlProfiler tests/qmlprofilertraceclient_test.cpp tests/qmlprofilertraceclient_test.h tests/qmlprofilertraceview_test.cpp tests/qmlprofilertraceview_test.h tests/tests.qrc + ) +else() + set(TEST_SOURCES "") +endif() + +set(QMLPROFILER_CPP_SOURCES + debugmessagesmodel.cpp debugmessagesmodel.h + flamegraphmodel.cpp flamegraphmodel.h + flamegraphview.cpp flamegraphview.h + inputeventsmodel.cpp inputeventsmodel.h + memoryusagemodel.cpp memoryusagemodel.h + pixmapcachemodel.cpp pixmapcachemodel.h + qmlevent.cpp qmlevent.h + qmleventlocation.cpp qmleventlocation.h + qmleventtype.cpp qmleventtype.h + qmlnote.cpp qmlnote.h + qmlprofiler_global.h + qmlprofileractions.cpp qmlprofileractions.h + qmlprofileranimationsmodel.cpp qmlprofileranimationsmodel.h + qmlprofilerattachdialog.cpp qmlprofilerattachdialog.h + qmlprofilerbindingloopsrenderpass.cpp qmlprofilerbindingloopsrenderpass.h + qmlprofilerclientmanager.cpp qmlprofilerclientmanager.h + qmlprofilerconstants.h + qmlprofilerdetailsrewriter.cpp qmlprofilerdetailsrewriter.h + qmlprofilereventsview.h + qmlprofilereventtypes.h + qmlprofilermodelmanager.cpp qmlprofilermodelmanager.h + qmlprofilernotesmodel.cpp qmlprofilernotesmodel.h + qmlprofilerplugin.cpp qmlprofilerplugin.h + qmlprofilerrangemodel.cpp qmlprofilerrangemodel.h + qmlprofilerrunconfigurationaspect.cpp qmlprofilerrunconfigurationaspect.h + qmlprofilerruncontrol.cpp qmlprofilerruncontrol.h + qmlprofilersettings.cpp qmlprofilersettings.h + qmlprofilerstatemanager.cpp qmlprofilerstatemanager.h + qmlprofilerstatewidget.cpp qmlprofilerstatewidget.h + qmlprofilerstatisticsmodel.cpp qmlprofilerstatisticsmodel.h + qmlprofilerstatisticsview.cpp qmlprofilerstatisticsview.h + qmlprofilertextmark.cpp qmlprofilertextmark.h + qmlprofilertimelinemodel.cpp qmlprofilertimelinemodel.h + qmlprofilertool.cpp qmlprofilertool.h + qmlprofilertraceclient.cpp qmlprofilertraceclient.h + qmlprofilertracefile.cpp qmlprofilertracefile.h + qmlprofilertraceview.cpp qmlprofilertraceview.h + qmlprofilerviewmanager.cpp qmlprofilerviewmanager.h + qmltypedevent.cpp qmltypedevent.h + scenegraphtimelinemodel.cpp scenegraphtimelinemodel.h ) + +add_qtc_plugin(QmlProfiler + DEPENDS QmlDebug QmlJS Tracing Qt5::QuickWidgets + PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport TextEditor + SOURCES + ${TEST_SOURCES} +) + +if(${Qt5_VERSION} VERSION_LESS "6.2.0") + extend_qtc_plugin(QmlProfiler + SOURCES + ${QMLPROFILER_CPP_SOURCES} + qml/qmlprofiler.qrc + ) +else() # < Qt 6.2 + set(QMLPROFILER_QML_FILES + qml/QmlProfilerFlameGraphView.qml + ) + + set(QMLPROFILER_QML_RESOURCES + qml/bindingloops.frag + qml/bindingloops.vert + ) + + foreach(file IN LISTS QMLPROFILER_QML_FILES QMLPROFILER_QML_RESOURCES) + get_filename_component(fileName "${file}" NAME) + set_source_files_properties("${file}" PROPERTIES QT_RESOURCE_ALIAS "${fileName}") + endforeach() + + qt_add_qml_module(QmlProfiler + URI "QtCreator.QmlProfiler" + VERSION "1.0" + NO_CREATE_PLUGIN_TARGET + QML_FILES + ${QMLPROFILER_QML_FILES} + RESOURCES + ${QMLPROFILER_QML_RESOURCES} + SOURCES + ${QMLPROFILER_CPP_SOURCES} + ) +endif() # < Qt 6.2 diff --git a/src/plugins/qmlprofiler/flamegraphmodel.h b/src/plugins/qmlprofiler/flamegraphmodel.h index 456502b9322..3e536bf2200 100644 --- a/src/plugins/qmlprofiler/flamegraphmodel.h +++ b/src/plugins/qmlprofiler/flamegraphmodel.h @@ -55,6 +55,10 @@ struct FlameGraphData { class FlameGraphModel : public QAbstractItemModel { Q_OBJECT +#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0) + QML_NAMED_ELEMENT(QmlProfilerFlameGraphModel) + QML_UNCREATABLE("use the context property") +#endif // Qt >= 6.2 public: enum Role { TypeIdRole = Qt::UserRole + 1, // Sort by data, not by displayed string diff --git a/src/plugins/qmlprofiler/flamegraphview.cpp b/src/plugins/qmlprofiler/flamegraphview.cpp index 4008da48a50..19d81c9721a 100644 --- a/src/plugins/qmlprofiler/flamegraphview.cpp +++ b/src/plugins/qmlprofiler/flamegraphview.cpp @@ -48,15 +48,16 @@ FlameGraphView::FlameGraphView(QmlProfilerModelManager *manager, QWidget *parent #if QT_VERSION < QT_VERSION_CHECK(6, 2, 0) qmlRegisterType("QtCreator.Tracing", 1, 0, "FlameGraph"); -#endif // Qt < 6.2 qmlRegisterUncreatableType("QtCreator.QmlProfiler", 1, 0, "QmlProfilerFlameGraphModel", QLatin1String("use the context property")); +#endif // Qt < 6.2 Timeline::TimelineTheme::setupTheme(m_content->engine()); m_content->rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model); - m_content->setSource(QUrl(QStringLiteral("qrc:/qmlprofiler/QmlProfilerFlameGraphView.qml"))); + m_content->setSource( + QUrl(QStringLiteral("qrc:/QtCreator/QmlProfiler/QmlProfilerFlameGraphView.qml"))); m_content->setClearColor(Utils::creatorTheme()->color(Utils::Theme::Timeline_BackgroundColor1)); m_content->setResizeMode(QQuickWidget::SizeRootObjectToView); diff --git a/src/plugins/qmlprofiler/qml/QmlProfilerFlameGraphView.qml b/src/plugins/qmlprofiler/qml/QmlProfilerFlameGraphView.qml index bf7f54b2728..1fd1a3ca538 100644 --- a/src/plugins/qmlprofiler/qml/QmlProfilerFlameGraphView.qml +++ b/src/plugins/qmlprofiler/qml/QmlProfilerFlameGraphView.qml @@ -24,7 +24,7 @@ ****************************************************************************/ import QtCreator.QmlProfiler 1.0 -import "../QtCreator/Tracing/" // TODO: Turn into module import when possible +import "../Tracing" // TODO: Turn into module import when possible FlameGraphView { id: root diff --git a/src/plugins/qmlprofiler/qml/qmlprofiler.qrc b/src/plugins/qmlprofiler/qml/qmlprofiler.qrc index daf9a34b48e..e3582b44eb6 100644 --- a/src/plugins/qmlprofiler/qml/qmlprofiler.qrc +++ b/src/plugins/qmlprofiler/qml/qmlprofiler.qrc @@ -1,5 +1,5 @@ - + bindingloops.vert bindingloops.frag QmlProfilerFlameGraphView.qml diff --git a/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp b/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp index 892f384b6ad..e9f056f5693 100644 --- a/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp @@ -317,11 +317,13 @@ BindingLoopMaterialShader::BindingLoopMaterialShader() : QSGMaterialShader() { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qmlprofiler/bindingloops.vert")); - setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qmlprofiler/bindingloops.frag")); + setShaderSourceFile(QOpenGLShader::Vertex, + QStringLiteral(":/QtCreator/QmlProfiler/bindingloops.vert")); + setShaderSourceFile(QOpenGLShader::Fragment, + QStringLiteral(":/QtCreator/QmlProfiler/bindingloops.frag")); #else // < Qt 6 - setShaderFileName(VertexStage, ":/qmlprofiler/bindingloops.vert"); - setShaderFileName(FragmentStage, ":/qmlprofiler/bindingloops.frag"); + setShaderFileName(VertexStage, ":/QtCreator/QmlProfiler/bindingloops.vert"); + setShaderFileName(FragmentStage, ":/QtCreator/QmlProfiler/bindingloops.frag"); #endif // < Qt 6 }