forked from qt-creator/qt-creator
QmlProfiler: eliminate redundant categories() methods
Change-Id: I3a85322cc583de37f1cc4eb256e3382a92c5c179 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -47,7 +47,7 @@ void AbstractTimelineModel::setModelManager(QmlProfilerModelManager *modelManage
|
|||||||
QStringList AbstractTimelineModel::categoryTitles() const
|
QStringList AbstractTimelineModel::categoryTitles() const
|
||||||
{
|
{
|
||||||
QStringList retString;
|
QStringList retString;
|
||||||
for (int i = 0; i < categories(); i++)
|
for (int i = 0; i < categoryCount(); i++)
|
||||||
retString << categoryLabel(i);
|
retString << categoryLabel(i);
|
||||||
return retString;
|
return retString;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ public:
|
|||||||
|
|
||||||
void setModelManager(QmlProfilerModelManager *modelManager);
|
void setModelManager(QmlProfilerModelManager *modelManager);
|
||||||
|
|
||||||
virtual int categories() const = 0;
|
|
||||||
QStringList categoryTitles() const;
|
QStringList categoryTitles() const;
|
||||||
virtual QString name() const = 0;
|
virtual QString name() const = 0;
|
||||||
virtual int count() const = 0;
|
virtual int count() const = 0;
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ Rectangle {
|
|||||||
color: "#dcdcdc"
|
color: "#dcdcdc"
|
||||||
height: col.height
|
height: col.height
|
||||||
|
|
||||||
property int rowCount: qmlProfilerModelProxy.categories();
|
property int rowCount: qmlProfilerModelProxy.categoryCount();
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: col
|
id: col
|
||||||
|
|||||||
@@ -77,11 +77,6 @@ PaintEventsModelProxy::~PaintEventsModelProxy()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PaintEventsModelProxy::categories() const
|
|
||||||
{
|
|
||||||
return categoryCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PaintEventsModelProxy::name() const
|
QString PaintEventsModelProxy::name() const
|
||||||
{
|
{
|
||||||
return QLatin1String("PaintEventsModelProxy");
|
return QLatin1String("PaintEventsModelProxy");
|
||||||
|
|||||||
@@ -63,8 +63,6 @@ public:
|
|||||||
PaintEventsModelProxy(QObject *parent = 0);
|
PaintEventsModelProxy(QObject *parent = 0);
|
||||||
~PaintEventsModelProxy();
|
~PaintEventsModelProxy();
|
||||||
|
|
||||||
|
|
||||||
int categories() const;
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
|
|
||||||
void loadData();
|
void loadData();
|
||||||
|
|||||||
@@ -84,11 +84,6 @@ BasicTimelineModel::~BasicTimelineModel()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BasicTimelineModel::categories() const
|
|
||||||
{
|
|
||||||
return categoryCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BasicTimelineModel::name() const
|
QString BasicTimelineModel::name() const
|
||||||
{
|
{
|
||||||
return QLatin1String("BasicTimelineModel");
|
return QLatin1String("BasicTimelineModel");
|
||||||
|
|||||||
@@ -82,8 +82,6 @@ public:
|
|||||||
BasicTimelineModel(QObject *parent = 0);
|
BasicTimelineModel(QObject *parent = 0);
|
||||||
~BasicTimelineModel();
|
~BasicTimelineModel();
|
||||||
|
|
||||||
|
|
||||||
int categories() const;
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
|
|
||||||
void loadData();
|
void loadData();
|
||||||
|
|||||||
@@ -95,11 +95,11 @@ void TimelineModelAggregator::addModel(AbstractTimelineModel *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// order?
|
// order?
|
||||||
int TimelineModelAggregator::categories() const
|
int TimelineModelAggregator::categoryCount() const
|
||||||
{
|
{
|
||||||
int categoryCount = 0;
|
int categoryCount = 0;
|
||||||
foreach (const AbstractTimelineModel *modelProxy, d->modelList)
|
foreach (const AbstractTimelineModel *modelProxy, d->modelList)
|
||||||
categoryCount += modelProxy->categories();
|
categoryCount += modelProxy->categoryCount();
|
||||||
return categoryCount;
|
return categoryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ int TimelineModelAggregator::visibleCategories() const
|
|||||||
{
|
{
|
||||||
int categoryCount = 0;
|
int categoryCount = 0;
|
||||||
foreach (const AbstractTimelineModel *modelProxy, d->modelList) {
|
foreach (const AbstractTimelineModel *modelProxy, d->modelList) {
|
||||||
for (int i = 0; i < modelProxy->categories(); i++)
|
for (int i = 0; i < modelProxy->categoryCount(); i++)
|
||||||
if (modelProxy->categoryDepth(i) > 0)
|
if (modelProxy->categoryDepth(i) > 0)
|
||||||
categoryCount ++;
|
categoryCount ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
void addModel(AbstractTimelineModel *m);
|
void addModel(AbstractTimelineModel *m);
|
||||||
|
|
||||||
|
|
||||||
Q_INVOKABLE int categories() const;
|
Q_INVOKABLE int categoryCount() const;
|
||||||
Q_INVOKABLE int visibleCategories() const;
|
Q_INVOKABLE int visibleCategories() const;
|
||||||
Q_INVOKABLE QStringList categoryTitles() const;
|
Q_INVOKABLE QStringList categoryTitles() const;
|
||||||
Q_INVOKABLE int count(int modelIndex = -1) const;
|
Q_INVOKABLE int count(int modelIndex = -1) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user