forked from qt-creator/qt-creator
QmlProfiler: Rename get* and find* methods to their canonical names
Also, all methods about events in models don't really need the "event" prefix as that is what the models are about. Change-Id: I7b995aa9c9dce7e01d4c862d094b1e73e6b6fb40 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -67,37 +67,37 @@ int AbstractTimelineModel::count() const
|
||||
return d->count();
|
||||
}
|
||||
|
||||
int AbstractTimelineModel::findFirstIndex(qint64 startTime) const
|
||||
int AbstractTimelineModel::firstIndex(qint64 startTime) const
|
||||
{
|
||||
Q_D(const AbstractTimelineModel);
|
||||
return d->findFirstIndex(startTime);
|
||||
return d->firstIndex(startTime);
|
||||
}
|
||||
|
||||
int AbstractTimelineModel::findFirstIndexNoParents(qint64 startTime) const
|
||||
int AbstractTimelineModel::firstIndexNoParents(qint64 startTime) const
|
||||
{
|
||||
Q_D(const AbstractTimelineModel);
|
||||
return d->findFirstIndexNoParents(startTime);
|
||||
return d->firstIndexNoParents(startTime);
|
||||
}
|
||||
|
||||
int AbstractTimelineModel::findLastIndex(qint64 endTime) const
|
||||
int AbstractTimelineModel::lastIndex(qint64 endTime) const
|
||||
{
|
||||
Q_D(const AbstractTimelineModel);
|
||||
return d->findLastIndex(endTime);
|
||||
return d->lastIndex(endTime);
|
||||
}
|
||||
|
||||
qint64 AbstractTimelineModel::getDuration(int index) const
|
||||
qint64 AbstractTimelineModel::duration(int index) const
|
||||
{
|
||||
Q_D(const AbstractTimelineModel);
|
||||
return d->duration(index);
|
||||
}
|
||||
|
||||
qint64 AbstractTimelineModel::getStartTime(int index) const
|
||||
qint64 AbstractTimelineModel::startTime(int index) const
|
||||
{
|
||||
Q_D(const AbstractTimelineModel);
|
||||
return d->startTime(index);
|
||||
}
|
||||
|
||||
qint64 AbstractTimelineModel::getEndTime(int index) const
|
||||
qint64 AbstractTimelineModel::endTime(int index) const
|
||||
{
|
||||
Q_D(const AbstractTimelineModel);
|
||||
return d->startTime(index) + d->duration(index);
|
||||
@@ -183,20 +183,20 @@ qint64 AbstractTimelineModel::traceDuration() const
|
||||
return d->modelManager->traceTime()->duration();
|
||||
}
|
||||
|
||||
const QVariantMap AbstractTimelineModel::getEventLocation(int index) const
|
||||
QVariantMap AbstractTimelineModel::location(int index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
QVariantMap map;
|
||||
return map;
|
||||
}
|
||||
|
||||
int AbstractTimelineModel::getEventIdForTypeIndex(int typeIndex) const
|
||||
int AbstractTimelineModel::eventIdForTypeIndex(int typeIndex) const
|
||||
{
|
||||
Q_UNUSED(typeIndex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AbstractTimelineModel::getEventIdForLocation(const QString &filename, int line, int column) const
|
||||
int AbstractTimelineModel::eventIdForLocation(const QString &filename, int line, int column) const
|
||||
{
|
||||
Q_UNUSED(filename);
|
||||
Q_UNUSED(line);
|
||||
@@ -204,13 +204,13 @@ int AbstractTimelineModel::getEventIdForLocation(const QString &filename, int li
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AbstractTimelineModel::getBindingLoopDest(int index) const
|
||||
int AbstractTimelineModel::bindingLoopDest(int index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
return -1;
|
||||
}
|
||||
|
||||
float AbstractTimelineModel::getHeight(int index) const
|
||||
float AbstractTimelineModel::height(int index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
return 1.0f;
|
||||
@@ -245,7 +245,7 @@ void AbstractTimelineModel::dataChanged()
|
||||
d->rowOffsets.clear();
|
||||
}
|
||||
|
||||
bool AbstractTimelineModel::eventAccepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
|
||||
bool AbstractTimelineModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
|
||||
{
|
||||
Q_D(const AbstractTimelineModel);
|
||||
return (event.rangeType == d->rangeType && event.message == d->message);
|
||||
|
||||
@@ -58,38 +58,38 @@ public:
|
||||
void setRowHeight(int rowNumber, int height);
|
||||
int height() const;
|
||||
|
||||
Q_INVOKABLE qint64 traceStartTime() const;
|
||||
Q_INVOKABLE qint64 traceEndTime() const;
|
||||
Q_INVOKABLE qint64 traceDuration() const;
|
||||
Q_INVOKABLE qint64 getDuration(int index) const;
|
||||
Q_INVOKABLE qint64 getStartTime(int index) const;
|
||||
Q_INVOKABLE qint64 getEndTime(int index) const;
|
||||
int findFirstIndex(qint64 startTime) const;
|
||||
int findFirstIndexNoParents(qint64 startTime) const;
|
||||
int findLastIndex(qint64 endTime) const;
|
||||
qint64 traceStartTime() const;
|
||||
qint64 traceEndTime() const;
|
||||
qint64 traceDuration() const;
|
||||
qint64 duration(int index) const;
|
||||
qint64 startTime(int index) const;
|
||||
qint64 endTime(int index) const;
|
||||
int firstIndex(qint64 startTime) const;
|
||||
int firstIndexNoParents(qint64 startTime) const;
|
||||
int lastIndex(qint64 endTime) const;
|
||||
int count() const;
|
||||
bool eventAccepted(const QmlProfilerDataModel::QmlEventTypeData &event) const;
|
||||
bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const;
|
||||
bool expanded() const;
|
||||
void setExpanded(bool expanded);
|
||||
QString displayName() const;
|
||||
|
||||
// Methods that have to be implemented by child models
|
||||
virtual int rowCount() const = 0;
|
||||
Q_INVOKABLE virtual int getEventId(int index) const = 0;
|
||||
Q_INVOKABLE virtual QColor getColor(int index) const = 0;
|
||||
virtual const QVariantList getLabels() const = 0;
|
||||
Q_INVOKABLE virtual const QVariantList getEventDetails(int index) const = 0;
|
||||
virtual int getEventRow(int index) const = 0;
|
||||
virtual int eventId(int index) const = 0;
|
||||
virtual QColor color(int index) const = 0;
|
||||
virtual QVariantList labels() const = 0;
|
||||
virtual QVariantList details(int index) const = 0;
|
||||
virtual int row(int index) const = 0;
|
||||
virtual void loadData() = 0;
|
||||
virtual void clear() = 0;
|
||||
|
||||
// Methods which can optionally be implemented by child models.
|
||||
// returned map should contain "file", "line", "column" properties, or be empty
|
||||
Q_INVOKABLE virtual const QVariantMap getEventLocation(int index) const;
|
||||
Q_INVOKABLE virtual int getEventIdForTypeIndex(int typeIndex) const;
|
||||
Q_INVOKABLE virtual int getEventIdForLocation(const QString &filename, int line, int column) const;
|
||||
Q_INVOKABLE virtual int getBindingLoopDest(int index) const;
|
||||
Q_INVOKABLE virtual float getHeight(int index) const;
|
||||
virtual QVariantMap location(int index) const;
|
||||
virtual int eventIdForTypeIndex(int typeIndex) const;
|
||||
virtual int eventIdForLocation(const QString &filename, int line, int column) const;
|
||||
virtual int bindingLoopDest(int index) const;
|
||||
virtual float height(int index) const;
|
||||
virtual int rowMinValue(int rowNumber) const;
|
||||
virtual int rowMaxValue(int rowNumber) const;
|
||||
|
||||
@@ -108,17 +108,17 @@ protected:
|
||||
Lightness = 166
|
||||
};
|
||||
|
||||
QColor getEventColor(int index) const
|
||||
QColor colorByEventId(int index) const
|
||||
{
|
||||
return getColorByHue(getEventId(index) * EventHueMultiplier);
|
||||
return colorByHue(eventId(index) * EventHueMultiplier);
|
||||
}
|
||||
|
||||
QColor getFractionColor(double fraction) const
|
||||
QColor colorByFraction(double fraction) const
|
||||
{
|
||||
return getColorByHue(fraction * FractionHueMultiplier + FractionHueMininimum);
|
||||
return colorByHue(fraction * FractionHueMultiplier + FractionHueMininimum);
|
||||
}
|
||||
|
||||
QColor getColorByHue(int hue) const
|
||||
QColor colorByHue(int hue) const
|
||||
{
|
||||
return QColor::fromHsl(hue % 360, Saturation, Lightness);
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ public:
|
||||
virtual qint64 startTime(int index) const = 0;
|
||||
virtual qint64 lastEndTime() const = 0;
|
||||
virtual qint64 firstStartTime() const = 0;
|
||||
virtual int findFirstIndex(qint64 startTime) const = 0;
|
||||
virtual int findFirstIndexNoParents(qint64 startTime) const = 0;
|
||||
virtual int findLastIndex(qint64 endTime) const = 0;
|
||||
virtual int firstIndex(qint64 startTime) const = 0;
|
||||
virtual int firstIndexNoParents(qint64 startTime) const = 0;
|
||||
virtual int lastIndex(qint64 endTime) const = 0;
|
||||
|
||||
QVector<int> rowOffsets;
|
||||
QmlProfilerModelManager *modelManager;
|
||||
|
||||
@@ -54,7 +54,7 @@ Item {
|
||||
height: trigger(qmlProfilerModelProxy.height(modelIndex))
|
||||
width: 150
|
||||
|
||||
function getDescriptions() {
|
||||
function updateDescriptions() {
|
||||
bindingTrigger = -bindingTrigger;
|
||||
if (!visible)
|
||||
return;
|
||||
@@ -62,7 +62,7 @@ Item {
|
||||
var desc=[];
|
||||
var ids=[];
|
||||
var extdesc=[];
|
||||
var labelList = qmlProfilerModelProxy.getLabels(modelIndex);
|
||||
var labelList = qmlProfilerModelProxy.labels(modelIndex);
|
||||
for (var i = 0; i < labelList.length; i++ ) {
|
||||
extdesc[i] = desc[i] = (labelList[i].description || qsTr("<bytecode>"));
|
||||
ids[i] = labelList[i].id;
|
||||
@@ -76,9 +76,9 @@ Item {
|
||||
|
||||
Connections {
|
||||
target: qmlProfilerModelProxy
|
||||
onExpandedChanged: getDescriptions();
|
||||
onStateChanged: getDescriptions()
|
||||
onRowHeightChanged: getDescriptions()
|
||||
onExpandedChanged: updateDescriptions();
|
||||
onStateChanged: updateDescriptions()
|
||||
onRowHeightChanged: updateDescriptions()
|
||||
}
|
||||
|
||||
Text {
|
||||
|
||||
@@ -135,10 +135,10 @@ Rectangle {
|
||||
return;
|
||||
|
||||
// if item is outside of the view, jump back to its position
|
||||
if (qmlProfilerModelProxy.getEndTime(modelIndex, itemIndex) < view.startTime ||
|
||||
qmlProfilerModelProxy.getStartTime(modelIndex, itemIndex) > view.endTime) {
|
||||
recenter((qmlProfilerModelProxy.getStartTime(modelIndex, itemIndex) +
|
||||
qmlProfilerModelProxy.getEndTime(modelIndex, itemIndex)) / 2);
|
||||
if (qmlProfilerModelProxy.endTime(modelIndex, itemIndex) < view.startTime ||
|
||||
qmlProfilerModelProxy.startTime(modelIndex, itemIndex) > view.endTime) {
|
||||
recenter((qmlProfilerModelProxy.startTime(modelIndex, itemIndex) +
|
||||
qmlProfilerModelProxy.endTime(modelIndex, itemIndex)) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ Rectangle {
|
||||
function selectById(modelIndex, eventId)
|
||||
{
|
||||
if (eventId === -1 || (modelIndex === view.selectedModel &&
|
||||
eventId === qmlProfilerModelProxy.getEventId(modelIndex, view.selectedItem)))
|
||||
eventId === qmlProfilerModelProxy.eventId(modelIndex, view.selectedItem)))
|
||||
return;
|
||||
|
||||
// this is a slot responding to events from the other pane
|
||||
@@ -348,16 +348,18 @@ Rectangle {
|
||||
onSelectionChanged: {
|
||||
if (selectedItem !== -1) {
|
||||
// display details
|
||||
rangeDetails.showInfo(qmlProfilerModelProxy.getEventDetails(selectedModel, selectedItem));
|
||||
rangeDetails.setLocation(qmlProfilerModelProxy.getEventLocation(selectedModel, selectedItem));
|
||||
rangeDetails.showInfo(qmlProfilerModelProxy.details(selectedModel,
|
||||
selectedItem));
|
||||
rangeDetails.setLocation(qmlProfilerModelProxy.location(selectedModel,
|
||||
selectedItem));
|
||||
|
||||
// center view (horizontally)
|
||||
recenterOnItem(selectedModel, selectedItem);
|
||||
if (!lockItemSelection) {
|
||||
lockItemSelection = true;
|
||||
// update in other views
|
||||
var eventLocation = qmlProfilerModelProxy.getEventLocation(
|
||||
view.selectedModel, view.selectedItem);
|
||||
var eventLocation = qmlProfilerModelProxy.location(view.selectedModel,
|
||||
view.selectedItem);
|
||||
gotoSourceLocation(eventLocation.file, eventLocation.line,
|
||||
eventLocation.column);
|
||||
lockItemSelection = false;
|
||||
@@ -368,7 +370,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
onItemPressed: {
|
||||
var location = qmlProfilerModelProxy.getEventLocation(modelIndex, pressedItem);
|
||||
var location = qmlProfilerModelProxy.location(modelIndex, pressedItem);
|
||||
if (location.hasOwnProperty("file")) // not empty
|
||||
root.gotoSourceLocation(location.file, location.line, location.column);
|
||||
}
|
||||
@@ -470,7 +472,7 @@ Rectangle {
|
||||
var fixedPoint = (view.startTime + view.endTime) / 2;
|
||||
if (view.selectedItem !== -1) {
|
||||
// center on selected item if it's inside the current screen
|
||||
var newFixedPoint = qmlProfilerModelProxy.getStartTime(view.selectedModel, view.selectedItem);
|
||||
var newFixedPoint = qmlProfilerModelProxy.startTime(view.selectedModel, view.selectedItem);
|
||||
if (newFixedPoint >= view.startTime && newFixedPoint < view.endTime)
|
||||
fixedPoint = newFixedPoint;
|
||||
}
|
||||
|
||||
@@ -56,20 +56,20 @@ function drawData(canvas, ctxt)
|
||||
for (var ii = canvas.offset; ii < qmlProfilerModelProxy.count(modelIndex);
|
||||
ii += canvas.increment) {
|
||||
|
||||
var xx = (qmlProfilerModelProxy.getStartTime(modelIndex,ii) -
|
||||
var xx = (qmlProfilerModelProxy.startTime(modelIndex,ii) -
|
||||
qmlProfilerModelProxy.traceStartTime()) * spacing;
|
||||
|
||||
var eventWidth = qmlProfilerModelProxy.getDuration(modelIndex,ii) * spacing;
|
||||
var eventWidth = qmlProfilerModelProxy.duration(modelIndex,ii) * spacing;
|
||||
|
||||
if (eventWidth < 1)
|
||||
eventWidth = 1;
|
||||
|
||||
xx = Math.round(xx);
|
||||
|
||||
var itemHeight = qmlProfilerModelProxy.getHeight(modelIndex,ii) * blockHeight;
|
||||
var itemHeight = qmlProfilerModelProxy.height(modelIndex,ii) * blockHeight;
|
||||
var yy = (modelIndex + 1) * blockHeight - itemHeight ;
|
||||
|
||||
ctxt.fillStyle = qmlProfilerModelProxy.getColor(modelIndex, ii);
|
||||
ctxt.fillStyle = qmlProfilerModelProxy.color(modelIndex, ii);
|
||||
ctxt.fillRect(xx, bump + yy, eventWidth, itemHeight);
|
||||
}
|
||||
}
|
||||
@@ -81,9 +81,9 @@ function drawData(canvas, ctxt)
|
||||
for (modelIndex = 0; modelIndex < qmlProfilerModelProxy.modelCount(); ++modelIndex) {
|
||||
for (ii = canvas.offset; ii < qmlProfilerModelProxy.count(modelIndex);
|
||||
ii += canvas.increment) {
|
||||
if (qmlProfilerModelProxy.getBindingLoopDest(modelIndex,ii) >= 0) {
|
||||
var xcenter = Math.round(qmlProfilerModelProxy.getStartTime(modelIndex,ii) +
|
||||
qmlProfilerModelProxy.getDuration(modelIndex,ii) -
|
||||
if (qmlProfilerModelProxy.bindingLoopDest(modelIndex,ii) >= 0) {
|
||||
var xcenter = Math.round(qmlProfilerModelProxy.startTime(modelIndex,ii) +
|
||||
qmlProfilerModelProxy.duration(modelIndex,ii) -
|
||||
qmlProfilerModelProxy.traceStartTime()) * spacing;
|
||||
var ycenter = Math.round(bump + blockHeight * modelIndex + blockHeight / 2);
|
||||
ctxt.beginPath();
|
||||
|
||||
@@ -78,9 +78,9 @@ void PaintEventsModelProxy::clear()
|
||||
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
||||
}
|
||||
|
||||
bool PaintEventsModelProxy::eventAccepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
|
||||
bool PaintEventsModelProxy::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
|
||||
{
|
||||
return AbstractTimelineModel::eventAccepted(event) &&
|
||||
return AbstractTimelineModel::accepted(event) &&
|
||||
event.detailType== QmlDebug::AnimationFrame;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ void PaintEventsModelProxy::loadData()
|
||||
|
||||
foreach (const QmlProfilerDataModel::QmlEventData &event, referenceList) {
|
||||
const QmlProfilerDataModel::QmlEventTypeData &type = typeList[event.typeIndex];
|
||||
if (!eventAccepted(type))
|
||||
if (!accepted(type))
|
||||
continue;
|
||||
|
||||
lastEvent.threadId = (QmlDebug::AnimationThread)event.numericData3;
|
||||
@@ -160,7 +160,7 @@ int PaintEventsModelProxy::PaintEventsModelProxyPrivate::rowFromThreadId(
|
||||
return (threadId == QmlDebug::GuiThread || maxGuiThreadAnimations == 0) ? 1 : 2;
|
||||
}
|
||||
|
||||
int PaintEventsModelProxy::getEventRow(int index) const
|
||||
int PaintEventsModelProxy::row(int index) const
|
||||
{
|
||||
Q_D(const PaintEventsModelProxy);
|
||||
return d->rowFromThreadId(d->range(index).threadId);
|
||||
@@ -180,13 +180,13 @@ int PaintEventsModelProxy::rowMaxValue(int rowNumber) const
|
||||
}
|
||||
}
|
||||
|
||||
int PaintEventsModelProxy::getEventId(int index) const
|
||||
int PaintEventsModelProxy::eventId(int index) const
|
||||
{
|
||||
Q_D(const PaintEventsModelProxy);
|
||||
return d->range(index).threadId;
|
||||
}
|
||||
|
||||
QColor PaintEventsModelProxy::getColor(int index) const
|
||||
QColor PaintEventsModelProxy::color(int index) const
|
||||
{
|
||||
Q_D(const PaintEventsModelProxy);
|
||||
double fpsFraction = d->range(index).framerate / 60.0;
|
||||
@@ -194,10 +194,10 @@ QColor PaintEventsModelProxy::getColor(int index) const
|
||||
fpsFraction = 1.0;
|
||||
if (fpsFraction < 0.0)
|
||||
fpsFraction = 0.0;
|
||||
return getFractionColor(fpsFraction);
|
||||
return colorByFraction(fpsFraction);
|
||||
}
|
||||
|
||||
float PaintEventsModelProxy::getHeight(int index) const
|
||||
float PaintEventsModelProxy::height(int index) const
|
||||
{
|
||||
Q_D(const PaintEventsModelProxy);
|
||||
const PaintEventsModelProxyPrivate::Range &range = d->range(index);
|
||||
@@ -212,7 +212,7 @@ float PaintEventsModelProxy::getHeight(int index) const
|
||||
d->maxRenderThreadAnimations);
|
||||
}
|
||||
|
||||
const QVariantList PaintEventsModelProxy::getLabels() const
|
||||
QVariantList PaintEventsModelProxy::labels() const
|
||||
{
|
||||
Q_D(const PaintEventsModelProxy);
|
||||
QVariantList result;
|
||||
@@ -236,7 +236,7 @@ const QVariantList PaintEventsModelProxy::getLabels() const
|
||||
return result;
|
||||
}
|
||||
|
||||
const QVariantList PaintEventsModelProxy::getEventDetails(int index) const
|
||||
QVariantList PaintEventsModelProxy::details(int index) const
|
||||
{
|
||||
Q_D(const PaintEventsModelProxy);
|
||||
QVariantList result;
|
||||
|
||||
@@ -66,18 +66,18 @@ public:
|
||||
|
||||
int rowMaxValue(int rowNumber) const;
|
||||
|
||||
Q_INVOKABLE int rowCount() const;
|
||||
Q_INVOKABLE int getEventId(int index) const;
|
||||
int getEventRow(int index) const;
|
||||
int rowCount() const;
|
||||
int eventId(int index) const;
|
||||
int row(int index) const;
|
||||
|
||||
Q_INVOKABLE QColor getColor(int index) const;
|
||||
Q_INVOKABLE float getHeight(int index) const;
|
||||
QColor color(int index) const;
|
||||
float height(int index) const;
|
||||
|
||||
Q_INVOKABLE const QVariantList getLabels() const;
|
||||
Q_INVOKABLE const QVariantList getEventDetails(int index) const;
|
||||
QVariantList labels() const;
|
||||
QVariantList details(int index) const;
|
||||
|
||||
private slots:
|
||||
bool eventAccepted(const QmlProfilerDataModel::QmlEventTypeData &event) const;
|
||||
bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const;
|
||||
|
||||
private:
|
||||
class PaintEventsModelProxyPrivate;
|
||||
|
||||
@@ -99,7 +99,7 @@ void RangeTimelineModel::loadData()
|
||||
const QVector<QmlProfilerDataModel::QmlEventTypeData> &typesList = simpleModel->getEventTypes();
|
||||
foreach (const QmlProfilerDataModel::QmlEventData &event, eventList) {
|
||||
const QmlProfilerDataModel::QmlEventTypeData &type = typesList[event.typeIndex];
|
||||
if (!eventAccepted(type))
|
||||
if (!accepted(type))
|
||||
continue;
|
||||
if (type.rangeType == QmlDebug::Painting)
|
||||
d->seenPaintEvent = true;
|
||||
@@ -239,7 +239,7 @@ QString RangeTimelineModel::categoryLabel(int categoryIndex)
|
||||
}
|
||||
}
|
||||
|
||||
int RangeTimelineModel::getEventRow(int index) const
|
||||
int RangeTimelineModel::row(int index) const
|
||||
{
|
||||
Q_D(const RangeTimelineModel);
|
||||
if (d->expanded)
|
||||
@@ -248,24 +248,24 @@ int RangeTimelineModel::getEventRow(int index) const
|
||||
return d->range(index).displayRowCollapsed;
|
||||
}
|
||||
|
||||
int RangeTimelineModel::getEventId(int index) const
|
||||
int RangeTimelineModel::eventId(int index) const
|
||||
{
|
||||
Q_D(const RangeTimelineModel);
|
||||
return d->range(index).eventId;
|
||||
}
|
||||
|
||||
int RangeTimelineModel::getBindingLoopDest(int index) const
|
||||
int RangeTimelineModel::bindingLoopDest(int index) const
|
||||
{
|
||||
Q_D(const RangeTimelineModel);
|
||||
return d->range(index).bindingLoopHead;
|
||||
}
|
||||
|
||||
QColor RangeTimelineModel::getColor(int index) const
|
||||
QColor RangeTimelineModel::color(int index) const
|
||||
{
|
||||
return getEventColor(index);
|
||||
return colorByEventId(index);
|
||||
}
|
||||
|
||||
const QVariantList RangeTimelineModel::getLabels() const
|
||||
QVariantList RangeTimelineModel::labels() const
|
||||
{
|
||||
Q_D(const RangeTimelineModel);
|
||||
QVariantList result;
|
||||
@@ -287,11 +287,11 @@ const QVariantList RangeTimelineModel::getLabels() const
|
||||
return result;
|
||||
}
|
||||
|
||||
const QVariantList RangeTimelineModel::getEventDetails(int index) const
|
||||
QVariantList RangeTimelineModel::details(int index) const
|
||||
{
|
||||
Q_D(const RangeTimelineModel);
|
||||
QVariantList result;
|
||||
int eventId = getEventId(index);
|
||||
int id = eventId(index);
|
||||
const QVector<QmlProfilerDataModel::QmlEventTypeData> &types =
|
||||
d->modelManager->qmlModel()->getEventTypes();
|
||||
|
||||
@@ -313,7 +313,7 @@ const QVariantList RangeTimelineModel::getEventDetails(int index) const
|
||||
// details
|
||||
{
|
||||
QVariantMap valuePair;
|
||||
QString detailsString = types[eventId].data;
|
||||
QString detailsString = types[id].data;
|
||||
if (detailsString.length() > 40)
|
||||
detailsString = detailsString.left(40) + QLatin1String("...");
|
||||
valuePair.insert(QCoreApplication::translate(trContext, "Details:"),
|
||||
@@ -325,25 +325,24 @@ const QVariantList RangeTimelineModel::getEventDetails(int index) const
|
||||
{
|
||||
QVariantMap valuePair;
|
||||
valuePair.insert(QCoreApplication::translate(trContext, "Location:"),
|
||||
QVariant(types[eventId].displayName));
|
||||
QVariant(types[id].displayName));
|
||||
result << valuePair;
|
||||
}
|
||||
|
||||
// isbindingloop
|
||||
{}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const QVariantMap RangeTimelineModel::getEventLocation(int index) const
|
||||
QVariantMap RangeTimelineModel::location(int index) const
|
||||
{
|
||||
Q_D(const RangeTimelineModel);
|
||||
QVariantMap result;
|
||||
int eventId = getEventId(index);
|
||||
int id = eventId(index);
|
||||
|
||||
const QmlDebug::QmlEventLocation &location
|
||||
= d->modelManager->qmlModel()->getEventTypes().at(eventId).location;
|
||||
= d->modelManager->qmlModel()->getEventTypes().at(id).location;
|
||||
|
||||
result.insert(QStringLiteral("file"), location.filename);
|
||||
result.insert(QStringLiteral("line"), location.line);
|
||||
@@ -352,7 +351,7 @@ const QVariantMap RangeTimelineModel::getEventLocation(int index) const
|
||||
return result;
|
||||
}
|
||||
|
||||
int RangeTimelineModel::getEventIdForTypeIndex(int typeIndex) const
|
||||
int RangeTimelineModel::eventIdForTypeIndex(int typeIndex) const
|
||||
{
|
||||
Q_D(const RangeTimelineModel);
|
||||
if (typeIndex < 0)
|
||||
@@ -364,7 +363,7 @@ int RangeTimelineModel::getEventIdForTypeIndex(int typeIndex) const
|
||||
return typeIndex;
|
||||
}
|
||||
|
||||
int RangeTimelineModel::getEventIdForLocation(const QString &filename, int line, int column) const
|
||||
int RangeTimelineModel::eventIdForLocation(const QString &filename, int line, int column) const
|
||||
{
|
||||
Q_D(const RangeTimelineModel);
|
||||
// if this is called from v8 view, we don't have the column number, it will be -1
|
||||
|
||||
@@ -71,20 +71,20 @@ public:
|
||||
|
||||
// QML interface
|
||||
|
||||
Q_INVOKABLE int rowCount() const;
|
||||
int rowCount() const;
|
||||
static QString categoryLabel(int categoryIndex);
|
||||
|
||||
int getEventRow(int index) const;
|
||||
Q_INVOKABLE int getEventId(int index) const;
|
||||
int getBindingLoopDest(int index) const;
|
||||
Q_INVOKABLE QColor getColor(int index) const;
|
||||
int row(int index) const;
|
||||
int eventId(int index) const;
|
||||
int bindingLoopDest(int index) const;
|
||||
QColor color(int index) const;
|
||||
|
||||
Q_INVOKABLE const QVariantList getLabels() const;
|
||||
Q_INVOKABLE const QVariantList getEventDetails(int index) const;
|
||||
Q_INVOKABLE const QVariantMap getEventLocation(int index) const;
|
||||
QVariantList labels() const;
|
||||
QVariantList details(int index) const;
|
||||
QVariantMap location(int index) const;
|
||||
|
||||
Q_INVOKABLE int getEventIdForTypeIndex(int typeIndex) const;
|
||||
Q_INVOKABLE int getEventIdForLocation(const QString &filename, int line, int column) const;
|
||||
int eventIdForTypeIndex(int typeIndex) const;
|
||||
int eventIdForLocation(const QString &filename, int line, int column) const;
|
||||
|
||||
private:
|
||||
class RangeTimelineModelPrivate;
|
||||
|
||||
@@ -265,7 +265,7 @@ void QmlProfilerTraceView::selectByTypeIndex(int typeIndex)
|
||||
return;
|
||||
|
||||
for (int modelIndex = 0; modelIndex < d->m_modelProxy->modelCount(); ++modelIndex) {
|
||||
int eventId = d->m_modelProxy->getEventIdForTypeIndex(modelIndex, typeIndex);
|
||||
int eventId = d->m_modelProxy->eventIdForTypeIndex(modelIndex, typeIndex);
|
||||
if (eventId != -1) {
|
||||
QMetaObject::invokeMethod(rootObject, "selectById",
|
||||
Q_ARG(QVariant,QVariant(modelIndex)),
|
||||
@@ -282,7 +282,7 @@ void QmlProfilerTraceView::selectBySourceLocation(const QString &filename, int l
|
||||
return;
|
||||
|
||||
for (int modelIndex = 0; modelIndex < d->m_modelProxy->modelCount(); ++modelIndex) {
|
||||
int eventId = d->m_modelProxy->getEventIdForLocation(modelIndex, filename, line, column);
|
||||
int eventId = d->m_modelProxy->eventIdForLocation(modelIndex, filename, line, column);
|
||||
if (eventId != -1) {
|
||||
QMetaObject::invokeMethod(rootObject, "selectById",
|
||||
Q_ARG(QVariant,QVariant(modelIndex)),
|
||||
|
||||
@@ -92,13 +92,13 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int SortedTimelineModel::findFirstIndexNoParents(qint64 startTime) const
|
||||
\fn int SortedTimelineModel::firstIndexNoParents(qint64 startTime) const
|
||||
Looks up the first range with an end time greater than the given time and
|
||||
returns its index. If no such range is found, it returns -1.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int SortedTimelineModel::findFirstIndex(qint64 startTime) const
|
||||
\fn int SortedTimelineModel::firstIndex(qint64 startTime) const
|
||||
Looks up the first range with an end time greater than the given time and
|
||||
returns its parent's index. If no such range is found, it returns -1. If there
|
||||
is no parent, it returns the found range's index. The parent of a range is the
|
||||
@@ -108,7 +108,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int SortedTimelineModel::findLastIndex(qint64 endTime) const
|
||||
\fn int SortedTimelineModel::lastIndex(qint64 endTime) const
|
||||
Looks up the last range with a start time smaller than the given time and
|
||||
returns its index. If no such range is found, it returns -1.
|
||||
*/
|
||||
|
||||
@@ -103,16 +103,16 @@ public:
|
||||
insertSorted(endTimes, RangeEnd(index, ranges[index].start + duration));
|
||||
}
|
||||
|
||||
inline int findFirstIndex(qint64 startTime) const
|
||||
inline int firstIndex(qint64 startTime) const
|
||||
{
|
||||
int index = findFirstIndexNoParents(startTime);
|
||||
int index = firstIndexNoParents(startTime);
|
||||
if (index == -1)
|
||||
return -1;
|
||||
int parent = ranges[index].parent;
|
||||
return parent == -1 ? index : parent;
|
||||
}
|
||||
|
||||
inline int findFirstIndexNoParents(qint64 startTime) const
|
||||
inline int firstIndexNoParents(qint64 startTime) const
|
||||
{
|
||||
// in the "endtime" list, find the first event that ends after startTime
|
||||
if (endTimes.isEmpty())
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
return endTimes[lowerBound(endTimes, startTime) + 1].startIndex;
|
||||
}
|
||||
|
||||
inline int findLastIndex(qint64 endTime) const
|
||||
inline int lastIndex(qint64 endTime) const
|
||||
{
|
||||
// in the "starttime" list, find the last event that starts before endtime
|
||||
if (ranges.isEmpty() || ranges.first().start >= endTime)
|
||||
|
||||
@@ -165,85 +165,85 @@ int TimelineModelAggregator::rowMaxValue(int modelIndex, int row) const
|
||||
return d->modelList[modelIndex]->rowMaxValue(row);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::findFirstIndex(int modelIndex, qint64 startTime) const
|
||||
int TimelineModelAggregator::firstIndex(int modelIndex, qint64 startTime) const
|
||||
{
|
||||
return d->modelList[modelIndex]->findFirstIndex(startTime);
|
||||
return d->modelList[modelIndex]->firstIndex(startTime);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::findFirstIndexNoParents(int modelIndex, qint64 startTime) const
|
||||
int TimelineModelAggregator::firstIndexNoParents(int modelIndex, qint64 startTime) const
|
||||
{
|
||||
return d->modelList[modelIndex]->findFirstIndexNoParents(startTime);
|
||||
return d->modelList[modelIndex]->firstIndexNoParents(startTime);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::findLastIndex(int modelIndex, qint64 endTime) const
|
||||
int TimelineModelAggregator::lastIndex(int modelIndex, qint64 endTime) const
|
||||
{
|
||||
return d->modelList[modelIndex]->findLastIndex(endTime);
|
||||
return d->modelList[modelIndex]->lastIndex(endTime);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::getEventRow(int modelIndex, int index) const
|
||||
int TimelineModelAggregator::row(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getEventRow(index);
|
||||
return d->modelList[modelIndex]->row(index);
|
||||
}
|
||||
|
||||
qint64 TimelineModelAggregator::getDuration(int modelIndex, int index) const
|
||||
qint64 TimelineModelAggregator::duration(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getDuration(index);
|
||||
return d->modelList[modelIndex]->duration(index);
|
||||
}
|
||||
|
||||
qint64 TimelineModelAggregator::getStartTime(int modelIndex, int index) const
|
||||
qint64 TimelineModelAggregator::startTime(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getStartTime(index);
|
||||
return d->modelList[modelIndex]->startTime(index);
|
||||
}
|
||||
|
||||
qint64 TimelineModelAggregator::getEndTime(int modelIndex, int index) const
|
||||
qint64 TimelineModelAggregator::endTime(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getEndTime(index);
|
||||
return d->modelList[modelIndex]->endTime(index);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::getEventId(int modelIndex, int index) const
|
||||
int TimelineModelAggregator::eventId(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getEventId(index);
|
||||
return d->modelList[modelIndex]->eventId(index);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::getBindingLoopDest(int modelIndex,int index) const
|
||||
int TimelineModelAggregator::bindingLoopDest(int modelIndex,int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getBindingLoopDest(index);
|
||||
return d->modelList[modelIndex]->bindingLoopDest(index);
|
||||
}
|
||||
|
||||
QColor TimelineModelAggregator::getColor(int modelIndex, int index) const
|
||||
QColor TimelineModelAggregator::color(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getColor(index);
|
||||
return d->modelList[modelIndex]->color(index);
|
||||
}
|
||||
|
||||
float TimelineModelAggregator::getHeight(int modelIndex, int index) const
|
||||
float TimelineModelAggregator::height(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getHeight(index);
|
||||
return d->modelList[modelIndex]->height(index);
|
||||
}
|
||||
|
||||
const QVariantList TimelineModelAggregator::getLabels(int modelIndex) const
|
||||
QVariantList TimelineModelAggregator::labels(int modelIndex) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getLabels();
|
||||
return d->modelList[modelIndex]->labels();
|
||||
}
|
||||
|
||||
const QVariantList TimelineModelAggregator::getEventDetails(int modelIndex, int index) const
|
||||
QVariantList TimelineModelAggregator::details(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getEventDetails(index);
|
||||
return d->modelList[modelIndex]->details(index);
|
||||
}
|
||||
|
||||
const QVariantMap TimelineModelAggregator::getEventLocation(int modelIndex, int index) const
|
||||
QVariantMap TimelineModelAggregator::location(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getEventLocation(index);
|
||||
return d->modelList[modelIndex]->location(index);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::getEventIdForTypeIndex(int modelIndex, int typeIndex) const
|
||||
int TimelineModelAggregator::eventIdForTypeIndex(int modelIndex, int typeIndex) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getEventIdForTypeIndex(typeIndex);
|
||||
return d->modelList[modelIndex]->eventIdForTypeIndex(typeIndex);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::getEventIdForLocation(int modelIndex, const QString &filename,
|
||||
int TimelineModelAggregator::eventIdForLocation(int modelIndex, const QString &filename,
|
||||
int line, int column) const
|
||||
{
|
||||
return d->modelList[modelIndex]->getEventIdForLocation(filename, line, column);
|
||||
return d->modelList[modelIndex]->eventIdForLocation(filename, line, column);
|
||||
}
|
||||
|
||||
void TimelineModelAggregator::dataChanged()
|
||||
|
||||
@@ -67,27 +67,27 @@ public:
|
||||
Q_INVOKABLE int rowMinValue(int modelIndex, int row) const;
|
||||
Q_INVOKABLE int rowMaxValue(int modelIndex, int row) const;
|
||||
|
||||
int findFirstIndex(int modelIndex, qint64 startTime) const;
|
||||
int findFirstIndexNoParents(int modelIndex, qint64 startTime) const;
|
||||
int findLastIndex(int modelIndex, qint64 endTime) const;
|
||||
Q_INVOKABLE int firstIndex(int modelIndex, qint64 startTime) const;
|
||||
Q_INVOKABLE int firstIndexNoParents(int modelIndex, qint64 startTime) const;
|
||||
Q_INVOKABLE int lastIndex(int modelIndex, qint64 endTime) const;
|
||||
|
||||
int getEventRow(int modelIndex, int index) const;
|
||||
Q_INVOKABLE qint64 getDuration(int modelIndex, int index) const;
|
||||
Q_INVOKABLE qint64 getStartTime(int modelIndex, int index) const;
|
||||
Q_INVOKABLE qint64 getEndTime(int modelIndex, int index) const;
|
||||
Q_INVOKABLE int getEventId(int modelIndex, int index) const;
|
||||
Q_INVOKABLE int getBindingLoopDest(int modelIndex, int index) const;
|
||||
Q_INVOKABLE QColor getColor(int modelIndex, int index) const;
|
||||
Q_INVOKABLE float getHeight(int modelIndex, int index) const;
|
||||
Q_INVOKABLE int row(int modelIndex, int index) const;
|
||||
Q_INVOKABLE qint64 duration(int modelIndex, int index) const;
|
||||
Q_INVOKABLE qint64 startTime(int modelIndex, int index) const;
|
||||
Q_INVOKABLE qint64 endTime(int modelIndex, int index) const;
|
||||
Q_INVOKABLE int eventId(int modelIndex, int index) const;
|
||||
Q_INVOKABLE int bindingLoopDest(int modelIndex, int index) const;
|
||||
Q_INVOKABLE QColor color(int modelIndex, int index) const;
|
||||
Q_INVOKABLE float height(int modelIndex, int index) const;
|
||||
|
||||
Q_INVOKABLE const QVariantList getLabels(int modelIndex) const;
|
||||
Q_INVOKABLE QVariantList labels(int modelIndex) const;
|
||||
|
||||
Q_INVOKABLE const QVariantList getEventDetails(int modelIndex, int index) const;
|
||||
Q_INVOKABLE const QVariantMap getEventLocation(int modelIndex, int index) const;
|
||||
Q_INVOKABLE QVariantList details(int modelIndex, int index) const;
|
||||
Q_INVOKABLE QVariantMap location(int modelIndex, int index) const;
|
||||
|
||||
Q_INVOKABLE int getEventIdForTypeIndex(int modelIndex, int typeIndex) const;
|
||||
Q_INVOKABLE int getEventIdForLocation(int modelIndex, const QString &filename, int line,
|
||||
int column) const;
|
||||
Q_INVOKABLE int eventIdForTypeIndex(int modelIndex, int typeIndex) const;
|
||||
Q_INVOKABLE int eventIdForLocation(int modelIndex, const QString &filename, int line,
|
||||
int column) const;
|
||||
|
||||
signals:
|
||||
void dataAvailable();
|
||||
|
||||
@@ -86,17 +86,17 @@ void TimelineRenderer::requestPaint()
|
||||
|
||||
inline void TimelineRenderer::getItemXExtent(int modelIndex, int i, int ¤tX, int &itemWidth)
|
||||
{
|
||||
qint64 start = m_profilerModelProxy->getStartTime(modelIndex, i) - m_startTime;
|
||||
qint64 start = m_profilerModelProxy->startTime(modelIndex, i) - m_startTime;
|
||||
if (start > 0) {
|
||||
currentX = start * m_spacing;
|
||||
itemWidth = qMax(1.0, (qMin(m_profilerModelProxy->getDuration(modelIndex, i) *
|
||||
itemWidth = qMax(1.0, (qMin(m_profilerModelProxy->duration(modelIndex, i) *
|
||||
m_spacing, m_spacedDuration)));
|
||||
} else {
|
||||
currentX = -OutOfScreenMargin;
|
||||
// Explicitly round the "start" part down, away from 0, to match the implicit rounding of
|
||||
// currentX in the > 0 case. If we don't do that we get glitches where a pixel is added if
|
||||
// the element starts outside the screen and subtracted if it starts inside the screen.
|
||||
itemWidth = qMax(1.0, (qMin(m_profilerModelProxy->getDuration(modelIndex, i) * m_spacing +
|
||||
itemWidth = qMax(1.0, (qMin(m_profilerModelProxy->duration(modelIndex, i) * m_spacing +
|
||||
floor(start * m_spacing) + OutOfScreenMargin,
|
||||
m_spacedDuration)));
|
||||
}
|
||||
@@ -123,9 +123,9 @@ void TimelineRenderer::paint(QPainter *p)
|
||||
p->setPen(Qt::transparent);
|
||||
|
||||
for (int modelIndex = 0; modelIndex < m_profilerModelProxy->modelCount(); modelIndex++) {
|
||||
int lastIndex = m_profilerModelProxy->findLastIndex(modelIndex, m_endTime);
|
||||
int lastIndex = m_profilerModelProxy->lastIndex(modelIndex, m_endTime);
|
||||
if (lastIndex >= 0 && lastIndex < m_profilerModelProxy->count(modelIndex)) {
|
||||
int firstIndex = m_profilerModelProxy->findFirstIndex(modelIndex, m_startTime);
|
||||
int firstIndex = m_profilerModelProxy->firstIndex(modelIndex, m_startTime);
|
||||
if (firstIndex >= 0) {
|
||||
drawItemsToPainter(p, modelIndex, firstIndex, lastIndex);
|
||||
if (m_selectedModel == modelIndex)
|
||||
@@ -150,13 +150,13 @@ void TimelineRenderer::drawItemsToPainter(QPainter *p, int modelIndex, int fromI
|
||||
for (int i = fromIndex; i <= toIndex; i++) {
|
||||
int currentX, currentY, itemWidth, itemHeight;
|
||||
|
||||
int rowNumber = m_profilerModelProxy->getEventRow(modelIndex, i);
|
||||
int rowNumber = m_profilerModelProxy->row(modelIndex, i);
|
||||
currentY = modelRowStart + m_profilerModelProxy->rowOffset(modelIndex, rowNumber) - y();
|
||||
if (currentY >= height())
|
||||
continue;
|
||||
|
||||
itemHeight = m_profilerModelProxy->rowHeight(modelIndex, rowNumber) *
|
||||
m_profilerModelProxy->getHeight(modelIndex, i);
|
||||
m_profilerModelProxy->height(modelIndex, i);
|
||||
|
||||
currentY += m_profilerModelProxy->rowHeight(modelIndex, rowNumber) - itemHeight;
|
||||
if (currentY + itemHeight < 0)
|
||||
@@ -165,7 +165,7 @@ void TimelineRenderer::drawItemsToPainter(QPainter *p, int modelIndex, int fromI
|
||||
getItemXExtent(modelIndex, i, currentX, itemWidth);
|
||||
|
||||
// normal events
|
||||
p->setBrush(m_profilerModelProxy->getColor(modelIndex, i));
|
||||
p->setBrush(m_profilerModelProxy->color(modelIndex, i));
|
||||
p->drawRect(currentX, currentY, itemWidth, itemHeight);
|
||||
}
|
||||
p->restore();
|
||||
@@ -177,7 +177,7 @@ void TimelineRenderer::drawSelectionBoxes(QPainter *p, int modelIndex, int fromI
|
||||
return;
|
||||
|
||||
|
||||
int id = m_profilerModelProxy->getEventId(modelIndex, m_selectedItem);
|
||||
int id = m_profilerModelProxy->eventId(modelIndex, m_selectedItem);
|
||||
|
||||
int modelRowStart = 0;
|
||||
for (int mi = 0; mi < modelIndex; mi++)
|
||||
@@ -197,12 +197,12 @@ void TimelineRenderer::drawSelectionBoxes(QPainter *p, int modelIndex, int fromI
|
||||
int currentX, currentY, itemWidth;
|
||||
QRect selectedItemRect(0,0,0,0);
|
||||
for (int i = fromIndex; i <= toIndex; i++) {
|
||||
if (m_profilerModelProxy->getEventId(modelIndex, i) != id)
|
||||
if (m_profilerModelProxy->eventId(modelIndex, i) != id)
|
||||
continue;
|
||||
|
||||
int row = m_profilerModelProxy->getEventRow(modelIndex, i);
|
||||
int row = m_profilerModelProxy->row(modelIndex, i);
|
||||
int rowHeight = m_profilerModelProxy->rowHeight(modelIndex, row);
|
||||
int itemHeight = rowHeight * m_profilerModelProxy->getHeight(modelIndex, i);
|
||||
int itemHeight = rowHeight * m_profilerModelProxy->height(modelIndex, i);
|
||||
|
||||
currentY = modelRowStart + m_profilerModelProxy->rowOffset(modelIndex, row) + rowHeight -
|
||||
itemHeight - y();
|
||||
@@ -239,7 +239,7 @@ void TimelineRenderer::drawBindingLoopMarkers(QPainter *p, int modelIndex, int f
|
||||
|
||||
p->save();
|
||||
for (int i = fromIndex; i <= toIndex; i++) {
|
||||
destindex = m_profilerModelProxy->getBindingLoopDest(modelIndex, i);
|
||||
destindex = m_profilerModelProxy->bindingLoopDest(modelIndex, i);
|
||||
if (destindex >= 0) {
|
||||
// to
|
||||
getItemXExtent(modelIndex, destindex, xto, width);
|
||||
@@ -383,8 +383,8 @@ void TimelineRenderer::manageHovered(int mouseX, int mouseY)
|
||||
}
|
||||
|
||||
// find if there's items in the time range
|
||||
int eventFrom = m_profilerModelProxy->findFirstIndex(modelIndex, startTime);
|
||||
int eventTo = m_profilerModelProxy->findLastIndex(modelIndex, endTime);
|
||||
int eventFrom = m_profilerModelProxy->firstIndex(modelIndex, startTime);
|
||||
int eventTo = m_profilerModelProxy->lastIndex(modelIndex, endTime);
|
||||
if (eventFrom == -1 ||
|
||||
eventTo < eventFrom || eventTo >= m_profilerModelProxy->count()) {
|
||||
m_currentSelection.eventIndex = -1;
|
||||
@@ -398,18 +398,18 @@ void TimelineRenderer::manageHovered(int mouseX, int mouseY)
|
||||
// find if we are in the right column
|
||||
int itemRow;
|
||||
for (int i=eventTo; i>=eventFrom; --i) {
|
||||
itemRow = modelRowStart + m_profilerModelProxy->getEventRow(modelIndex, i);
|
||||
itemRow = modelRowStart + m_profilerModelProxy->row(modelIndex, i);
|
||||
|
||||
if (itemRow == row) {
|
||||
// There can be small events that don't reach the cursor position after large events
|
||||
// that do but are in a different row.
|
||||
qint64 itemEnd = m_profilerModelProxy->getEndTime(modelIndex, i);
|
||||
qint64 itemEnd = m_profilerModelProxy->endTime(modelIndex, i);
|
||||
if (itemEnd < startTime)
|
||||
continue;
|
||||
|
||||
// match
|
||||
m_currentSelection.eventIndex = i;
|
||||
m_currentSelection.startTime = m_profilerModelProxy->getStartTime(modelIndex, i);
|
||||
m_currentSelection.startTime = m_profilerModelProxy->startTime(modelIndex, i);
|
||||
m_currentSelection.endTime = itemEnd;
|
||||
m_currentSelection.row = row;
|
||||
m_currentSelection.modelIndex = modelIndex;
|
||||
@@ -450,7 +450,7 @@ int TimelineRenderer::getYPosition(int modelIndex, int index) const
|
||||
modelRowStart += m_profilerModelProxy->height(mi);
|
||||
|
||||
return modelRowStart + m_profilerModelProxy->rowOffset(modelIndex,
|
||||
m_profilerModelProxy->getEventRow(modelIndex, index));
|
||||
m_profilerModelProxy->row(modelIndex, index));
|
||||
}
|
||||
|
||||
void TimelineRenderer::selectNext()
|
||||
@@ -460,7 +460,7 @@ void TimelineRenderer::selectNext()
|
||||
|
||||
qint64 searchTime = m_startTime;
|
||||
if (m_selectedItem != -1)
|
||||
searchTime = m_profilerModelProxy->getStartTime(m_selectedModel, m_selectedItem);
|
||||
searchTime = m_profilerModelProxy->startTime(m_selectedModel, m_selectedItem);
|
||||
|
||||
QVarLengthArray<int> itemIndexes(m_profilerModelProxy->modelCount());
|
||||
for (int i = 0; i < m_profilerModelProxy->modelCount(); i++) {
|
||||
@@ -468,10 +468,10 @@ void TimelineRenderer::selectNext()
|
||||
if (m_selectedModel == i) {
|
||||
itemIndexes[i] = (m_selectedItem + 1) % m_profilerModelProxy->count(i);
|
||||
} else {
|
||||
if (m_profilerModelProxy->getStartTime(i, 0) > searchTime)
|
||||
if (m_profilerModelProxy->startTime(i, 0) > searchTime)
|
||||
itemIndexes[i] = 0;
|
||||
else
|
||||
itemIndexes[i] = (m_profilerModelProxy->findLastIndex(i, searchTime) + 1) % m_profilerModelProxy->count(i);
|
||||
itemIndexes[i] = (m_profilerModelProxy->lastIndex(i, searchTime) + 1) % m_profilerModelProxy->count(i);
|
||||
}
|
||||
} else {
|
||||
itemIndexes[i] = -1;
|
||||
@@ -483,7 +483,7 @@ void TimelineRenderer::selectNext()
|
||||
for (int i = 0; i < m_profilerModelProxy->modelCount(); i++) {
|
||||
if (itemIndexes[i] == -1)
|
||||
continue;
|
||||
qint64 newStartTime = m_profilerModelProxy->getStartTime(i, itemIndexes[i]);
|
||||
qint64 newStartTime = m_profilerModelProxy->startTime(i, itemIndexes[i]);
|
||||
if (newStartTime > searchTime && newStartTime < candidateStartTime) {
|
||||
candidateStartTime = newStartTime;
|
||||
candidateModelIndex = i;
|
||||
@@ -499,10 +499,10 @@ void TimelineRenderer::selectNext()
|
||||
candidateStartTime = m_profilerModelProxy->traceEndTime();
|
||||
for (int i = 0; i < m_profilerModelProxy->modelCount(); i++)
|
||||
if (m_profilerModelProxy->count(i) > 0 &&
|
||||
m_profilerModelProxy->getStartTime(i,0) < candidateStartTime) {
|
||||
m_profilerModelProxy->startTime(i,0) < candidateStartTime) {
|
||||
candidateModelIndex = i;
|
||||
itemIndex = 0;
|
||||
candidateStartTime = m_profilerModelProxy->getStartTime(i,0);
|
||||
candidateStartTime = m_profilerModelProxy->startTime(i,0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ void TimelineRenderer::selectPrev()
|
||||
|
||||
qint64 searchTime = m_endTime;
|
||||
if (m_selectedItem != -1)
|
||||
searchTime = m_profilerModelProxy->getStartTime(m_selectedModel, m_selectedItem);
|
||||
searchTime = m_profilerModelProxy->startTime(m_selectedModel, m_selectedItem);
|
||||
|
||||
QVarLengthArray<int> itemIndexes(m_profilerModelProxy->modelCount());
|
||||
for (int i = 0; i < m_profilerModelProxy->modelCount(); i++) {
|
||||
@@ -526,7 +526,7 @@ void TimelineRenderer::selectPrev()
|
||||
itemIndexes[i] = m_profilerModelProxy->count(m_selectedModel) -1;
|
||||
}
|
||||
else
|
||||
itemIndexes[i] = m_profilerModelProxy->findLastIndex(i, searchTime);
|
||||
itemIndexes[i] = m_profilerModelProxy->lastIndex(i, searchTime);
|
||||
}
|
||||
|
||||
int candidateModelIndex = -1;
|
||||
@@ -535,7 +535,7 @@ void TimelineRenderer::selectPrev()
|
||||
if (itemIndexes[i] == -1
|
||||
|| itemIndexes[i] >= m_profilerModelProxy->count(i))
|
||||
continue;
|
||||
qint64 newStartTime = m_profilerModelProxy->getStartTime(i, itemIndexes[i]);
|
||||
qint64 newStartTime = m_profilerModelProxy->startTime(i, itemIndexes[i]);
|
||||
if (newStartTime < searchTime && newStartTime > candidateStartTime) {
|
||||
candidateStartTime = newStartTime;
|
||||
candidateModelIndex = i;
|
||||
@@ -551,10 +551,10 @@ void TimelineRenderer::selectPrev()
|
||||
candidateStartTime = m_profilerModelProxy->traceStartTime();
|
||||
for (int i = 0; i < m_profilerModelProxy->modelCount(); i++)
|
||||
if (m_profilerModelProxy->count(i) > 0 &&
|
||||
m_profilerModelProxy->getStartTime(i,m_profilerModelProxy->count(i)-1) > candidateStartTime) {
|
||||
m_profilerModelProxy->startTime(i,m_profilerModelProxy->count(i)-1) > candidateStartTime) {
|
||||
candidateModelIndex = i;
|
||||
itemIndex = m_profilerModelProxy->count(candidateModelIndex) - 1;
|
||||
candidateStartTime = m_profilerModelProxy->getStartTime(i,m_profilerModelProxy->count(i)-1);
|
||||
candidateStartTime = m_profilerModelProxy->startTime(i,m_profilerModelProxy->count(i)-1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,7 +565,7 @@ int TimelineRenderer::nextItemFromId(int modelIndex, int eventId) const
|
||||
{
|
||||
int ndx = -1;
|
||||
if (m_selectedItem == -1)
|
||||
ndx = m_profilerModelProxy->findFirstIndexNoParents(modelIndex, m_startTime);
|
||||
ndx = m_profilerModelProxy->firstIndexNoParents(modelIndex, m_startTime);
|
||||
else
|
||||
ndx = m_selectedItem + 1;
|
||||
if (ndx < 0)
|
||||
@@ -574,7 +574,7 @@ int TimelineRenderer::nextItemFromId(int modelIndex, int eventId) const
|
||||
ndx = 0;
|
||||
int startIndex = ndx;
|
||||
do {
|
||||
if (m_profilerModelProxy->getEventId(modelIndex, ndx) == eventId)
|
||||
if (m_profilerModelProxy->eventId(modelIndex, ndx) == eventId)
|
||||
return ndx;
|
||||
ndx = (ndx + 1) % m_profilerModelProxy->count(modelIndex);
|
||||
} while (ndx != startIndex);
|
||||
@@ -585,14 +585,14 @@ int TimelineRenderer::prevItemFromId(int modelIndex, int eventId) const
|
||||
{
|
||||
int ndx = -1;
|
||||
if (m_selectedItem == -1)
|
||||
ndx = m_profilerModelProxy->findFirstIndexNoParents(modelIndex, m_startTime);
|
||||
ndx = m_profilerModelProxy->firstIndexNoParents(modelIndex, m_startTime);
|
||||
else
|
||||
ndx = m_selectedItem - 1;
|
||||
if (ndx < 0)
|
||||
ndx = m_profilerModelProxy->count(modelIndex) - 1;
|
||||
int startIndex = ndx;
|
||||
do {
|
||||
if (m_profilerModelProxy->getEventId(modelIndex, ndx) == eventId)
|
||||
if (m_profilerModelProxy->eventId(modelIndex, ndx) == eventId)
|
||||
return ndx;
|
||||
if (--ndx < 0)
|
||||
ndx = m_profilerModelProxy->count(modelIndex)-1;
|
||||
|
||||
Reference in New Issue
Block a user