forked from qt-creator/qt-creator
QmlProfiler: Convert to using Tr::tr
Change-Id: I9f4f8c0e499eeb1e686d1094f3442c415b845c21 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "debugmessagesmodel.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include <tracing/timelineformattime.h>
|
||||
|
||||
namespace QmlProfiler {
|
||||
@@ -26,17 +27,17 @@ QRgb DebugMessagesModel::color(int index) const
|
||||
}
|
||||
|
||||
static const char *messageTypes[] = {
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Debug Message"),
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Warning Message"),
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Critical Message"),
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Fatal Message"),
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Info Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Debug Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Warning Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Critical Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Fatal Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Info Message"),
|
||||
};
|
||||
|
||||
QString DebugMessagesModel::messageType(uint i)
|
||||
{
|
||||
return i < sizeof(messageTypes) / sizeof(char *) ? tr(messageTypes[i]) :
|
||||
tr("Unknown Message %1").arg(i);
|
||||
return i < sizeof(messageTypes) / sizeof(char *) ? Tr::tr(messageTypes[i]) :
|
||||
Tr::tr("Unknown Message %1").arg(i);
|
||||
}
|
||||
|
||||
QVariantList DebugMessagesModel::labels() const
|
||||
@@ -59,10 +60,10 @@ QVariantMap DebugMessagesModel::details(int index) const
|
||||
|
||||
QVariantMap result;
|
||||
result.insert(QLatin1String("displayName"), messageType(type.detailType()));
|
||||
result.insert(tr("Timestamp"), Timeline::formatTime(startTime(index),
|
||||
result.insert(Tr::tr("Timestamp"), Timeline::formatTime(startTime(index),
|
||||
manager->traceDuration()));
|
||||
result.insert(tr("Message"), m_data[index].text);
|
||||
result.insert(tr("Location"), type.displayName());
|
||||
result.insert(Tr::tr("Message"), m_data[index].text);
|
||||
result.insert(Tr::tr("Location"), type.displayName());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "flamegraphmodel.h"
|
||||
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -149,7 +149,7 @@ void FlameGraphModel::restrictToFeatures(quint64 visibleFeatures)
|
||||
std::bind(&FlameGraphModel::finalize, this),
|
||||
[this](const QString &message) {
|
||||
if (!message.isEmpty()) {
|
||||
emit m_modelManager->error(tr("Could not re-read events from temporary trace file: %1")
|
||||
emit m_modelManager->error(Tr::tr("Could not re-read events from temporary trace file: %1")
|
||||
.arg(message));
|
||||
}
|
||||
endResetModel();
|
||||
@@ -160,11 +160,11 @@ void FlameGraphModel::restrictToFeatures(quint64 visibleFeatures)
|
||||
static QString nameForType(RangeType typeNumber)
|
||||
{
|
||||
switch (typeNumber) {
|
||||
case Compiling: return FlameGraphModel::tr("Compile");
|
||||
case Creating: return FlameGraphModel::tr("Create");
|
||||
case Binding: return FlameGraphModel::tr("Binding");
|
||||
case HandlingSignal: return FlameGraphModel::tr("Signal");
|
||||
case Javascript: return FlameGraphModel::tr("JavaScript");
|
||||
case Compiling: return Tr::tr("Compile");
|
||||
case Creating: return Tr::tr("Create");
|
||||
case Binding: return Tr::tr("Binding");
|
||||
case HandlingSignal: return Tr::tr("Signal");
|
||||
case Javascript: return Tr::tr("JavaScript");
|
||||
default: Q_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const
|
||||
case TypeRole: return nameForType(type.rangeType());
|
||||
case RangeTypeRole: return type.rangeType();
|
||||
case DetailsRole: return type.data().isEmpty() ?
|
||||
FlameGraphModel::tr("Source code not available") : type.data();
|
||||
Tr::tr("Source code not available") : type.data();
|
||||
case LocationRole: return type.displayName();
|
||||
default: return QVariant();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "flamegraphview.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilertool.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <tracing/flamegraph.h>
|
||||
#include <tracing/timelinetheme.h>
|
||||
@@ -22,7 +23,7 @@ FlameGraphView::FlameGraphView(QmlProfilerModelManager *manager, QWidget *parent
|
||||
m_model(new FlameGraphModel(manager, this))
|
||||
{
|
||||
setObjectName("QmlProfiler.FlameGraph.Dock");
|
||||
setWindowTitle(tr("Flame Graph"));
|
||||
setWindowTitle(Tr::tr("Flame Graph"));
|
||||
|
||||
m_content->engine()->addImportPath(":/qt/qml/");
|
||||
Timeline::TimelineTheme::setupTheme(m_content->engine());
|
||||
@@ -63,9 +64,9 @@ void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
|
||||
|
||||
menu.addActions(QmlProfilerTool::profilerContextMenuActions());
|
||||
menu.addSeparator();
|
||||
QAction *getGlobalStatsAction = menu.addAction(tr("Show Full Range"));
|
||||
QAction *getGlobalStatsAction = menu.addAction(Tr::tr("Show Full Range"));
|
||||
getGlobalStatsAction->setEnabled(m_model->modelManager()->isRestrictedToRange());
|
||||
QAction *resetAction = menu.addAction(tr("Reset Flame Graph"));
|
||||
QAction *resetAction = menu.addAction(Tr::tr("Reset Flame Graph"));
|
||||
resetAction->setEnabled(m_content->rootObject()->property("zoomed").toBool());
|
||||
|
||||
const QAction *selected = menu.exec(position);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "inputeventsmodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilereventtypes.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <tracing/timelineformattime.h>
|
||||
|
||||
@@ -36,12 +37,12 @@ QVariantList InputEventsModel::labels() const
|
||||
QVariantList result;
|
||||
|
||||
QVariantMap element;
|
||||
element.insert(QLatin1String("description"), QVariant(tr("Mouse Events")));
|
||||
element.insert(QLatin1String("description"), QVariant(Tr::tr("Mouse Events")));
|
||||
element.insert(QLatin1String("id"), QVariant(Mouse));
|
||||
result << element;
|
||||
|
||||
element.clear();
|
||||
element.insert(QLatin1String("description"), QVariant(tr("Keyboard Events")));
|
||||
element.insert(QLatin1String("description"), QVariant(Tr::tr("Keyboard Events")));
|
||||
element.insert(QLatin1String("id"), QVariant(Key));
|
||||
result << element;
|
||||
|
||||
@@ -56,56 +57,56 @@ QMetaEnum InputEventsModel::metaEnum(const char *name)
|
||||
QVariantMap InputEventsModel::details(int index) const
|
||||
{
|
||||
QVariantMap result;
|
||||
result.insert(tr("Timestamp"), Timeline::formatTime(startTime(index),
|
||||
result.insert(Tr::tr("Timestamp"), Timeline::formatTime(startTime(index),
|
||||
modelManager()->traceDuration()));
|
||||
QString type;
|
||||
const Item &event = m_data[index];
|
||||
switch (event.type) {
|
||||
case InputKeyPress:
|
||||
type = tr("Key Press");
|
||||
type = Tr::tr("Key Press");
|
||||
Q_FALLTHROUGH();
|
||||
case InputKeyRelease:
|
||||
if (type.isEmpty())
|
||||
type = tr("Key Release");
|
||||
type = Tr::tr("Key Release");
|
||||
if (event.a != 0) {
|
||||
result.insert(tr("Key"), QLatin1String(metaEnum("Key").valueToKey(event.a)));
|
||||
result.insert(Tr::tr("Key"), QLatin1String(metaEnum("Key").valueToKey(event.a)));
|
||||
}
|
||||
if (event.b != 0) {
|
||||
result.insert(tr("Modifiers"),
|
||||
result.insert(Tr::tr("Modifiers"),
|
||||
QLatin1String(metaEnum("KeyboardModifiers").valueToKeys(event.b)));
|
||||
}
|
||||
break;
|
||||
case InputMouseDoubleClick:
|
||||
type = tr("Double Click");
|
||||
type = Tr::tr("Double Click");
|
||||
Q_FALLTHROUGH();
|
||||
case InputMousePress:
|
||||
if (type.isEmpty())
|
||||
type = tr("Mouse Press");
|
||||
type = Tr::tr("Mouse Press");
|
||||
Q_FALLTHROUGH();
|
||||
case InputMouseRelease:
|
||||
if (type.isEmpty())
|
||||
type = tr("Mouse Release");
|
||||
result.insert(tr("Button"), QLatin1String(metaEnum("MouseButtons").valueToKey(event.a)));
|
||||
result.insert(tr("Result"), QLatin1String(metaEnum("MouseButtons").valueToKeys(event.b)));
|
||||
type = Tr::tr("Mouse Release");
|
||||
result.insert(Tr::tr("Button"), QLatin1String(metaEnum("MouseButtons").valueToKey(event.a)));
|
||||
result.insert(Tr::tr("Result"), QLatin1String(metaEnum("MouseButtons").valueToKeys(event.b)));
|
||||
break;
|
||||
case InputMouseMove:
|
||||
type = tr("Mouse Move");
|
||||
result.insert(tr("X"), QString::number(event.a));
|
||||
result.insert(tr("Y"), QString::number(event.b));
|
||||
type = Tr::tr("Mouse Move");
|
||||
result.insert(Tr::tr("X"), QString::number(event.a));
|
||||
result.insert(Tr::tr("Y"), QString::number(event.b));
|
||||
break;
|
||||
case InputMouseWheel:
|
||||
type = tr("Mouse Wheel");
|
||||
result.insert(tr("Angle X"), QString::number(event.a));
|
||||
result.insert(tr("Angle Y"), QString::number(event.b));
|
||||
type = Tr::tr("Mouse Wheel");
|
||||
result.insert(Tr::tr("Angle X"), QString::number(event.a));
|
||||
result.insert(Tr::tr("Angle Y"), QString::number(event.b));
|
||||
break;
|
||||
case InputKeyUnknown:
|
||||
type = tr("Keyboard Event");
|
||||
type = Tr::tr("Keyboard Event");
|
||||
break;
|
||||
case InputMouseUnknown:
|
||||
type = tr("Mouse Event");
|
||||
type = Tr::tr("Mouse Event");
|
||||
break;
|
||||
default:
|
||||
type = tr("Unknown");
|
||||
type = Tr::tr("Unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "memoryusagemodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilereventtypes.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -63,12 +64,12 @@ QVariantList MemoryUsageModel::labels() const
|
||||
QVariantList result;
|
||||
|
||||
QVariantMap element;
|
||||
element.insert(QLatin1String("description"), tr("Memory Allocation"));
|
||||
element.insert(QLatin1String("description"), Tr::tr("Memory Allocation"));
|
||||
element.insert(QLatin1String("id"), HeapPage);
|
||||
result << element;
|
||||
|
||||
element.clear();
|
||||
element.insert(QLatin1String("description"), tr("Memory Usage"));
|
||||
element.insert(QLatin1String("description"), Tr::tr("Memory Usage"));
|
||||
element.insert(QLatin1String("id"), SmallItem);
|
||||
result << element;
|
||||
|
||||
@@ -90,30 +91,30 @@ QVariantMap MemoryUsageModel::details(int index) const
|
||||
const Item *ev = &m_data[index];
|
||||
|
||||
if (ev->allocated >= -ev->deallocated)
|
||||
result.insert(QLatin1String("displayName"), tr("Memory Allocated"));
|
||||
result.insert(QLatin1String("displayName"), Tr::tr("Memory Allocated"));
|
||||
else
|
||||
result.insert(QLatin1String("displayName"), tr("Memory Freed"));
|
||||
result.insert(QLatin1String("displayName"), Tr::tr("Memory Freed"));
|
||||
|
||||
result.insert(tr("Total"), tr("%n byte(s)", nullptr, toSameSignedInt(ev->size)));
|
||||
result.insert(Tr::tr("Total"), Tr::tr("%n byte(s)", nullptr, toSameSignedInt(ev->size)));
|
||||
if (ev->allocations > 0) {
|
||||
result.insert(tr("Allocated"), tr("%n byte(s)", nullptr, toSameSignedInt(ev->allocated)));
|
||||
result.insert(tr("Allocations"), ev->allocations);
|
||||
result.insert(Tr::tr("Allocated"), Tr::tr("%n byte(s)", nullptr, toSameSignedInt(ev->allocated)));
|
||||
result.insert(Tr::tr("Allocations"), ev->allocations);
|
||||
}
|
||||
if (ev->deallocations > 0) {
|
||||
result.insert(tr("Deallocated"),
|
||||
tr("%n byte(s)", nullptr, toSameSignedInt(-ev->deallocated)));
|
||||
result.insert(tr("Deallocations"), ev->deallocations);
|
||||
result.insert(Tr::tr("Deallocated"),
|
||||
Tr::tr("%n byte(s)", nullptr, toSameSignedInt(-ev->deallocated)));
|
||||
result.insert(Tr::tr("Deallocations"), ev->deallocations);
|
||||
}
|
||||
QString memoryTypeName;
|
||||
switch (selectionId(index)) {
|
||||
case HeapPage: memoryTypeName = tr("Heap Allocation"); break;
|
||||
case LargeItem: memoryTypeName = tr("Large Item Allocation"); break;
|
||||
case SmallItem: memoryTypeName = tr("Heap Usage"); break;
|
||||
case HeapPage: memoryTypeName = Tr::tr("Heap Allocation"); break;
|
||||
case LargeItem: memoryTypeName = Tr::tr("Large Item Allocation"); break;
|
||||
case SmallItem: memoryTypeName = Tr::tr("Heap Usage"); break;
|
||||
default: Q_UNREACHABLE();
|
||||
}
|
||||
result.insert(tr("Type"), memoryTypeName);
|
||||
result.insert(Tr::tr("Type"), memoryTypeName);
|
||||
|
||||
result.insert(tr("Location"), modelManager()->eventType(ev->typeId).displayName());
|
||||
result.insert(Tr::tr("Location"), modelManager()->eventType(ev->typeId).displayName());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "pixmapcachemodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilereventtypes.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <tracing/timelineformattime.h>
|
||||
|
||||
@@ -71,7 +72,7 @@ QVariantList PixmapCacheModel::labels() const
|
||||
|
||||
// Cache Size
|
||||
QVariantMap element;
|
||||
element.insert(QLatin1String("description"), tr("Cache Size"));
|
||||
element.insert(QLatin1String("description"), Tr::tr("Cache Size"));
|
||||
|
||||
element.insert(QLatin1String("id"), 0);
|
||||
result << element;
|
||||
@@ -95,19 +96,19 @@ QVariantMap PixmapCacheModel::details(int index) const
|
||||
const Item *ev = &m_data[index];
|
||||
|
||||
if (ev->pixmapEventType == PixmapCacheCountChanged) {
|
||||
result.insert(QLatin1String("displayName"), tr("Image Cached"));
|
||||
result.insert(tr("Cache Size"), QString::fromLatin1("%1 px").arg(ev->cacheSize));
|
||||
result.insert(QLatin1String("displayName"), Tr::tr("Image Cached"));
|
||||
result.insert(Tr::tr("Cache Size"), QString::fromLatin1("%1 px").arg(ev->cacheSize));
|
||||
} else {
|
||||
result.insert(QLatin1String("displayName"), tr("Image Loaded"));
|
||||
result.insert(QLatin1String("displayName"), Tr::tr("Image Loaded"));
|
||||
if (m_pixmaps[ev->urlIndex].sizes[ev->sizeIndex].loadState != Finished)
|
||||
result.insert(tr("Result"), tr("Load Error"));
|
||||
result.insert(tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
result.insert(Tr::tr("Result"), Tr::tr("Load Error"));
|
||||
result.insert(Tr::tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
}
|
||||
|
||||
result.insert(tr("File"), getFilenameOnly(m_pixmaps[ev->urlIndex].url));
|
||||
result.insert(tr("Width"), QString::fromLatin1("%1 px")
|
||||
result.insert(Tr::tr("File"), getFilenameOnly(m_pixmaps[ev->urlIndex].url));
|
||||
result.insert(Tr::tr("Width"), QString::fromLatin1("%1 px")
|
||||
.arg(m_pixmaps[ev->urlIndex].sizes[ev->sizeIndex].size.width()));
|
||||
result.insert(tr("Height"), QString::fromLatin1("%1 px")
|
||||
result.insert(Tr::tr("Height"), QString::fromLatin1("%1 px")
|
||||
.arg(m_pixmaps[ev->urlIndex].sizes[ev->sizeIndex].size.height()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -24,21 +24,21 @@ FlameGraphView {
|
||||
]
|
||||
|
||||
trRoleNames: [
|
||||
QmlProfilerFlameGraphModel.DurationRole, qsTr("Total Time"),
|
||||
QmlProfilerFlameGraphModel.CallCountRole, qsTr("Calls"),
|
||||
QmlProfilerFlameGraphModel.DetailsRole, qsTr("Details"),
|
||||
QmlProfilerFlameGraphModel.TimePerCallRole, qsTr("Mean Time"),
|
||||
QmlProfilerFlameGraphModel.TimeInPercentRole, qsTr("In Percent"),
|
||||
QmlProfilerFlameGraphModel.LocationRole, qsTr("Location"),
|
||||
QmlProfilerFlameGraphModel.AllocationsRole, qsTr("Allocations"),
|
||||
QmlProfilerFlameGraphModel.MemoryRole, qsTr("Memory")
|
||||
QmlProfilerFlameGraphModel.DurationRole, qsTranslate("QmlProfiler", "Total Time"),
|
||||
QmlProfilerFlameGraphModel.CallCountRole, qsTranslate("QmlProfiler", "Calls"),
|
||||
QmlProfilerFlameGraphModel.DetailsRole, qsTranslate("QmlProfiler", "Details"),
|
||||
QmlProfilerFlameGraphModel.TimePerCallRole, qsTranslate("QmlProfiler", "Mean Time"),
|
||||
QmlProfilerFlameGraphModel.TimeInPercentRole, qsTranslate("QmlProfiler", "In Percent"),
|
||||
QmlProfilerFlameGraphModel.LocationRole, qsTranslate("QmlProfiler", "Location"),
|
||||
QmlProfilerFlameGraphModel.AllocationsRole, qsTranslate("QmlProfiler", "Allocations"),
|
||||
QmlProfilerFlameGraphModel.MemoryRole, qsTranslate("QmlProfiler", "Memory")
|
||||
].reduce(toMap, {})
|
||||
|
||||
details: function(flameGraph) {
|
||||
var model = [];
|
||||
if (!flameGraph.dataValid) {
|
||||
model.push(trRoleNames[QmlProfilerFlameGraphModel.DetailsRole]);
|
||||
model.push(qsTr("Various Events"));
|
||||
model.push(qsTranslate("QmlProfiler", "Various Events"));
|
||||
} else {
|
||||
function addDetail(role, format) { root.addDetail(role, format, model, flameGraph); }
|
||||
|
||||
@@ -55,7 +55,7 @@ FlameGraphView {
|
||||
|
||||
summary: function(attached) {
|
||||
if (!attached.dataValid)
|
||||
return qsTr("others");
|
||||
return qsTranslate("QmlProfiler", "others");
|
||||
|
||||
return attached.data(QmlProfilerFlameGraphModel.DetailsRole) + " ("
|
||||
+ attached.data(QmlProfilerFlameGraphModel.TypeRole) + ", "
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
|
||||
#include "qmlprofileractions.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilertool.h"
|
||||
#include "qmlprofilerstatemanager.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilerstatemanager.h"
|
||||
#include "qmlprofilertool.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <debugger/analyzer/analyzerconstants.h>
|
||||
|
||||
@@ -25,10 +26,10 @@ QmlProfilerActions::QmlProfilerActions(QObject *parent) : QObject(parent)
|
||||
|
||||
void QmlProfilerActions::attachToTool(QmlProfilerTool *tool)
|
||||
{
|
||||
const QString description = tr("The QML Profiler can be used to find performance "
|
||||
"bottlenecks in applications using QML.");
|
||||
const QString description = Tr::tr("The QML Profiler can be used to find performance "
|
||||
"bottlenecks in applications using QML.");
|
||||
|
||||
m_runAction = std::make_unique<QAction>(tr("QML Profiler"));
|
||||
m_runAction = std::make_unique<QAction>(Tr::tr("QML Profiler"));
|
||||
m_runAction->setToolTip(description);
|
||||
QObject::connect(m_runAction.get(), &QAction::triggered,
|
||||
tool, &QmlProfilerTool::profileStartupProject);
|
||||
@@ -38,16 +39,16 @@ void QmlProfilerActions::attachToTool(QmlProfilerTool *tool)
|
||||
m_runAction->setEnabled(toolStartAction->isEnabled());
|
||||
});
|
||||
|
||||
m_attachAction = std::make_unique<QAction>(tr("QML Profiler (Attach to Waiting Application)"));
|
||||
m_attachAction = std::make_unique<QAction>(Tr::tr("QML Profiler (Attach to Waiting Application)"));
|
||||
m_attachAction->setToolTip(description);
|
||||
QObject::connect(m_attachAction.get(), &QAction::triggered,
|
||||
tool, &QmlProfilerTool::attachToWaitingApplication);
|
||||
|
||||
m_loadQmlTrace = std::make_unique<QAction>(tr("Load QML Trace"));
|
||||
m_loadQmlTrace = std::make_unique<QAction>(Tr::tr("Load QML Trace"));
|
||||
connect(m_loadQmlTrace.get(), &QAction::triggered,
|
||||
tool, &QmlProfilerTool::showLoadDialog, Qt::QueuedConnection);
|
||||
|
||||
m_saveQmlTrace = std::make_unique<QAction>(tr("Save QML Trace"));
|
||||
m_saveQmlTrace = std::make_unique<QAction>(Tr::tr("Save QML Trace"));
|
||||
connect(m_saveQmlTrace.get(), &QAction::triggered,
|
||||
tool, &QmlProfilerTool::showSaveDialog, Qt::QueuedConnection);
|
||||
|
||||
@@ -69,7 +70,7 @@ void QmlProfilerActions::attachToTool(QmlProfilerTool *tool)
|
||||
void QmlProfilerActions::registerActions()
|
||||
{
|
||||
m_options.reset(ActionManager::createMenu("Analyzer.Menu.QMLOptions"));
|
||||
m_options->menu()->setTitle(tr("QML Profiler Options"));
|
||||
m_options->menu()->setTitle(Tr::tr("QML Profiler Options"));
|
||||
m_options->menu()->setEnabled(true);
|
||||
ActionContainer *menu = ActionManager::actionContainer(M_DEBUG_ANALYZER);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "qmlprofileranimationsmodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <tracing/timelineformattime.h>
|
||||
@@ -133,16 +134,16 @@ QVariantList QmlProfilerAnimationsModel::labels() const
|
||||
|
||||
if (m_maxGuiThreadAnimations > 0) {
|
||||
QVariantMap element;
|
||||
element.insert(QLatin1String("displayName"), tr("Animations"));
|
||||
element.insert(QLatin1String("description"), tr("GUI Thread"));
|
||||
element.insert(QLatin1String("displayName"), Tr::tr("Animations"));
|
||||
element.insert(QLatin1String("description"), Tr::tr("GUI Thread"));
|
||||
element.insert(QLatin1String("id"), GuiThread);
|
||||
result << element;
|
||||
}
|
||||
|
||||
if (m_maxRenderThreadAnimations > 0) {
|
||||
QVariantMap element;
|
||||
element.insert(QLatin1String("displayName"), tr("Animations"));
|
||||
element.insert(QLatin1String("description"), tr("Render Thread"));
|
||||
element.insert(QLatin1String("displayName"), Tr::tr("Animations"));
|
||||
element.insert(QLatin1String("description"), Tr::tr("Render Thread"));
|
||||
element.insert(QLatin1String("id"), RenderThread);
|
||||
result << element;
|
||||
}
|
||||
@@ -155,11 +156,11 @@ QVariantMap QmlProfilerAnimationsModel::details(int index) const
|
||||
QVariantMap result;
|
||||
|
||||
result.insert(QStringLiteral("displayName"), displayName());
|
||||
result.insert(tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
result.insert(tr("Framerate"), QString::fromLatin1("%1 FPS").arg(m_data[index].framerate));
|
||||
result.insert(tr("Animations"), QString::number(m_data[index].animationcount));
|
||||
result.insert(tr("Context"), selectionId(index) == GuiThread ? tr("GUI Thread") :
|
||||
tr("Render Thread"));
|
||||
result.insert(Tr::tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
result.insert(Tr::tr("Framerate"), QString::fromLatin1("%1 FPS").arg(m_data[index].framerate));
|
||||
result.insert(Tr::tr("Animations"), QString::number(m_data[index].animationcount));
|
||||
result.insert(Tr::tr("Context"), selectionId(index) == GuiThread ? Tr::tr("GUI Thread") :
|
||||
Tr::tr("Render Thread"));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilerattachdialog.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <projectexplorer/kitchooser.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
@@ -28,7 +29,7 @@ QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
d(new QmlProfilerAttachDialogPrivate)
|
||||
{
|
||||
setWindowTitle(tr("Start QML Profiler"));
|
||||
setWindowTitle(Tr::tr("Start QML Profiler"));
|
||||
|
||||
d->kitChooser = new KitChooser(this);
|
||||
d->kitChooser->setKitPredicate([](const Kit *kit) {
|
||||
@@ -47,14 +48,14 @@ QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
|
||||
auto hint = new QLabel(this);
|
||||
hint->setWordWrap(true);
|
||||
hint->setTextFormat(Qt::RichText);
|
||||
hint->setText(tr("Select an externally started QML-debug enabled application.<p>"
|
||||
"Commonly used command-line arguments are:")
|
||||
hint->setText(Tr::tr("Select an externally started QML-debug enabled application.<p>"
|
||||
"Commonly used command-line arguments are:")
|
||||
+ "<p><tt>-qmljsdebugger=port:<port>,block,<br>"
|
||||
" services:CanvasFrameRate,EngineControl,DebugMessages</tt>");
|
||||
|
||||
auto formLayout = new QFormLayout;
|
||||
formLayout->addRow(tr("Kit:"), d->kitChooser);
|
||||
formLayout->addRow(tr("&Port:"), d->portSpinBox);
|
||||
formLayout->addRow(Tr::tr("Kit:"), d->kitChooser);
|
||||
formLayout->addRow(Tr::tr("&Port:"), d->portSpinBox);
|
||||
|
||||
auto verticalLayout = new QVBoxLayout(this);
|
||||
verticalLayout->addWidget(hint);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilertracefile.h"
|
||||
#include "qmlprofilernotesmodel.h"
|
||||
#include "qmlprofilerdetailsrewriter.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilernotesmodel.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include "qmlprofilertracefile.h"
|
||||
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <tracing/tracestashfile.h>
|
||||
@@ -23,19 +24,19 @@
|
||||
namespace QmlProfiler {
|
||||
|
||||
static const char *ProfileFeatureNames[] = {
|
||||
QT_TRANSLATE_NOOP("MainView", "JavaScript"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Memory Usage"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Pixmap Cache"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Scene Graph"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Animations"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Painting"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Compiling"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Creating"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Binding"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Handling Signal"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Input Events"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Debug Messages"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Quick3D")
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "JavaScript"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Memory Usage"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Pixmap Cache"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Scene Graph"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Animations"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Painting"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Compiling"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Creating"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Binding"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Handling Signal"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Input Events"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Debug Messages"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Quick3D")
|
||||
};
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(ProfileFeatureNames) == sizeof(char *) * MaximumProfileFeature);
|
||||
@@ -176,7 +177,7 @@ void QmlProfilerModelManager::replayQmlEvents(QmlEventLoader loader,
|
||||
|
||||
if (!result && errorHandler) {
|
||||
errorHandler(future.isCanceled() ? QString()
|
||||
: tr("Failed to replay QML events from stash file."));
|
||||
: Tr::tr("Failed to replay QML events from stash file."));
|
||||
} else if (result && finalizer) {
|
||||
finalizer();
|
||||
}
|
||||
@@ -203,7 +204,7 @@ void QmlProfilerModelManager::clearTypeStorage()
|
||||
static QString getDisplayName(const QmlEventType &event)
|
||||
{
|
||||
if (event.location().filename().isEmpty()) {
|
||||
return QmlProfilerModelManager::tr("<bytecode>");
|
||||
return Tr::tr("<bytecode>");
|
||||
} else {
|
||||
const QString filePath = QUrl(event.location().filename()).path();
|
||||
return filePath.mid(filePath.lastIndexOf(QLatin1Char('/')) + 1) + QLatin1Char(':') +
|
||||
@@ -219,7 +220,7 @@ static QString getInitialDetails(const QmlEventType &event)
|
||||
details = details.replace(QLatin1Char('\n'),QLatin1Char(' ')).simplified();
|
||||
if (details.isEmpty()) {
|
||||
if (event.rangeType() == Javascript)
|
||||
details = QmlProfilerModelManager::tr("anonymous function");
|
||||
details = Tr::tr("anonymous function");
|
||||
} else {
|
||||
QRegularExpression rewrite(QLatin1String("^\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)$"));
|
||||
QRegularExpressionMatch match = rewrite.match(details);
|
||||
@@ -483,7 +484,7 @@ QmlProfilerEventStorage::QmlProfilerEventStorage(
|
||||
: m_file("qmlprofiler-data"), m_errorHandler(errorHandler)
|
||||
{
|
||||
if (!m_file.open())
|
||||
errorHandler(tr("Cannot open temporary trace file to store events."));
|
||||
errorHandler(Tr::tr("Cannot open temporary trace file to store events."));
|
||||
}
|
||||
|
||||
int QmlProfilerEventStorage::append(Timeline::TraceEvent &&event)
|
||||
@@ -503,13 +504,13 @@ void QmlProfilerEventStorage::clear()
|
||||
m_size = 0;
|
||||
m_file.clear();
|
||||
if (!m_file.open())
|
||||
m_errorHandler(tr("Failed to reset temporary trace file."));
|
||||
m_errorHandler(Tr::tr("Failed to reset temporary trace file."));
|
||||
}
|
||||
|
||||
void QmlProfilerEventStorage::finalize()
|
||||
{
|
||||
if (!m_file.flush())
|
||||
m_errorHandler(tr("Failed to flush temporary trace file."));
|
||||
m_errorHandler(Tr::tr("Failed to flush temporary trace file."));
|
||||
}
|
||||
|
||||
QmlProfilerEventStorage::ErrorHandler QmlProfilerEventStorage::errorHandler() const
|
||||
@@ -530,13 +531,13 @@ bool QmlProfilerEventStorage::replay(
|
||||
case Timeline::TraceStashFile<QmlEvent>::ReplaySuccess:
|
||||
return true;
|
||||
case Timeline::TraceStashFile<QmlEvent>::ReplayOpenFailed:
|
||||
m_errorHandler(tr("Could not re-open temporary trace file."));
|
||||
m_errorHandler(Tr::tr("Could not re-open temporary trace file."));
|
||||
break;
|
||||
case Timeline::TraceStashFile<QmlEvent>::ReplayLoadFailed:
|
||||
// Happens if the loader rejects an event. Not an actual error
|
||||
break;
|
||||
case Timeline::TraceStashFile<QmlEvent>::ReplayReadPastEnd:
|
||||
m_errorHandler(tr("Read past end in temporary trace file."));
|
||||
m_errorHandler(Tr::tr("Read past end in temporary trace file."));
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilerrangemodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilerbindingloopsrenderpass.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilerrangemodel.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <tracing/timelinenotesrenderpass.h>
|
||||
#include <tracing/timelineitemsrenderpass.h>
|
||||
@@ -202,12 +203,12 @@ QVariantMap QmlProfilerRangeModel::details(int index) const
|
||||
int id = selectionId(index);
|
||||
|
||||
result.insert(QStringLiteral("displayName"),
|
||||
tr(QmlProfilerModelManager::featureName(mainFeature())));
|
||||
result.insert(tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
Tr::tr(QmlProfilerModelManager::featureName(mainFeature())));
|
||||
result.insert(Tr::tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
|
||||
const QmlEventType &type = modelManager()->eventType(id);
|
||||
result.insert(tr("Details"), type.data());
|
||||
result.insert(tr("Location"), type.displayName());
|
||||
result.insert(Tr::tr("Details"), type.data());
|
||||
result.insert(Tr::tr("Location"), type.displayName());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilerrunconfigurationaspect.h"
|
||||
#include "qmlprofilersettings.h"
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <debugger/analyzer/analyzerrunconfigwidget.h>
|
||||
|
||||
@@ -16,7 +17,7 @@ QmlProfilerRunConfigurationAspect::QmlProfilerRunConfigurationAspect(ProjectExpl
|
||||
setProjectSettings(new QmlProfilerSettings);
|
||||
setGlobalSettings(QmlProfilerPlugin::globalSettings());
|
||||
setId(Constants::SETTINGS);
|
||||
setDisplayName(QCoreApplication::translate("QmlProfilerRunConfiguration", "QML Profiler Settings"));
|
||||
setDisplayName(Tr::tr("QML Profiler Settings"));
|
||||
setUsingGlobalSettings(true);
|
||||
resetProjectToGlobalSettings();
|
||||
setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); });
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilersettings.h"
|
||||
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilersettings.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
@@ -40,8 +40,8 @@ QmlProfilerSettings::QmlProfilerSettings()
|
||||
registerAspect(&flushEnabled);
|
||||
flushEnabled.setSettingsKey("Analyzer.QmlProfiler.FlushEnabled");
|
||||
flushEnabled.setLabelPlacement(BoolAspect::LabelPlacement::InExtraLabel);
|
||||
flushEnabled.setLabelText(tr("Flush data while profiling:"));
|
||||
flushEnabled.setToolTip(tr(
|
||||
flushEnabled.setLabelText(Tr::tr("Flush data while profiling:"));
|
||||
flushEnabled.setToolTip(Tr::tr(
|
||||
"Periodically flush pending data to the profiler. This reduces the delay when loading the\n"
|
||||
"data and the memory usage in the application. It distorts the profile as the flushing\n"
|
||||
"itself takes time."));
|
||||
@@ -50,7 +50,7 @@ QmlProfilerSettings::QmlProfilerSettings()
|
||||
flushInterval.setSettingsKey("Analyzer.QmlProfiler.FlushInterval");
|
||||
flushInterval.setRange(1, 10000000);
|
||||
flushInterval.setDefaultValue(1000);
|
||||
flushInterval.setLabelText(tr("Flush interval (ms):"));
|
||||
flushInterval.setLabelText(Tr::tr("Flush interval (ms):"));
|
||||
flushInterval.setEnabler(&flushEnabled);
|
||||
|
||||
registerAspect(&lastTraceFile);
|
||||
@@ -59,8 +59,8 @@ QmlProfilerSettings::QmlProfilerSettings()
|
||||
registerAspect(&aggregateTraces);
|
||||
aggregateTraces.setSettingsKey("Analyzer.QmlProfiler.AggregateTraces");
|
||||
aggregateTraces.setLabelPlacement(BoolAspect::LabelPlacement::InExtraLabel);
|
||||
aggregateTraces.setLabelText(tr("Process data only when process ends:"));
|
||||
aggregateTraces.setToolTip(tr(
|
||||
aggregateTraces.setLabelText(Tr::tr("Process data only when process ends:"));
|
||||
aggregateTraces.setToolTip(Tr::tr(
|
||||
"Only process data when the process being profiled ends, not when the current recording\n"
|
||||
"session ends. This way multiple recording sessions can be aggregated in a single trace,\n"
|
||||
"for example if multiple QML engines start and stop sequentially during a single run of\n"
|
||||
@@ -80,9 +80,9 @@ void QmlProfilerSettings::writeGlobalSettings() const
|
||||
QmlProfilerOptionsPage::QmlProfilerOptionsPage()
|
||||
{
|
||||
setId(Constants::SETTINGS);
|
||||
setDisplayName(QmlProfilerSettings::tr("QML Profiler"));
|
||||
setDisplayName(Tr::tr("QML Profiler"));
|
||||
setCategory("T.Analyzer");
|
||||
setDisplayCategory(QmlProfilerSettings::tr("Analyzer"));
|
||||
setDisplayCategory(Tr::tr("Analyzer"));
|
||||
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilerstatewidget.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/theme/theme.h>
|
||||
@@ -114,24 +115,24 @@ void QmlProfilerStateWidget::updateDisplay()
|
||||
// Heuristic to not show the number if the application will only send the events when it
|
||||
// stops. The number is still > 0 then because we get some StartTrace etc.
|
||||
const int numEvents = d->m_modelManager->numEvents();
|
||||
showText(numEvents > 256 ? tr("Profiling application: %n events", nullptr, numEvents) :
|
||||
tr("Profiling application"));
|
||||
showText(numEvents > 256 ? Tr::tr("Profiling application: %n events", nullptr, numEvents) :
|
||||
Tr::tr("Profiling application"));
|
||||
} else if (d->m_modelManager->traceDuration() > 0 && d->m_modelManager->isEmpty()) {
|
||||
// After profiling, there is an empty trace
|
||||
showText(tr("No QML events recorded"));
|
||||
showText(Tr::tr("No QML events recorded"));
|
||||
} else if (!d->m_modelManager->isEmpty()) {
|
||||
// When datamodel is acquiring data
|
||||
if (d->m_profilerState->currentState() != QmlProfilerStateManager::Idle) {
|
||||
// we don't know how much more, so progress numbers are strange here
|
||||
showText(tr("Loading buffered data: %n events", nullptr,
|
||||
d->m_modelManager->numEvents()));
|
||||
showText(Tr::tr("Loading buffered data: %n events", nullptr,
|
||||
d->m_modelManager->numEvents()));
|
||||
} else {
|
||||
// Application died before all data could be read
|
||||
showText(tr("Loading offline data: %n events", nullptr,
|
||||
d->m_modelManager->numEvents()));
|
||||
showText(Tr::tr("Loading offline data: %n events", nullptr,
|
||||
d->m_modelManager->numEvents()));
|
||||
}
|
||||
} else {
|
||||
showText(tr("Waiting for data"));
|
||||
showText(Tr::tr("Waiting for data"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilerstatisticsmodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilerstatisticsmodel.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <tracing/timelineformattime.h>
|
||||
#include <utils/algorithm.h>
|
||||
@@ -15,12 +16,12 @@ namespace QmlProfiler {
|
||||
QString nameForType(RangeType typeNumber)
|
||||
{
|
||||
switch (typeNumber) {
|
||||
case Painting: return QmlProfilerStatisticsModel::tr("Painting");
|
||||
case Compiling: return QmlProfilerStatisticsModel::tr("Compiling");
|
||||
case Creating: return QmlProfilerStatisticsModel::tr("Creating");
|
||||
case Binding: return QmlProfilerStatisticsModel::tr("Binding");
|
||||
case HandlingSignal: return QmlProfilerStatisticsModel::tr("Handling Signal");
|
||||
case Javascript: return QmlProfilerStatisticsModel::tr("JavaScript");
|
||||
case Painting: return Tr::tr("Painting");
|
||||
case Compiling: return Tr::tr("Compiling");
|
||||
case Creating: return Tr::tr("Creating");
|
||||
case Binding: return Tr::tr("Binding");
|
||||
case HandlingSignal: return Tr::tr("Handling Signal");
|
||||
case Javascript: return Tr::tr("JavaScript");
|
||||
default: return QString();
|
||||
}
|
||||
}
|
||||
@@ -91,7 +92,7 @@ void QmlProfilerStatisticsModel::restrictToFeatures(quint64 features)
|
||||
}, [this](const QString &message) {
|
||||
endResetModel();
|
||||
if (!message.isEmpty()) {
|
||||
emit m_modelManager->error(tr("Could not re-read events from temporary trace file: %1")
|
||||
emit m_modelManager->error(Tr::tr("Could not re-read events from temporary trace file: %1")
|
||||
.arg(message));
|
||||
}
|
||||
clear();
|
||||
@@ -239,7 +240,7 @@ QVariant QmlProfilerStatisticsModel::dataForMainEntry(const QModelIndex &index,
|
||||
case MainMinTime:
|
||||
return Timeline::formatTime(m_rootDuration);
|
||||
case MainDetails:
|
||||
return tr("Main program");
|
||||
return Tr::tr("Main program");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -274,7 +275,7 @@ QVariant QmlProfilerStatisticsModel::data(const QModelIndex &index, int role) co
|
||||
return type.location().column();
|
||||
case Qt::ToolTipRole:
|
||||
if (stats.recursive > 0) {
|
||||
return (tr("+%1 in recursive calls")
|
||||
return (Tr::tr("+%1 in recursive calls")
|
||||
.arg(Timeline::formatTime(stats.recursive)));
|
||||
} else {
|
||||
auto it = m_notes.constFind(typeIndex);
|
||||
@@ -313,7 +314,7 @@ QVariant QmlProfilerStatisticsModel::data(const QModelIndex &index, int role) co
|
||||
case Qt::DisplayRole:
|
||||
switch (index.column()) {
|
||||
case MainLocation:
|
||||
return type.displayName().isEmpty() ? tr("<bytecode>") : type.displayName();
|
||||
return type.displayName().isEmpty() ? Tr::tr("<bytecode>") : type.displayName();
|
||||
case MainType:
|
||||
return nameForType(type.rangeType());
|
||||
case MainTimeInPercent:
|
||||
@@ -335,7 +336,7 @@ QVariant QmlProfilerStatisticsModel::data(const QModelIndex &index, int role) co
|
||||
case MainMinTime:
|
||||
return Timeline::formatTime(stats.minimum);
|
||||
case MainDetails:
|
||||
return type.data().isEmpty() ? tr("Source code not available")
|
||||
return type.data().isEmpty() ? Tr::tr("Source code not available")
|
||||
: type.data();
|
||||
default:
|
||||
QTC_CHECK(false);
|
||||
@@ -353,18 +354,18 @@ QVariant QmlProfilerStatisticsModel::headerData(int section, Qt::Orientation ori
|
||||
return QAbstractTableModel::headerData(section, orientation, role);
|
||||
|
||||
switch (section) {
|
||||
case MainCallCount: return tr("Calls");
|
||||
case MainDetails: return tr("Details");
|
||||
case MainLocation: return tr("Location");
|
||||
case MainMaxTime: return tr("Longest Time");
|
||||
case MainTimePerCall: return tr("Mean Time");
|
||||
case MainSelfTime: return tr("Self Time");
|
||||
case MainSelfTimeInPercent: return tr("Self Time in Percent");
|
||||
case MainMinTime: return tr("Shortest Time");
|
||||
case MainTimeInPercent: return tr("Time in Percent");
|
||||
case MainTotalTime: return tr("Total Time");
|
||||
case MainType: return tr("Type");
|
||||
case MainMedianTime: return tr("Median Time");
|
||||
case MainCallCount: return Tr::tr("Calls");
|
||||
case MainDetails: return Tr::tr("Details");
|
||||
case MainLocation: return Tr::tr("Location");
|
||||
case MainMaxTime: return Tr::tr("Longest Time");
|
||||
case MainTimePerCall: return Tr::tr("Mean Time");
|
||||
case MainSelfTime: return Tr::tr("Self Time");
|
||||
case MainSelfTimeInPercent: return Tr::tr("Self Time in Percent");
|
||||
case MainMinTime: return Tr::tr("Shortest Time");
|
||||
case MainTimeInPercent: return Tr::tr("Time in Percent");
|
||||
case MainTotalTime: return Tr::tr("Total Time");
|
||||
case MainType: return Tr::tr("Type");
|
||||
case MainMedianTime: return Tr::tr("Median Time");
|
||||
case MaxMainField:
|
||||
default: QTC_ASSERT(false, return QString());
|
||||
}
|
||||
@@ -560,7 +561,7 @@ QVariant QmlProfilerStatisticsRelativesModel::dataForMainEntry(qint64 totalDurat
|
||||
case RelativeLocation: return "<program>";
|
||||
case RelativeTotalTime: return Timeline::formatTime(totalDuration);
|
||||
case RelativeCallCount: return 1;
|
||||
case RelativeDetails: return tr("Main Program");
|
||||
case RelativeDetails: return Tr::tr("Main Program");
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
@@ -598,7 +599,7 @@ QVariant QmlProfilerStatisticsRelativesModel::data(const QModelIndex &index, int
|
||||
case ColumnRole:
|
||||
return type.location().column();
|
||||
case Qt::ToolTipRole:
|
||||
return stats.isRecursive ? tr("called recursively") : QString();
|
||||
return stats.isRecursive ? Tr::tr("called recursively") : QString();
|
||||
case Qt::ForegroundRole:
|
||||
return stats.isRecursive
|
||||
? Utils::creatorTheme()->color(Utils::Theme::Timeline_HighlightColor)
|
||||
@@ -617,7 +618,7 @@ QVariant QmlProfilerStatisticsRelativesModel::data(const QModelIndex &index, int
|
||||
case Qt::DisplayRole:
|
||||
switch (index.column()) {
|
||||
case RelativeLocation:
|
||||
return type.displayName().isEmpty() ? tr("<bytecode>") : type.displayName();
|
||||
return type.displayName().isEmpty() ? Tr::tr("<bytecode>") : type.displayName();
|
||||
case RelativeType:
|
||||
return nameForType(type.rangeType());
|
||||
case RelativeTotalTime:
|
||||
@@ -625,7 +626,7 @@ QVariant QmlProfilerStatisticsRelativesModel::data(const QModelIndex &index, int
|
||||
case RelativeCallCount:
|
||||
return stats.calls;
|
||||
case RelativeDetails:
|
||||
return type.data().isEmpty() ? tr("Source code not available")
|
||||
return type.data().isEmpty() ? Tr::tr("Source code not available")
|
||||
: type.data();
|
||||
default:
|
||||
QTC_CHECK(false);
|
||||
@@ -644,16 +645,16 @@ QVariant QmlProfilerStatisticsRelativesModel::headerData(int section, Qt::Orient
|
||||
|
||||
switch (section) {
|
||||
case RelativeLocation:
|
||||
return m_relation == QmlProfilerStatisticsCallees ? tr("Callee") : tr("Caller");
|
||||
return m_relation == QmlProfilerStatisticsCallees ? Tr::tr("Callee") : Tr::tr("Caller");
|
||||
case RelativeType:
|
||||
return tr("Type");
|
||||
return Tr::tr("Type");
|
||||
case RelativeTotalTime:
|
||||
return tr("Total Time");
|
||||
return Tr::tr("Total Time");
|
||||
case RelativeCallCount:
|
||||
return tr("Calls");
|
||||
return Tr::tr("Calls");
|
||||
case RelativeDetails:
|
||||
return m_relation == QmlProfilerStatisticsCallees ? tr("Callee Description")
|
||||
: tr("Caller Description");
|
||||
return m_relation == QmlProfilerStatisticsCallees ? Tr::tr("Callee Description")
|
||||
: Tr::tr("Caller Description");
|
||||
case MaxRelativeField:
|
||||
default:
|
||||
QTC_ASSERT(false, return QString());
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "qmlprofilerstatisticsview.h"
|
||||
#include "qmlprofilertool.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <coreplugin/minisplitter.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -46,7 +47,7 @@ QmlProfilerStatisticsView::QmlProfilerStatisticsView(QmlProfilerModelManager *pr
|
||||
: QmlProfilerEventsView(parent)
|
||||
{
|
||||
setObjectName(QLatin1String("QmlProfiler.Statistics.Dock"));
|
||||
setWindowTitle(tr("Statistics"));
|
||||
setWindowTitle(Tr::tr("Statistics"));
|
||||
|
||||
auto model = new QmlProfilerStatisticsModel(profilerModelManager);
|
||||
m_mainView.reset(new QmlProfilerStatisticsMainView(model));
|
||||
@@ -122,16 +123,16 @@ void QmlProfilerStatisticsView::contextMenuEvent(QContextMenuEvent *ev)
|
||||
if (mouseOnTable(position)) {
|
||||
menu.addSeparator();
|
||||
if (m_mainView->selectedModelIndex().isValid())
|
||||
copyRowAction = menu.addAction(tr("Copy Row"));
|
||||
copyTableAction = menu.addAction(tr("Copy Table"));
|
||||
copyRowAction = menu.addAction(Tr::tr("Copy Row"));
|
||||
copyTableAction = menu.addAction(Tr::tr("Copy Table"));
|
||||
|
||||
showExtendedStatsAction = menu.addAction(tr("Extended Event Statistics"));
|
||||
showExtendedStatsAction = menu.addAction(Tr::tr("Extended Event Statistics"));
|
||||
showExtendedStatsAction->setCheckable(true);
|
||||
showExtendedStatsAction->setChecked(m_mainView->showExtendedStatistics());
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
getGlobalStatsAction = menu.addAction(tr("Show Full Range"));
|
||||
getGlobalStatsAction = menu.addAction(Tr::tr("Show Full Range"));
|
||||
if (!m_mainView->isRestrictedToRange())
|
||||
getGlobalStatsAction->setEnabled(false);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilertimelinemodel.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
namespace QmlProfiler {
|
||||
|
||||
@@ -12,7 +13,7 @@ QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *mode
|
||||
TimelineModel(parent), m_message(message), m_rangeType(rangeType), m_mainFeature(mainFeature),
|
||||
m_modelManager(modelManager)
|
||||
{
|
||||
setDisplayName(tr(QmlProfilerModelManager::featureName(mainFeature)));
|
||||
setDisplayName(Tr::tr(QmlProfilerModelManager::featureName(mainFeature)));
|
||||
connect(modelManager, &QmlProfilerModelManager::typeDetailsFinished,
|
||||
this, &Timeline::TimelineModel::labelsChanged);
|
||||
connect(modelManager, &QmlProfilerModelManager::typeDetailsFinished,
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilertool.h"
|
||||
#include "qmlprofilerstatemanager.h"
|
||||
#include "qmlprofilerruncontrol.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilerattachdialog.h"
|
||||
#include "qmlprofilerviewmanager.h"
|
||||
#include "qmlprofilerclientmanager.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilerrunconfigurationaspect.h"
|
||||
#include "qmlprofilersettings.h"
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilerrunconfigurationaspect.h"
|
||||
#include "qmlprofilerruncontrol.h"
|
||||
#include "qmlprofilersettings.h"
|
||||
#include "qmlprofilerstatemanager.h"
|
||||
#include "qmlprofilertextmark.h"
|
||||
#include "qmlprofilertool.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include "qmlprofilerviewmanager.h"
|
||||
|
||||
#include <app/app_version.h>
|
||||
|
||||
@@ -170,7 +171,7 @@ QmlProfilerTool::QmlProfilerTool()
|
||||
|
||||
d->m_clearButton = new QToolButton;
|
||||
d->m_clearButton->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
|
||||
d->m_clearButton->setToolTip(tr("Discard data"));
|
||||
d->m_clearButton->setToolTip(Tr::tr("Discard data"));
|
||||
|
||||
connect(d->m_clearButton, &QAbstractButton::clicked, [this](){
|
||||
if (checkForUnsavedNotes())
|
||||
@@ -179,7 +180,7 @@ QmlProfilerTool::QmlProfilerTool()
|
||||
|
||||
d->m_searchButton = new QToolButton;
|
||||
d->m_searchButton->setIcon(Utils::Icons::ZOOM_TOOLBAR.icon());
|
||||
d->m_searchButton->setToolTip(tr("Search timeline event notes."));
|
||||
d->m_searchButton->setToolTip(Tr::tr("Search timeline event notes."));
|
||||
d->m_searchButton->setEnabled(false);
|
||||
|
||||
connect(d->m_searchButton, &QToolButton::clicked, this, &QmlProfilerTool::showTimeLineSearch);
|
||||
@@ -189,7 +190,7 @@ QmlProfilerTool::QmlProfilerTool()
|
||||
|
||||
d->m_displayFeaturesButton = new QToolButton;
|
||||
d->m_displayFeaturesButton->setIcon(Utils::Icons::FILTER.icon());
|
||||
d->m_displayFeaturesButton->setToolTip(tr("Hide or show event categories."));
|
||||
d->m_displayFeaturesButton->setToolTip(Tr::tr("Hide or show event categories."));
|
||||
d->m_displayFeaturesButton->setPopupMode(QToolButton::InstantPopup);
|
||||
d->m_displayFeaturesButton->setProperty("noArrow", true);
|
||||
d->m_displayFeaturesMenu = new QMenu(d->m_displayFeaturesButton);
|
||||
@@ -245,7 +246,7 @@ QmlProfilerTool::QmlProfilerTool()
|
||||
const static QIcon recordOff = Debugger::Icons::RECORD_OFF.icon();
|
||||
|
||||
// update display
|
||||
d->m_recordButton->setToolTip(recording ? tr("Disable Profiling") : tr("Enable Profiling"));
|
||||
d->m_recordButton->setToolTip(recording ? Tr::tr("Disable Profiling") : Tr::tr("Enable Profiling"));
|
||||
d->m_recordButton->setIcon(recording ? recordOn : recordOff);
|
||||
d->m_recordButton->setChecked(recording);
|
||||
};
|
||||
@@ -275,10 +276,10 @@ void QmlProfilerTool::updateRunActions()
|
||||
{
|
||||
if (d->m_toolBusy) {
|
||||
d->m_startAction->setEnabled(false);
|
||||
d->m_startAction->setToolTip(tr("A QML Profiler analysis is still in progress."));
|
||||
d->m_startAction->setToolTip(Tr::tr("A QML Profiler analysis is still in progress."));
|
||||
d->m_stopAction->setEnabled(true);
|
||||
} else {
|
||||
QString tooltip = tr("Start QML Profiler analysis.");
|
||||
QString tooltip = Tr::tr("Start QML Profiler analysis.");
|
||||
bool canRun = ProjectExplorerPlugin::canRunStartupProject
|
||||
(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, &tooltip);
|
||||
d->m_startAction->setToolTip(tooltip);
|
||||
@@ -306,7 +307,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
|
||||
|
||||
// If we're still trying to connect, stop now.
|
||||
if (d->m_profilerConnections->isConnecting()) {
|
||||
showNonmodalWarning(tr("The application finished before a connection could be "
|
||||
showNonmodalWarning(Tr::tr("The application finished before a connection could be "
|
||||
"established. No data was loaded."));
|
||||
}
|
||||
d->m_profilerConnections->disconnectFromServer();
|
||||
@@ -338,9 +339,9 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
|
||||
const int interval = d->m_profilerConnections->retryInterval();
|
||||
const int retries = d->m_profilerConnections->maximumRetries();
|
||||
|
||||
infoBox->setText(QmlProfilerTool::tr("Could not connect to the in-process QML profiler "
|
||||
"within %1 s.\n"
|
||||
"Do you want to retry and wait %2 s?")
|
||||
infoBox->setText(Tr::tr("Could not connect to the in-process QML profiler "
|
||||
"within %1 s.\n"
|
||||
"Do you want to retry and wait %2 s?")
|
||||
.arg(interval * retries / 1000.0)
|
||||
.arg(interval * 2 * retries / 1000.0));
|
||||
infoBox->setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel | QMessageBox::Help);
|
||||
@@ -359,7 +360,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
|
||||
Q_FALLTHROUGH();
|
||||
case QMessageBox::Cancel:
|
||||
// The actual error message has already been logged.
|
||||
QmlProfilerTool::logState(QmlProfilerTool::tr("Failed to connect."));
|
||||
QmlProfilerTool::logState(Tr::tr("Failed to connect."));
|
||||
runWorker->cancelProcess();
|
||||
break;
|
||||
}
|
||||
@@ -432,8 +433,8 @@ void QmlProfilerTool::updateTimeDisplay()
|
||||
break;
|
||||
}
|
||||
QString timeString = QString::number(seconds,'f',1);
|
||||
QString profilerTimeStr = QmlProfilerTool::tr("%1 s").arg(timeString, 6);
|
||||
d->m_timeLabel->setText(tr("Elapsed: %1").arg(profilerTimeStr));
|
||||
QString profilerTimeStr = Tr::tr("%1 s").arg(timeString, 6);
|
||||
d->m_timeLabel->setText(Tr::tr("Elapsed: %1").arg(profilerTimeStr));
|
||||
}
|
||||
|
||||
void QmlProfilerTool::showTimeLineSearch()
|
||||
@@ -560,7 +561,7 @@ void QmlProfilerTool::showErrorDialog(const QString &error)
|
||||
{
|
||||
auto errorDialog = new QMessageBox(ICore::dialogParent());
|
||||
errorDialog->setIcon(QMessageBox::Warning);
|
||||
errorDialog->setWindowTitle(tr("QML Profiler"));
|
||||
errorDialog->setWindowTitle(Tr::tr("QML Profiler"));
|
||||
errorDialog->setText(error);
|
||||
errorDialog->setStandardButtons(QMessageBox::Ok);
|
||||
errorDialog->setDefaultButton(QMessageBox::Ok);
|
||||
@@ -582,16 +583,16 @@ void QmlProfilerTool::showSaveDialog()
|
||||
QLatin1String tFile(QtdFileExtension);
|
||||
QLatin1String zFile(QztFileExtension);
|
||||
FilePath filePath = FileUtils::getSaveFilePath(
|
||||
nullptr, tr("Save QML Trace"),
|
||||
nullptr, Tr::tr("Save QML Trace"),
|
||||
QmlProfilerPlugin::globalSettings()->lastTraceFile.filePath(),
|
||||
tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile));
|
||||
Tr::tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile));
|
||||
if (!filePath.isEmpty()) {
|
||||
if (!filePath.endsWith(zFile) && !filePath.endsWith(tFile))
|
||||
filePath = filePath + zFile;
|
||||
saveLastTraceFile(filePath);
|
||||
Debugger::enableMainWindow(false);
|
||||
Core::ProgressManager::addTask(d->m_profilerModelManager->save(filePath.toString()),
|
||||
tr("Saving Trace Data"), TASK_SAVE,
|
||||
Tr::tr("Saving Trace Data"), TASK_SAVE,
|
||||
Core::ProgressManager::ShowInApplicationIcon);
|
||||
}
|
||||
}
|
||||
@@ -606,9 +607,9 @@ void QmlProfilerTool::showLoadDialog()
|
||||
QLatin1String tFile(QtdFileExtension);
|
||||
QLatin1String zFile(QztFileExtension);
|
||||
FilePath filePath = FileUtils::getOpenFilePath(
|
||||
nullptr, tr("Load QML Trace"),
|
||||
nullptr, Tr::tr("Load QML Trace"),
|
||||
QmlProfilerPlugin::globalSettings()->lastTraceFile.filePath(),
|
||||
tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile));
|
||||
Tr::tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile));
|
||||
|
||||
if (!filePath.isEmpty()) {
|
||||
saveLastTraceFile(filePath);
|
||||
@@ -617,7 +618,7 @@ void QmlProfilerTool::showLoadDialog()
|
||||
this, &QmlProfilerTool::setRecordedFeatures);
|
||||
d->m_profilerModelManager->populateFileFinder();
|
||||
Core::ProgressManager::addTask(d->m_profilerModelManager->load(filePath.toString()),
|
||||
tr("Loading Trace Data"), TASK_LOAD);
|
||||
Tr::tr("Loading Trace Data"), TASK_LOAD);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,8 +657,8 @@ bool QmlProfilerTool::checkForUnsavedNotes()
|
||||
{
|
||||
if (!d->m_profilerModelManager->notesModel()->isModified())
|
||||
return true;
|
||||
return QMessageBox::warning(QApplication::activeWindow(), tr("QML Profiler"),
|
||||
tr("You are about to discard the profiling data, including unsaved "
|
||||
return QMessageBox::warning(QApplication::activeWindow(), Tr::tr("QML Profiler"),
|
||||
Tr::tr("You are about to discard the profiling data, including unsaved "
|
||||
"notes. Do you want to continue?"),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes;
|
||||
}
|
||||
@@ -670,7 +671,7 @@ void QmlProfilerTool::clientsDisconnected()
|
||||
} else if (d->m_profilerState->serverRecording()) {
|
||||
// If the application stopped by itself, check if we have all the data
|
||||
if (d->m_profilerState->currentState() != QmlProfilerStateManager::AppStopRequested) {
|
||||
showNonmodalWarning(tr("Application finished before loading profiled data.\n"
|
||||
showNonmodalWarning(Tr::tr("Application finished before loading profiled data.\n"
|
||||
"Please use the stop button instead."));
|
||||
}
|
||||
}
|
||||
@@ -687,7 +688,7 @@ void QmlProfilerTool::clientsDisconnected()
|
||||
void addFeatureToMenu(QMenu *menu, ProfileFeature feature, quint64 enabledFeatures)
|
||||
{
|
||||
QAction *action =
|
||||
menu->addAction(QmlProfilerTool::tr(QmlProfilerModelManager::featureName(feature)));
|
||||
menu->addAction(Tr::tr(QmlProfilerModelManager::featureName(feature)));
|
||||
action->setCheckable(true);
|
||||
action->setData(static_cast<uint>(feature));
|
||||
action->setChecked(enabledFeatures & (1ULL << (feature)));
|
||||
@@ -754,7 +755,7 @@ void QmlProfilerTool::showNonmodalWarning(const QString &warningMsg)
|
||||
{
|
||||
auto noExecWarning = new QMessageBox(ICore::dialogParent());
|
||||
noExecWarning->setIcon(QMessageBox::Warning);
|
||||
noExecWarning->setWindowTitle(tr("QML Profiler"));
|
||||
noExecWarning->setWindowTitle(Tr::tr("QML Profiler"));
|
||||
noExecWarning->setText(warningMsg);
|
||||
noExecWarning->setStandardButtons(QMessageBox::Ok);
|
||||
noExecWarning->setDefaultButton(QMessageBox::Ok);
|
||||
@@ -814,8 +815,8 @@ void QmlProfilerTool::serverRecordingChanged()
|
||||
// We cannot stop it here, so we cannot give the usual yes/no dialog. Show a dialog
|
||||
// offering to immediately save the data instead.
|
||||
if (d->m_profilerModelManager->notesModel()->isModified() &&
|
||||
QMessageBox::warning(QApplication::activeWindow(), tr("QML Profiler"),
|
||||
tr("Starting a new profiling session will discard the "
|
||||
QMessageBox::warning(QApplication::activeWindow(), Tr::tr("QML Profiler"),
|
||||
Tr::tr("Starting a new profiling session will discard the "
|
||||
"previous data, including unsaved notes.\nDo you want "
|
||||
"to save the data first?"),
|
||||
QMessageBox::Save, QMessageBox::Discard) ==
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilertracefile.h"
|
||||
#include "qmlprofilernotesmodel.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilernotesmodel.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include "qmlprofilertracefile.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -169,7 +170,7 @@ void QmlProfilerTraceFile::loadQtd(QIODevice *device)
|
||||
}
|
||||
|
||||
if (stream.hasError())
|
||||
fail(tr("Error while parsing trace data file: %1").arg(stream.errorString()));
|
||||
fail(Tr::tr("Error while parsing trace data file: %1").arg(stream.errorString()));
|
||||
else
|
||||
finish();
|
||||
}
|
||||
@@ -182,7 +183,7 @@ void QmlProfilerTraceFile::loadQzt(QIODevice *device)
|
||||
QByteArray magic;
|
||||
stream >> magic;
|
||||
if (magic != QByteArray("QMLPROFILER")) {
|
||||
fail(tr("Invalid magic: %1").arg(QLatin1String(magic)));
|
||||
fail(Tr::tr("Invalid magic: %1").arg(QLatin1String(magic)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +191,7 @@ void QmlProfilerTraceFile::loadQzt(QIODevice *device)
|
||||
stream >> dataStreamVersion;
|
||||
|
||||
if (dataStreamVersion > QDataStream::Qt_DefaultCompiledVersion) {
|
||||
fail(tr("Unknown data stream version: %1").arg(dataStreamVersion));
|
||||
fail(Tr::tr("Unknown data stream version: %1").arg(dataStreamVersion));
|
||||
return;
|
||||
}
|
||||
stream.setVersion(dataStreamVersion);
|
||||
@@ -214,7 +215,7 @@ void QmlProfilerTraceFile::loadQzt(QIODevice *device)
|
||||
quint32 numEventTypes;
|
||||
bufferStream >> numEventTypes;
|
||||
if (numEventTypes > quint32(std::numeric_limits<int>::max())) {
|
||||
fail(tr("Excessive number of event types: %1").arg(numEventTypes));
|
||||
fail(Tr::tr("Excessive number of event types: %1").arg(numEventTypes));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,7 +248,7 @@ void QmlProfilerTraceFile::loadQzt(QIODevice *device)
|
||||
bufferStream >> event;
|
||||
if (bufferStream.status() == QDataStream::Ok) {
|
||||
if (event.typeIndex() >= traceManager()->numEventTypes()) {
|
||||
fail(tr("Invalid type index %1").arg(event.typeIndex()));
|
||||
fail(Tr::tr("Invalid type index %1").arg(event.typeIndex()));
|
||||
return;
|
||||
}
|
||||
addFeature(manager->eventType(event.typeIndex()).feature());
|
||||
@@ -256,7 +257,7 @@ void QmlProfilerTraceFile::loadQzt(QIODevice *device)
|
||||
} else if (bufferStream.status() == QDataStream::ReadPastEnd) {
|
||||
break; // Apparently EOF is a character so we end up here after the last event.
|
||||
} else if (bufferStream.status() == QDataStream::ReadCorruptData) {
|
||||
fail(tr("Corrupt data before position %1.").arg(device->pos()));
|
||||
fail(Tr::tr("Corrupt data before position %1.").arg(device->pos()));
|
||||
return;
|
||||
} else {
|
||||
Q_UNREACHABLE();
|
||||
@@ -766,9 +767,9 @@ void QmlProfilerTraceFile::saveQtd(QIODevice *device)
|
||||
stream.writeEndDocument();
|
||||
|
||||
if (stream.hasError())
|
||||
fail(tr("Error writing trace file."));
|
||||
fail(Tr::tr("Error writing trace file."));
|
||||
}, [this](const QString &message) {
|
||||
fail(tr("Could not re-read events from temporary trace file: %1\nSaving failed.")
|
||||
fail(Tr::tr("Could not re-read events from temporary trace file: %1\nSaving failed.")
|
||||
.arg(message));
|
||||
}, future());
|
||||
}
|
||||
@@ -836,7 +837,7 @@ void QmlProfilerTraceFile::saveQzt(QIODevice *device)
|
||||
addEventsProgress(traceEnd() - lastProgressTimestamp);
|
||||
}
|
||||
}, [this](const QString &message) {
|
||||
fail(tr("Could not re-read events from temporary trace file: %1\nSaving failed.")
|
||||
fail(Tr::tr("Could not re-read events from temporary trace file: %1\nSaving failed.")
|
||||
.arg(message));
|
||||
}, future());
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilertraceview.h"
|
||||
#include "qmlprofilertool.h"
|
||||
#include "qmlprofilerstatemanager.h"
|
||||
#include "qmlprofileranimationsmodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilernotesmodel.h"
|
||||
#include "qmlprofileranimationsmodel.h"
|
||||
#include "qmlprofilerrangemodel.h"
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilerrangemodel.h"
|
||||
#include "qmlprofilerstatemanager.h"
|
||||
#include "qmlprofilertool.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include "qmlprofilertraceview.h"
|
||||
|
||||
#include "quick3dmodel.h"
|
||||
#include "inputeventsmodel.h"
|
||||
@@ -70,7 +71,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
|
||||
QmlProfilerModelManager *modelManager)
|
||||
: QWidget(parent), d(new QmlProfilerTraceViewPrivate(this))
|
||||
{
|
||||
setWindowTitle(tr("Timeline"));
|
||||
setWindowTitle(Tr::tr("Timeline"));
|
||||
setObjectName("QmlProfiler.Timeline.Dock");
|
||||
|
||||
d->m_zoomControl = new Timeline::TimelineZoomControl(this);
|
||||
@@ -238,17 +239,17 @@ void QmlProfilerTraceView::showContextMenu(QPoint position)
|
||||
menu.addActions(QmlProfilerTool::profilerContextMenuActions());
|
||||
menu.addSeparator();
|
||||
|
||||
QAction *getLocalStatsAction = menu.addAction(tr("Analyze Current Range"));
|
||||
QAction *getLocalStatsAction = menu.addAction(Tr::tr("Analyze Current Range"));
|
||||
if (!hasValidSelection())
|
||||
getLocalStatsAction->setEnabled(false);
|
||||
|
||||
QAction *getGlobalStatsAction = menu.addAction(tr("Analyze Full Range"));
|
||||
QAction *getGlobalStatsAction = menu.addAction(Tr::tr("Analyze Full Range"));
|
||||
if (!d->m_modelManager->isRestrictedToRange())
|
||||
getGlobalStatsAction->setEnabled(false);
|
||||
|
||||
if (d->m_zoomControl->traceDuration() > 0) {
|
||||
menu.addSeparator();
|
||||
viewAllAction = menu.addAction(tr("Reset Zoom"));
|
||||
viewAllAction = menu.addAction(Tr::tr("Reset Zoom"));
|
||||
}
|
||||
|
||||
QAction *selectedAction = menu.exec(position);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilerviewmanager.h"
|
||||
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilerstatewidget.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include "qmlprofilerviewmanager.h"
|
||||
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
|
||||
@@ -32,7 +32,7 @@ QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
|
||||
QTC_ASSERT(m_profilerModelManager, return);
|
||||
QTC_ASSERT(m_profilerState, return);
|
||||
|
||||
m_perspective = new Perspective(Constants::QmlProfilerPerspectiveId, tr("QML Profiler"));
|
||||
m_perspective = new Perspective(Constants::QmlProfilerPerspectiveId, Tr::tr("QML Profiler"));
|
||||
m_perspective->setAboutToActivateCallback([this]() { createViews(); });
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "quick3dmodel.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include <tracing/timelineformattime.h>
|
||||
#include "qmlprofilertr.h"
|
||||
#include "quick3dmodel.h"
|
||||
|
||||
#include <tracing/timelineformattime.h>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
@@ -22,43 +23,43 @@ QRgb Quick3DModel::color(int index) const
|
||||
}
|
||||
|
||||
static const char *messageTypes[] = {
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Render Frame"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Synchronize Frame"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Prepare Frame"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Mesh Load"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Custom Mesh Load"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Texture Load"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Generate Shader"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Load Shader"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Particle Update"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Render Frame"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Synchronize Frame"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Prepare Frame"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Mesh Load"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Custom Mesh Load"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Texture Load"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Generate Shader"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Load Shader"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Particle Update"),
|
||||
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Mesh Memory consumption"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Texture Memory consumption"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Mesh Memory consumption"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Texture Memory consumption"),
|
||||
};
|
||||
|
||||
static const char *unloadMessageTypes[] = {
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Mesh Unload"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Custom Mesh Unload"),
|
||||
QT_TRANSLATE_NOOP("Quick3DModel", "Texture Unload"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Mesh Unload"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Custom Mesh Unload"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Texture Unload"),
|
||||
};
|
||||
|
||||
QString Quick3DModel::messageType(uint i)
|
||||
{
|
||||
return i < sizeof(messageTypes) / sizeof(char *) ? tr(messageTypes[i]) :
|
||||
tr("Unknown Message %1").arg(i);
|
||||
return i < sizeof(messageTypes) / sizeof(char *) ? Tr::tr(messageTypes[i]) :
|
||||
Tr::tr("Unknown Message %1").arg(i);
|
||||
}
|
||||
|
||||
QString Quick3DModel::unloadMessageType(uint i)
|
||||
{
|
||||
switch (i) {
|
||||
case MeshLoad:
|
||||
return tr(unloadMessageTypes[0]);
|
||||
return Tr::tr(unloadMessageTypes[0]);
|
||||
case CustomMeshLoad:
|
||||
return tr(unloadMessageTypes[1]);
|
||||
return Tr::tr(unloadMessageTypes[1]);
|
||||
case TextureLoad:
|
||||
return tr(unloadMessageTypes[2]);
|
||||
return Tr::tr(unloadMessageTypes[2]);
|
||||
}
|
||||
return tr("Unknown Unload Message %1").arg(i);
|
||||
return Tr::tr("Unknown Unload Message %1").arg(i);
|
||||
}
|
||||
|
||||
QVariantList Quick3DModel::labels() const
|
||||
@@ -67,7 +68,7 @@ QVariantList Quick3DModel::labels() const
|
||||
for (int i = 0; i <= m_maximumMsgType; ++i) {
|
||||
QVariantMap element;
|
||||
element.insert(QLatin1String("displayName"),
|
||||
i != ParticleUpdate ? tr("Render Thread") : tr("GUI Thread"));
|
||||
i != ParticleUpdate ? Tr::tr("Render Thread") : Tr::tr("GUI Thread"));
|
||||
element.insert(QLatin1String("description"), messageType(i));
|
||||
element.insert(QLatin1String("id"), i);
|
||||
result << element;
|
||||
@@ -101,22 +102,22 @@ QVariantMap Quick3DModel::details(int index) const
|
||||
bool unload = m_data[index].unload;
|
||||
QVariantMap result;
|
||||
result.insert(QLatin1String("displayName"),
|
||||
detailType != ParticleUpdate ? tr("Render Thread") : tr("GUI Thread"));
|
||||
result.insert(tr("Description"),
|
||||
detailType != ParticleUpdate ? Tr::tr("Render Thread") : Tr::tr("GUI Thread"));
|
||||
result.insert(Tr::tr("Description"),
|
||||
!unload ? messageType(detailType) : unloadMessageType(detailType));
|
||||
if (detailType < MeshMemoryConsumption)
|
||||
result.insert(tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
result.insert(Tr::tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
if (detailType == ParticleUpdate)
|
||||
result.insert(tr("Count"), m_data[index].data);
|
||||
result.insert(Tr::tr("Count"), m_data[index].data);
|
||||
if (detailType == RenderFrame) {
|
||||
quint32 calls = m_data[index].data & 0xffffffff;
|
||||
quint32 passes = m_data[index].data >> 32;
|
||||
result.insert(tr("Draw Calls"), calls);
|
||||
result.insert(tr("Render Passes"), passes);
|
||||
result.insert(Tr::tr("Draw Calls"), calls);
|
||||
result.insert(Tr::tr("Render Passes"), passes);
|
||||
}
|
||||
if ((detailType >= MeshLoad && detailType <= TextureLoad)
|
||||
|| (detailType >= MeshMemoryConsumption && detailType <= TextureMemoryConsumption)) {
|
||||
result.insert(tr("Total Memory Usage"), m_data[index].data);
|
||||
result.insert(Tr::tr("Total Memory Usage"), m_data[index].data);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "scenegraphtimelinemodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilereventtypes.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include "scenegraphtimelinemodel.h"
|
||||
|
||||
#include <tracing/timelineformattime.h>
|
||||
|
||||
@@ -14,32 +15,32 @@ namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
static const char *ThreadLabels[] = {
|
||||
QT_TRANSLATE_NOOP("MainView", "GUI Thread"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Render Thread"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Render Thread Details")
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "GUI Thread"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Render Thread"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Render Thread Details")
|
||||
};
|
||||
|
||||
static const char *StageLabels[] = {
|
||||
QT_TRANSLATE_NOOP("MainView", "Polish"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Wait"),
|
||||
QT_TRANSLATE_NOOP("MainView", "GUI Thread Sync"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Animations"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Render Thread Sync"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Render"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Swap"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Render Preprocess"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Render Update"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Render Bind"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Render Render"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Material Compile"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Glyph Render"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Glyph Upload"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Texture Bind"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Texture Convert"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Texture Swizzle"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Texture Upload"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Texture Mipmap"),
|
||||
QT_TRANSLATE_NOOP("MainView", "Texture Delete")
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Polish"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Wait"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "GUI Thread Sync"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Animations"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Render Thread Sync"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Render"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Swap"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Render Preprocess"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Render Update"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Render Bind"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Render Render"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Material Compile"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Glyph Render"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Glyph Upload"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Texture Bind"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Texture Convert"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Texture Swizzle"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Texture Upload"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Texture Mipmap"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Texture Delete")
|
||||
};
|
||||
|
||||
enum SceneGraphCategoryType {
|
||||
@@ -86,8 +87,8 @@ QVariantList SceneGraphTimelineModel::labels() const
|
||||
for (SceneGraphStage i = MinimumSceneGraphStage; i < MaximumSceneGraphStage;
|
||||
i = static_cast<SceneGraphStage>(i + 1)) {
|
||||
QVariantMap element;
|
||||
element.insert(QLatin1String("displayName"), tr(threadLabel(i)));
|
||||
element.insert(QLatin1String("description"), tr(StageLabels[i]));
|
||||
element.insert(QLatin1String("displayName"), Tr::tr(threadLabel(i)));
|
||||
element.insert(QLatin1String("description"), Tr::tr(StageLabels[i]));
|
||||
element.insert(QLatin1String("id"), i);
|
||||
result << element;
|
||||
}
|
||||
@@ -100,13 +101,13 @@ QVariantMap SceneGraphTimelineModel::details(int index) const
|
||||
QVariantMap result;
|
||||
const SceneGraphStage stage = static_cast<SceneGraphStage>(selectionId(index));
|
||||
|
||||
result.insert(QLatin1String("displayName"), tr(threadLabel(stage)));
|
||||
result.insert(tr("Stage"), tr(StageLabels[stage]));
|
||||
result.insert(tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
result.insert(QLatin1String("displayName"), Tr::tr(threadLabel(stage)));
|
||||
result.insert(Tr::tr("Stage"), Tr::tr(StageLabels[stage]));
|
||||
result.insert(Tr::tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
|
||||
const int glyphCount = m_data[index].glyphCount;
|
||||
if (glyphCount >= 0)
|
||||
result.insert(tr("Glyphs"), QString::number(glyphCount));
|
||||
result.insert(Tr::tr("Glyphs"), QString::number(glyphCount));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "debugmessagesmodel_test.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <tracing/timelineformattime.h>
|
||||
|
||||
@@ -49,11 +50,11 @@ void DebugMessagesModelTest::testColor()
|
||||
}
|
||||
|
||||
static const char *messageTypes[] = {
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Debug Message"),
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Warning Message"),
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Critical Message"),
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Fatal Message"),
|
||||
QT_TRANSLATE_NOOP("DebugMessagesModel", "Info Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Debug Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Warning Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Critical Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Fatal Message"),
|
||||
QT_TRANSLATE_NOOP("QmlProfiler", "Info Message"),
|
||||
};
|
||||
|
||||
void DebugMessagesModelTest::testLabels()
|
||||
@@ -61,7 +62,7 @@ void DebugMessagesModelTest::testLabels()
|
||||
QVariantList labels = model.labels();
|
||||
for (int i = 0; i <= QtMsgType::QtInfoMsg; ++i) {
|
||||
QVariantMap element = labels[i].toMap();
|
||||
QCOMPARE(element[QLatin1String("description")].toString(), model.tr(messageTypes[i]));
|
||||
QCOMPARE(element[QLatin1String("description")].toString(), Tr::tr(messageTypes[i]));
|
||||
QCOMPARE(element[QLatin1String("id")].toInt(), i);
|
||||
}
|
||||
}
|
||||
@@ -71,12 +72,12 @@ void DebugMessagesModelTest::testDetails()
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
QVariantMap details = model.details(i);
|
||||
QCOMPARE(details.value(QLatin1String("displayName")).toString(),
|
||||
model.tr(messageTypes[i % (QtMsgType::QtInfoMsg + 1)]));
|
||||
QCOMPARE(details.value(model.tr("Timestamp")).toString(),
|
||||
Tr::tr(messageTypes[i % (QtMsgType::QtInfoMsg + 1)]));
|
||||
QCOMPARE(details.value(Tr::tr("Timestamp")).toString(),
|
||||
Timeline::formatTime(i));
|
||||
QCOMPARE(details.value(model.tr("Message")).toString(),
|
||||
QCOMPARE(details.value(Tr::tr("Message")).toString(),
|
||||
QString::fromLatin1("message %1").arg(i));
|
||||
QCOMPARE(details.value(model.tr("Location")).toString(),
|
||||
QCOMPARE(details.value(Tr::tr("Location")).toString(),
|
||||
QString::fromLatin1("somefile.js:%1").arg(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "flamegraphmodel_test.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <qmlprofiler/qmlprofilerrangemodel.h>
|
||||
|
||||
@@ -111,10 +112,10 @@ void FlameGraphModelTest::testCounts()
|
||||
void FlameGraphModelTest::testData()
|
||||
{
|
||||
const QVector<QString> typeRoles({
|
||||
FlameGraphModel::tr("JavaScript"),
|
||||
FlameGraphModel::tr("Signal"),
|
||||
FlameGraphModel::tr("Binding"),
|
||||
FlameGraphModel::tr("Create")
|
||||
Tr::tr("JavaScript"),
|
||||
Tr::tr("Signal"),
|
||||
Tr::tr("Binding"),
|
||||
Tr::tr("Create")
|
||||
});
|
||||
|
||||
QModelIndex index = model.index(0, 0);
|
||||
@@ -122,9 +123,9 @@ void FlameGraphModelTest::testData()
|
||||
QCOMPARE(model.data(index, FlameGraphModel::TypeIdRole).toInt(), 0);
|
||||
QCOMPARE(model.data(index2, FlameGraphModel::TypeIdRole).toInt(), 4);
|
||||
QCOMPARE(model.data(index, FlameGraphModel::TypeRole).toString(),
|
||||
FlameGraphModel::tr("JavaScript"));
|
||||
Tr::tr("JavaScript"));
|
||||
QCOMPARE(model.data(index2, FlameGraphModel::TypeRole).toString(),
|
||||
FlameGraphModel::tr("Compile"));
|
||||
Tr::tr("Compile"));
|
||||
QCOMPARE(model.data(index, FlameGraphModel::DurationRole).toLongLong(), 21);
|
||||
QCOMPARE(model.data(index2, FlameGraphModel::DurationRole).toLongLong(), 13);
|
||||
QCOMPARE(model.data(index, FlameGraphModel::CallCountRole).toInt(), 1);
|
||||
@@ -172,7 +173,7 @@ void FlameGraphModelTest::testData()
|
||||
|
||||
index2 = model.index(0, 0, index2);
|
||||
QCOMPARE(model.data(index2, FlameGraphModel::TypeRole).toString(),
|
||||
FlameGraphModel::tr("Compile"));
|
||||
Tr::tr("Compile"));
|
||||
QCOMPARE(model.data(index2, FlameGraphModel::NoteRole).toString(), QString());
|
||||
QCOMPARE(model.data(index2, FlameGraphModel::CallCountRole).toInt(), 1);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "inputeventsmodel_test.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <tracing/timelinemodel_p.h>
|
||||
#include <tracing/timelineformattime.h>
|
||||
@@ -70,11 +71,11 @@ void InputEventsModelTest::testLabels()
|
||||
{
|
||||
QVariantList labels = model.labels();
|
||||
QVariantMap mouseLabel = labels[0].toMap();
|
||||
QCOMPARE(mouseLabel[QString("description")].toString(), model.tr("Mouse Events"));
|
||||
QCOMPARE(mouseLabel[QString("description")].toString(), Tr::tr("Mouse Events"));
|
||||
QCOMPARE(mouseLabel[QString("id")].toInt(), static_cast<int>(Mouse));
|
||||
|
||||
QVariantMap keyLabel = labels[1].toMap();
|
||||
QCOMPARE(keyLabel[QString("description")].toString(), model.tr("Keyboard Events"));
|
||||
QCOMPARE(keyLabel[QString("description")].toString(), Tr::tr("Keyboard Events"));
|
||||
QCOMPARE(keyLabel[QString("id")].toInt(), static_cast<int>(Key));
|
||||
}
|
||||
|
||||
@@ -82,75 +83,75 @@ void InputEventsModelTest::testDetails()
|
||||
{
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
const QVariantMap details = model.details(i);
|
||||
QCOMPARE(details[model.tr("Timestamp")].toString(), Timeline::formatTime(i));
|
||||
QCOMPARE(details[Tr::tr("Timestamp")].toString(), Timeline::formatTime(i));
|
||||
QString displayName = details[QString("displayName")].toString();
|
||||
QVERIFY(!displayName.isEmpty());
|
||||
switch (inputType(i)) {
|
||||
case InputKeyPress:
|
||||
QCOMPARE(displayName, model.tr("Key Press"));
|
||||
QCOMPARE(displayName, Tr::tr("Key Press"));
|
||||
if (i == 0) {
|
||||
// all the numbers are 0 here, so no other members
|
||||
QVERIFY(!details.contains(model.tr("Key")));
|
||||
QVERIFY(!details.contains(model.tr("Modifiers")));
|
||||
QVERIFY(!details.contains(Tr::tr("Key")));
|
||||
QVERIFY(!details.contains(Tr::tr("Modifiers")));
|
||||
} else {
|
||||
QCOMPARE(details[model.tr("Key")].toString(), QString("Key_Space"));
|
||||
QCOMPARE(details[model.tr("Modifiers")].toString(),
|
||||
QCOMPARE(details[Tr::tr("Key")].toString(), QString("Key_Space"));
|
||||
QCOMPARE(details[Tr::tr("Modifiers")].toString(),
|
||||
QString("ShiftModifier|MetaModifier"));
|
||||
}
|
||||
break;
|
||||
case InputKeyRelease:
|
||||
QCOMPARE(displayName, model.tr("Key Release"));
|
||||
QCOMPARE(details[model.tr("Modifiers")].toString(), QString("ShiftModifier"));
|
||||
QCOMPARE(details[model.tr("Key")].toString(), QString("Key_Space"));
|
||||
QCOMPARE(displayName, Tr::tr("Key Release"));
|
||||
QCOMPARE(details[Tr::tr("Modifiers")].toString(), QString("ShiftModifier"));
|
||||
QCOMPARE(details[Tr::tr("Key")].toString(), QString("Key_Space"));
|
||||
break;
|
||||
case InputKeyUnknown:
|
||||
QCOMPARE(displayName, model.tr("Keyboard Event"));
|
||||
QVERIFY(!details.contains(model.tr("Key")));
|
||||
QVERIFY(!details.contains(model.tr("Modifiers")));
|
||||
QCOMPARE(displayName, Tr::tr("Keyboard Event"));
|
||||
QVERIFY(!details.contains(Tr::tr("Key")));
|
||||
QVERIFY(!details.contains(Tr::tr("Modifiers")));
|
||||
break;
|
||||
case InputMousePress:
|
||||
QCOMPARE(displayName, model.tr("Mouse Press"));
|
||||
QCOMPARE(displayName, Tr::tr("Mouse Press"));
|
||||
|
||||
// 0x60 is not a valid mouse button
|
||||
QVERIFY(details.contains(model.tr("Button")));
|
||||
QVERIFY(details[model.tr("Button")].toString().isEmpty());
|
||||
QVERIFY(details.contains(Tr::tr("Button")));
|
||||
QVERIFY(details[Tr::tr("Button")].toString().isEmpty());
|
||||
|
||||
QCOMPARE(details[model.tr("Result")].toString(),
|
||||
QCOMPARE(details[Tr::tr("Result")].toString(),
|
||||
QString("ExtraButton23|MaxMouseButton"));
|
||||
break;
|
||||
case InputMouseRelease:
|
||||
QCOMPARE(displayName, model.tr("Mouse Release"));
|
||||
QCOMPARE(details[model.tr("Button")].toString(), QString("ExtraButton5"));
|
||||
QVERIFY(details.contains(model.tr("Result")));
|
||||
QVERIFY(details[model.tr("Result")].toString().isEmpty());
|
||||
QCOMPARE(displayName, Tr::tr("Mouse Release"));
|
||||
QCOMPARE(details[Tr::tr("Button")].toString(), QString("ExtraButton5"));
|
||||
QVERIFY(details.contains(Tr::tr("Result")));
|
||||
QVERIFY(details[Tr::tr("Result")].toString().isEmpty());
|
||||
break;
|
||||
case InputMouseMove:
|
||||
QCOMPARE(displayName, model.tr("Mouse Move"));
|
||||
QCOMPARE(details[model.tr("X")].toString(), QString("160"));
|
||||
QCOMPARE(details[model.tr("Y")].toString(), QString("167772160"));
|
||||
QCOMPARE(displayName, Tr::tr("Mouse Move"));
|
||||
QCOMPARE(details[Tr::tr("X")].toString(), QString("160"));
|
||||
QCOMPARE(details[Tr::tr("Y")].toString(), QString("167772160"));
|
||||
break;
|
||||
case InputMouseDoubleClick:
|
||||
QCOMPARE(displayName, model.tr("Double Click"));
|
||||
QVERIFY(details.contains(model.tr("Button")));
|
||||
QVERIFY(details[model.tr("Button")].toString().isEmpty());
|
||||
QCOMPARE(details[model.tr("Result")].toString(), QString("MaxMouseButton"));
|
||||
QCOMPARE(displayName, Tr::tr("Double Click"));
|
||||
QVERIFY(details.contains(Tr::tr("Button")));
|
||||
QVERIFY(details[Tr::tr("Button")].toString().isEmpty());
|
||||
QCOMPARE(details[Tr::tr("Result")].toString(), QString("MaxMouseButton"));
|
||||
break;
|
||||
case InputMouseWheel:
|
||||
QCOMPARE(displayName, model.tr("Mouse Wheel"));
|
||||
QCOMPARE(details[model.tr("Angle X")].toString(), QString("224"));
|
||||
QCOMPARE(details[model.tr("Angle Y")].toString(), QString("234881024"));
|
||||
QCOMPARE(displayName, Tr::tr("Mouse Wheel"));
|
||||
QCOMPARE(details[Tr::tr("Angle X")].toString(), QString("224"));
|
||||
QCOMPARE(details[Tr::tr("Angle Y")].toString(), QString("234881024"));
|
||||
break;
|
||||
case InputMouseUnknown:
|
||||
QCOMPARE(displayName, model.tr("Mouse Event"));
|
||||
QVERIFY(!details.contains(model.tr("X")));
|
||||
QVERIFY(!details.contains(model.tr("Y")));
|
||||
QVERIFY(!details.contains(model.tr("Angle X")));
|
||||
QVERIFY(!details.contains(model.tr("Angle Y")));
|
||||
QVERIFY(!details.contains(model.tr("Button")));
|
||||
QVERIFY(!details.contains(model.tr("Result")));
|
||||
QCOMPARE(displayName, Tr::tr("Mouse Event"));
|
||||
QVERIFY(!details.contains(Tr::tr("X")));
|
||||
QVERIFY(!details.contains(Tr::tr("Y")));
|
||||
QVERIFY(!details.contains(Tr::tr("Angle X")));
|
||||
QVERIFY(!details.contains(Tr::tr("Angle Y")));
|
||||
QVERIFY(!details.contains(Tr::tr("Button")));
|
||||
QVERIFY(!details.contains(Tr::tr("Result")));
|
||||
break;
|
||||
default:
|
||||
QCOMPARE(displayName, model.tr("Unknown"));
|
||||
QCOMPARE(displayName, Tr::tr("Unknown"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "memoryusagemodel_test.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include <QtTest>
|
||||
|
||||
namespace QmlProfiler {
|
||||
@@ -115,52 +116,52 @@ void MemoryUsageModelTest::testLabels()
|
||||
const QVariantList labels = model.labels();
|
||||
|
||||
const QVariantMap allocations = labels[0].toMap();
|
||||
QCOMPARE(allocations[QString("description")].toString(), model.tr("Memory Allocation"));
|
||||
QCOMPARE(allocations[QString("description")].toString(), Tr::tr("Memory Allocation"));
|
||||
QCOMPARE(allocations[QString("id")].toInt(), static_cast<int>(HeapPage));
|
||||
|
||||
const QVariantMap usages = labels[1].toMap();
|
||||
QCOMPARE(usages[QString("description")].toString(), model.tr("Memory Usage"));
|
||||
QCOMPARE(usages[QString("description")].toString(), Tr::tr("Memory Usage"));
|
||||
QCOMPARE(usages[QString("id")].toInt(), static_cast<int>(SmallItem));
|
||||
}
|
||||
|
||||
void MemoryUsageModelTest::testDetails()
|
||||
{
|
||||
const QVariantMap allocated = model.details(0);
|
||||
QCOMPARE(allocated[QString("displayName")].toString(), model.tr("Memory Allocated"));
|
||||
QCOMPARE(allocated[model.tr("Total")].toString(),
|
||||
model.tr("%n byte(s)", nullptr, 4096));
|
||||
QCOMPARE(allocated[model.tr("Allocated")].toString(),
|
||||
model.tr("%n byte(s)", nullptr, 4096));
|
||||
QCOMPARE(allocated[model.tr("Allocations")].toString(), QString::number(2));
|
||||
QCOMPARE(allocated[model.tr("Type")].toString(), model.tr("Heap Allocation"));
|
||||
QCOMPARE(allocated[model.tr("Location")].toString(), QmlProfilerModelManager::tr("<bytecode>"));
|
||||
QCOMPARE(allocated[QString("displayName")].toString(), Tr::tr("Memory Allocated"));
|
||||
QCOMPARE(allocated[Tr::tr("Total")].toString(),
|
||||
Tr::tr("%n byte(s)", nullptr, 4096));
|
||||
QCOMPARE(allocated[Tr::tr("Allocated")].toString(),
|
||||
Tr::tr("%n byte(s)", nullptr, 4096));
|
||||
QCOMPARE(allocated[Tr::tr("Allocations")].toString(), QString::number(2));
|
||||
QCOMPARE(allocated[Tr::tr("Type")].toString(), Tr::tr("Heap Allocation"));
|
||||
QCOMPARE(allocated[Tr::tr("Location")].toString(), Tr::tr("<bytecode>"));
|
||||
|
||||
QVERIFY(!allocated.contains(model.tr("Deallocated")));
|
||||
QVERIFY(!allocated.contains(model.tr("Deallocations")));
|
||||
QVERIFY(!allocated.contains(Tr::tr("Deallocated")));
|
||||
QVERIFY(!allocated.contains(Tr::tr("Deallocations")));
|
||||
|
||||
const QVariantMap large = model.details(2);
|
||||
QCOMPARE(large[QString("displayName")].toString(), model.tr("Memory Allocated"));
|
||||
QCOMPARE(large[model.tr("Total")].toString(),
|
||||
model.tr("%n byte(s)", nullptr, 5120));
|
||||
QCOMPARE(large[model.tr("Allocated")].toString(),
|
||||
model.tr("%n byte(s)", nullptr, 1024));
|
||||
QCOMPARE(large[model.tr("Allocations")].toString(), QString::number(1));
|
||||
QCOMPARE(large[model.tr("Type")].toString(), model.tr("Large Item Allocation"));
|
||||
QCOMPARE(large[model.tr("Location")].toString(), QmlProfilerModelManager::tr("<bytecode>"));
|
||||
QCOMPARE(large[QString("displayName")].toString(), Tr::tr("Memory Allocated"));
|
||||
QCOMPARE(large[Tr::tr("Total")].toString(),
|
||||
Tr::tr("%n byte(s)", nullptr, 5120));
|
||||
QCOMPARE(large[Tr::tr("Allocated")].toString(),
|
||||
Tr::tr("%n byte(s)", nullptr, 1024));
|
||||
QCOMPARE(large[Tr::tr("Allocations")].toString(), QString::number(1));
|
||||
QCOMPARE(large[Tr::tr("Type")].toString(), Tr::tr("Large Item Allocation"));
|
||||
QCOMPARE(large[Tr::tr("Location")].toString(), Tr::tr("<bytecode>"));
|
||||
|
||||
QVERIFY(!large.contains(model.tr("Deallocated")));
|
||||
QVERIFY(!large.contains(model.tr("Deallocations")));
|
||||
QVERIFY(!large.contains(Tr::tr("Deallocated")));
|
||||
QVERIFY(!large.contains(Tr::tr("Deallocations")));
|
||||
|
||||
const QVariantMap freed = model.details(9);
|
||||
QCOMPARE(freed[QString("displayName")].toString(), model.tr("Memory Freed"));
|
||||
QCOMPARE(freed[model.tr("Total")].toString(), model.tr("%n byte(s)", nullptr, 2048));
|
||||
QCOMPARE(freed[model.tr("Deallocated")].toString(), model.tr("%n byte(s)", nullptr, 1024));
|
||||
QCOMPARE(freed[model.tr("Deallocations")].toString(), QString::number(1));
|
||||
QCOMPARE(freed[model.tr("Type")].toString(), model.tr("Heap Usage"));
|
||||
QCOMPARE(freed[model.tr("Location")].toString(), QmlProfilerModelManager::tr("<bytecode>"));
|
||||
QCOMPARE(freed[QString("displayName")].toString(), Tr::tr("Memory Freed"));
|
||||
QCOMPARE(freed[Tr::tr("Total")].toString(), Tr::tr("%n byte(s)", nullptr, 2048));
|
||||
QCOMPARE(freed[Tr::tr("Deallocated")].toString(), Tr::tr("%n byte(s)", nullptr, 1024));
|
||||
QCOMPARE(freed[Tr::tr("Deallocations")].toString(), QString::number(1));
|
||||
QCOMPARE(freed[Tr::tr("Type")].toString(), Tr::tr("Heap Usage"));
|
||||
QCOMPARE(freed[Tr::tr("Location")].toString(), Tr::tr("<bytecode>"));
|
||||
|
||||
QVERIFY(!freed.contains(model.tr("Allocated")));
|
||||
QVERIFY(!freed.contains(model.tr("Allocations")));
|
||||
QVERIFY(!freed.contains(Tr::tr("Allocated")));
|
||||
QVERIFY(!freed.contains(Tr::tr("Allocations")));
|
||||
}
|
||||
|
||||
void MemoryUsageModelTest::testExpandedRow()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "pixmapcachemodel_test.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include <tracing/timelineformattime.h>
|
||||
#include <QtTest>
|
||||
|
||||
@@ -218,25 +219,25 @@ void PixmapCacheModelTest::testConsistency()
|
||||
break;
|
||||
case 1:
|
||||
QCOMPARE(collapsedRow, 1);
|
||||
QVERIFY(details[QLatin1String("displayName")].toString() == model.tr("Image Cached"));
|
||||
QVERIFY(details.contains(model.tr("Cache Size")));
|
||||
QVERIFY(details[QLatin1String("displayName")].toString() == Tr::tr("Image Cached"));
|
||||
QVERIFY(details.contains(Tr::tr("Cache Size")));
|
||||
break;
|
||||
default:
|
||||
QVERIFY(collapsedRow > 1);
|
||||
QCOMPARE(model.relativeHeight(i), 1.0f);
|
||||
QVERIFY(expandedRow < model.expandedRowCount());
|
||||
QVERIFY(details[QLatin1String("displayName")].toString() == model.tr("Image Loaded"));
|
||||
QCOMPARE(details[model.tr("Duration")].toString(),
|
||||
QVERIFY(details[QLatin1String("displayName")].toString() == Tr::tr("Image Loaded"));
|
||||
QCOMPARE(details[Tr::tr("Duration")].toString(),
|
||||
Timeline::formatTime(model.duration(i)));
|
||||
// In expanded view pixmaps of the same URL but different sizes are allowed to overlap.
|
||||
// It looks bad, but that should be a rare thing.
|
||||
break;
|
||||
}
|
||||
|
||||
QString filename = details[PixmapCacheModel::tr("File")].toString();
|
||||
QString filename = details[Tr::tr("File")].toString();
|
||||
QVERIFY(filename == QString("dings.png") || filename == QString("blah.png"));
|
||||
QVERIFY(details.contains(PixmapCacheModel::tr("Width")));
|
||||
QVERIFY(details.contains(PixmapCacheModel::tr("Height")));
|
||||
QVERIFY(details.contains(Tr::tr("Width")));
|
||||
QVERIFY(details.contains(Tr::tr("Height")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +276,7 @@ void PixmapCacheModelTest::testLabels()
|
||||
|
||||
const QVariantMap countRow = labels[0].toMap();
|
||||
|
||||
QCOMPARE(countRow[QString("description")].toString(), model.tr("Cache Size"));
|
||||
QCOMPARE(countRow[QString("description")].toString(), Tr::tr("Cache Size"));
|
||||
QCOMPARE(countRow[QString("id")].toInt(), 0);
|
||||
|
||||
const QVariantMap dingsRow = labels[1].toMap();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofileranimationsmodel_test.h"
|
||||
#include "qmlprofilertr.h"
|
||||
#include <tracing/timelineformattime.h>
|
||||
#include <QtTest>
|
||||
|
||||
@@ -81,13 +82,13 @@ void QmlProfilerAnimationsModelTest::testLabels()
|
||||
QCOMPARE(labels.length(), 2);
|
||||
|
||||
QVariantMap label0 = labels[0].toMap();
|
||||
QCOMPARE(label0["displayName"].toString(), QmlProfilerAnimationsModel::tr("Animations"));
|
||||
QCOMPARE(label0["description"].toString(), QmlProfilerAnimationsModel::tr("GUI Thread"));
|
||||
QCOMPARE(label0["displayName"].toString(), Tr::tr("Animations"));
|
||||
QCOMPARE(label0["description"].toString(), Tr::tr("GUI Thread"));
|
||||
QCOMPARE(label0["id"].toInt(), static_cast<int>(GuiThread));
|
||||
|
||||
QVariantMap label1 = labels[1].toMap();
|
||||
QCOMPARE(label1["displayName"].toString(), QmlProfilerAnimationsModel::tr("Animations"));
|
||||
QCOMPARE(label1["description"].toString(), QmlProfilerAnimationsModel::tr("Render Thread"));
|
||||
QCOMPARE(label1["displayName"].toString(), Tr::tr("Animations"));
|
||||
QCOMPARE(label1["description"].toString(), Tr::tr("Render Thread"));
|
||||
QCOMPARE(label1["id"].toInt(), static_cast<int>(RenderThread));
|
||||
}
|
||||
|
||||
@@ -96,15 +97,15 @@ void QmlProfilerAnimationsModelTest::testDetails()
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
QVariantMap details = model.details(i);
|
||||
QCOMPARE(details["displayName"].toString(), model.displayName());
|
||||
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Duration")].toString(),
|
||||
QCOMPARE(details[Tr::tr("Duration")].toString(),
|
||||
Timeline::formatTime(1));
|
||||
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Framerate")].toString(),
|
||||
QCOMPARE(details[Tr::tr("Framerate")].toString(),
|
||||
QString::fromLatin1("%1 FPS").arg(frameRate(i)));
|
||||
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Animations")].toString(),
|
||||
QCOMPARE(details[Tr::tr("Animations")].toString(),
|
||||
QString::number(9 - i));
|
||||
QCOMPARE(details[QmlProfilerAnimationsModel::tr("Context")].toString(), i % 2 ?
|
||||
QmlProfilerAnimationsModel::tr("Render Thread") :
|
||||
QmlProfilerAnimationsModel::tr("GUI Thread"));
|
||||
QCOMPARE(details[Tr::tr("Context")].toString(), i % 2 ?
|
||||
Tr::tr("Render Thread") :
|
||||
Tr::tr("GUI Thread"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (C) 2017 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmlprofilertr.h"
|
||||
#include "qmlprofilertraceclient_test.h"
|
||||
#include <qmldebug/qpacketprotocol.h>
|
||||
#include <QtTest>
|
||||
@@ -66,7 +67,7 @@ void QmlProfilerTraceClientTest::testMessageReceived()
|
||||
traceClient.clear();
|
||||
}, [this, &lastError](const QString &message) {
|
||||
QVERIFY(!message.isEmpty());
|
||||
if (lastError == QmlProfilerModelManager::tr("Read past end in temporary trace file.")) {
|
||||
if (lastError == Tr::tr("Read past end in temporary trace file.")) {
|
||||
// Ignore read-past-end errors: Our test traces are somewhat dirty and don't end on
|
||||
// packet boundaries
|
||||
modelManager.clearAll();
|
||||
|
||||
Reference in New Issue
Block a user