diff --git a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp index 2cd5dd90bc3..9ae9db62612 100644 --- a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp @@ -47,12 +47,10 @@ namespace Internal { QmlProfilerAnimationsModel::QmlProfilerAnimationsModel(QmlProfilerModelManager *manager, QObject *parent) : - QmlProfilerTimelineModel(manager, - tr(QmlProfilerModelManager::featureName(QmlDebug::ProfileAnimations)), - QmlDebug::Event, QmlDebug::MaximumRangeType, parent) + QmlProfilerTimelineModel(manager, QmlDebug::Event, QmlDebug::MaximumRangeType, + QmlDebug::ProfileAnimations, parent) { m_maxGuiThreadAnimations = m_maxRenderThreadAnimations = 0; - announceFeatures(1 << QmlDebug::ProfileAnimations); } void QmlProfilerAnimationsModel::clear() diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp index 021f9bd2cd5..064474b1ab1 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp @@ -51,10 +51,10 @@ namespace Internal { QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager, QmlDebug::RangeType range, QObject *parent) : - QmlProfilerTimelineModel(manager, categoryLabel(range), QmlDebug::MaximumMessage, range, parent) + QmlProfilerTimelineModel(manager, QmlDebug::MaximumMessage, range, + QmlDebug::featureFromRangeType(range), parent) { m_expandedRowTypes << -1; - announceFeatures(1ULL << QmlDebug::featureFromRangeType(rangeType())); } void QmlProfilerRangeModel::clear() @@ -186,12 +186,6 @@ void QmlProfilerRangeModel::findBindingLoops() } -QString QmlProfilerRangeModel::categoryLabel(QmlDebug::RangeType rangeType) -{ - return QCoreApplication::translate("MainView", - QmlProfilerModelManager::featureName(QmlDebug::featureFromRangeType(rangeType))); -} - int QmlProfilerRangeModel::expandedRow(int index) const { return m_data[index].displayRowExpanded; @@ -237,7 +231,8 @@ QVariantMap QmlProfilerRangeModel::details(int index) const const QVector &types = modelManager()->qmlModel()->getEventTypes(); - result.insert(QStringLiteral("displayName"), categoryLabel(rangeType())); + result.insert(QStringLiteral("displayName"), + tr(QmlProfilerModelManager::featureName(mainFeature()))); result.insert(tr("Duration"), QmlProfilerBaseModel::formatTime(duration(index))); result.insert(tr("Details"), types[id].data); diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.h b/src/plugins/qmlprofiler/qmlprofilerrangemodel.h index fb8e7fcb67a..9dc2940c666 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.h +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.h @@ -64,8 +64,6 @@ public: QmlProfilerRangeModel(QmlProfilerModelManager *manager, QmlDebug::RangeType range, QObject *parent = 0); - static QString categoryLabel(QmlDebug::RangeType categoryIndex); - Q_INVOKABLE int expandedRow(int index) const; Q_INVOKABLE int collapsedRow(int index) const; int bindingLoopDest(int index) const; diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp index 7bdaa119bf3..ec90364db5a 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp @@ -33,14 +33,18 @@ namespace QmlProfiler { QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, - const QString &displayName, QmlDebug::Message message, - QmlDebug::RangeType rangeType, QObject *parent) : - TimelineModel(modelManager->registerModelProxy(), displayName, parent), m_message(message), - m_rangeType(rangeType), m_modelManager(modelManager) + QmlDebug::RangeType rangeType, + QmlDebug::ProfileFeature mainFeature, + QObject *parent) : + TimelineModel(modelManager->registerModelProxy(), + tr(QmlProfilerModelManager::featureName(mainFeature)), parent), + m_message(message), m_rangeType(rangeType), m_mainFeature(mainFeature), + m_modelManager(modelManager) { connect(modelManager, &QmlProfilerModelManager::stateChanged, this, &QmlProfilerTimelineModel::dataChanged); + announceFeatures(1ULL << m_mainFeature); } QmlDebug::RangeType QmlProfilerTimelineModel::rangeType() const @@ -53,6 +57,11 @@ QmlDebug::Message QmlProfilerTimelineModel::message() const return m_message; } +QmlDebug::ProfileFeature QmlProfilerTimelineModel::mainFeature() const +{ + return m_mainFeature; +} + bool QmlProfilerTimelineModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const { return (event.rangeType == m_rangeType && event.message == m_message); @@ -105,6 +114,11 @@ void QmlProfilerTimelineModel::dataChanged() emit labelsChanged(); } +void QmlProfilerTimelineModel::onVisibleFeaturesChanged(quint64 features) +{ + setHidden(!(features & (1ULL << m_mainFeature))); +} + int QmlProfilerTimelineModel::bindingLoopDest(int index) const { Q_UNUSED(index); diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h index 1adf1b7f878..7c85d9878d0 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h @@ -45,14 +45,15 @@ class QMLPROFILER_EXPORT QmlProfilerTimelineModel : public Timeline::TimelineMod Q_PROPERTY(QmlProfilerModelManager *modelManager READ modelManager CONSTANT) public: - QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, const QString &displayName, + QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, QmlDebug::Message message, QmlDebug::RangeType rangeType, - QObject *parent); + QmlDebug::ProfileFeature mainFeature, QObject *parent); QmlProfilerModelManager *modelManager() const; QmlDebug::RangeType rangeType() const; QmlDebug::Message message() const; + QmlDebug::ProfileFeature mainFeature() const; virtual bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const; bool handlesTypeId(int typeId) const; @@ -63,6 +64,7 @@ public: private slots: void dataChanged(); + void onVisibleFeaturesChanged(quint64 features); protected: void updateProgress(qint64 count, qint64 max) const; @@ -71,6 +73,7 @@ protected: private: const QmlDebug::Message m_message; const QmlDebug::RangeType m_rangeType; + const QmlDebug::ProfileFeature m_mainFeature; QmlProfilerModelManager *const m_modelManager; };