Docker: Move to Tr::tr

There were no strings in the .ts files yet.

Change-Id: I86e7edace45db796fc3cc80d2735d1a80b897c85
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2022-07-13 10:43:31 +02:00
parent 4ca769afb1
commit 57ce33bc4e
13 changed files with 127 additions and 152 deletions

View File

@@ -25,6 +25,8 @@
#include "dockerapi.h" #include "dockerapi.h"
#include "dockertr.h"
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
@@ -36,11 +38,10 @@
Q_LOGGING_CATEGORY(dockerApiLog, "qtc.docker.api", QtDebugMsg); Q_LOGGING_CATEGORY(dockerApiLog, "qtc.docker.api", QtDebugMsg);
namespace Docker {
namespace Internal {
using namespace Utils; using namespace Utils;
namespace Docker::Internal {
DockerApi *s_instance{nullptr}; DockerApi *s_instance{nullptr};
DockerApi::DockerApi(DockerSettings *settings) DockerApi::DockerApi(DockerSettings *settings)
@@ -91,7 +92,7 @@ void DockerApi::checkCanConnect(bool async)
emit dockerDaemonAvailableChanged(); emit dockerDaemonAvailableChanged();
}); });
Core::ProgressManager::addTask(future, tr("Checking docker daemon"), "DockerPlugin"); Core::ProgressManager::addTask(future, Tr::tr("Checking docker daemon"), "DockerPlugin");
return; return;
} }
@@ -127,5 +128,4 @@ FilePath DockerApi::dockerClient()
return FilePath::fromString(m_settings->dockerBinaryPath.value()); return FilePath::fromString(m_settings->dockerBinaryPath.value());
} }
} // namespace Internal } // Docker::Internal
} // namespace Docker

View File

@@ -27,15 +27,14 @@
#include "dockersettings.h" #include "dockersettings.h"
#include <QMutex>
#include <QObject>
#include <utils/filepath.h> #include <utils/filepath.h>
#include <utils/guard.h> #include <utils/guard.h>
#include <utils/optional.h> #include <utils/optional.h>
namespace Docker { #include <QMutex>
namespace Internal { #include <QObject>
namespace Docker::Internal {
class DockerApi : public QObject class DockerApi : public QObject
{ {
@@ -60,11 +59,9 @@ public:
private: private:
Utils::FilePath dockerClient(); Utils::FilePath dockerClient();
private:
Utils::optional<bool> m_dockerDaemonAvailable; Utils::optional<bool> m_dockerDaemonAvailable;
QMutex m_daemonCheckGuard; QMutex m_daemonCheckGuard;
DockerSettings *m_settings; DockerSettings *m_settings;
}; };
} // namespace Internal } // Docker::Internal
} // namespace Docker

View File

@@ -23,18 +23,13 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef DOCKERCONSTANTS_H #pragma once
#define DOCKERCONSTANTS_H
namespace Docker { namespace Docker::Constants {
namespace Constants {
const char DOCKER[] = "docker"; const char DOCKER[] = "docker";
const char DOCKER_SETTINGS_ID[] = "Docker.Settings"; const char DOCKER_SETTINGS_ID[] = "Docker.Settings";
const char DOCKER_DEVICE_TYPE[] = "DockerDeviceType"; const char DOCKER_DEVICE_TYPE[] = "DockerDeviceType";
} // namespace Constants } // Docker::Constants
} // namespace Docker
#endif // DOCKERCONSTANTS_H

View File

@@ -25,8 +25,10 @@
#include "dockerdevice.h" #include "dockerdevice.h"
#include "dockerapi.h"
#include "dockerconstants.h" #include "dockerconstants.h"
#include "dockerdevicewidget.h" #include "dockerdevicewidget.h"
#include "dockertr.h"
#include "kitdetector.h" #include "kitdetector.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
@@ -95,8 +97,7 @@ using namespace ProjectExplorer;
using namespace QtSupport; using namespace QtSupport;
using namespace Utils; using namespace Utils;
namespace Docker { namespace Docker::Internal {
namespace Internal {
const QString s_pidMarker = "__qtc$$qtc__"; const QString s_pidMarker = "__qtc$$qtc__";
@@ -125,8 +126,6 @@ private:
class DockerDevicePrivate : public QObject class DockerDevicePrivate : public QObject
{ {
Q_DECLARE_TR_FUNCTIONS(Docker::Internal::DockerDevice)
public: public:
DockerDevicePrivate(DockerDevice *parent, DockerSettings *settings) DockerDevicePrivate(DockerDevice *parent, DockerSettings *settings)
: q(parent) : q(parent)
@@ -298,8 +297,8 @@ Tasks DockerDevice::validate() const
Tasks result; Tasks result;
if (d->m_data.mounts.isEmpty()) { if (d->m_data.mounts.isEmpty()) {
result << Task(Task::Error, result << Task(Task::Error,
tr("The docker device has not set up shared directories." Tr::tr("The docker device has not set up shared directories."
"This will not work for building."), "This will not work for building."),
{}, -1, {}); {}, -1, {});
} }
return result; return result;
@@ -325,17 +324,17 @@ DockerDevice::DockerDevice(DockerSettings *settings, const DockerDeviceData &dat
{ {
d->m_data = data; d->m_data = data;
setDisplayType(tr("Docker")); setDisplayType(Tr::tr("Docker"));
setOsType(OsTypeOtherUnix); setOsType(OsTypeOtherUnix);
setDefaultDisplayName(tr("Docker Image"));; setDefaultDisplayName(Tr::tr("Docker Image"));;
setDisplayName(tr("Docker Image \"%1\" (%2)").arg(data.repoAndTag()).arg(data.imageId)); setDisplayName(Tr::tr("Docker Image \"%1\" (%2)").arg(data.repoAndTag()).arg(data.imageId));
setAllowEmptyCommand(true); setAllowEmptyCommand(true);
setOpenTerminal([this, settings](const Environment &env, const FilePath &workingDir) { setOpenTerminal([this, settings](const Environment &env, const FilePath &workingDir) {
Q_UNUSED(env); // TODO: That's the runnable's environment in general. Use it via -e below. Q_UNUSED(env); // TODO: That's the runnable's environment in general. Use it via -e below.
updateContainerAccess(); updateContainerAccess();
if (d->m_container.isEmpty()) { if (d->m_container.isEmpty()) {
MessageManager::writeDisrupting(tr("Error starting remote shell. No container.")); MessageManager::writeDisrupting(Tr::tr("Error starting remote shell. No container."));
return; return;
} }
@@ -344,7 +343,7 @@ DockerDevice::DockerDevice(DockerSettings *settings, const DockerDeviceData &dat
QObject::connect(proc, &QtcProcess::done, [proc] { QObject::connect(proc, &QtcProcess::done, [proc] {
if (proc->error() != QProcess::UnknownError && MessageManager::instance()) if (proc->error() != QProcess::UnknownError && MessageManager::instance())
MessageManager::writeDisrupting(tr("Error starting remote shell.")); MessageManager::writeDisrupting(Tr::tr("Error starting remote shell."));
proc->deleteLater(); proc->deleteLater();
}); });
@@ -354,7 +353,7 @@ DockerDevice::DockerDevice(DockerSettings *settings, const DockerDeviceData &dat
proc->start(); proc->start();
}); });
addDeviceAction({tr("Open Shell in Container"), [](const IDevice::Ptr &device, QWidget *) { addDeviceAction({Tr::tr("Open Shell in Container"), [](const IDevice::Ptr &device, QWidget *) {
device->openTerminal(device->systemEnvironment(), FilePath()); device->openTerminal(device->systemEnvironment(), FilePath());
}}); }});
} }
@@ -472,10 +471,10 @@ void DockerDevicePrivate::startContainer()
m_shell.reset(); m_shell.reset();
DockerApi::recheckDockerDaemon(); DockerApi::recheckDockerDaemon();
MessageManager::writeFlashing(tr("Docker daemon appears to be not running. " MessageManager::writeFlashing(Tr::tr("Docker daemon appears to be not running. "
"Verify daemon is up and running and reset the " "Verify daemon is up and running and reset the "
"docker daemon on the docker device settings page " "docker daemon on the docker device settings page "
"or restart Qt Creator.")); "or restart Qt Creator."));
}); });
if (!m_shell->start()) { if (!m_shell->start()) {
@@ -1085,7 +1084,7 @@ public:
: QDialog(ICore::dialogParent()) : QDialog(ICore::dialogParent())
, m_settings(settings) , m_settings(settings)
{ {
setWindowTitle(DockerDevice::tr("Docker Image Selection")); setWindowTitle(Tr::tr("Docker Image Selection"));
resize(800, 600); resize(800, 600);
m_model.setHeader({"Repository", "Tag", "Image", "Size"}); m_model.setHeader({"Repository", "Tag", "Image", "Size"});
@@ -1120,7 +1119,7 @@ public:
m_buttons->button(QDialogButtonBox::Ok)->setEnabled(false); m_buttons->button(QDialogButtonBox::Ok)->setEnabled(false);
CommandLine cmd{m_settings->dockerBinaryPath.filePath(), {"images", "--format", "{{.ID}}\\t{{.Repository}}\\t{{.Tag}}\\t{{.Size}}"}}; CommandLine cmd{m_settings->dockerBinaryPath.filePath(), {"images", "--format", "{{.ID}}\\t{{.Repository}}\\t{{.Tag}}\\t{{.Size}}"}};
m_log->append(DockerDevice::tr("Running \"%1\"\n").arg(cmd.toUserOutput())); m_log->append(Tr::tr("Running \"%1\"\n").arg(cmd.toUserOutput()));
m_process = new QtcProcess(this); m_process = new QtcProcess(this);
m_process->setCommand(cmd); m_process->setCommand(cmd);
@@ -1131,7 +1130,7 @@ public:
for (const QString &line : out.split('\n')) { for (const QString &line : out.split('\n')) {
const QStringList parts = line.trimmed().split('\t'); const QStringList parts = line.trimmed().split('\t');
if (parts.size() != 4) { if (parts.size() != 4) {
m_log->append(DockerDevice::tr("Unexpected result: %1").arg(line) + '\n'); m_log->append(Tr::tr("Unexpected result: %1").arg(line) + '\n');
continue; continue;
} }
auto item = new DockerImageItem; auto item = new DockerImageItem;
@@ -1141,12 +1140,12 @@ public:
item->size = parts.at(3); item->size = parts.at(3);
m_model.rootItem()->appendChild(item); m_model.rootItem()->appendChild(item);
} }
m_log->append(DockerDevice::tr("Done.")); m_log->append(Tr::tr("Done."));
}); });
connect(m_process, &Utils::QtcProcess::readyReadStandardError, this, [this] { connect(m_process, &Utils::QtcProcess::readyReadStandardError, this, [this] {
const QString out = DockerDevice::tr("Error: %1").arg(m_process->cleanedStdErr()); const QString out = Tr::tr("Error: %1").arg(m_process->cleanedStdErr());
m_log->append(DockerDevice::tr("Error: %1").arg(out)); m_log->append(Tr::tr("Error: %1").arg(out));
}); });
connect(m_process, &QtcProcess::done, errorLabel, [errorLabel, this] { connect(m_process, &QtcProcess::done, errorLabel, [errorLabel, this] {
@@ -1193,7 +1192,7 @@ public:
DockerDeviceFactory::DockerDeviceFactory(DockerSettings *settings) DockerDeviceFactory::DockerDeviceFactory(DockerSettings *settings)
: IDeviceFactory(Constants::DOCKER_DEVICE_TYPE) : IDeviceFactory(Constants::DOCKER_DEVICE_TYPE)
{ {
setDisplayName(DockerDevice::tr("Docker Device")); setDisplayName(Tr::tr("Docker Device"));
setIcon(QIcon()); setIcon(QIcon());
setCreator([settings] { setCreator([settings] {
DockerDeviceSetupWizard wizard(settings); DockerDeviceSetupWizard wizard(settings);
@@ -1218,5 +1217,4 @@ void DockerDeviceFactory::shutdownExistingDevices()
} }
} }
} // Internal } // Docker::Internal
} // Docker

View File

@@ -35,8 +35,7 @@
#include <QMutex> #include <QMutex>
namespace Docker { namespace Docker::Internal {
namespace Internal {
class DockerDeviceData class DockerDeviceData
{ {
@@ -54,8 +53,6 @@ public:
class DockerDevice : public ProjectExplorer::IDevice class DockerDevice : public ProjectExplorer::IDevice
{ {
Q_DECLARE_TR_FUNCTIONS(Docker::Internal::DockerDevice)
public: public:
using Ptr = QSharedPointer<DockerDevice>; using Ptr = QSharedPointer<DockerDevice>;
using ConstPtr = QSharedPointer<const DockerDevice>; using ConstPtr = QSharedPointer<const DockerDevice>;
@@ -148,7 +145,6 @@ private:
std::vector<QWeakPointer<DockerDevice> > m_existingDevices; std::vector<QWeakPointer<DockerDevice> > m_existingDevices;
}; };
} // Internal } // Docker::Internal
} // Docker
Q_DECLARE_METATYPE(Docker::Internal::DockerDeviceData) Q_DECLARE_METATYPE(Docker::Internal::DockerDeviceData)

View File

@@ -25,6 +25,10 @@
#include "dockerdevicewidget.h" #include "dockerdevicewidget.h"
#include "dockerapi.h"
#include "dockerdevice.h"
#include "dockertr.h"
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
@@ -32,17 +36,16 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <QCoreApplication> #include <QCheckBox>
#include <QToolButton>
#include <QTextBrowser>
#include <QPushButton>
#include <QComboBox> #include <QComboBox>
#include <QPushButton>
#include <QTextBrowser>
#include <QToolButton>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
namespace Docker { namespace Docker::Internal {
namespace Internal {
DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device) DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
: IDeviceWidget(device), m_kitItemDetector(device) : IDeviceWidget(device), m_kitItemDetector(device)
@@ -52,24 +55,24 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
DockerDeviceData &data = dockerDevice->data(); DockerDeviceData &data = dockerDevice->data();
auto repoLabel = new QLabel(tr("Repository:")); auto repoLabel = new QLabel(Tr::tr("Repository:"));
m_repoLineEdit = new QLineEdit; m_repoLineEdit = new QLineEdit;
m_repoLineEdit->setText(data.repo); m_repoLineEdit->setText(data.repo);
m_repoLineEdit->setEnabled(false); m_repoLineEdit->setEnabled(false);
auto tagLabel = new QLabel(tr("Tag:")); auto tagLabel = new QLabel(Tr::tr("Tag:"));
m_tagLineEdit = new QLineEdit; m_tagLineEdit = new QLineEdit;
m_tagLineEdit->setText(data.tag); m_tagLineEdit->setText(data.tag);
m_tagLineEdit->setEnabled(false); m_tagLineEdit->setEnabled(false);
auto idLabel = new QLabel(tr("Image ID:")); auto idLabel = new QLabel(Tr::tr("Image ID:"));
m_idLineEdit = new QLineEdit; m_idLineEdit = new QLineEdit;
m_idLineEdit->setText(data.imageId); m_idLineEdit->setText(data.imageId);
m_idLineEdit->setEnabled(false); m_idLineEdit->setEnabled(false);
auto daemonStateLabel = new QLabel(tr("Daemon state:")); auto daemonStateLabel = new QLabel(Tr::tr("Daemon state:"));
m_daemonReset = new QToolButton; m_daemonReset = new QToolButton;
m_daemonReset->setToolTip(tr("Clears detected daemon state. " m_daemonReset->setToolTip(Tr::tr("Clears detected daemon state. "
"It will be automatically re-evaluated next time access is needed.")); "It will be automatically re-evaluated next time access is needed."));
m_daemonState = new QLabel; m_daemonState = new QLabel;
@@ -84,9 +87,9 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
DockerApi::recheckDockerDaemon(); DockerApi::recheckDockerDaemon();
}); });
m_runAsOutsideUser = new QCheckBox(tr("Run as outside user")); m_runAsOutsideUser = new QCheckBox(Tr::tr("Run as outside user"));
m_runAsOutsideUser->setToolTip(tr("Uses user ID and group ID of the user running Qt Creator " m_runAsOutsideUser->setToolTip(Tr::tr("Uses user ID and group ID of the user running Qt Creator "
"in the docker container.")); "in the docker container."));
m_runAsOutsideUser->setChecked(data.useLocalUidGid); m_runAsOutsideUser->setChecked(data.useLocalUidGid);
m_runAsOutsideUser->setEnabled(HostOsInfo::isLinuxHost()); m_runAsOutsideUser->setEnabled(HostOsInfo::isLinuxHost());
@@ -94,13 +97,13 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
data.useLocalUidGid = on; data.useLocalUidGid = on;
}); });
auto pathListLabel = new InfoLabel(tr("Paths to mount:")); auto pathListLabel = new InfoLabel(Tr::tr("Paths to mount:"));
pathListLabel->setAdditionalToolTip(tr("Source directory list should not be empty.")); pathListLabel->setAdditionalToolTip(Tr::tr("Source directory list should not be empty."));
m_pathsListEdit = new PathListEditor; m_pathsListEdit = new PathListEditor;
m_pathsListEdit->setPlaceholderText(tr("Host directories to mount into the container")); m_pathsListEdit->setPlaceholderText(Tr::tr("Host directories to mount into the container"));
m_pathsListEdit->setToolTip(tr("Maps paths in this list one-to-one to the " m_pathsListEdit->setToolTip(Tr::tr("Maps paths in this list one-to-one to the "
"docker container.")); "docker container."));
m_pathsListEdit->setPathList(data.mounts); m_pathsListEdit->setPathList(data.mounts);
auto markupMounts = [this, pathListLabel] { auto markupMounts = [this, pathListLabel] {
@@ -118,19 +121,19 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
connect(&m_kitItemDetector, &KitDetector::logOutput, connect(&m_kitItemDetector, &KitDetector::logOutput,
logView, &QTextBrowser::append); logView, &QTextBrowser::append);
auto autoDetectButton = new QPushButton(tr("Auto-detect Kit Items")); auto autoDetectButton = new QPushButton(Tr::tr("Auto-detect Kit Items"));
auto undoAutoDetectButton = new QPushButton(tr("Remove Auto-Detected Kit Items")); auto undoAutoDetectButton = new QPushButton(Tr::tr("Remove Auto-Detected Kit Items"));
auto listAutoDetectedButton = new QPushButton(tr("List Auto-Detected Kit Items")); auto listAutoDetectedButton = new QPushButton(Tr::tr("List Auto-Detected Kit Items"));
auto searchDirsComboBox = new QComboBox; auto searchDirsComboBox = new QComboBox;
searchDirsComboBox->addItem(tr("Search in PATH")); searchDirsComboBox->addItem(Tr::tr("Search in PATH"));
searchDirsComboBox->addItem(tr("Search in Selected Directories")); searchDirsComboBox->addItem(Tr::tr("Search in Selected Directories"));
auto searchDirsLineEdit = new FancyLineEdit; auto searchDirsLineEdit = new FancyLineEdit;
searchDirsLineEdit->setPlaceholderText(tr("Semicolon-separated list of directories")); searchDirsLineEdit->setPlaceholderText(Tr::tr("Semicolon-separated list of directories"));
searchDirsLineEdit->setToolTip( searchDirsLineEdit->setToolTip(
tr("Select the paths in the docker image that should be scanned for kit entries.")); Tr::tr("Select the paths in the docker image that should be scanned for kit entries."));
searchDirsLineEdit->setHistoryCompleter("DockerMounts", true); searchDirsLineEdit->setHistoryCompleter("DockerMounts", true);
auto searchPaths = [searchDirsComboBox, searchDirsLineEdit, dockerDevice] { auto searchPaths = [searchDirsComboBox, searchDirsLineEdit, dockerDevice] {
@@ -155,9 +158,9 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
m_kitItemDetector.autoDetect(dockerDevice->id().toString(), searchPaths()); m_kitItemDetector.autoDetect(dockerDevice->id().toString(), searchPaths());
if (DockerApi::instance()->dockerDaemonAvailable().value_or(false) == false) if (DockerApi::instance()->dockerDaemonAvailable().value_or(false) == false)
logView->append(tr("Docker daemon appears to be not running.")); logView->append(Tr::tr("Docker daemon appears to be not running."));
else else
logView->append(tr("Docker daemon appears to be running.")); logView->append(Tr::tr("Docker daemon appears to be running."));
updateDaemonStateTexts(); updateDaemonStateTexts();
}); });
@@ -195,7 +198,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
listAutoDetectedButton, listAutoDetectedButton,
Stretch(), Stretch(),
}, },
new QLabel(tr("Detection log:")), new QLabel(Tr::tr("Detection log:")),
logView logView
} }
}.attachTo(this); }.attachTo(this);
@@ -215,15 +218,14 @@ void DockerDeviceWidget::updateDaemonStateTexts()
Utils::optional<bool> daemonState = DockerApi::instance()->dockerDaemonAvailable(); Utils::optional<bool> daemonState = DockerApi::instance()->dockerDaemonAvailable();
if (!daemonState.has_value()) { if (!daemonState.has_value()) {
m_daemonReset->setIcon(Icons::INFO.icon()); m_daemonReset->setIcon(Icons::INFO.icon());
m_daemonState->setText(tr("Daemon state not evaluated.")); m_daemonState->setText(Tr::tr("Daemon state not evaluated."));
} else if (daemonState.value()) { } else if (daemonState.value()) {
m_daemonReset->setIcon(Icons::OK.icon()); m_daemonReset->setIcon(Icons::OK.icon());
m_daemonState->setText(tr("Docker daemon running.")); m_daemonState->setText(Tr::tr("Docker daemon running."));
} else { } else {
m_daemonReset->setIcon(Icons::CRITICAL.icon()); m_daemonReset->setIcon(Icons::CRITICAL.icon());
m_daemonState->setText(tr("Docker daemon not running.")); m_daemonState->setText(Tr::tr("Docker daemon not running."));
} }
} }
} // Internal } // Docker::Internal
} // Docker

View File

@@ -25,23 +25,24 @@
#pragma once #pragma once
#include "dockerplugin.h"
#include "dockerdevice.h"
#include "kitdetector.h" #include "kitdetector.h"
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/devicesupport/idevicewidget.h> #include <projectexplorer/devicesupport/idevicewidget.h>
#include <utils/pathlisteditor.h> #include <utils/pathlisteditor.h>
#include <QCheckBox> QT_BEGIN_NAMESPACE
class QCheckBox;
class QLabel;
class QLineEdit;
class QToolButton;
QT_END_NAMESPACE
namespace Docker { namespace Docker::Internal {
namespace Internal {
class DockerDeviceWidget final : public ProjectExplorer::IDeviceWidget class DockerDeviceWidget final : public ProjectExplorer::IDeviceWidget
{ {
Q_DECLARE_TR_FUNCTIONS(Docker::Internal::DockerDevice)
public: public:
explicit DockerDeviceWidget(const ProjectExplorer::IDevice::Ptr &device); explicit DockerDeviceWidget(const ProjectExplorer::IDevice::Ptr &device);
@@ -59,5 +60,4 @@ private:
KitDetector m_kitItemDetector; KitDetector m_kitItemDetector;
}; };
} // Internal } // Docker::Internal
} // Docker

View File

@@ -37,8 +37,7 @@ using namespace Core;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
namespace Docker { namespace Docker::Internal {
namespace Internal {
class DockerPluginPrivate class DockerPluginPrivate
{ {
@@ -82,5 +81,4 @@ bool DockerPlugin::initialize(const QStringList &arguments, QString *errorString
return true; return true;
} }
} // namespace Internal } // Docker::Interanl
} // namespace Docker

View File

@@ -31,8 +31,7 @@
#include <utils/optional.h> #include <utils/optional.h>
namespace Docker { namespace Docker::Internal {
namespace Internal {
class DockerPlugin final : public ExtensionSystem::IPlugin class DockerPlugin final : public ExtensionSystem::IPlugin
{ {
@@ -52,5 +51,4 @@ private:
class DockerPluginPrivate *d = nullptr; class DockerPluginPrivate *d = nullptr;
}; };
} // namespace Internal } // Docker::Internal
} // namespace Docker

View File

@@ -26,6 +26,7 @@
#include "dockersettings.h" #include "dockersettings.h"
#include "dockerconstants.h" #include "dockerconstants.h"
#include "dockertr.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -36,8 +37,7 @@
using namespace Utils; using namespace Utils;
namespace Docker { namespace Docker::Internal {
namespace Internal {
DockerSettings::DockerSettings() DockerSettings::DockerSettings()
{ {
@@ -48,9 +48,9 @@ DockerSettings::DockerSettings()
dockerBinaryPath.setDisplayStyle(StringAspect::PathChooserDisplay); dockerBinaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
dockerBinaryPath.setExpectedKind(PathChooser::ExistingCommand); dockerBinaryPath.setExpectedKind(PathChooser::ExistingCommand);
dockerBinaryPath.setDefaultFilePath(FilePath::fromString("docker").searchInPath({"/usr/local/bin"})); dockerBinaryPath.setDefaultFilePath(FilePath::fromString("docker").searchInPath({"/usr/local/bin"}));
dockerBinaryPath.setDisplayName(tr("Docker CLI")); dockerBinaryPath.setDisplayName(Tr::tr("Docker CLI"));
dockerBinaryPath.setHistoryCompleter("Docker.Command.History"); dockerBinaryPath.setHistoryCompleter("Docker.Command.History");
dockerBinaryPath.setLabelText(tr("Command:")); dockerBinaryPath.setLabelText(Tr::tr("Command:"));
dockerBinaryPath.setSettingsKey("cli"); dockerBinaryPath.setSettingsKey("cli");
readSettings(Core::ICore::settings()); readSettings(Core::ICore::settings());
@@ -61,7 +61,7 @@ DockerSettings::DockerSettings()
DockerSettingsPage::DockerSettingsPage(DockerSettings *settings) DockerSettingsPage::DockerSettingsPage(DockerSettings *settings)
{ {
setId(Docker::Constants::DOCKER_SETTINGS_ID); setId(Docker::Constants::DOCKER_SETTINGS_ID);
setDisplayName(DockerSettings::tr("Docker")); setDisplayName(Tr::tr("Docker"));
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY); setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
setSettings(settings); setSettings(settings);
@@ -72,7 +72,7 @@ DockerSettingsPage::DockerSettingsPage(DockerSettings *settings)
// clang-format off // clang-format off
Column { Column {
Group { Group {
Title(DockerSettings::tr("Configuration")), Title(Tr::tr("Configuration")),
Row { s.dockerBinaryPath } Row { s.dockerBinaryPath }
}, },
Stretch() Stretch()
@@ -81,5 +81,4 @@ DockerSettingsPage::DockerSettingsPage(DockerSettings *settings)
}); });
} }
} // namespace Internal } // Docker::Internal
} // namespace Docker

View File

@@ -25,16 +25,14 @@
#pragma once #pragma once
#include "coreplugin/dialogs/ioptionspage.h" #include <coreplugin/dialogs/ioptionspage.h>
#include <utils/aspects.h> #include <utils/aspects.h>
namespace Docker { namespace Docker::Internal {
namespace Internal {
class DockerSettings final : public Utils::AspectContainer class DockerSettings final : public Utils::AspectContainer
{ {
Q_DECLARE_TR_FUNCTIONS(Docker::Internal::DockerSettings)
public: public:
DockerSettings(); DockerSettings();
@@ -47,5 +45,4 @@ public:
explicit DockerSettingsPage(DockerSettings *settings); explicit DockerSettingsPage(DockerSettings *settings);
}; };
} // namespace Internal } // Docker::Internal
} // namespace Docker

View File

@@ -30,6 +30,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/projectexplorertr.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h> #include <projectexplorer/toolchainmanager.h>
@@ -48,13 +49,10 @@ using namespace ProjectExplorer;
using namespace QtSupport; using namespace QtSupport;
using namespace Utils; using namespace Utils;
namespace Docker { namespace Docker::Internal {
namespace Internal {
class KitDetectorPrivate class KitDetectorPrivate
{ {
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::KitItemDetector)
public: public:
KitDetectorPrivate(KitDetector *parent, const IDevice::ConstPtr &device) KitDetectorPrivate(KitDetector *parent, const IDevice::ConstPtr &device)
: q(parent) : q(parent)
@@ -110,29 +108,29 @@ void KitDetector::listAutoDetected(const QString &sharedId) const
void KitDetectorPrivate::undoAutoDetect() const void KitDetectorPrivate::undoAutoDetect() const
{ {
emit q->logOutput(tr("Start removing auto-detected items associated with this docker image.")); emit q->logOutput(ProjectExplorer::Tr::tr("Start removing auto-detected items associated with this docker image."));
emit q->logOutput('\n' + tr("Removing kits...")); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Removing kits..."));
for (Kit *kit : KitManager::kits()) { for (Kit *kit : KitManager::kits()) {
if (kit->autoDetectionSource() == m_sharedId) { if (kit->autoDetectionSource() == m_sharedId) {
emit q->logOutput(tr("Removed \"%1\"").arg(kit->displayName())); emit q->logOutput(ProjectExplorer::Tr::tr("Removed \"%1\"").arg(kit->displayName()));
KitManager::deregisterKit(kit); KitManager::deregisterKit(kit);
} }
}; };
emit q->logOutput('\n' + tr("Removing Qt version entries...")); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Removing Qt version entries..."));
for (QtVersion *qtVersion : QtVersionManager::versions()) { for (QtVersion *qtVersion : QtVersionManager::versions()) {
if (qtVersion->detectionSource() == m_sharedId) { if (qtVersion->detectionSource() == m_sharedId) {
emit q->logOutput(tr("Removed \"%1\"").arg(qtVersion->displayName())); emit q->logOutput(ProjectExplorer::Tr::tr("Removed \"%1\"").arg(qtVersion->displayName()));
QtVersionManager::removeVersion(qtVersion); QtVersionManager::removeVersion(qtVersion);
} }
}; };
emit q->logOutput('\n' + tr("Removing toolchain entries...")); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Removing toolchain entries..."));
const Toolchains toolchains = ToolChainManager::toolchains(); const Toolchains toolchains = ToolChainManager::toolchains();
for (ToolChain *toolChain : toolchains) { for (ToolChain *toolChain : toolchains) {
if (toolChain && toolChain->detectionSource() == m_sharedId) { if (toolChain && toolChain->detectionSource() == m_sharedId) {
emit q->logOutput(tr("Removed \"%1\"").arg(toolChain->displayName())); emit q->logOutput(ProjectExplorer::Tr::tr("Removed \"%1\"").arg(toolChain->displayName()));
ToolChainManager::deregisterToolChain(toolChain); ToolChainManager::deregisterToolChain(toolChain);
} }
}; };
@@ -157,26 +155,26 @@ void KitDetectorPrivate::undoAutoDetect() const
emit q->logOutput('\n' + logMessage); emit q->logOutput('\n' + logMessage);
} }
emit q->logOutput('\n' + tr("Removal of previously auto-detected kit items finished.") + "\n\n"); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Removal of previously auto-detected kit items finished.") + "\n\n");
} }
void KitDetectorPrivate::listAutoDetected() const void KitDetectorPrivate::listAutoDetected() const
{ {
emit q->logOutput(tr("Start listing auto-detected items associated with this docker image.")); emit q->logOutput(ProjectExplorer::Tr::tr("Start listing auto-detected items associated with this docker image."));
emit q->logOutput('\n' + tr("Kits:")); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Kits:"));
for (Kit *kit : KitManager::kits()) { for (Kit *kit : KitManager::kits()) {
if (kit->autoDetectionSource() == m_sharedId) if (kit->autoDetectionSource() == m_sharedId)
emit q->logOutput(kit->displayName()); emit q->logOutput(kit->displayName());
} }
emit q->logOutput('\n' + tr("Qt versions:")); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Qt versions:"));
for (QtVersion *qtVersion : QtVersionManager::versions()) { for (QtVersion *qtVersion : QtVersionManager::versions()) {
if (qtVersion->detectionSource() == m_sharedId) if (qtVersion->detectionSource() == m_sharedId)
emit q->logOutput(qtVersion->displayName()); emit q->logOutput(qtVersion->displayName());
} }
emit q->logOutput('\n' + tr("Toolchains:")); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Toolchains:"));
for (ToolChain *toolChain : ToolChainManager::toolchains()) { for (ToolChain *toolChain : ToolChainManager::toolchains()) {
if (toolChain->detectionSource() == m_sharedId) if (toolChain->detectionSource() == m_sharedId)
emit q->logOutput(toolChain->displayName()); emit q->logOutput(toolChain->displayName());
@@ -204,7 +202,7 @@ void KitDetectorPrivate::listAutoDetected() const
emit q->logOutput('\n' + logMessage); emit q->logOutput('\n' + logMessage);
} }
emit q->logOutput('\n' + tr("Listing of previously auto-detected kit items finished.") + "\n\n"); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Listing of previously auto-detected kit items finished.") + "\n\n");
} }
QtVersions KitDetectorPrivate::autoDetectQtVersions() const QtVersions KitDetectorPrivate::autoDetectQtVersions() const
@@ -227,14 +225,14 @@ QtVersions KitDetectorPrivate::autoDetectQtVersions() const
qtVersions.append(qtVersion); qtVersions.append(qtVersion);
QtVersionManager::addVersion(qtVersion); QtVersionManager::addVersion(qtVersion);
emit q->logOutput( emit q->logOutput(
tr("Found \"%1\"").arg(qtVersion->qmakeFilePath().toUserOutput())); ProjectExplorer::Tr::tr("Found \"%1\"").arg(qtVersion->qmakeFilePath().toUserOutput()));
} }
} }
} }
return true; return true;
}; };
emit q->logOutput(tr("Searching for qmake executables...")); emit q->logOutput(ProjectExplorer::Tr::tr("Searching for qmake executables..."));
const QStringList candidates = {"qmake-qt6", "qmake-qt5", "qmake"}; const QStringList candidates = {"qmake-qt6", "qmake-qt5", "qmake"};
for (const FilePath &searchPath : m_searchPaths) { for (const FilePath &searchPath : m_searchPaths) {
@@ -245,9 +243,9 @@ QtVersions KitDetectorPrivate::autoDetectQtVersions() const
} }
if (!error.isEmpty()) if (!error.isEmpty())
emit q->logOutput(tr("Error: %1.").arg(error)); emit q->logOutput(ProjectExplorer::Tr::tr("Error: %1.").arg(error));
if (qtVersions.isEmpty()) if (qtVersions.isEmpty())
emit q->logOutput(tr("No Qt installation found.")); emit q->logOutput(ProjectExplorer::Tr::tr("No Qt installation found."));
return qtVersions; return qtVersions;
} }
@@ -258,20 +256,20 @@ Toolchains KitDetectorPrivate::autoDetectToolChains()
Toolchains alreadyKnown = ToolChainManager::toolchains(); Toolchains alreadyKnown = ToolChainManager::toolchains();
Toolchains allNewToolChains; Toolchains allNewToolChains;
QApplication::processEvents(); QApplication::processEvents();
emit q->logOutput('\n' + tr("Searching toolchains...")); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Searching toolchains..."));
for (ToolChainFactory *factory : factories) { for (ToolChainFactory *factory : factories) {
emit q->logOutput(tr("Searching toolchains of type %1").arg(factory->displayName())); emit q->logOutput(ProjectExplorer::Tr::tr("Searching toolchains of type %1").arg(factory->displayName()));
const ToolchainDetector detector(alreadyKnown, m_device, m_searchPaths); const ToolchainDetector detector(alreadyKnown, m_device, m_searchPaths);
const Toolchains newToolChains = factory->autoDetect(detector); const Toolchains newToolChains = factory->autoDetect(detector);
for (ToolChain *toolChain : newToolChains) { for (ToolChain *toolChain : newToolChains) {
emit q->logOutput(tr("Found \"%1\"").arg(toolChain->compilerCommand().toUserOutput())); emit q->logOutput(ProjectExplorer::Tr::tr("Found \"%1\"").arg(toolChain->compilerCommand().toUserOutput()));
toolChain->setDetectionSource(m_sharedId); toolChain->setDetectionSource(m_sharedId);
ToolChainManager::registerToolChain(toolChain); ToolChainManager::registerToolChain(toolChain);
alreadyKnown.append(toolChain); alreadyKnown.append(toolChain);
} }
allNewToolChains.append(newToolChains); allNewToolChains.append(newToolChains);
} }
emit q->logOutput(tr("%1 new toolchains found.").arg(allNewToolChains.size())); emit q->logOutput(ProjectExplorer::Tr::tr("%1 new toolchains found.").arg(allNewToolChains.size()));
return allNewToolChains; return allNewToolChains;
} }
@@ -318,7 +316,7 @@ void KitDetectorPrivate::autoDetect()
undoAutoDetect(); undoAutoDetect();
emit q->logOutput(tr("Starting auto-detection. This will take a while...")); emit q->logOutput(ProjectExplorer::Tr::tr("Starting auto-detection. This will take a while..."));
const Toolchains toolchains = autoDetectToolChains(); const Toolchains toolchains = autoDetectToolChains();
const QtVersions qtVersions = autoDetectQtVersions(); const QtVersions qtVersions = autoDetectQtVersions();
@@ -363,10 +361,9 @@ void KitDetectorPrivate::autoDetect()
}; };
Kit *kit = KitManager::registerKit(initializeKit); Kit *kit = KitManager::registerKit(initializeKit);
emit q->logOutput('\n' + tr("Registered kit %1").arg(kit->displayName())); emit q->logOutput('\n' + ProjectExplorer::Tr::tr("Registered kit %1").arg(kit->displayName()));
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }
} // namespace Internal } // Docker::Internal
} // namespace Docker

View File

@@ -30,8 +30,7 @@
#include <QObject> #include <QObject>
namespace Docker { namespace Docker::Internal {
namespace Internal {
class KitDetector : public QObject class KitDetector : public QObject
{ {
@@ -52,5 +51,4 @@ private:
class KitDetectorPrivate *d = nullptr; class KitDetectorPrivate *d = nullptr;
}; };
} // Internal } // Docker::Internal
} // Docker