QmlProfiler: Show placeholder labels in select locations

The "<bytecode>" and "Source code not available" labels should not be
added to the model as otherwise they end up in trace files. Instead the
view should show them instead of empty strings where it makes sense.

Change-Id: I37a0c8468ead0194771556d9276c24cb7f05c061
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-07-02 13:57:10 +02:00
parent 7394211603
commit ccf871aa20
4 changed files with 14 additions and 12 deletions

View File

@@ -64,9 +64,8 @@ Item {
var extdesc=[];
var labelList = qmlProfilerModelProxy.getLabels(modelIndex);
for (var i = 0; i < labelList.length; i++ ) {
desc[i] = labelList[i].description;
extdesc[i] = desc[i] = (labelList[i].description || qsTr("<bytecode>"));
ids[i] = labelList[i].id;
extdesc[i] = labelList[i].description;
if (labelList[i].displayName !== undefined)
extdesc[i] += " (" + labelList[i].displayName + ")";
}

View File

@@ -68,8 +68,10 @@ Item {
rangeDetails.dialogTitle = eventData[0]["title"];
for (var i = 1; i < eventData.length; i++) {
for (var k in eventData[i]) {
eventInfo.append({"content" : k});
eventInfo.append({"content" : eventData[i][k]})
if (eventData[i][k].length > 0) {
eventInfo.append({"content" : k});
eventInfo.append({"content" : eventData[i][k]});
}
}
}
rangeDetails.visible = true;

View File

@@ -69,10 +69,7 @@ QString getDisplayName(const QmlProfilerDataModel::QmlEventTypeData &event)
const QmlDebug::QmlEventLocation eventLocation = getLocation(event);
QString displayName;
// generate hash
if (eventLocation.filename.isEmpty()) {
displayName = QmlProfilerDataModel::tr("<bytecode>");
} else {
if (!eventLocation.filename.isEmpty()) {
const QString filePath = QUrl(eventLocation.filename).path();
displayName = filePath.mid(filePath.lastIndexOf(QLatin1Char('/')) + 1) + QLatin1Char(':') +
QString::number(eventLocation.line);

View File

@@ -580,7 +580,8 @@ void QmlProfilerEventsMainView::parseModelProxy()
QList<QStandardItem *> newRow;
if (d->m_fieldShown[Name])
newRow << new EventsViewItem(event.displayName);
newRow << new EventsViewItem(event.displayName.isEmpty() ? tr("<bytecode>") :
event.displayName);
if (d->m_fieldShown[Type]) {
QString typeString = QmlProfilerEventsMainView::nameForType(event.rangeType);
@@ -637,7 +638,8 @@ void QmlProfilerEventsMainView::parseModelProxy()
}
if (d->m_fieldShown[Details]) {
newRow << new EventsViewItem(event.data);
newRow << new EventsViewItem(event.data.isEmpty() ? tr("Source code not available") :
event.data);
newRow.last()->setData(QVariant(event.data));
}
@@ -894,11 +896,13 @@ void QmlProfilerEventRelativesView::rebuildTree(
// ToDo: here we were going to search for the data in the other modelproxy
// maybe we should store the data in this proxy and get it here
// no indirections at this level of abstraction!
newRow << new EventsViewItem(type.displayName);
newRow << new EventsViewItem(type.displayName.isEmpty() ? tr("<bytecode>") :
type.displayName);
newRow << new EventsViewItem(QmlProfilerEventsMainView::nameForType(type.rangeType));
newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(event.duration));
newRow << new EventsViewItem(QString::number(event.calls));
newRow << new EventsViewItem(type.data);
newRow << new EventsViewItem(type.data.isEmpty() ? tr("Source code not available") :
type.data);
newRow.at(0)->setData(QVariant(typeIndex), EventTypeIndexRole);
newRow.at(2)->setData(QVariant(event.duration));