forked from qt-creator/qt-creator
QmlProfiler: Define a main feature for timeline models
They will be shown and hidden when that feature is enabled or disabled. Change-Id: I42b67bd25729901262298553b118fe2624941789 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -47,12 +47,10 @@ namespace Internal {
|
|||||||
|
|
||||||
QmlProfilerAnimationsModel::QmlProfilerAnimationsModel(QmlProfilerModelManager *manager,
|
QmlProfilerAnimationsModel::QmlProfilerAnimationsModel(QmlProfilerModelManager *manager,
|
||||||
QObject *parent) :
|
QObject *parent) :
|
||||||
QmlProfilerTimelineModel(manager,
|
QmlProfilerTimelineModel(manager, QmlDebug::Event, QmlDebug::MaximumRangeType,
|
||||||
tr(QmlProfilerModelManager::featureName(QmlDebug::ProfileAnimations)),
|
QmlDebug::ProfileAnimations, parent)
|
||||||
QmlDebug::Event, QmlDebug::MaximumRangeType, parent)
|
|
||||||
{
|
{
|
||||||
m_maxGuiThreadAnimations = m_maxRenderThreadAnimations = 0;
|
m_maxGuiThreadAnimations = m_maxRenderThreadAnimations = 0;
|
||||||
announceFeatures(1 << QmlDebug::ProfileAnimations);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerAnimationsModel::clear()
|
void QmlProfilerAnimationsModel::clear()
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ namespace Internal {
|
|||||||
|
|
||||||
QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager,
|
QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager,
|
||||||
QmlDebug::RangeType range, QObject *parent) :
|
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;
|
m_expandedRowTypes << -1;
|
||||||
announceFeatures(1ULL << QmlDebug::featureFromRangeType(rangeType()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerRangeModel::clear()
|
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
|
int QmlProfilerRangeModel::expandedRow(int index) const
|
||||||
{
|
{
|
||||||
return m_data[index].displayRowExpanded;
|
return m_data[index].displayRowExpanded;
|
||||||
@@ -237,7 +231,8 @@ QVariantMap QmlProfilerRangeModel::details(int index) const
|
|||||||
const QVector<QmlProfilerDataModel::QmlEventTypeData> &types =
|
const QVector<QmlProfilerDataModel::QmlEventTypeData> &types =
|
||||||
modelManager()->qmlModel()->getEventTypes();
|
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("Duration"), QmlProfilerBaseModel::formatTime(duration(index)));
|
||||||
|
|
||||||
result.insert(tr("Details"), types[id].data);
|
result.insert(tr("Details"), types[id].data);
|
||||||
|
|||||||
@@ -64,8 +64,6 @@ public:
|
|||||||
QmlProfilerRangeModel(QmlProfilerModelManager *manager, QmlDebug::RangeType range,
|
QmlProfilerRangeModel(QmlProfilerModelManager *manager, QmlDebug::RangeType range,
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
static QString categoryLabel(QmlDebug::RangeType categoryIndex);
|
|
||||||
|
|
||||||
Q_INVOKABLE int expandedRow(int index) const;
|
Q_INVOKABLE int expandedRow(int index) const;
|
||||||
Q_INVOKABLE int collapsedRow(int index) const;
|
Q_INVOKABLE int collapsedRow(int index) const;
|
||||||
int bindingLoopDest(int index) const;
|
int bindingLoopDest(int index) const;
|
||||||
|
|||||||
@@ -33,14 +33,18 @@
|
|||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
|
|
||||||
QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager,
|
QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager,
|
||||||
const QString &displayName,
|
|
||||||
QmlDebug::Message message,
|
QmlDebug::Message message,
|
||||||
QmlDebug::RangeType rangeType, QObject *parent) :
|
QmlDebug::RangeType rangeType,
|
||||||
TimelineModel(modelManager->registerModelProxy(), displayName, parent), m_message(message),
|
QmlDebug::ProfileFeature mainFeature,
|
||||||
m_rangeType(rangeType), m_modelManager(modelManager)
|
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,
|
connect(modelManager, &QmlProfilerModelManager::stateChanged,
|
||||||
this, &QmlProfilerTimelineModel::dataChanged);
|
this, &QmlProfilerTimelineModel::dataChanged);
|
||||||
|
announceFeatures(1ULL << m_mainFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlDebug::RangeType QmlProfilerTimelineModel::rangeType() const
|
QmlDebug::RangeType QmlProfilerTimelineModel::rangeType() const
|
||||||
@@ -53,6 +57,11 @@ QmlDebug::Message QmlProfilerTimelineModel::message() const
|
|||||||
return m_message;
|
return m_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QmlDebug::ProfileFeature QmlProfilerTimelineModel::mainFeature() const
|
||||||
|
{
|
||||||
|
return m_mainFeature;
|
||||||
|
}
|
||||||
|
|
||||||
bool QmlProfilerTimelineModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
|
bool QmlProfilerTimelineModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
|
||||||
{
|
{
|
||||||
return (event.rangeType == m_rangeType && event.message == m_message);
|
return (event.rangeType == m_rangeType && event.message == m_message);
|
||||||
@@ -105,6 +114,11 @@ void QmlProfilerTimelineModel::dataChanged()
|
|||||||
emit labelsChanged();
|
emit labelsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerTimelineModel::onVisibleFeaturesChanged(quint64 features)
|
||||||
|
{
|
||||||
|
setHidden(!(features & (1ULL << m_mainFeature)));
|
||||||
|
}
|
||||||
|
|
||||||
int QmlProfilerTimelineModel::bindingLoopDest(int index) const
|
int QmlProfilerTimelineModel::bindingLoopDest(int index) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
|
|||||||
@@ -45,14 +45,15 @@ class QMLPROFILER_EXPORT QmlProfilerTimelineModel : public Timeline::TimelineMod
|
|||||||
Q_PROPERTY(QmlProfilerModelManager *modelManager READ modelManager CONSTANT)
|
Q_PROPERTY(QmlProfilerModelManager *modelManager READ modelManager CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, const QString &displayName,
|
QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager,
|
||||||
QmlDebug::Message message, QmlDebug::RangeType rangeType,
|
QmlDebug::Message message, QmlDebug::RangeType rangeType,
|
||||||
QObject *parent);
|
QmlDebug::ProfileFeature mainFeature, QObject *parent);
|
||||||
|
|
||||||
QmlProfilerModelManager *modelManager() const;
|
QmlProfilerModelManager *modelManager() const;
|
||||||
|
|
||||||
QmlDebug::RangeType rangeType() const;
|
QmlDebug::RangeType rangeType() const;
|
||||||
QmlDebug::Message message() const;
|
QmlDebug::Message message() const;
|
||||||
|
QmlDebug::ProfileFeature mainFeature() const;
|
||||||
|
|
||||||
virtual bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const;
|
virtual bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const;
|
||||||
bool handlesTypeId(int typeId) const;
|
bool handlesTypeId(int typeId) const;
|
||||||
@@ -63,6 +64,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void dataChanged();
|
void dataChanged();
|
||||||
|
void onVisibleFeaturesChanged(quint64 features);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateProgress(qint64 count, qint64 max) const;
|
void updateProgress(qint64 count, qint64 max) const;
|
||||||
@@ -71,6 +73,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
const QmlDebug::Message m_message;
|
const QmlDebug::Message m_message;
|
||||||
const QmlDebug::RangeType m_rangeType;
|
const QmlDebug::RangeType m_rangeType;
|
||||||
|
const QmlDebug::ProfileFeature m_mainFeature;
|
||||||
QmlProfilerModelManager *const m_modelManager;
|
QmlProfilerModelManager *const m_modelManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user