forked from qt-creator/qt-creator
Reduce code duplication
Change-Id: Icc072982427dc3874262fcaaf9885931e1588e80 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "qmldebug/qmlprofilereventtypes.h"
|
||||
#include "qmlprofiler/qmlprofilermodelmanager.h"
|
||||
#include "qmlprofiler/sortedtimelinemodel.h"
|
||||
#include "qmlprofiler/singlecategorytimelinemodel_p.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@@ -28,14 +29,11 @@ namespace Internal {
|
||||
|
||||
using namespace QmlProfiler;
|
||||
|
||||
class PixmapCacheModel::PixmapCacheModelPrivate : public SortedTimelineModel<PixmapCacheEvent> {
|
||||
class PixmapCacheModel::PixmapCacheModelPrivate :
|
||||
public SortedTimelineModel<PixmapCacheEvent,
|
||||
SingleCategoryTimelineModel::SingleCategoryTimelineModelPrivate>
|
||||
{
|
||||
public:
|
||||
PixmapCacheModelPrivate(PixmapCacheModel *qq):q(qq) {}
|
||||
|
||||
~PixmapCacheModelPrivate();
|
||||
|
||||
PixmapCacheModel *q;
|
||||
|
||||
void computeCacheSizes();
|
||||
void resizeUnfinishedLoads();
|
||||
void flattenLoads();
|
||||
@@ -43,133 +41,54 @@ public:
|
||||
|
||||
QVector < QString > pixmapUrls;
|
||||
QVector < QPair<int, int> > pixmapSizes;
|
||||
bool isExpanded;
|
||||
int expandedRowCount;
|
||||
int collapsedRowCount;
|
||||
void addVP(QVariantList &l, QString label, qint64 time);
|
||||
void addVP(QVariantList &l, QString label, qint64 time) const;
|
||||
|
||||
qint64 minCacheSize;
|
||||
qint64 maxCacheSize;
|
||||
private:
|
||||
Q_DECLARE_PUBLIC(PixmapCacheModel)
|
||||
};
|
||||
|
||||
PixmapCacheModel::PixmapCacheModel(QObject *parent)
|
||||
: AbstractTimelineModel(QLatin1String("PixmapCacheTimeLineModel"), parent),
|
||||
d(new PixmapCacheModelPrivate(this))
|
||||
: SingleCategoryTimelineModel(new PixmapCacheModelPrivate(),
|
||||
QLatin1String("PixmapCacheTimeLineModel"),
|
||||
QLatin1String("Pixmap Cache"), QmlDebug::PixmapCacheEvent, parent)
|
||||
{
|
||||
Q_D(PixmapCacheModel);
|
||||
d->collapsedRowCount = 1;
|
||||
d->expandedRowCount = 1;
|
||||
}
|
||||
|
||||
PixmapCacheModel::~PixmapCacheModel()
|
||||
{
|
||||
}
|
||||
|
||||
int PixmapCacheModel::count() const
|
||||
{
|
||||
return d->count();
|
||||
}
|
||||
|
||||
bool PixmapCacheModel::eventAccepted(const QmlProfilerSimpleModel::QmlEventData &event) const
|
||||
{
|
||||
return (event.eventType == QmlDebug::PixmapCacheEvent);
|
||||
}
|
||||
|
||||
qint64 PixmapCacheModel::lastTimeMark() const
|
||||
{
|
||||
return d->lastEndTime();
|
||||
}
|
||||
|
||||
bool PixmapCacheModel::expanded(int ) const
|
||||
{
|
||||
return d->isExpanded;
|
||||
}
|
||||
|
||||
void PixmapCacheModel::setExpanded(int category, bool expanded)
|
||||
{
|
||||
Q_UNUSED(category);
|
||||
bool prev_expanded = d->isExpanded;
|
||||
d->isExpanded = expanded;
|
||||
if (prev_expanded != expanded)
|
||||
emit expandedChanged();
|
||||
}
|
||||
|
||||
int PixmapCacheModel::categoryDepth(int categoryIndex) const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
Q_UNUSED(categoryIndex);
|
||||
if (isEmpty())
|
||||
return 1;
|
||||
if (d->isExpanded)
|
||||
if (d->expanded)
|
||||
return d->expandedRowCount;
|
||||
return d->collapsedRowCount;
|
||||
}
|
||||
|
||||
int PixmapCacheModel::categoryCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
const QString PixmapCacheModel::categoryLabel(int categoryIndex) const
|
||||
{
|
||||
Q_UNUSED(categoryIndex);
|
||||
return QLatin1String("Pixmap Cache");
|
||||
}
|
||||
|
||||
int PixmapCacheModel::findFirstIndex(qint64 startTime) const
|
||||
{
|
||||
return d->findFirstIndex(startTime);
|
||||
}
|
||||
|
||||
int PixmapCacheModel::findFirstIndexNoParents(qint64 startTime) const
|
||||
{
|
||||
return d->findFirstIndexNoParents(startTime);
|
||||
}
|
||||
|
||||
int PixmapCacheModel::findLastIndex(qint64 endTime) const
|
||||
{
|
||||
return d->findLastIndex(endTime);
|
||||
}
|
||||
|
||||
int PixmapCacheModel::getEventType(int index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
return QmlDebug::PixmapCacheEvent;
|
||||
}
|
||||
|
||||
int PixmapCacheModel::getEventCategory(int index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PixmapCacheModel::getEventRow(int index) const
|
||||
{
|
||||
if (d->isExpanded)
|
||||
Q_D(const PixmapCacheModel);
|
||||
if (d->expanded)
|
||||
return d->range(index).rowNumberExpanded;
|
||||
return d->range(index).rowNumberCollapsed;
|
||||
}
|
||||
|
||||
qint64 PixmapCacheModel::getDuration(int index) const
|
||||
{
|
||||
return d->range(index).duration;
|
||||
}
|
||||
|
||||
qint64 PixmapCacheModel::getStartTime(int index) const
|
||||
{
|
||||
return d->range(index).start;
|
||||
}
|
||||
|
||||
qint64 PixmapCacheModel::getEndTime(int index) const
|
||||
{
|
||||
return getStartTime(index)+getDuration(index);
|
||||
}
|
||||
|
||||
int PixmapCacheModel::getEventId(int index) const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
return d->range(index).eventId;
|
||||
}
|
||||
|
||||
QColor PixmapCacheModel::getColor(int index) const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
if (d->range(index).pixmapEventType == PixmapCacheCountChanged)
|
||||
return QColor::fromHsl(240, 76, 166);
|
||||
|
||||
@@ -179,6 +98,7 @@ QColor PixmapCacheModel::getColor(int index) const
|
||||
|
||||
float PixmapCacheModel::getHeight(int index) const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
if (d->range(index).pixmapEventType == PixmapCacheCountChanged) {
|
||||
float scale = d->maxCacheSize - d->minCacheSize;
|
||||
float fraction = 1.0f;
|
||||
@@ -202,10 +122,11 @@ QString getFilenameOnly(QString absUrl)
|
||||
|
||||
const QVariantList PixmapCacheModel::getLabelsForCategory(int category) const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
Q_UNUSED(category);
|
||||
QVariantList result;
|
||||
|
||||
if (d->isExpanded && !isEmpty()) {
|
||||
if (d->expanded && !isEmpty()) {
|
||||
{
|
||||
// Cache Size
|
||||
QVariantMap element;
|
||||
@@ -230,7 +151,7 @@ const QVariantList PixmapCacheModel::getLabelsForCategory(int category) const
|
||||
return result;
|
||||
}
|
||||
|
||||
void PixmapCacheModel::PixmapCacheModelPrivate::addVP(QVariantList &l, QString label, qint64 time)
|
||||
void PixmapCacheModel::PixmapCacheModelPrivate::addVP(QVariantList &l, QString label, qint64 time) const
|
||||
{
|
||||
if (time > 0) {
|
||||
QVariantMap res;
|
||||
@@ -241,6 +162,7 @@ void PixmapCacheModel::PixmapCacheModelPrivate::addVP(QVariantList &l, QString l
|
||||
|
||||
const QVariantList PixmapCacheModel::getEventDetails(int index) const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
QVariantList result;
|
||||
const PixmapCacheModelPrivate::Range *ev = &d->range(index);
|
||||
|
||||
@@ -281,26 +203,11 @@ const QVariantList PixmapCacheModel::getEventDetails(int index) const
|
||||
return result;
|
||||
}
|
||||
|
||||
const QVariantMap PixmapCacheModel::getEventLocation(int /*index*/) const
|
||||
{
|
||||
QVariantMap map;
|
||||
return map;
|
||||
}
|
||||
|
||||
int PixmapCacheModel::getEventIdForHash(const QString &/*eventHash*/) const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int PixmapCacheModel::getEventIdForLocation(const QString &/*filename*/, int /*line*/, int /*column*/) const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void PixmapCacheModel::loadData()
|
||||
{
|
||||
Q_D(PixmapCacheModel);
|
||||
clear();
|
||||
QmlProfilerSimpleModel *simpleModel = m_modelManager->simpleModel();
|
||||
QmlProfilerSimpleModel *simpleModel = d->modelManager->simpleModel();
|
||||
if (simpleModel->isEmpty())
|
||||
return;
|
||||
|
||||
@@ -386,7 +293,7 @@ void PixmapCacheModel::loadData()
|
||||
break;
|
||||
}
|
||||
|
||||
m_modelManager->modelProxyCountUpdated(m_modelId, d->count(), 2*simpleModel->getEvents().count());
|
||||
d->modelManager->modelProxyCountUpdated(d->modelId, d->count(), 2*simpleModel->getEvents().count());
|
||||
}
|
||||
|
||||
if (lastCacheSizeEvent != -1) {
|
||||
@@ -400,19 +307,20 @@ void PixmapCacheModel::loadData()
|
||||
d->computeRowCounts();
|
||||
d->computeNesting();
|
||||
|
||||
m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
|
||||
d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1);
|
||||
}
|
||||
|
||||
void PixmapCacheModel::clear()
|
||||
{
|
||||
Q_D(PixmapCacheModel);
|
||||
d->SortedTimelineModel::clear();
|
||||
d->pixmapUrls.clear();
|
||||
d->pixmapSizes.clear();
|
||||
d->collapsedRowCount = 1;
|
||||
d->expandedRowCount = 1;
|
||||
d->isExpanded = false;
|
||||
d->expanded = false;
|
||||
|
||||
m_modelManager->modelProxyCountUpdated(m_modelId, 0, 1);
|
||||
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
||||
}
|
||||
|
||||
void PixmapCacheModel::PixmapCacheModelPrivate::computeCacheSizes()
|
||||
@@ -431,6 +339,7 @@ void PixmapCacheModel::PixmapCacheModelPrivate::computeCacheSizes()
|
||||
|
||||
void PixmapCacheModel::PixmapCacheModelPrivate::resizeUnfinishedLoads()
|
||||
{
|
||||
Q_Q(PixmapCacheModel);
|
||||
// all the "load start" events with duration 0 continue till the end of the trace
|
||||
for (int i = 0; i < count(); i++) {
|
||||
if (range(i).pixmapEventType == PixmapCacheModel::PixmapLoadingStarted &&
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#define PIXMAPCACHEMODEL_H
|
||||
|
||||
#include "qmlprofiler/qmlprofilertimelinemodelproxy.h"
|
||||
#include "qmlprofiler/qmlprofilermodelmanager.h"
|
||||
#include "qmlprofiler/singlecategorytimelinemodel.h"
|
||||
#include "qmlprofiler/qmlprofilersimplemodel.h"
|
||||
|
||||
#include <QStringList>
|
||||
@@ -29,7 +29,7 @@
|
||||
namespace QmlProfilerExtension {
|
||||
namespace Internal {
|
||||
|
||||
class PixmapCacheModel : public QmlProfiler::AbstractTimelineModel
|
||||
class PixmapCacheModel : public QmlProfiler::SingleCategoryTimelineModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -55,33 +55,10 @@ public:
|
||||
};
|
||||
|
||||
PixmapCacheModel(QObject *parent = 0);
|
||||
~PixmapCacheModel();
|
||||
|
||||
|
||||
// void setModelManager(QmlProfiler::Internal::QmlProfilerModelManager *modelManager);
|
||||
|
||||
int count() const;
|
||||
|
||||
bool eventAccepted(const QmlProfiler::QmlProfilerSimpleModel::QmlEventData &event) const;
|
||||
|
||||
Q_INVOKABLE qint64 lastTimeMark() const;
|
||||
|
||||
Q_INVOKABLE bool expanded(int category) const;
|
||||
Q_INVOKABLE void setExpanded(int category, bool expanded);
|
||||
Q_INVOKABLE int categoryDepth(int categoryIndex) const;
|
||||
Q_INVOKABLE int categoryCount() const;
|
||||
Q_INVOKABLE const QString categoryLabel(int categoryIndex) const;
|
||||
|
||||
int findFirstIndex(qint64 startTime) const;
|
||||
int findFirstIndexNoParents(qint64 startTime) const;
|
||||
int findLastIndex(qint64 endTime) const;
|
||||
|
||||
int getEventType(int index) const;
|
||||
int getEventCategory(int index) const;
|
||||
int getEventRow(int index) const;
|
||||
Q_INVOKABLE qint64 getDuration(int index) const;
|
||||
Q_INVOKABLE qint64 getStartTime(int index) const;
|
||||
Q_INVOKABLE qint64 getEndTime(int index) const;
|
||||
Q_INVOKABLE int getEventId(int index) const;
|
||||
Q_INVOKABLE QColor getColor(int index) const;
|
||||
Q_INVOKABLE float getHeight(int index) const;
|
||||
@@ -89,18 +66,13 @@ public:
|
||||
Q_INVOKABLE const QVariantList getLabelsForCategory(int category) const;
|
||||
|
||||
Q_INVOKABLE const QVariantList getEventDetails(int index) const;
|
||||
Q_INVOKABLE const QVariantMap getEventLocation(int index) const;
|
||||
|
||||
Q_INVOKABLE int getEventIdForHash(const QString &eventHash) const;
|
||||
Q_INVOKABLE int getEventIdForLocation(const QString &filename, int line, int column) const;
|
||||
|
||||
void loadData();
|
||||
void clear();
|
||||
|
||||
private:
|
||||
class PixmapCacheModelPrivate;
|
||||
PixmapCacheModelPrivate *d;
|
||||
|
||||
Q_DECLARE_PRIVATE(PixmapCacheModel)
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "qmldebug/qmlprofilereventtypes.h"
|
||||
#include "qmlprofiler/qmlprofilermodelmanager.h"
|
||||
#include "qmlprofiler/sortedtimelinemodel.h"
|
||||
#include "qmlprofiler/singlecategorytimelinemodel_p.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
@@ -51,53 +52,23 @@ enum SceneGraphCategoryType {
|
||||
MaximumSceneGraphCategoryType
|
||||
};
|
||||
|
||||
class SceneGraphTimelineModel::SceneGraphTimelineModelPrivate : public SortedTimelineModel<SceneGraphTimelineModel::SceneGraphEvent> {
|
||||
class SceneGraphTimelineModel::SceneGraphTimelineModelPrivate :
|
||||
public SortedTimelineModel<SceneGraphTimelineModel::SceneGraphEvent,
|
||||
SingleCategoryTimelineModel::SingleCategoryTimelineModelPrivate>
|
||||
{
|
||||
public:
|
||||
SceneGraphTimelineModelPrivate(SceneGraphTimelineModel *qq):q(qq) {}
|
||||
~SceneGraphTimelineModelPrivate();
|
||||
|
||||
SceneGraphTimelineModel *q;
|
||||
|
||||
bool isExpanded;
|
||||
void addVP(QVariantList &l, QString label, qint64 time);
|
||||
void addVP(QVariantList &l, QString label, qint64 time) const;
|
||||
private:
|
||||
Q_DECLARE_PUBLIC(SceneGraphTimelineModel)
|
||||
};
|
||||
|
||||
SceneGraphTimelineModel::SceneGraphTimelineModel(QObject *parent)
|
||||
: AbstractTimelineModel(QLatin1String("SceneGraphTimeLineModel"), parent),
|
||||
d(new SceneGraphTimelineModelPrivate(this))
|
||||
: SingleCategoryTimelineModel(new SceneGraphTimelineModelPrivate,
|
||||
QLatin1String("SceneGraphTimeLineModel"), tr("Scene Graph"),
|
||||
QmlDebug::SceneGraphFrameEvent, parent)
|
||||
{
|
||||
}
|
||||
|
||||
SceneGraphTimelineModel::~SceneGraphTimelineModel()
|
||||
{
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::count() const
|
||||
{
|
||||
return d->count();
|
||||
}
|
||||
|
||||
bool SceneGraphTimelineModel::eventAccepted(const QmlProfiler::QmlProfilerSimpleModel::QmlEventData &event) const
|
||||
{
|
||||
return (event.eventType == QmlDebug::SceneGraphFrameEvent);
|
||||
}
|
||||
|
||||
qint64 SceneGraphTimelineModel::lastTimeMark() const
|
||||
{
|
||||
return d->lastEndTime();
|
||||
}
|
||||
|
||||
bool SceneGraphTimelineModel::expanded(int ) const
|
||||
{
|
||||
return d->isExpanded;
|
||||
}
|
||||
|
||||
void SceneGraphTimelineModel::setExpanded(int category, bool expanded)
|
||||
{
|
||||
Q_UNUSED(category);
|
||||
d->isExpanded = expanded;
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::categoryDepth(int categoryIndex) const
|
||||
{
|
||||
Q_UNUSED(categoryIndex);
|
||||
@@ -106,66 +77,15 @@ int SceneGraphTimelineModel::categoryDepth(int categoryIndex) const
|
||||
return 3;
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::categoryCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
const QString SceneGraphTimelineModel::categoryLabel(int categoryIndex) const
|
||||
{
|
||||
Q_UNUSED(categoryIndex);
|
||||
return tr("Scene Graph");
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::findFirstIndex(qint64 startTime) const
|
||||
{
|
||||
return d->findFirstIndex(startTime);
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::findFirstIndexNoParents(qint64 startTime) const
|
||||
{
|
||||
return d->findFirstIndexNoParents(startTime);
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::findLastIndex(qint64 endTime) const
|
||||
{
|
||||
return d->findLastIndex(endTime);
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::getEventType(int index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
return QmlDebug::SceneGraphFrameEvent;
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::getEventCategory(int index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::getEventRow(int index) const
|
||||
{
|
||||
Q_D(const SceneGraphTimelineModel);
|
||||
return d->range(index).sgEventType + 1;
|
||||
}
|
||||
|
||||
qint64 SceneGraphTimelineModel::getDuration(int index) const
|
||||
{
|
||||
return d->range(index).duration;
|
||||
}
|
||||
|
||||
qint64 SceneGraphTimelineModel::getStartTime(int index) const
|
||||
{
|
||||
return d->range(index).start;
|
||||
}
|
||||
|
||||
qint64 SceneGraphTimelineModel::getEndTime(int index) const
|
||||
{
|
||||
return getStartTime(index)+getDuration(index);
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::getEventId(int index) const
|
||||
{
|
||||
Q_D(const SceneGraphTimelineModel);
|
||||
return d->range(index).sgEventType;
|
||||
}
|
||||
|
||||
@@ -186,12 +106,6 @@ QColor SceneGraphTimelineModel::getColor(int index) const
|
||||
return QColor::fromHsl((fpsFraction*96)+10, 76, 166);
|
||||
}
|
||||
|
||||
float SceneGraphTimelineModel::getHeight(int index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
QString labelForSGType(int t)
|
||||
{
|
||||
switch ((SceneGraphCategoryType)t) {
|
||||
@@ -205,10 +119,11 @@ QString labelForSGType(int t)
|
||||
|
||||
const QVariantList SceneGraphTimelineModel::getLabelsForCategory(int category) const
|
||||
{
|
||||
Q_D(const SceneGraphTimelineModel);
|
||||
Q_UNUSED(category);
|
||||
QVariantList result;
|
||||
|
||||
if (d->isExpanded && !isEmpty()) {
|
||||
if (d->expanded && !isEmpty()) {
|
||||
for (int i = 0; i < MaximumSceneGraphCategoryType; i++) {
|
||||
QVariantMap element;
|
||||
|
||||
@@ -222,7 +137,7 @@ const QVariantList SceneGraphTimelineModel::getLabelsForCategory(int category) c
|
||||
return result;
|
||||
}
|
||||
|
||||
void SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::addVP(QVariantList &l, QString label, qint64 time)
|
||||
void SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::addVP(QVariantList &l, QString label, qint64 time) const
|
||||
{
|
||||
if (time > 0) {
|
||||
QVariantMap res;
|
||||
@@ -234,8 +149,11 @@ void SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::addVP(QVariantList
|
||||
|
||||
const QVariantList SceneGraphTimelineModel::getEventDetails(int index) const
|
||||
{
|
||||
Q_D(const SceneGraphTimelineModel);
|
||||
QVariantList result;
|
||||
const SortedTimelineModel<SceneGraphEvent>::Range *ev = &d->range(index);
|
||||
const SortedTimelineModel<SceneGraphEvent,
|
||||
SingleCategoryTimelineModel::SingleCategoryTimelineModelPrivate>::Range *ev =
|
||||
&d->range(index);
|
||||
|
||||
{
|
||||
QVariantMap res;
|
||||
@@ -273,26 +191,11 @@ const QVariantList SceneGraphTimelineModel::getEventDetails(int index) const
|
||||
return result;
|
||||
}
|
||||
|
||||
const QVariantMap SceneGraphTimelineModel::getEventLocation(int /*index*/) const
|
||||
{
|
||||
QVariantMap map;
|
||||
return map;
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::getEventIdForHash(const QString &) const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::getEventIdForLocation(const QString &/*filename*/, int /*line*/, int /*column*/) const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void SceneGraphTimelineModel::loadData()
|
||||
{
|
||||
Q_D(SceneGraphTimelineModel);
|
||||
clear();
|
||||
QmlProfilerSimpleModel *simpleModel = m_modelManager->simpleModel();
|
||||
QmlProfilerSimpleModel *simpleModel = d->modelManager->simpleModel();
|
||||
if (simpleModel->isEmpty())
|
||||
return;
|
||||
|
||||
@@ -380,18 +283,19 @@ void SceneGraphTimelineModel::loadData()
|
||||
}
|
||||
}
|
||||
|
||||
m_modelManager->modelProxyCountUpdated(m_modelId, d->count(), simpleModel->getEvents().count());
|
||||
d->modelManager->modelProxyCountUpdated(d->modelId, d->count(), simpleModel->getEvents().count());
|
||||
}
|
||||
|
||||
d->computeNesting();
|
||||
m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
|
||||
d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1);
|
||||
}
|
||||
|
||||
void SceneGraphTimelineModel::clear()
|
||||
{
|
||||
Q_D(SceneGraphTimelineModel);
|
||||
d->clear();
|
||||
d->isExpanded = false;
|
||||
m_modelManager->modelProxyCountUpdated(m_modelId, 0, 1);
|
||||
d->expanded = false;
|
||||
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#ifndef SCENEGRAPHTIMELINEMODEL_H
|
||||
#define SCENEGRAPHTIMELINEMODEL_H
|
||||
|
||||
#include "qmlprofiler/abstracttimelinemodel.h"
|
||||
#include "qmlprofiler/singlecategorytimelinemodel.h"
|
||||
#include "qmlprofiler/qmlprofilermodelmanager.h"
|
||||
#include "qmlprofiler/qmlprofilersimplemodel.h"
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Internal {
|
||||
|
||||
#define timingFieldCount 16
|
||||
|
||||
class SceneGraphTimelineModel : public QmlProfiler::AbstractTimelineModel
|
||||
class SceneGraphTimelineModel : public QmlProfiler::SingleCategoryTimelineModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -41,54 +41,24 @@ public:
|
||||
qint64 timing[timingFieldCount];
|
||||
};
|
||||
|
||||
|
||||
SceneGraphTimelineModel(QObject *parent = 0);
|
||||
~SceneGraphTimelineModel();
|
||||
|
||||
|
||||
// void setModelManager(QmlProfiler::Internal::QmlProfilerModelManager *modelManager);
|
||||
|
||||
int count() const;
|
||||
|
||||
bool eventAccepted(const QmlProfiler::QmlProfilerSimpleModel::QmlEventData &event) const;
|
||||
|
||||
Q_INVOKABLE qint64 lastTimeMark() const;
|
||||
|
||||
Q_INVOKABLE bool expanded(int category) const;
|
||||
Q_INVOKABLE void setExpanded(int category, bool expanded);
|
||||
Q_INVOKABLE int categoryDepth(int categoryIndex) const;
|
||||
Q_INVOKABLE int categoryCount() const;
|
||||
Q_INVOKABLE const QString categoryLabel(int categoryIndex) const;
|
||||
|
||||
int findFirstIndex(qint64 startTime) const;
|
||||
int findFirstIndexNoParents(qint64 startTime) const;
|
||||
int findLastIndex(qint64 endTime) const;
|
||||
|
||||
int getEventType(int index) const;
|
||||
int getEventCategory(int index) const;
|
||||
int getEventRow(int index) const;
|
||||
Q_INVOKABLE qint64 getDuration(int index) const;
|
||||
Q_INVOKABLE qint64 getStartTime(int index) const;
|
||||
Q_INVOKABLE qint64 getEndTime(int index) const;
|
||||
Q_INVOKABLE int getEventId(int index) const;
|
||||
Q_INVOKABLE QColor getColor(int index) const;
|
||||
Q_INVOKABLE float getHeight(int index) const;
|
||||
|
||||
Q_INVOKABLE const QVariantList getLabelsForCategory(int category) const;
|
||||
|
||||
Q_INVOKABLE const QVariantList getEventDetails(int index) const;
|
||||
Q_INVOKABLE const QVariantMap getEventLocation(int index) const;
|
||||
|
||||
Q_INVOKABLE int getEventIdForHash(const QString &eventHash) const;
|
||||
Q_INVOKABLE int getEventIdForLocation(const QString &filename, int line, int column) const;
|
||||
|
||||
void loadData();
|
||||
void clear();
|
||||
|
||||
private:
|
||||
class SceneGraphTimelineModelPrivate;
|
||||
SceneGraphTimelineModelPrivate *d;
|
||||
|
||||
Q_DECLARE_PRIVATE(SceneGraphTimelineModel)
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user