summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/plugininstallwizard.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2023-01-16 17:20:07 +0100
committerhjk <hjk@qt.io>2023-01-17 14:34:16 +0000
commit015b1ee53cd381ec36f6ed3d143bdd8f0d87f40b (patch)
treefed41ee76f0c4cdfcbe70c4eed8d3313b0491fbd /src/plugins/coreplugin/plugininstallwizard.cpp
parent8f8150db2d547bc5a7c783785128a7d45de615cf (diff)
downloadqt-creator-015b1ee53cd381ec36f6ed3d143bdd8f0d87f40b.tar.gz
Core: Tr::tr
Change-Id: I0064814b0689f0f65072d2b0f60e26162587fd54 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/plugininstallwizard.cpp')
-rw-r--r--src/plugins/coreplugin/plugininstallwizard.cpp72
1 files changed, 32 insertions, 40 deletions
diff --git a/src/plugins/coreplugin/plugininstallwizard.cpp b/src/plugins/coreplugin/plugininstallwizard.cpp
index 7ea00e9282..ae62d21564 100644
--- a/src/plugins/coreplugin/plugininstallwizard.cpp
+++ b/src/plugins/coreplugin/plugininstallwizard.cpp
@@ -4,6 +4,7 @@
#include "plugininstallwizard.h"
#include "coreplugin.h"
+#include "coreplugintr.h"
#include "icore.h"
#include <extensionsystem/pluginspec.h>
@@ -77,14 +78,13 @@ public:
: WizardPage(parent)
, m_data(data)
{
- setTitle(PluginInstallWizard::tr("Source"));
+ setTitle(Tr::tr("Source"));
auto vlayout = new QVBoxLayout;
setLayout(vlayout);
auto label = new QLabel(
"<p>"
- + PluginInstallWizard::tr(
- "Choose source location. This can be a plugin library file or a zip file.")
+ + Tr::tr("Choose source location. This can be a plugin library file or a zip file.")
+ "</p>");
label->setWordWrap(true);
vlayout->addWidget(label);
@@ -113,7 +113,7 @@ public:
{
const FilePath path = m_data->sourcePath;
if (!QFile::exists(path.toString())) {
- m_info->setText(PluginInstallWizard::tr("File does not exist."));
+ m_info->setText(Tr::tr("File does not exist."));
return false;
}
if (hasLibSuffix(path))
@@ -151,14 +151,14 @@ public:
: WizardPage(parent)
, m_data(data)
{
- setTitle(PluginInstallWizard::tr("Check Archive"));
+ setTitle(Tr::tr("Check Archive"));
auto vlayout = new QVBoxLayout;
setLayout(vlayout);
m_label = new InfoLabel;
m_label->setElideMode(Qt::ElideNone);
m_label->setWordWrap(true);
- m_cancelButton = new QPushButton(PluginInstallWizard::tr("Cancel"));
+ m_cancelButton = new QPushButton(Tr::tr("Cancel"));
m_output = new QTextEdit;
m_output->setReadOnly(true);
@@ -179,7 +179,7 @@ public:
m_tempDir = std::make_unique<TemporaryDirectory>("plugininstall");
m_data->extractedPath = m_tempDir->path();
- m_label->setText(PluginInstallWizard::tr("Checking archive..."));
+ m_label->setText(Tr::tr("Checking archive..."));
m_label->setType(InfoLabel::None);
m_cancelButton->setVisible(true);
@@ -188,7 +188,7 @@ public:
m_archive.reset(new Archive(m_data->sourcePath, m_tempDir->path()));
if (!m_archive->isValid()) {
m_label->setType(InfoLabel::Error);
- m_label->setText(PluginInstallWizard::tr("The file is not an archive."));
+ m_label->setText(Tr::tr("The file is not an archive."));
return;
}
QObject::connect(m_archive.get(), &Archive::outputReceived, this,
@@ -214,11 +214,10 @@ public:
m_cancelButton->setVisible(false);
if (m_canceled) {
m_label->setType(InfoLabel::Information);
- m_label->setText(PluginInstallWizard::tr("Canceled."));
+ m_label->setText(Tr::tr("Canceled."));
} else {
m_label->setType(InfoLabel::Error);
- m_label->setText(
- PluginInstallWizard::tr("There was an error while unarchiving."));
+ m_label->setText(Tr::tr("There was an error while unarchiving."));
}
} else { // unarchiving was successful, run a check
m_archiveCheck = Utils::runAsync(
@@ -229,10 +228,10 @@ public:
const bool ok = f.resultCount() == 0 && !f.isCanceled();
if (f.isCanceled()) {
m_label->setType(InfoLabel::Information);
- m_label->setText(PluginInstallWizard::tr("Canceled."));
+ m_label->setText(Tr::tr("Canceled."));
} else if (ok) {
m_label->setType(InfoLabel::Ok);
- m_label->setText(PluginInstallWizard::tr("Archive is OK."));
+ m_label->setText(Tr::tr("Archive is OK."));
} else {
const ArchiveIssue issue = f.result();
m_label->setType(issue.type);
@@ -275,8 +274,7 @@ public:
});
if (found != dependencies.constEnd()) {
if (!coreplugin->provides(found->name, found->version)) {
- fi.reportResult({PluginInstallWizard::tr(
- "Plugin requires an incompatible version of %1 (%2).")
+ fi.reportResult({Tr::tr("Plugin requires an incompatible version of %1 (%2).")
.arg(Constants::IDE_DISPLAY_NAME)
.arg(found->version),
InfoLabel::Error});
@@ -286,9 +284,8 @@ public:
return; // successful / no error
}
}
- fi.reportResult(
- {PluginInstallWizard::tr("Did not find %1 plugin.").arg(Constants::IDE_DISPLAY_NAME),
- InfoLabel::Error});
+ fi.reportResult({Tr::tr("Did not find %1 plugin.").arg(Constants::IDE_DISPLAY_NAME),
+ InfoLabel::Error});
}
void cleanupPage() final
@@ -323,21 +320,19 @@ public:
: WizardPage(parent)
, m_data(data)
{
- setTitle(PluginInstallWizard::tr("Install Location"));
+ setTitle(Tr::tr("Install Location"));
auto vlayout = new QVBoxLayout;
setLayout(vlayout);
- auto label = new QLabel("<p>" + PluginInstallWizard::tr("Choose install location.")
- + "</p>");
+ auto label = new QLabel("<p>" + Tr::tr("Choose install location.") + "</p>");
label->setWordWrap(true);
vlayout->addWidget(label);
vlayout->addSpacing(10);
- auto localInstall = new QRadioButton(PluginInstallWizard::tr("User plugins"));
+ auto localInstall = new QRadioButton(Tr::tr("User plugins"));
localInstall->setChecked(!m_data->installIntoApplication);
- auto localLabel = new QLabel(
- PluginInstallWizard::tr("The plugin will be available to all compatible %1 "
- "installations, but only for the current user.")
+ auto localLabel = new QLabel(Tr::tr("The plugin will be available to all compatible %1 "
+ "installations, but only for the current user.")
.arg(Constants::IDE_DISPLAY_NAME));
localLabel->setWordWrap(true);
localLabel->setAttribute(Qt::WA_MacSmallSize, true);
@@ -347,11 +342,11 @@ public:
vlayout->addSpacing(10);
auto appInstall = new QRadioButton(
- PluginInstallWizard::tr("%1 installation").arg(Constants::IDE_DISPLAY_NAME));
+ Tr::tr("%1 installation").arg(Constants::IDE_DISPLAY_NAME));
appInstall->setChecked(m_data->installIntoApplication);
auto appLabel = new QLabel(
- PluginInstallWizard::tr("The plugin will be available only to this %1 "
- "installation, but for all users that can access it.")
+ Tr::tr("The plugin will be available only to this %1 "
+ "installation, but for all users that can access it.")
.arg(Constants::IDE_DISPLAY_NAME));
appLabel->setWordWrap(true);
appLabel->setAttribute(Qt::WA_MacSmallSize, true);
@@ -377,7 +372,7 @@ public:
: WizardPage(parent)
, m_data(data)
{
- setTitle(PluginInstallWizard::tr("Summary"));
+ setTitle(Tr::tr("Summary"));
auto vlayout = new QVBoxLayout;
setLayout(vlayout);
@@ -390,7 +385,7 @@ public:
void initializePage() final
{
m_summaryLabel->setText(
- PluginInstallWizard::tr("\"%1\" will be installed into \"%2\".")
+ Tr::tr("\"%1\" will be installed into \"%2\".")
.arg(m_data->sourcePath.toUserOutput(),
pluginInstallPath(m_data->installIntoApplication).toUserOutput()));
}
@@ -419,13 +414,11 @@ static bool copyPluginFile(const FilePath &src, const FilePath &dest)
const FilePath destFile = dest.pathAppended(src.fileName());
if (destFile.exists()) {
QMessageBox box(QMessageBox::Question,
- PluginInstallWizard::tr("Overwrite File"),
- PluginInstallWizard::tr("The file \"%1\" exists. Overwrite?")
- .arg(destFile.toUserOutput()),
+ Tr::tr("Overwrite File"),
+ Tr::tr("The file \"%1\" exists. Overwrite?").arg(destFile.toUserOutput()),
QMessageBox::Cancel,
ICore::dialogParent());
- QPushButton *acceptButton = box.addButton(PluginInstallWizard::tr("Overwrite"),
- QMessageBox::AcceptRole);
+ QPushButton *acceptButton = box.addButton(Tr::tr("Overwrite"), QMessageBox::AcceptRole);
box.setDefaultButton(acceptButton);
box.exec();
if (box.clickedButton() != acceptButton)
@@ -435,9 +428,8 @@ static bool copyPluginFile(const FilePath &src, const FilePath &dest)
dest.parentDir().ensureWritableDir();
if (!src.copyFile(destFile)) {
QMessageBox::warning(ICore::dialogParent(),
- PluginInstallWizard::tr("Failed to Write File"),
- PluginInstallWizard::tr("Failed to write file \"%1\".")
- .arg(destFile.toUserOutput()));
+ Tr::tr("Failed to Write File"),
+ Tr::tr("Failed to write file \"%1\".").arg(destFile.toUserOutput()));
return false;
}
postCopyOperation()(destFile);
@@ -447,7 +439,7 @@ static bool copyPluginFile(const FilePath &src, const FilePath &dest)
bool PluginInstallWizard::exec()
{
Wizard wizard(ICore::dialogParent());
- wizard.setWindowTitle(tr("Install Plugin"));
+ wizard.setWindowTitle(Tr::tr("Install Plugin"));
Data data;
@@ -475,7 +467,7 @@ bool PluginInstallWizard::exec()
FileUtils::CopyAskingForOverwrite(ICore::dialogParent(),
postCopyOperation()))) {
QMessageBox::warning(ICore::dialogParent(),
- PluginInstallWizard::tr("Failed to Copy Plugin Files"),
+ Tr::tr("Failed to Copy Plugin Files"),
error);
return false;
}