Tracing/Qml|PerfProfiler/CtfVisualizer: Move QML modules to :/qt/qml

We don't want to dedicate the whole resource file system to QML.

Change-Id: I4c7e4af7aeeab00f44c5244e99949a90abb032cf
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Alessandro Portale
2022-07-19 17:26:34 +02:00
committed by Ulf Hermann
parent 24c6073196
commit 8cb1775ba8
23 changed files with 47 additions and 30 deletions

View File

@@ -90,7 +90,7 @@ endforeach()
qt_add_shaders(Tracing "res_tracingshaders" qt_add_shaders(Tracing "res_tracingshaders"
BATCHABLE BATCHABLE
PREFIX PREFIX
"/QtCreator/Tracing" "/qt/qml/QtCreator/Tracing"
BASE BASE
"qml" "qml"
FILES FILES
@@ -104,6 +104,7 @@ qt_add_qml_module(Tracing
URI "QtCreator.Tracing" URI "QtCreator.Tracing"
VERSION "1.0" VERSION "1.0"
NO_PLUGIN NO_PLUGIN
RESOURCE_PREFIX "/qt/qml"
DEPENDENCIES DEPENDENCIES
QtQuick QtQuick
QML_FILES QML_FILES

View File

@@ -1,5 +1,5 @@
<RCC> <RCC>
<qresource prefix="/QtCreator/Tracing"> <qresource prefix="/qt/qml/QtCreator/Tracing">
<file>ButtonsBar.qml</file> <file>ButtonsBar.qml</file>
<file>CategoryLabel.qml</file> <file>CategoryLabel.qml</file>
<file>Detail.qml</file> <file>Detail.qml</file>

View File

@@ -451,8 +451,8 @@ public:
TimelineItemsMaterialShader::TimelineItemsMaterialShader() TimelineItemsMaterialShader::TimelineItemsMaterialShader()
: QSGMaterialShader() : QSGMaterialShader()
{ {
setShaderFileName(VertexStage, ":/QtCreator/Tracing/timelineitems_qt6.vert.qsb"); setShaderFileName(VertexStage, ":/qt/qml/QtCreator/Tracing/timelineitems_qt6.vert.qsb");
setShaderFileName(FragmentStage, ":/QtCreator/Tracing/timelineitems_qt6.frag.qsb"); setShaderFileName(FragmentStage, ":/qt/qml/QtCreator/Tracing/timelineitems_qt6.frag.qsb");
} }
bool TimelineItemsMaterialShader::updateUniformData(RenderState &state, bool TimelineItemsMaterialShader::updateUniformData(RenderState &state,

View File

@@ -236,8 +236,8 @@ public:
NotesMaterialShader::NotesMaterialShader() NotesMaterialShader::NotesMaterialShader()
: QSGMaterialShader() : QSGMaterialShader()
{ {
setShaderFileName(VertexStage, ":/QtCreator/Tracing/notes_qt6.vert.qsb"); setShaderFileName(VertexStage, ":/qt/qml/QtCreator/Tracing/notes_qt6.vert.qsb");
setShaderFileName(FragmentStage, ":/QtCreator/Tracing/notes_qt6.frag.qsb"); setShaderFileName(FragmentStage, ":/qt/qml/QtCreator/Tracing/notes_qt6.frag.qsb");
} }
static QColor notesColor() static QColor notesColor()

View File

@@ -69,19 +69,19 @@ public:
else if (iconName == "zoom") else if (iconName == "zoom")
icon = Icons::ZOOM_TOOLBAR; icon = Icons::ZOOM_TOOLBAR;
else if (iconName == "rangeselection") else if (iconName == "rangeselection")
icon = Icon({{":/QtCreator/Tracing/ico_rangeselection.png", Theme::IconsBaseColor}}); icon = Icon({{":/qt/qml/QtCreator/Tracing/ico_rangeselection.png", Theme::IconsBaseColor}});
else if (iconName == "rangeselected") else if (iconName == "rangeselected")
icon = Icon({{":/QtCreator/Tracing/ico_rangeselected.png", Theme::IconsBaseColor}}); icon = Icon({{":/qt/qml/QtCreator/Tracing/ico_rangeselected.png", Theme::IconsBaseColor}});
else if (iconName == "selectionmode") else if (iconName == "selectionmode")
icon = Icon({{":/QtCreator/Tracing/ico_selectionmode.png", Theme::IconsBaseColor}}); icon = Icon({{":/qt/qml/QtCreator/Tracing/ico_selectionmode.png", Theme::IconsBaseColor}});
else if (iconName == "edit") else if (iconName == "edit")
icon = Icon({{":/QtCreator/Tracing/ico_edit.png", Theme::IconsBaseColor}}); icon = Icon({{":/qt/qml/QtCreator/Tracing/ico_edit.png", Theme::IconsBaseColor}});
else if (iconName == "lock_open") else if (iconName == "lock_open")
icon = Icons::UNLOCKED_TOOLBAR; icon = Icons::UNLOCKED_TOOLBAR;
else if (iconName == "lock_closed") else if (iconName == "lock_closed")
icon = Icons::LOCKED_TOOLBAR; icon = Icons::LOCKED_TOOLBAR;
else if (iconName == "range_handle") else if (iconName == "range_handle")
icon = Icon({{":/QtCreator/Tracing/range_handle.png", Theme::IconsBaseColor}}); icon = Icon({{":/qt/qml/QtCreator/Tracing/range_handle.png", Theme::IconsBaseColor}});
else if (iconName == "note") else if (iconName == "note")
icon = Icons::INFO_TOOLBAR; icon = Icons::INFO_TOOLBAR;
else if (iconName == "split") else if (iconName == "split")

View File

@@ -41,7 +41,7 @@ Project {
Group { Group {
name: "Qml Files" name: "Qml Files"
Qt.core.resourcePrefix: "QtCreator/Tracing/" Qt.core.resourcePrefix: "qt/qml/QtCreator/Tracing/"
fileTags: "qt.core.resource_data" fileTags: "qt.core.resource_data"
files: "qml/**" files: "qml/**"
} }

View File

@@ -34,7 +34,7 @@
#include <tracing/timelinetheme.h> #include <tracing/timelinetheme.h>
#include <QQmlContext> #include <QQmlContext>
#include <QQmlEngine>
namespace CtfVisualizer { namespace CtfVisualizer {
namespace Internal { namespace Internal {
@@ -49,13 +49,14 @@ CtfVisualizerTraceView::CtfVisualizerTraceView(QWidget *parent, CtfVisualizerToo
// Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin
setMinimumHeight(170); setMinimumHeight(170);
engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(engine()); Timeline::TimelineTheme::setupTheme(engine());
rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"), rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"),
tool->modelAggregator()); tool->modelAggregator());
rootContext()->setContextProperty(QLatin1String("zoomControl"), rootContext()->setContextProperty(QLatin1String("zoomControl"),
tool->zoomControl()); tool->zoomControl());
setSource(QUrl(QLatin1String("qrc:/QtCreator/Tracing/MainView.qml"))); setSource(QUrl(QLatin1String("qrc:/qt/qml/QtCreator/Tracing/MainView.qml")));
// Avoid ugly warnings when reading from null properties in QML. // Avoid ugly warnings when reading from null properties in QML.
connect(tool->modelAggregator(), &QObject::destroyed, this, [this]{ setSource(QUrl()); }); connect(tool->modelAggregator(), &QObject::destroyed, this, [this]{ setSource(QUrl()); });

View File

@@ -60,6 +60,7 @@ qt_add_qml_module(PerfProfiler
URI "QtCreator.PerfProfiler" URI "QtCreator.PerfProfiler"
VERSION "1.0" VERSION "1.0"
NO_PLUGIN NO_PLUGIN
RESOURCE_PREFIX "/qt/qml"
QML_FILES QML_FILES
PerfProfilerFlameGraphView.qml PerfProfilerFlameGraphView.qml
SOURCES SOURCES

View File

@@ -24,7 +24,7 @@
****************************************************************************/ ****************************************************************************/
import QtCreator.PerfProfiler import QtCreator.PerfProfiler
import "../Tracing" // TODO: Turn into module import when possible import QtCreator.Tracing
FlameGraphView { FlameGraphView {
id: root id: root

View File

@@ -72,7 +72,7 @@ QtcPlugin {
Group { Group {
name: "Qml Files" name: "Qml Files"
Qt.core.resourcePrefix: "QtCreator/PerfProfiler/" Qt.core.resourcePrefix: "qt/qml/QtCreator/PerfProfiler/"
fileTags: "qt.core.resource_data" fileTags: "qt.core.resource_data"
files: [ "PerfProfilerFlameGraphView.qml" ] files: [ "PerfProfilerFlameGraphView.qml" ]
} }

View File

@@ -33,6 +33,7 @@
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
#include <QQmlContext> #include <QQmlContext>
#include <QQmlEngine>
namespace PerfProfiler { namespace PerfProfiler {
namespace Internal { namespace Internal {
@@ -45,10 +46,12 @@ PerfProfilerFlameGraphView::PerfProfilerFlameGraphView(QWidget *parent, PerfProf
PerfProfilerTraceManager *manager = tool->traceManager(); PerfProfilerTraceManager *manager = tool->traceManager();
m_model = new PerfProfilerFlameGraphModel(manager); m_model = new PerfProfilerFlameGraphModel(manager);
engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(engine()); Timeline::TimelineTheme::setupTheme(engine());
rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model); rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model);
setSource(QUrl(QStringLiteral("qrc:/QtCreator/PerfProfiler/PerfProfilerFlameGraphView.qml"))); setSource(QUrl(QStringLiteral(
"qrc:/qt/qml/QtCreator/PerfProfiler/PerfProfilerFlameGraphView.qml")));
setClearColor(Utils::creatorTheme()->color(Utils::Theme::Timeline_BackgroundColor1)); setClearColor(Utils::creatorTheme()->color(Utils::Theme::Timeline_BackgroundColor1));
setResizeMode(QQuickWidget::SizeRootObjectToView); setResizeMode(QQuickWidget::SizeRootObjectToView);

View File

@@ -33,6 +33,7 @@
#include <tracing/timelinetheme.h> #include <tracing/timelinetheme.h>
#include <QQmlContext> #include <QQmlContext>
#include <QQmlEngine>
namespace PerfProfiler { namespace PerfProfiler {
namespace Internal { namespace Internal {
@@ -47,13 +48,14 @@ PerfProfilerTraceView::PerfProfilerTraceView(QWidget *parent, PerfProfilerTool *
// Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin
setMinimumHeight(170); setMinimumHeight(170);
engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(engine()); Timeline::TimelineTheme::setupTheme(engine());
rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"), rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"),
tool->modelManager()); tool->modelManager());
rootContext()->setContextProperty(QLatin1String("zoomControl"), rootContext()->setContextProperty(QLatin1String("zoomControl"),
tool->zoomControl()); tool->zoomControl());
setSource(QUrl(QLatin1String("qrc:/QtCreator/Tracing/MainView.qml"))); setSource(QUrl(QLatin1String("qrc:/qt/qml/QtCreator/Tracing/MainView.qml")));
// Avoid ugly warnings when reading from null properties in QML. // Avoid ugly warnings when reading from null properties in QML.
connect(tool->modelManager(), &QObject::destroyed, this, [this]{ setSource(QUrl()); }); connect(tool->modelManager(), &QObject::destroyed, this, [this]{ setSource(QUrl()); });

View File

@@ -97,7 +97,7 @@ endforeach()
qt_add_shaders(QmlProfiler "res_qmlprofilershaders" qt_add_shaders(QmlProfiler "res_qmlprofilershaders"
BATCHABLE BATCHABLE
PREFIX PREFIX
"/QtCreator/QmlProfiler" "/qt/qml/QtCreator/QmlProfiler"
BASE BASE
"qml" "qml"
FILES FILES
@@ -109,6 +109,7 @@ qt_add_qml_module(QmlProfiler
URI "QtCreator.QmlProfiler" URI "QtCreator.QmlProfiler"
VERSION "1.0" VERSION "1.0"
NO_PLUGIN NO_PLUGIN
RESOURCE_PREFIX "/qt/qml"
QML_FILES QML_FILES
${QMLPROFILER_QML_FILES} ${QMLPROFILER_QML_FILES}
RESOURCES RESOURCES

View File

@@ -46,11 +46,12 @@ FlameGraphView::FlameGraphView(QmlProfilerModelManager *manager, QWidget *parent
setObjectName("QmlProfiler.FlameGraph.Dock"); setObjectName("QmlProfiler.FlameGraph.Dock");
setWindowTitle(tr("Flame Graph")); setWindowTitle(tr("Flame Graph"));
m_content->engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(m_content->engine()); Timeline::TimelineTheme::setupTheme(m_content->engine());
m_content->rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model); m_content->rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model);
m_content->setSource( m_content->setSource(QUrl(QStringLiteral(
QUrl(QStringLiteral("qrc:/QtCreator/QmlProfiler/QmlProfilerFlameGraphView.qml"))); "qrc:/qt/qml/QtCreator/QmlProfiler/QmlProfilerFlameGraphView.qml")));
m_content->setClearColor(Utils::creatorTheme()->color(Utils::Theme::Timeline_BackgroundColor1)); m_content->setClearColor(Utils::creatorTheme()->color(Utils::Theme::Timeline_BackgroundColor1));
m_content->setResizeMode(QQuickWidget::SizeRootObjectToView); m_content->setResizeMode(QQuickWidget::SizeRootObjectToView);

View File

@@ -24,7 +24,7 @@
****************************************************************************/ ****************************************************************************/
import QtCreator.QmlProfiler import QtCreator.QmlProfiler
import "../Tracing" // TODO: Turn into module import when possible import QtCreator.Tracing
FlameGraphView { FlameGraphView {
id: root id: root

View File

@@ -66,7 +66,7 @@ QtcPlugin {
Group { Group {
name: "Qml Files" name: "Qml Files"
Qt.core.resourcePrefix: "QtCreator/QmlProfiler/" Qt.core.resourcePrefix: "qt/qml/QtCreator/QmlProfiler/"
fileTags: "qt.core.resource_data" fileTags: "qt.core.resource_data"
files: "qml/**" files: "qml/**"
} }

View File

@@ -301,8 +301,8 @@ public:
BindingLoopMaterialShader::BindingLoopMaterialShader() BindingLoopMaterialShader::BindingLoopMaterialShader()
: QSGMaterialShader() : QSGMaterialShader()
{ {
setShaderFileName(VertexStage, ":/QtCreator/QmlProfiler/bindingloops_qt6.vert.qsb"); setShaderFileName(VertexStage, ":/qt/qml/QtCreator/QmlProfiler/bindingloops_qt6.vert.qsb");
setShaderFileName(FragmentStage, ":/QtCreator/QmlProfiler/bindingloops_qt6.frag.qsb"); setShaderFileName(FragmentStage, ":/qt/qml/QtCreator/QmlProfiler/bindingloops_qt6.frag.qsb");
} }
static QColor bindingLoopsColor() static QColor bindingLoopsColor()

View File

@@ -65,6 +65,7 @@
#include <QScrollBar> #include <QScrollBar>
#include <QSlider> #include <QSlider>
#include <QMenu> #include <QMenu>
#include <QQmlEngine>
#include <QQuickItem> #include <QQuickItem>
#include <QQuickWidget> #include <QQuickWidget>
#include <QApplication> #include <QApplication>
@@ -159,13 +160,14 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
// Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin
setMinimumHeight(170); setMinimumHeight(170);
d->m_mainView->engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(d->m_mainView->engine()); Timeline::TimelineTheme::setupTheme(d->m_mainView->engine());
d->m_mainView->rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"), d->m_mainView->rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"),
d->m_modelProxy); d->m_modelProxy);
d->m_mainView->rootContext()->setContextProperty(QLatin1String("zoomControl"), d->m_mainView->rootContext()->setContextProperty(QLatin1String("zoomControl"),
d->m_zoomControl); d->m_zoomControl);
d->m_mainView->setSource(QUrl(QLatin1String("qrc:/QtCreator/Tracing/MainView.qml"))); d->m_mainView->setSource(QUrl(QLatin1String("qrc:/qt/qml/QtCreator/Tracing/MainView.qml")));
connect(d->m_modelProxy, &Timeline::TimelineModelAggregator::updateCursorPosition, connect(d->m_modelProxy, &Timeline::TimelineModelAggregator::updateCursorPosition,
this, &QmlProfilerTraceView::updateCursorPosition); this, &QmlProfilerTraceView::updateCursorPosition);

View File

@@ -16,6 +16,7 @@ qt_add_qml_module(tst_tracing_flamegraphview
URI "QtCreator.TstTracingFlameGraphView" URI "QtCreator.TstTracingFlameGraphView"
VERSION "1.0" VERSION "1.0"
NO_PLUGIN NO_PLUGIN
RESOURCE_PREFIX "/qt/qml"
QML_FILES QML_FILES
TestFlameGraphView.qml TestFlameGraphView.qml
SOURCES SOURCES

View File

@@ -24,7 +24,7 @@
****************************************************************************/ ****************************************************************************/
import QtCreator.TstTracingFlameGraphView import QtCreator.TstTracingFlameGraphView
import "../Tracing" // TODO: Turn into module import when possible import QtCreator.Tracing
FlameGraphView { FlameGraphView {
id: root id: root

View File

@@ -17,7 +17,7 @@ TracingAutotest {
Group { Group {
name: "Qml Files" name: "Qml Files"
Qt.core.resourcePrefix: "QtCreator/TstTracingFlameGraphView/" Qt.core.resourcePrefix: "qt/qml/QtCreator/TstTracingFlameGraphView/"
fileTags: "qt.core.resource_data" fileTags: "qt.core.resource_data"
files: [ files: [
"TestFlameGraphView.qml", "TestFlameGraphView.qml",

View File

@@ -32,6 +32,7 @@
#include <QObject> #include <QObject>
#include <QQmlContext> #include <QQmlContext>
#include <QQmlEngine>
#include <QQuickWidget> #include <QQuickWidget>
#include <QtTest> #include <QtTest>
@@ -80,11 +81,12 @@ void tst_FlameGraphView::initTestCase()
{ {
model.fill(); model.fill();
widget.engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(widget.engine()); Timeline::TimelineTheme::setupTheme(widget.engine());
widget.rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), &model); widget.rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), &model);
widget.setSource(QUrl(QStringLiteral( widget.setSource(QUrl(QStringLiteral(
"qrc:/QtCreator/TstTracingFlameGraphView/TestFlameGraphView.qml"))); "qrc:/qt/qml/QtCreator/TstTracingFlameGraphView/TestFlameGraphView.qml")));
widget.setResizeMode(QQuickWidget::SizeRootObjectToView); widget.setResizeMode(QQuickWidget::SizeRootObjectToView);
widget.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); widget.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

View File

@@ -26,6 +26,7 @@
#include <QApplication> #include <QApplication>
#include <QQuickView> #include <QQuickView>
#include <QQmlContext> #include <QQmlContext>
#include <QQmlEngine>
#include <tracing/timelinerenderer.h> #include <tracing/timelinerenderer.h>
#include <tracing/timelineoverviewrenderer.h> #include <tracing/timelineoverviewrenderer.h>
@@ -125,6 +126,7 @@ public:
{ {
setResizeMode(QQuickView::SizeRootObjectToView); setResizeMode(QQuickView::SizeRootObjectToView);
engine()->addImportPath(":/qt/qml/");
TimelineTheme::setupTheme(engine()); TimelineTheme::setupTheme(engine());
m_modelAggregator = new TimelineModelAggregator(this); m_modelAggregator = new TimelineModelAggregator(this);
@@ -137,7 +139,7 @@ public:
m_zoomControl = new TimelineZoomControl(this); m_zoomControl = new TimelineZoomControl(this);
m_zoomControl->setTrace(0, oneMs * 1000); // Total timeline length m_zoomControl->setTrace(0, oneMs * 1000); // Total timeline length
rootContext()->setContextProperty("zoomControl", m_zoomControl); rootContext()->setContextProperty("zoomControl", m_zoomControl);
setSource(QUrl(QLatin1String("qrc:/QtCreator/Tracing/MainView.qml"))); setSource(QUrl(QLatin1String("qrc:/qt/qml/QtCreator/Tracing/MainView.qml")));
// Zoom onto first timeline third. Needs to be done after loading setSource. // Zoom onto first timeline third. Needs to be done after loading setSource.
m_zoomControl->setRange(0, oneMs * 1000 / 3.0); m_zoomControl->setRange(0, oneMs * 1000 / 3.0);