@@ -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."
- "Commonly used command-line arguments are:")
+ hint->setText(Tr::tr("Select an externally started QML-debug enabled application.
"
+ "Commonly used command-line arguments are:")
+ "
-qmljsdebugger=port:<port>,block,
"
" services:CanvasFrameRate,EngineControl,DebugMessages");
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);
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
index a1aab1d883e..695685a0660 100644
--- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
@@ -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
#include
@@ -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("");
+ return Tr::tr("");
} 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::ReplaySuccess:
return true;
case Timeline::TraceStashFile::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::ReplayLoadFailed:
// Happens if the loader rejects an event. Not an actual error
break;
case Timeline::TraceStashFile::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;
diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp
index cc2c59f2f4d..ff4dfb8a7ac 100644
--- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp
@@ -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
#include
@@ -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;
}
diff --git a/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp b/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp
index 5c38dd0bbea..ecf15b0e0fb 100644
--- a/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp
@@ -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
@@ -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); });
diff --git a/src/plugins/qmlprofiler/qmlprofilersettings.cpp b/src/plugins/qmlprofiler/qmlprofilersettings.cpp
index a9f1d292f0a..d49200d2fcd 100644
--- a/src/plugins/qmlprofiler/qmlprofilersettings.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilersettings.cpp
@@ -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
@@ -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);
}
diff --git a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp
index d0a1b530665..ab3f6e0b918 100644
--- a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp
@@ -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
#include
@@ -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"));
}
}
diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp
index af6995e005d..b618af27b8f 100644
--- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp
@@ -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
#include
@@ -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("") : type.displayName();
+ return type.displayName().isEmpty() ? Tr::tr("") : 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 "";
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("") : type.displayName();
+ return type.displayName().isEmpty() ? Tr::tr("") : 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());
diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp
index 0e5143e1075..d1c84852367 100644
--- a/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp
@@ -3,6 +3,7 @@
#include "qmlprofilerstatisticsview.h"
#include "qmlprofilertool.h"
+#include "qmlprofilertr.h"
#include
#include
@@ -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);
diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp
index aeeccd87659..2dc1eb48894 100644
--- a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp
@@ -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,
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index 2f92f9347b9..c74e85638ef 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -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
@@ -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(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) ==
diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
index 84159abfe9d..629d692124e 100644
--- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
@@ -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
@@ -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::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());
}
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
index 2d8ee1848c5..68ea86cb955 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
@@ -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);
diff --git a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp
index fafa7fdb069..f4b3492d10f 100644
--- a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp
@@ -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
@@ -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(); });
}
diff --git a/src/plugins/qmlprofiler/quick3dmodel.cpp b/src/plugins/qmlprofiler/quick3dmodel.cpp
index 75bfd619d76..48f6409fe17 100644
--- a/src/plugins/qmlprofiler/quick3dmodel.cpp
+++ b/src/plugins/qmlprofiler/quick3dmodel.cpp
@@ -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
+#include "qmlprofilertr.h"
+#include "quick3dmodel.h"
+#include
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;
}
diff --git a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp
index e16284fed66..d6ddc9ed5c4 100644
--- a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp
+++ b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp
@@ -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
@@ -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(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(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;
}
diff --git a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp
index eea2f371586..9d702e24e0a 100644
--- a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp
@@ -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
@@ -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));
}
}
diff --git a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp
index 9f6c81a355d..dfa7e02ea17 100644
--- a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp
@@ -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
@@ -111,10 +112,10 @@ void FlameGraphModelTest::testCounts()
void FlameGraphModelTest::testData()
{
const QVector 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);
}
diff --git a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp
index 78d64cc90c8..3a98aee3cc0 100644
--- a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp
@@ -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
#include
@@ -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(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(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;
}
}
diff --git a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp
index 1d0dba4171e..ca25338ad1d 100644
--- a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp
@@ -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
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(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(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(""));
+ 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(""));
- 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(""));
+ 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(""));
- 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(""));
+ 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(""));
- 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()
diff --git a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp
index f6e8dfd0c1d..8f5f05797e2 100644
--- a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp
@@ -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
#include
@@ -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();
diff --git a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp
index 7c54547b357..2003dff8260 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp
@@ -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
#include
@@ -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(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(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"));
}
}
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp
index 71e3fabcc04..7afa6ff7127 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp
+++ b/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp
@@ -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
#include
@@ -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();