Commit cfaa30d0 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Eliminate ambiguity from TimelineModelAggregator::count()

It wasn't helpful that this method could either count all events or
only the events from a specific model.

Change-Id: I09dcb37edd3403a23f6ee9008fc71b6761aa9e26
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent dbb4e761
......@@ -41,7 +41,7 @@ function drawGraph(canvas, ctxt)
//draw the actual data to be graphed
function drawData(canvas, ctxt)
{
if ((!qmlProfilerModelProxy) || qmlProfilerModelProxy.count() === 0)
if ((!qmlProfilerModelProxy) || qmlProfilerModelProxy.isEmpty())
return;
var spacing = canvas.width / qmlProfilerModelProxy.traceDuration();
......
......@@ -99,7 +99,10 @@ Canvas {
target: qmlProfilerModelProxy
onDataAvailable: {
dataReady = true;
increment = Math.ceil(qmlProfilerModelProxy.count() / eventsPerPass);
increment = 0;
for (var i = 0; i < qmlProfilerModelProxy.modelCount(); ++i)
increment += qmlProfilerModelProxy.count(i);
increment = Math.ceil(increment / eventsPerPass);
offset = -1;
requestPaint();
}
......
......@@ -122,15 +122,7 @@ QVariantList TimelineModelAggregator::models() const
int TimelineModelAggregator::count(int modelIndex) const
{
if (modelIndex == -1) {
int totalCount = 0;
foreach (const AbstractTimelineModel *modelProxy, d->modelList)
totalCount += modelProxy->count();
return totalCount;
} else {
return d->modelList[modelIndex]->count();
}
return d->modelList[modelIndex]->count();
}
bool TimelineModelAggregator::isEmpty() const
......
......@@ -51,7 +51,7 @@ public:
const AbstractTimelineModel *model(int modelIndex) const;
QVariantList models() const;
Q_INVOKABLE int count(int modelIndex = -1) const;
Q_INVOKABLE int count(int modelIndex) const;
void clear();
Q_INVOKABLE int modelCount() const;
......@@ -59,7 +59,7 @@ public:
Q_INVOKABLE qint64 traceEndTime() const;
Q_INVOKABLE qint64 traceDuration() const;
bool isEmpty() const;
Q_INVOKABLE bool isEmpty() const;
Q_INVOKABLE int rowHeight(int modelIndex, int row) const;
Q_INVOKABLE void setRowHeight(int modelIndex, int row, int height);
......
......@@ -408,7 +408,7 @@ void TimelineRenderer::manageHovered(int mouseX, int mouseY)
int eventFrom = m_profilerModelProxy->firstIndex(modelIndex, startTime);
int eventTo = m_profilerModelProxy->lastIndex(modelIndex, endTime);
if (eventFrom == -1 ||
eventTo < eventFrom || eventTo >= m_profilerModelProxy->count()) {
eventTo < eventFrom || eventTo >= m_profilerModelProxy->count(modelIndex)) {
m_currentSelection.eventIndex = -1;
return;
}
......@@ -464,7 +464,7 @@ void TimelineRenderer::clearData()
int TimelineRenderer::getYPosition(int modelIndex, int index) const
{
Q_ASSERT(m_profilerModelProxy);
if (index >= m_profilerModelProxy->count())
if (index >= m_profilerModelProxy->count(modelIndex))
return 0;
int modelRowStart = 0;
......@@ -477,7 +477,7 @@ int TimelineRenderer::getYPosition(int modelIndex, int index) const
void TimelineRenderer::selectNext()
{
if (m_profilerModelProxy->count() == 0)
if (m_profilerModelProxy->isEmpty())
return;
qint64 searchTime = m_startTime;
......@@ -533,7 +533,7 @@ void TimelineRenderer::selectNext()
void TimelineRenderer::selectPrev()
{
if (m_profilerModelProxy->count() == 0)
if (m_profilerModelProxy->isEmpty())
return;
qint64 searchTime = m_endTime;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment