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"
BATCHABLE
PREFIX
"/QtCreator/Tracing"
"/qt/qml/QtCreator/Tracing"
BASE
"qml"
FILES
@@ -104,6 +104,7 @@ qt_add_qml_module(Tracing
URI "QtCreator.Tracing"
VERSION "1.0"
NO_PLUGIN
RESOURCE_PREFIX "/qt/qml"
DEPENDENCIES
QtQuick
QML_FILES

View File

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

View File

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

View File

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

View File

@@ -69,19 +69,19 @@ public:
else if (iconName == "zoom")
icon = Icons::ZOOM_TOOLBAR;
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")
icon = Icon({{":/QtCreator/Tracing/ico_rangeselected.png", Theme::IconsBaseColor}});
icon = Icon({{":/qt/qml/QtCreator/Tracing/ico_rangeselected.png", Theme::IconsBaseColor}});
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")
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")
icon = Icons::UNLOCKED_TOOLBAR;
else if (iconName == "lock_closed")
icon = Icons::LOCKED_TOOLBAR;
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")
icon = Icons::INFO_TOOLBAR;
else if (iconName == "split")

View File

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

View File

@@ -34,7 +34,7 @@
#include <tracing/timelinetheme.h>
#include <QQmlContext>
#include <QQmlEngine>
namespace CtfVisualizer {
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
setMinimumHeight(170);
engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(engine());
rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"),
tool->modelAggregator());
rootContext()->setContextProperty(QLatin1String("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.
connect(tool->modelAggregator(), &QObject::destroyed, this, [this]{ setSource(QUrl()); });

View File

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

View File

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

View File

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

View File

@@ -33,6 +33,7 @@
#include <utils/theme/theme.h>
#include <QQmlContext>
#include <QQmlEngine>
namespace PerfProfiler {
namespace Internal {
@@ -45,10 +46,12 @@ PerfProfilerFlameGraphView::PerfProfilerFlameGraphView(QWidget *parent, PerfProf
PerfProfilerTraceManager *manager = tool->traceManager();
m_model = new PerfProfilerFlameGraphModel(manager);
engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(engine());
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));
setResizeMode(QQuickWidget::SizeRootObjectToView);

View File

@@ -33,6 +33,7 @@
#include <tracing/timelinetheme.h>
#include <QQmlContext>
#include <QQmlEngine>
namespace PerfProfiler {
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
setMinimumHeight(170);
engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(engine());
rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"),
tool->modelManager());
rootContext()->setContextProperty(QLatin1String("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.
connect(tool->modelManager(), &QObject::destroyed, this, [this]{ setSource(QUrl()); });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -65,6 +65,7 @@
#include <QScrollBar>
#include <QSlider>
#include <QMenu>
#include <QQmlEngine>
#include <QQuickItem>
#include <QQuickWidget>
#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
setMinimumHeight(170);
d->m_mainView->engine()->addImportPath(":/qt/qml/");
Timeline::TimelineTheme::setupTheme(d->m_mainView->engine());
d->m_mainView->rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"),
d->m_modelProxy);
d->m_mainView->rootContext()->setContextProperty(QLatin1String("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,
this, &QmlProfilerTraceView::updateCursorPosition);

View File

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

View File

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

View File

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

View File

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

View File

@@ -26,6 +26,7 @@
#include <QApplication>
#include <QQuickView>
#include <QQmlContext>
#include <QQmlEngine>
#include <tracing/timelinerenderer.h>
#include <tracing/timelineoverviewrenderer.h>
@@ -125,6 +126,7 @@ public:
{
setResizeMode(QQuickView::SizeRootObjectToView);
engine()->addImportPath(":/qt/qml/");
TimelineTheme::setupTheme(engine());
m_modelAggregator = new TimelineModelAggregator(this);
@@ -137,7 +139,7 @@ public:
m_zoomControl = new TimelineZoomControl(this);
m_zoomControl->setTrace(0, oneMs * 1000); // Total timeline length
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.
m_zoomControl->setRange(0, oneMs * 1000 / 3.0);