diff options
author | Kai Koehne <kai.koehne@digia.com> | 2013-06-13 15:54:09 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@digia.com> | 2013-06-18 10:39:34 +0300 |
commit | f7200fd825de8bd991082a24796e934be61be9db (patch) | |
tree | 00adeb8b63c0498b13a07fdbaa768816aa82b5f2 | |
parent | bd5e7091895a7e3e31add4577233ef9c781ea5a4 (diff) | |
download | qt-creator-f7200fd825de8bd991082a24796e934be61be9db.tar.gz |
QmlProfiler: Re-use 2.7 translations
Change-Id: I269b60d39d53c25928380714f9fdafeca12b19a7
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r-- | plugins/qmlprofiler/qmlprofilereventview.cpp | 64 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilereventview.h | 17 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp | 8 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp | 18 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilertreeview.cpp | 45 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilertreeview.h | 23 | ||||
-rw-r--r-- | plugins/qmlprofiler/qv8profilerdatamodel.cpp | 8 | ||||
-rw-r--r-- | plugins/qmlprofiler/qv8profilerdatamodel.h | 2 | ||||
-rw-r--r-- | plugins/qmlprofiler/qv8profilereventview.cpp | 76 | ||||
-rw-r--r-- | plugins/qmlprofiler/qv8profilereventview.h | 16 |
10 files changed, 156 insertions, 121 deletions
diff --git a/plugins/qmlprofiler/qmlprofilereventview.cpp b/plugins/qmlprofiler/qmlprofilereventview.cpp index 0a13ce7748..07f1309518 100644 --- a/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -353,10 +353,10 @@ QmlProfilerEventsMainView::QmlProfilerEventsMainView(QWidget *parent, setFieldViewable(Name, true); setFieldViewable(Type, true); - setFieldViewable(Percent, true); - setFieldViewable(TotalDuration, true); - setFieldViewable(SelfPercent, false); - setFieldViewable(SelfDuration, false); + setFieldViewable(TimeInPercent, true); + setFieldViewable(TotalTime, true); + setFieldViewable(SelfTimeInPercent, false); + setFieldViewable(SelfTime, false); setFieldViewable(CallCount, true); setFieldViewable(TimePerCall, true); setFieldViewable(MaxTime, true); @@ -400,53 +400,53 @@ void QmlProfilerEventsMainView::setHeaderLabels() d->m_columnIndex.clear(); if (d->m_fieldShown[Name]) { d->m_columnIndex[Name] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Location"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(Location))); d->m_firstNumericColumn++; } if (d->m_fieldShown[Type]) { d->m_columnIndex[Type] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Type"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(Type))); d->m_firstNumericColumn++; } - if (d->m_fieldShown[Percent]) { - d->m_columnIndex[Percent] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time in Percent"))); + if (d->m_fieldShown[TimeInPercent]) { + d->m_columnIndex[TimeInPercent] = fieldIndex; + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(TimeInPercent))); } - if (d->m_fieldShown[TotalDuration]) { - d->m_columnIndex[TotalDuration] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Total Time"))); + if (d->m_fieldShown[TotalTime]) { + d->m_columnIndex[TotalTime] = fieldIndex; + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(TotalTime))); } - if (d->m_fieldShown[SelfPercent]) { + if (d->m_fieldShown[SelfTimeInPercent]) { d->m_columnIndex[Type] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Self Time in Percent"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(SelfTimeInPercent))); } - if (d->m_fieldShown[SelfDuration]) { - d->m_columnIndex[SelfDuration] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Self Time"))); + if (d->m_fieldShown[SelfTime]) { + d->m_columnIndex[SelfTime] = fieldIndex; + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(SelfTime))); } if (d->m_fieldShown[CallCount]) { d->m_columnIndex[CallCount] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Calls"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(CallCount))); } if (d->m_fieldShown[TimePerCall]) { d->m_columnIndex[TimePerCall] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Mean Time"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(TimePerCall))); } if (d->m_fieldShown[MedianTime]) { d->m_columnIndex[MedianTime] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Median Time"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(MedianTime))); } if (d->m_fieldShown[MaxTime]) { d->m_columnIndex[MaxTime] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Longest Time"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(MaxTime))); } if (d->m_fieldShown[MinTime]) { d->m_columnIndex[MinTime] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Shortest Time"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(MinTime))); } if (d->m_fieldShown[Details]) { d->m_columnIndex[Details] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Details"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(Details))); } } @@ -542,12 +542,12 @@ void QmlProfilerEventsMainView::parseModelProxy() newRow.last()->setToolTip(toolTipText); } - if (d->m_fieldShown[Percent]) { + if (d->m_fieldShown[TimeInPercent]) { newRow << new EventsViewItem(QString::number(event.percentOfTime,'f',2)+QLatin1String(" %")); newRow.last()->setData(QVariant(event.percentOfTime)); } - if (d->m_fieldShown[TotalDuration]) { + if (d->m_fieldShown[TotalTime]) { newRow << new EventsViewItem(displayTime(event.duration)); newRow.last()->setData(QVariant(event.duration)); } @@ -887,21 +887,21 @@ void QmlProfilerEventRelativesView::updateHeader() int columnIndex = 0; if (calleesView) - treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Callee"))); + treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(Callee))); else - treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Caller"))); + treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(Caller))); - treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Type"))); + treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(Type))); - treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Total Time"))); + treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(TotalTime))); - treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Calls"))); + treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(CallCount))); if (calleesView) - treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Callee Description"))); + treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(CalleeDescription))); else - treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Caller Description"))); + treeModel()->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(CallerDescription))); } } diff --git a/plugins/qmlprofiler/qmlprofilereventview.h b/plugins/qmlprofiler/qmlprofilereventview.h index 8294a5f30e..ef3c4d8596 100644 --- a/plugins/qmlprofiler/qmlprofilereventview.h +++ b/plugins/qmlprofiler/qmlprofilereventview.h @@ -104,23 +104,6 @@ class QmlProfilerEventsMainView : public QmlProfilerTreeView { Q_OBJECT public: - enum Fields { - Name, - Type, - Percent, - TotalDuration, - SelfPercent, - SelfDuration, - CallCount, - TimePerCall, - MaxTime, - MinTime, - MedianTime, - Details, - - MaxFields - }; - explicit QmlProfilerEventsMainView(QWidget *parent, QmlProfilerEventsModelProxy *modelProxy); ~QmlProfilerEventsMainView(); diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp index 28bfa1eb57..21aa33d5f5 100644 --- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp +++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp @@ -30,6 +30,7 @@ #include "qmlprofilerpainteventsmodelproxy.h" #include "qmlprofilermodelmanager.h" #include "qmlprofilersimplemodel.h" +#include <QCoreApplication> #include <QVector> #include <QHash> @@ -387,6 +388,7 @@ const QVariantList PaintEventsModelProxy::getEventDetails(int index) const QVariantList result; // int eventId = getEventId(index); + static const char trContext[] = "RangeDetails"; { QVariantMap valuePair; valuePair.insert(QLatin1String("title"), QVariant(categoryLabel(0))); @@ -396,21 +398,21 @@ const QVariantList PaintEventsModelProxy::getEventDetails(int index) const // duration { QVariantMap valuePair; - valuePair.insert(tr("Duration:"), QVariant(d->displayTime(d->eventList[index].duration))); + valuePair.insert(QCoreApplication::translate(trContext, "Duration:"), QVariant(d->displayTime(d->eventList[index].duration))); result << valuePair; } // duration { QVariantMap valuePair; - valuePair.insert(tr("Framerate:"), QVariant(QString::fromLatin1("%1 FPS").arg(d->eventList[index].framerate))); + valuePair.insert(QCoreApplication::translate(trContext, "Framerate:"), QVariant(QString::fromLatin1("%1 FPS").arg(d->eventList[index].framerate))); result << valuePair; } // duration { QVariantMap valuePair; - valuePair.insert(tr("Animations:"), QVariant(QString::fromLatin1("%1").arg(d->eventList[index].animationcount))); + valuePair.insert(QCoreApplication::translate(trContext, "Animations:"), QVariant(QString::fromLatin1("%1").arg(d->eventList[index].animationcount))); result << valuePair; } diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp index fc4ea6cabf..a1655547c4 100644 --- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp +++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp @@ -31,6 +31,7 @@ #include "qmlprofilermodelmanager.h" #include "qmlprofilersimplemodel.h" +#include <QCoreApplication> #include <QVector> #include <QHash> #include <QUrl> @@ -434,11 +435,11 @@ int BasicTimelineModel::categoryCount() const const QString BasicTimelineModel::categoryLabel(int categoryIndex) const { switch (categoryIndex) { - case 0: return tr("Painting"); break; - case 1: return tr("Compiling"); break; - case 2: return tr("Creating"); break; - case 3: return tr("Binding"); break; - case 4: return tr("Handling Signal"); break; + case 0: return QCoreApplication::translate("MainView", "Painting"); break; + case 1: return QCoreApplication::translate("MainView", "Compiling"); break; + case 2: return QCoreApplication::translate("MainView", "Creating"); break; + case 3: return QCoreApplication::translate("MainView", "Binding"); break; + case 4: return QCoreApplication::translate("MainView", "Handling Signal"); break; default: return QString(); } } @@ -627,6 +628,7 @@ const QVariantList BasicTimelineModel::getEventDetails(int index) const QVariantList result; int eventId = getEventId(index); + static const char trContext[] = "RangeDetails"; { QVariantMap valuePair; valuePair.insert(QLatin1String("title"), QVariant(categoryLabel(d->eventDict[eventId].eventType))); @@ -636,7 +638,7 @@ const QVariantList BasicTimelineModel::getEventDetails(int index) const // duration { QVariantMap valuePair; - valuePair.insert(tr("Duration:"), QVariant(d->displayTime(d->startTimeData[index].duration))); + valuePair.insert(QCoreApplication::translate(trContext, "Duration:"), QVariant(d->displayTime(d->startTimeData[index].duration))); result << valuePair; } @@ -646,14 +648,14 @@ const QVariantList BasicTimelineModel::getEventDetails(int index) const QString detailsString = d->eventDict[eventId].details; if (detailsString.length() > 40) detailsString = detailsString.left(40) + QLatin1String("..."); - valuePair.insert(tr("Details:"), QVariant(detailsString)); + valuePair.insert(QCoreApplication::translate(trContext, "Details:"), QVariant(detailsString)); result << valuePair; } // location { QVariantMap valuePair; - valuePair.insert(tr("Location:"), QVariant(d->eventDict[eventId].displayName)); + valuePair.insert(QCoreApplication::translate(trContext, "Location:"), QVariant(d->eventDict[eventId].displayName)); result << valuePair; } diff --git a/plugins/qmlprofiler/qmlprofilertreeview.cpp b/plugins/qmlprofiler/qmlprofilertreeview.cpp index 2409e4383d..0d10bbb4e9 100644 --- a/plugins/qmlprofiler/qmlprofilertreeview.cpp +++ b/plugins/qmlprofiler/qmlprofilertreeview.cpp @@ -28,6 +28,7 @@ ****************************************************************************/ #include "qmlprofilertreeview.h" +#include <QCoreApplication> #include <QHeaderView> namespace QmlProfiler { @@ -42,5 +43,49 @@ QmlProfilerTreeView::QmlProfilerTreeView(QWidget *parent) header()->setMinimumSectionSize(50); } + +// Translate from "old" context to keep 2.8 string freeze +QString QmlProfilerTreeView::displayHeader(Fields header) const +{ + static const char ctxt1[] = "QmlProfiler::Internal::QmlProfilerEventsParentsAndChildrenView"; + static const char ctxt2[] = "QmlProfiler::Internal::QmlProfilerEventsMainView"; + + switch (header) { + case Callee: + return QCoreApplication::translate(ctxt1, "Callee"); + case CalleeDescription: + return QCoreApplication::translate(ctxt1, "Callee Description"); + case Caller: + return QCoreApplication::translate(ctxt1, "Caller"); + case CallerDescription: + return QCoreApplication::translate(ctxt1, "Caller Description"); + case CallCount: + return QCoreApplication::translate(ctxt2, "Calls"); + case Details: + return QCoreApplication::translate(ctxt2, "Details"); + case Location: + return QCoreApplication::translate(ctxt2, "Location"); + case MaxTime: + return QCoreApplication::translate(ctxt2, "Longest Time"); + case TimePerCall: + return QCoreApplication::translate(ctxt2, "Mean Time"); + case SelfTime: + return QCoreApplication::translate(ctxt2, "Self Time"); + case SelfTimeInPercent: + return QCoreApplication::translate(ctxt2, "Self Time in Percent"); + case MinTime: + return QCoreApplication::translate(ctxt2, "Shortest Time"); + case TimeInPercent: + return QCoreApplication::translate(ctxt2, "Time in Percent"); + case TotalTime: + return QCoreApplication::translate(ctxt2, "Total Time"); + case Type: + return QCoreApplication::translate(ctxt2, "Type"); + case MedianTime: + return QCoreApplication::translate(ctxt2, "Median Time"); + } + return QString(); +} + } // namespace Internal } // namespace QmlProfiler diff --git a/plugins/qmlprofiler/qmlprofilertreeview.h b/plugins/qmlprofiler/qmlprofilertreeview.h index d0c5995963..73b2b5d769 100644 --- a/plugins/qmlprofiler/qmlprofilertreeview.h +++ b/plugins/qmlprofiler/qmlprofilertreeview.h @@ -41,6 +41,29 @@ class QmlProfilerTreeView : public QTreeView protected: QmlProfilerTreeView(QWidget *parent = 0); + + + enum Fields { + Name, + Callee, + CalleeDescription, + Caller, + CallerDescription, + CallCount, + Details, + Location, + MaxTime, + TimePerCall, + SelfTime, + SelfTimeInPercent, + MinTime, + TimeInPercent, + TotalTime, + Type, + MedianTime, + MaxFields + }; + QString displayHeader(Fields header) const; }; } // namespace Internal diff --git a/plugins/qmlprofiler/qv8profilerdatamodel.cpp b/plugins/qmlprofiler/qv8profilerdatamodel.cpp index ac90fd00e0..ab4c7b8fa8 100644 --- a/plugins/qmlprofiler/qv8profilerdatamodel.cpp +++ b/plugins/qmlprofiler/qv8profilerdatamodel.cpp @@ -63,7 +63,7 @@ QV8EventData &QV8EventData::operator=(const QV8EventData &ref) totalTime = ref.totalTime; totalPercent = ref.totalPercent; selfTime = ref.selfTime; - selfPercent = ref.selfPercent; + SelfTimeInPercent = ref.SelfTimeInPercent; eventId = ref.eventId; qDeleteAll(parentHash); @@ -82,7 +82,7 @@ QV8EventData::QV8EventData() totalTime = 0; selfTime = 0; totalPercent = 0; - selfPercent = 0; + SelfTimeInPercent = 0; } QV8EventData::~QV8EventData() @@ -263,7 +263,7 @@ void QV8ProfilerDataModel::QV8ProfilerDataModelPrivate::collectV8Statistics() foreach (QV8EventData *v8event, v8EventHash.values()) { v8event->totalPercent = v8event->totalTime * 100.0 / totalTimes; - v8event->selfPercent = v8event->selfTime * 100.0 / selfTimes; + v8event->SelfTimeInPercent = v8event->selfTime * 100.0 / selfTimes; } int index = 0; @@ -293,7 +293,7 @@ void QV8ProfilerDataModel::QV8ProfilerDataModelPrivate::clearV8RootEvent() v8RootEvent.totalTime = 0; v8RootEvent.totalPercent = 0; v8RootEvent.selfTime = 0; - v8RootEvent.selfPercent = 0; + v8RootEvent.SelfTimeInPercent = 0; v8RootEvent.eventId = -1; qDeleteAll(v8RootEvent.parentHash.values()); diff --git a/plugins/qmlprofiler/qv8profilerdatamodel.h b/plugins/qmlprofiler/qv8profilerdatamodel.h index 0dc44ba3ad..633c2107f2 100644 --- a/plugins/qmlprofiler/qv8profilerdatamodel.h +++ b/plugins/qmlprofiler/qv8profilerdatamodel.h @@ -54,7 +54,7 @@ struct QV8EventData double totalTime; // given in milliseconds double totalPercent; double selfTime; - double selfPercent; + double SelfTimeInPercent; QHash <QString, QV8EventSub *> parentHash; QHash <QString, QV8EventSub *> childrenHash; int eventId; diff --git a/plugins/qmlprofiler/qv8profilereventview.cpp b/plugins/qmlprofiler/qv8profilereventview.cpp index e50c533e02..7888f00e0a 100644 --- a/plugins/qmlprofiler/qv8profilereventview.cpp +++ b/plugins/qmlprofiler/qv8profilereventview.cpp @@ -197,8 +197,8 @@ void QV8ProfilerEventsWidget::contextMenuEvent(QContextMenuEvent *ev) if (mouseOnTable(position)) { menu.addSeparator(); if (selectedItem().isValid()) - copyRowAction = menu.addAction(tr("Copy Row")); - copyTableAction = menu.addAction(tr("Copy Table")); + copyRowAction = menu.addAction(QCoreApplication::translate("QmlProfiler::Internal::QmlProfilerEventsWidget", "Copy Row")); + copyTableAction = menu.addAction(QCoreApplication::translate("QmlProfiler::Internal::QmlProfilerEventsWidget", "Copy Table")); } QAction *selectedAction = menu.exec(position); @@ -293,10 +293,10 @@ QV8ProfilerEventsMainView::QV8ProfilerEventsMainView(QWidget *parent, setFieldViewable(Name, true); setFieldViewable(Type, false); - setFieldViewable(Percent, true); - setFieldViewable(TotalDuration, true); - setFieldViewable(SelfPercent, true); - setFieldViewable(SelfDuration, true); + setFieldViewable(TimeInPercent, true); + setFieldViewable(TotalTime, true); + setFieldViewable(SelfTimeInPercent, true); + setFieldViewable(SelfTime, true); setFieldViewable(CallCount, false); setFieldViewable(TimePerCall, false); setFieldViewable(MaxTime, false); @@ -335,53 +335,53 @@ void QV8ProfilerEventsMainView::setHeaderLabels() d->m_columnIndex.clear(); if (d->m_fieldShown[Name]) { d->m_columnIndex[Name] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Location"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(Location))); d->m_firstNumericColumn++; } if (d->m_fieldShown[Type]) { d->m_columnIndex[Type] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Type"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(Type))); d->m_firstNumericColumn++; } - if (d->m_fieldShown[Percent]) { - d->m_columnIndex[Percent] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time in Percent"))); + if (d->m_fieldShown[TimeInPercent]) { + d->m_columnIndex[TimeInPercent] = fieldIndex; + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(TimeInPercent))); } - if (d->m_fieldShown[TotalDuration]) { - d->m_columnIndex[TotalDuration] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Total Time"))); + if (d->m_fieldShown[TotalTime]) { + d->m_columnIndex[TotalTime] = fieldIndex; + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(TotalTime))); } - if (d->m_fieldShown[SelfPercent]) { + if (d->m_fieldShown[SelfTimeInPercent]) { d->m_columnIndex[Type] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Self Time in Percent"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(SelfTimeInPercent))); } - if (d->m_fieldShown[SelfDuration]) { - d->m_columnIndex[SelfDuration] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Self Time"))); + if (d->m_fieldShown[SelfTime]) { + d->m_columnIndex[SelfTime] = fieldIndex; + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(SelfTime))); } if (d->m_fieldShown[CallCount]) { d->m_columnIndex[CallCount] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Calls"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(CallCount))); } if (d->m_fieldShown[TimePerCall]) { d->m_columnIndex[TimePerCall] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Mean Time"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(TimePerCall))); } if (d->m_fieldShown[MedianTime]) { d->m_columnIndex[MedianTime] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Median Time"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(MedianTime))); } if (d->m_fieldShown[MaxTime]) { d->m_columnIndex[MaxTime] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Longest Time"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(MaxTime))); } if (d->m_fieldShown[MinTime]) { d->m_columnIndex[MinTime] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Shortest Time"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(MinTime))); } if (d->m_fieldShown[Details]) { d->m_columnIndex[Details] = fieldIndex; - d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Details"))); + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(displayHeader(Details))); } } @@ -430,22 +430,22 @@ void QV8ProfilerEventsMainView::QV8ProfilerEventsMainViewPrivate::buildV8ModelFr if (m_fieldShown[Name]) newRow << new EventsViewItem(v8event->displayName); - if (m_fieldShown[Percent]) { + if (m_fieldShown[TimeInPercent]) { newRow << new EventsViewItem(QString::number(v8event->totalPercent,'f',2)+QLatin1String(" %")); newRow.last()->setData(QVariant(v8event->totalPercent)); } - if (m_fieldShown[TotalDuration]) { + if (m_fieldShown[TotalTime]) { newRow << new EventsViewItem(displayTime(v8event->totalTime)); newRow.last()->setData(QVariant(v8event->totalTime)); } - if (m_fieldShown[SelfPercent]) { - newRow << new EventsViewItem(QString::number(v8event->selfPercent,'f',2)+QLatin1String(" %")); - newRow.last()->setData(QVariant(v8event->selfPercent)); + if (m_fieldShown[SelfTimeInPercent]) { + newRow << new EventsViewItem(QString::number(v8event->SelfTimeInPercent,'f',2)+QLatin1String(" %")); + newRow.last()->setData(QVariant(v8event->SelfTimeInPercent)); } - if (m_fieldShown[SelfDuration]) { + if (m_fieldShown[SelfTime]) { newRow << new EventsViewItem(displayTime(v8event->selfTime)); newRow.last()->setData(QVariant(v8event->selfTime)); } @@ -716,20 +716,16 @@ void QV8ProfilerEventRelativesView::updateHeader() int columnIndex = 0; if (m_type == ChildrenView) - m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Callee"))); + m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(Callee))); else - m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Caller"))); + m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(Caller))); - m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Type"))); - - m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Total Time"))); - - m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Calls"))); + m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(TotalTime))); if (m_type == ChildrenView) - m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Callee Description"))); + m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(CalleeDescription))); else - m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(tr("Caller Description"))); + m_model->setHeaderData(columnIndex++, Qt::Horizontal, QVariant(displayHeader(CallerDescription))); } void QV8ProfilerEventRelativesView::jumpToItem(const QModelIndex &index) diff --git a/plugins/qmlprofiler/qv8profilereventview.h b/plugins/qmlprofiler/qv8profilereventview.h index 25db4efed4..da52f5e4c3 100644 --- a/plugins/qmlprofiler/qv8profilereventview.h +++ b/plugins/qmlprofiler/qv8profilereventview.h @@ -88,22 +88,6 @@ class QV8ProfilerEventsMainView : public QmlProfilerTreeView { Q_OBJECT public: - enum Fields { - Name, - Type, - Percent, - TotalDuration, - SelfPercent, - SelfDuration, - CallCount, - TimePerCall, - MaxTime, - MinTime, - MedianTime, - Details, - - MaxFields - }; explicit QV8ProfilerEventsMainView(QWidget *parent, QV8ProfilerDataModel *v8Model); |