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:
@@ -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) ==
|
||||
|
||||
Reference in New Issue
Block a user