Commit 3c094eee authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: Make most of SortedTimelineModel protected



We don't want anyone to insert stuff into the ranges without reflecting
it in the actual data.

Change-Id: Iaa8cc9a962216ba466da2c468826f6fbf6bef11c
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent f6d8d484
......@@ -61,10 +61,6 @@ public:
inline qint64 timestamp() const {return end;}
};
SortedTimelineModel(QObject *parent = 0) : QObject(parent) {}
void clear();
inline int count() const { return ranges.count(); }
qint64 duration(int index) const { return ranges[index].duration; }
......@@ -76,31 +72,6 @@ public:
inline const Range &range(int index) const { return ranges[index]; }
inline int insert(qint64 startTime, qint64 duration, int typeId)
{
/* Doing insert-sort here is preferable as most of the time the times will actually be
* presorted in the right way. So usually this will just result in appending. */
int index = insertSorted(ranges, Range(startTime, duration, typeId));
if (index < ranges.size() - 1)
incrementStartIndices(index);
insertSorted(endTimes, RangeEnd(index, startTime + duration));
return index;
}
inline int insertStart(qint64 startTime, int typeId)
{
int index = insertSorted(ranges, Range(startTime, 0, typeId));
if (index < ranges.size() - 1)
incrementStartIndices(index);
return index;
}
inline void insertEnd(int index, qint64 duration)
{
ranges[index].duration = duration;
insertSorted(endTimes, RangeEnd(index, ranges[index].start + duration));
}
inline int firstIndex(qint64 startTime) const
{
int index = firstIndexNoParents(startTime);
......@@ -137,6 +108,36 @@ public:
}
protected:
SortedTimelineModel(QObject *parent = 0) : QObject(parent) {}
void clear();
inline int insert(qint64 startTime, qint64 duration, int typeId)
{
/* Doing insert-sort here is preferable as most of the time the times will actually be
* presorted in the right way. So usually this will just result in appending. */
int index = insertSorted(ranges, Range(startTime, duration, typeId));
if (index < ranges.size() - 1)
incrementStartIndices(index);
insertSorted(endTimes, RangeEnd(index, startTime + duration));
return index;
}
inline int insertStart(qint64 startTime, int typeId)
{
int index = insertSorted(ranges, Range(startTime, 0, typeId));
if (index < ranges.size() - 1)
incrementStartIndices(index);
return index;
}
inline void insertEnd(int index, qint64 duration)
{
ranges[index].duration = duration;
insertSorted(endTimes, RangeEnd(index, ranges[index].start + duration));
}
void computeNesting();
void incrementStartIndices(int index)
......
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