From ccf871aa200a4147044e46e1245c5d9e5ccd12ef Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 2 Jul 2014 13:57:10 +0200 Subject: [PATCH] QmlProfiler: Show placeholder labels in select locations The "" 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 --- src/plugins/qmlprofiler/qml/CategoryLabel.qml | 3 +-- src/plugins/qmlprofiler/qml/RangeDetails.qml | 6 ++++-- src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp | 5 +---- src/plugins/qmlprofiler/qmlprofilereventview.cpp | 12 ++++++++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/plugins/qmlprofiler/qml/CategoryLabel.qml b/src/plugins/qmlprofiler/qml/CategoryLabel.qml index d3f572ff2d7..c51c24c0f2b 100644 --- a/src/plugins/qmlprofiler/qml/CategoryLabel.qml +++ b/src/plugins/qmlprofiler/qml/CategoryLabel.qml @@ -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("")); ids[i] = labelList[i].id; - extdesc[i] = labelList[i].description; if (labelList[i].displayName !== undefined) extdesc[i] += " (" + labelList[i].displayName + ")"; } diff --git a/src/plugins/qmlprofiler/qml/RangeDetails.qml b/src/plugins/qmlprofiler/qml/RangeDetails.qml index e1627036927..b5bbf4af8b1 100644 --- a/src/plugins/qmlprofiler/qml/RangeDetails.qml +++ b/src/plugins/qmlprofiler/qml/RangeDetails.qml @@ -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; diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp index 9a8e80113d5..92dc82959da 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp @@ -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(""); - } else { + if (!eventLocation.filename.isEmpty()) { const QString filePath = QUrl(eventLocation.filename).path(); displayName = filePath.mid(filePath.lastIndexOf(QLatin1Char('/')) + 1) + QLatin1Char(':') + QString::number(eventLocation.line); diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index 813beaa3bcf..d4bb588478f 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -580,7 +580,8 @@ void QmlProfilerEventsMainView::parseModelProxy() QList newRow; if (d->m_fieldShown[Name]) - newRow << new EventsViewItem(event.displayName); + newRow << new EventsViewItem(event.displayName.isEmpty() ? tr("") : + 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("") : + 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));