From f70f4e6f7cf69853a0b451355a08cd0720dfcdaa Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 13 Jun 2014 19:16:35 +0200 Subject: [PATCH] QmlProfiler: remove "Source code not available." This string crops up in far too many places where it's not supposed to be. If we really need it we should add it to the views in the exact places where we want it instead of writing it into the model. Change-Id: I5f17a2aead7f6c2d42f485bf629baaf759e90547 Reviewed-by: Kai Koehne --- src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp | 7 +++---- src/plugins/qmlprofiler/qmlprofilertracefile.cpp | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp index 089e2e4498a..86d5ef6430b 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp @@ -85,13 +85,12 @@ QString getInitialDetails(const QmlProfilerDataModel::QmlEventTypeData &event) { QString details; // generate details string - if (event.data.isEmpty()) - details = QmlProfilerDataModel::tr("Source code not available."); - else { + if (!event.data.isEmpty()) { details = event.data; details.replace(QLatin1Char('\n'),QLatin1Char(' ')).simplified(); if (details.isEmpty()) { - details = QmlProfilerDataModel::tr("anonymous function"); + if (event.rangeType == QmlDebug::Javascript) + details = QmlProfilerDataModel::tr("anonymous function"); } else { QRegExp rewrite(QLatin1String("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)")); bool match = rewrite.exactMatch(details); diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp index d6b8706a9fd..b101aad4907 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp @@ -451,7 +451,10 @@ void QmlProfilerFileWriter::save(QIODevice *device) stream.writeTextElement(_("line"), QString::number(event.location.line)); stream.writeTextElement(_("column"), QString::number(event.location.column)); } - stream.writeTextElement(_("details"), event.data); + + if (!event.data.isEmpty()) + stream.writeTextElement(_("details"), event.data); + if (event.rangeType == Binding) stream.writeTextElement(_("bindingType"), QString::number(event.detailType)); if (event.message == Event && event.detailType == AnimationFrame)