From 46e660c646c74a9c1838bf68f405af7f2f5ed11c Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 18 Jan 2023 08:42:48 +0100 Subject: [PATCH] Boot2Qt: Tr::tr Interestingly, the contexts were predominantly Qdb::*, standardize on that. Long term we might collapse RemoteLinux descendants anyway. Change-Id: Id7009ee6b662d6c29f98e3809619b604aeeea7d9 Reviewed-by: Alessandro Portale --- share/qtcreator/translations/qtcreator_de.ts | 40 +---------------- share/qtcreator/translations/qtcreator_ja.ts | 32 +------------- share/qtcreator/translations/qtcreator_ru.ts | 37 +--------------- .../qtcreator/translations/qtcreator_zh_CN.ts | 39 ++--------------- src/plugins/boot2qt/CMakeLists.txt | 1 + src/plugins/boot2qt/boot2qt.qbs | 1 + .../device-detection/devicedetector.cpp | 16 +++---- .../boot2qt/device-detection/devicedetector.h | 7 +-- .../device-detection/qdbdevicetracker.cpp | 12 +++--- .../device-detection/qdbdevicetracker.h | 7 ++- .../device-detection/qdbmessagetracker.cpp | 11 +++-- .../device-detection/qdbmessagetracker.h | 7 ++- .../boot2qt/device-detection/qdbwatcher.cpp | 25 ++++++----- .../boot2qt/device-detection/qdbwatcher.h | 7 ++- .../boot2qt/qdbdeployconfigurationfactory.cpp | 10 ++--- .../boot2qt/qdbdeployconfigurationfactory.h | 6 +-- src/plugins/boot2qt/qdbdevice.cpp | 43 +++++++++---------- src/plugins/boot2qt/qdbdevice.h | 9 +--- src/plugins/boot2qt/qdbdevicedebugsupport.cpp | 3 +- src/plugins/boot2qt/qdbmakedefaultappstep.cpp | 22 ++++------ src/plugins/boot2qt/qdbmakedefaultappstep.h | 6 +-- src/plugins/boot2qt/qdbplugin.cpp | 15 +++---- src/plugins/boot2qt/qdbplugin.h | 6 +-- src/plugins/boot2qt/qdbqtversion.cpp | 9 ++-- src/plugins/boot2qt/qdbqtversion.h | 6 +-- src/plugins/boot2qt/qdbrunconfiguration.cpp | 25 +++++------ src/plugins/boot2qt/qdbrunconfiguration.h | 6 +-- .../boot2qt/qdbstopapplicationstep.cpp | 21 ++++----- src/plugins/boot2qt/qdbstopapplicationstep.h | 6 +-- src/plugins/boot2qt/{boot2qttr.h => qdbtr.h} | 6 +-- src/plugins/boot2qt/qdbutils.cpp | 11 ++--- src/plugins/boot2qt/qdbutils.h | 10 ++--- 32 files changed, 141 insertions(+), 321 deletions(-) rename src/plugins/boot2qt/{boot2qttr.h => qdbtr.h} (70%) diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index bdc2e94779e..543e80a1f26 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -44423,7 +44423,7 @@ Doppelklicken Sie einen Eintrag um ihn zu ändern. - Qdb::Internal::QdbDevice + ::Qdb Starting command "%1" on device "%2". @@ -44488,9 +44488,6 @@ Doppelklicken Sie einen Eintrag um ihn zu ändern. Boot2Qt Network Device Setup - - - Qdb::Internal::QdbMakeDefaultAppService Remote process failed: %1 Der entfernte Prozess schlug fehl: %1 @@ -44503,9 +44500,6 @@ Doppelklicken Sie einen Eintrag um ihn zu ändern. Reset the default application. - - - Qdb::Internal::QdbRunConfiguration Full command line: @@ -50839,7 +50833,7 @@ in "%2" aus. - Qdb::Internal::DeviceDetector + ::Qdb Device "%1" %2 @@ -50852,16 +50846,10 @@ in "%2" aus. Device detection error: %1 - - - Qdb::Internal::QdbDeviceTracker Shutting down device discovery due to unexpected response: %1 - - - Qdb::Internal::QdbMessageTracker Shutting down message reception due to unexpected response: %1 @@ -50870,9 +50858,6 @@ in "%2" aus. QDB message: %1 - - - Qdb::Internal::QdbWatcher Unexpected QLocalSocket error: %1 @@ -50901,16 +50886,10 @@ in "%2" aus. Starting QDB host server. - - - Qdb::Internal::QdbDeployConfiguration Deploy to Boot2Qt target - - - Qdb::Internal::QdbMakeDefaultAppStep Set this application to start by default @@ -50923,9 +50902,6 @@ in "%2" aus. Change default application - - - Qdb Flash wizard "%1" failed to start. @@ -50938,17 +50914,11 @@ in "%2" aus. Flash Boot to Qt Device - - - QtVersion Boot2Qt Qt version is used for Boot2Qt development Boot2Qt - - - Qdb::Internal::QdbStopApplicationService Could not check and possibly stop running application. @@ -50961,16 +50931,10 @@ in "%2" aus. Stopped the running application. - - - Qdb::Internal::QdbStopApplicationStep Stop already running application - - - ::Boot2Qt Boot2Qt: %1 diff --git a/share/qtcreator/translations/qtcreator_ja.ts b/share/qtcreator/translations/qtcreator_ja.ts index 21dde5fa7ef..cac10f8aa32 100644 --- a/share/qtcreator/translations/qtcreator_ja.ts +++ b/share/qtcreator/translations/qtcreator_ja.ts @@ -45125,7 +45125,7 @@ The name of the release build configuration created by default for a qmake proje - Qdb::Internal::DeviceDetector + ::Qdb Device "%1" %2 デバイス "%1" %2 @@ -45138,16 +45138,10 @@ The name of the release build configuration created by default for a qmake proje Device detection error: %1 デバイス検出エラー: %1 - - - Qdb::Internal::QdbDeviceTracker Shutting down device discovery due to unexpected response: %1 予期しない応答があったため、デバイスの捜索を停止します: %1 - - - Qdb::Internal::QdbMessageTracker Shutting down message reception due to unexpected response: %1 予期しない応答があったため、メッセージ受信を停止します: %1 @@ -45156,9 +45150,6 @@ The name of the release build configuration created by default for a qmake proje QDB message: %1 QDB メッセージ: %1 - - - Qdb::Internal::QdbWatcher Unexpected QLocalSocket error: %1 予期していない QLocalSocket エラー: %1 @@ -45187,16 +45178,10 @@ The name of the release build configuration created by default for a qmake proje Starting QDB host server. GDB ホストサーバー起動中。 - - - Qdb::Internal::QdbDeployConfiguration Deploy to Boot2Qt target Boot2Qt ターゲットにデプロイ - - - Qdb::Internal::QdbDevice Starting command "%1" on device "%2". デバイス "%2" でコマンド "%1" を開始します。 @@ -45209,9 +45194,6 @@ The name of the release build configuration created by default for a qmake proje Device name: デバイス名: - - - Qdb::Internal::QdbMakeDefaultAppService Remote process failed: %1 リモートプロセスが失敗しました: %1 @@ -45224,9 +45206,6 @@ The name of the release build configuration created by default for a qmake proje Reset the default application. デフォルトのアプリケーションをリセットします。 - - - Qdb::Internal::QdbMakeDefaultAppStep Set this application to start by default このアプリケーションをデフォルトで起動するように設定する @@ -45239,9 +45218,6 @@ The name of the release build configuration created by default for a qmake proje Change default application デフォルトのアプリケーションを変更する - - - Qdb Flash wizard "%1" failed to start. Flash ウィザード "%1" の起動に失敗しました。 @@ -45250,9 +45226,6 @@ The name of the release build configuration created by default for a qmake proje Flash wizard executable "%1" not found. Flash ウィザードの実行ファイル "%1" が見つかりません。 - - - Qdb::Internal::QdbRunConfiguration Executable on device: デバイス上の実行可能ファイル: @@ -45265,9 +45238,6 @@ The name of the release build configuration created by default for a qmake proje Executable on host: ホスト上の実行可能ファイル: - - - ::Boot2Qt Boot2Qt: %1 Boot2Qt: %1 diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts index 7e22c1c5c35..1980d578604 100644 --- a/share/qtcreator/translations/qtcreator_ru.ts +++ b/share/qtcreator/translations/qtcreator_ru.ts @@ -5195,7 +5195,7 @@ For example, "Revision: 15" will leave the branch at revision 15. - ::Boot2Qt + ::Qdb Boot2Qt: %1 Boot2Qt: %1 @@ -34129,7 +34129,7 @@ The affected files are: - Qdb + ::Qdb Flash wizard "%1" failed to start. Не удалось запустить программатор «%1». @@ -34142,9 +34142,6 @@ The affected files are: Flash Boot to Qt Device Запрограммировать устройство Boot to Qt - - - Qdb::Internal::DeviceDetector Device "%1" %2 Устройство «%1» %2 @@ -34157,16 +34154,10 @@ The affected files are: Device detection error: %1 Ошибка определения устройства: %1 - - - Qdb::Internal::QdbDeployConfiguration Deploy to Boot2Qt target Развёртывание на Boot2Qt - - - Qdb::Internal::QdbDevice Starting command "%1" on device "%2". Запуск команды «%1» на устройстве «%2». @@ -34231,16 +34222,10 @@ The affected files are: Boot2Qt Network Device Setup Настройка сетевого устройства Boot2Qt - - - Qdb::Internal::QdbDeviceTracker Shutting down device discovery due to unexpected response: %1 Завершение определения устройств из-за неожиданного ответа: %1 - - - Qdb::Internal::QdbMakeDefaultAppService Remote process failed: %1 Ошибка внешнего процесса: %1 @@ -34253,9 +34238,6 @@ The affected files are: Reset the default application. Сбросить приложение по умолчанию. - - - Qdb::Internal::QdbMakeDefaultAppStep Change default application Сменить приложение по умолчанию @@ -34268,9 +34250,6 @@ The affected files are: Reset default application Сбросить приложение по умолчанию - - - Qdb::Internal::QdbMessageTracker Shutting down message reception due to unexpected response: %1 Завершение приёма сообщения из-за неожиданного ответа: %1 @@ -34279,9 +34258,6 @@ The affected files are: QDB message: %1 Сообщение QDB: %1 - - - Qdb::Internal::QdbRunConfiguration Full command line: Полная командная строка: @@ -34306,9 +34282,6 @@ The affected files are: The remote executable must be set in order to run on a Boot2Qt device. Для запуска на устройстве Boot2Qt внешнего приложения, его необходимо задать. - - - Qdb::Internal::QdbStopApplicationService Could not check and possibly stop running application. Не удалось проверить и, вероятно, остановить работающее приложение. @@ -34321,16 +34294,10 @@ The affected files are: Stopped the running application. Работающее приложение остановлено. - - - Qdb::Internal::QdbStopApplicationStep Stop already running application Остановка работающего приложения - - - Qdb::Internal::QdbWatcher Unexpected QLocalSocket error: %1 Неожиданная ошибка QLocalSocket: %1 diff --git a/share/qtcreator/translations/qtcreator_zh_CN.ts b/share/qtcreator/translations/qtcreator_zh_CN.ts index 462af722a8e..88ab78e9cb0 100644 --- a/share/qtcreator/translations/qtcreator_zh_CN.ts +++ b/share/qtcreator/translations/qtcreator_zh_CN.ts @@ -5336,7 +5336,7 @@ Local pulls are not applied to the master branch. - ::Boot2Qt + ::Qdb Boot2Qt: %1 @@ -31744,7 +31744,7 @@ The affected files are: - Qdb + ::Qdb Flash wizard "%1" failed to start. @@ -31757,9 +31757,6 @@ The affected files are: Flash Boot to Qt Device - - - Qdb::Internal::DeviceDetector Device "%1" %2 @@ -31772,16 +31769,10 @@ The affected files are: Device detection error: %1 - - - Qdb::Internal::QdbDeployConfiguration Deploy to Boot2Qt target - - - Qdb::Internal::QdbDevice Starting command "%1" on device "%2". @@ -31846,16 +31837,10 @@ The affected files are: Boot2Qt Network Device Setup - - - Qdb::Internal::QdbDeviceTracker Shutting down device discovery due to unexpected response: %1 - - - Qdb::Internal::QdbMakeDefaultAppService Remote process failed: %1 远端进程失败:%1 @@ -31868,9 +31853,6 @@ The affected files are: Reset the default application. - - - Qdb::Internal::QdbMakeDefaultAppStep Set this application to start by default @@ -31883,9 +31865,6 @@ The affected files are: Change default application - - - Qdb::Internal::QdbMessageTracker Shutting down message reception due to unexpected response: %1 @@ -31894,9 +31873,6 @@ The affected files are: QDB message: %1 - - - Qdb::Internal::QdbRunConfiguration Full command line: @@ -31921,9 +31897,6 @@ The affected files are: The remote executable must be set in order to run on a Boot2Qt device. - - - Qdb::Internal::QdbStopApplicationService Could not check and possibly stop running application. @@ -31936,16 +31909,10 @@ The affected files are: Stopped the running application. - - - Qdb::Internal::QdbStopApplicationStep Stop already running application - - - Qdb::Internal::QdbWatcher Unexpected QLocalSocket error: %1 @@ -39262,7 +39229,7 @@ For more details, see /etc/sysctl.d/10-ptrace.conf - QtVersion + ::Qdb Boot2Qt Qt version is used for Boot2Qt development diff --git a/src/plugins/boot2qt/CMakeLists.txt b/src/plugins/boot2qt/CMakeLists.txt index 627b7b6d3b6..ba8faecd31b 100644 --- a/src/plugins/boot2qt/CMakeLists.txt +++ b/src/plugins/boot2qt/CMakeLists.txt @@ -14,6 +14,7 @@ add_qtc_plugin(Boot2Qt qdbqtversion.cpp qdbqtversion.h qdbrunconfiguration.cpp qdbrunconfiguration.h qdbstopapplicationstep.cpp qdbstopapplicationstep.h + qdbtr.h qdbutils.cpp qdbutils.h ) diff --git a/src/plugins/boot2qt/boot2qt.qbs b/src/plugins/boot2qt/boot2qt.qbs index 448659b47b3..ba2a5cd6dc8 100644 --- a/src/plugins/boot2qt/boot2qt.qbs +++ b/src/plugins/boot2qt/boot2qt.qbs @@ -33,6 +33,7 @@ QtcPlugin { "qdbplugin.h", "qdbstopapplicationstep.cpp", "qdbstopapplicationstep.h", + "qdbtr.h", "qdbqtversion.cpp", "qdbqtversion.h", "qdbrunconfiguration.cpp", diff --git a/src/plugins/boot2qt/device-detection/devicedetector.cpp b/src/plugins/boot2qt/device-detection/devicedetector.cpp index cdc0c53d211..78dfeb259de 100644 --- a/src/plugins/boot2qt/device-detection/devicedetector.cpp +++ b/src/plugins/boot2qt/device-detection/devicedetector.cpp @@ -3,11 +3,13 @@ #include "devicedetector.h" -#include "../qdbutils.h" #include "../qdbconstants.h" #include "../qdbdevice.h" +#include "../qdbtr.h" +#include "../qdbutils.h" #include + #include #include @@ -15,8 +17,7 @@ using namespace ProjectExplorer; -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { static bool isAutodetectedQdbDevice(const IDevice::ConstPtr &device) { @@ -74,11 +75,11 @@ void DeviceDetector::handleDeviceEvent(QdbDeviceTracker::DeviceEventType eventTy } const Utils::Id deviceId = Constants::QdbHardwareDevicePrefix.withSuffix(':' + serial); - const auto messagePrefix = tr("Device \"%1\" %2").arg(serial); + const auto messagePrefix = Tr::tr("Device \"%1\" %2").arg(serial); DeviceManager * const dm = DeviceManager::instance(); if (eventType == QdbDeviceTracker::NewDevice) { - const QString name = tr("Qt Debug Bridge device %1").arg(serial); + const QString name = Tr::tr("Qt Debug Bridge device %1").arg(serial); QdbDevice::Ptr device = QdbDevice::create(); device->setupId(IDevice::AutoDetected, deviceId); device->setDisplayName(name); @@ -109,7 +110,7 @@ void DeviceDetector::handleDeviceEvent(QdbDeviceTracker::DeviceEventType eventTy void DeviceDetector::handleTrackerError(const QString &errorMessage) { - showMessage(tr("Device detection error: %1").arg(errorMessage), true); + showMessage(Tr::tr("Device detection error: %1").arg(errorMessage), true); stop(); } @@ -123,5 +124,4 @@ void DeviceDetector::resetDevices() } } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/device-detection/devicedetector.h b/src/plugins/boot2qt/device-detection/devicedetector.h index 8f218e8e89f..d9ad510c859 100644 --- a/src/plugins/boot2qt/device-detection/devicedetector.h +++ b/src/plugins/boot2qt/device-detection/devicedetector.h @@ -3,12 +3,10 @@ #pragma once -#include "../qdbdevice.h" #include "qdbdevicetracker.h" #include "qdbmessagetracker.h" -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class DeviceDetector : public QObject { @@ -34,5 +32,4 @@ private: QdbMessageTracker m_messageTracker; }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/device-detection/qdbdevicetracker.cpp b/src/plugins/boot2qt/device-detection/qdbdevicetracker.cpp index f0bbcd40e4d..0ebd4d877f5 100644 --- a/src/plugins/boot2qt/device-detection/qdbdevicetracker.cpp +++ b/src/plugins/boot2qt/device-detection/qdbdevicetracker.cpp @@ -2,16 +2,15 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qdbdevicetracker.h" -#include "qdbwatcher.h" -#include "../qdbutils.h" #include "hostmessages.h" +#include "qdbwatcher.h" +#include "../qdbtr.h" #include #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { QdbDeviceTracker::QdbDeviceTracker(QObject *parent) : QObject(parent) @@ -36,7 +35,7 @@ void QdbDeviceTracker::handleWatchMessage(const QJsonDocument &document) if (type != ResponseType::NewDevice && type != ResponseType::DisconnectedDevice) { stop(); const QString message = - tr("Shutting down device discovery due to unexpected response: %1"); + Tr::tr("Shutting down device discovery due to unexpected response: %1"); emit trackerError(message.arg(QString::fromUtf8(document.toJson()))); return; } @@ -61,5 +60,4 @@ void QdbDeviceTracker::handleWatchMessage(const QJsonDocument &document) emit deviceEvent(eventType, info); } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/device-detection/qdbdevicetracker.h b/src/plugins/boot2qt/device-detection/qdbdevicetracker.h index d999c4504d7..297f50eeddd 100644 --- a/src/plugins/boot2qt/device-detection/qdbdevicetracker.h +++ b/src/plugins/boot2qt/device-detection/qdbdevicetracker.h @@ -2,11 +2,11 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once + #include #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbWatcher; @@ -35,5 +35,4 @@ private: QdbWatcher *m_qdbWatcher = nullptr; }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/device-detection/qdbmessagetracker.cpp b/src/plugins/boot2qt/device-detection/qdbmessagetracker.cpp index 4e31af64c17..81c2209150b 100644 --- a/src/plugins/boot2qt/device-detection/qdbmessagetracker.cpp +++ b/src/plugins/boot2qt/device-detection/qdbmessagetracker.cpp @@ -4,6 +4,7 @@ #include "qdbmessagetracker.h" #include "qdbwatcher.h" +#include "../qdbtr.h" #include "../qdbutils.h" #include "hostmessages.h" @@ -11,8 +12,7 @@ #include #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { QdbMessageTracker::QdbMessageTracker(QObject *parent) : QObject(parent) @@ -39,7 +39,7 @@ void QdbMessageTracker::handleWatchMessage(const QJsonDocument &document) if (type != ResponseType::Messages) { stop(); const QString message = - tr("Shutting down message reception due to unexpected response: %1"); + Tr::tr("Shutting down message reception due to unexpected response: %1"); emit trackerError(message.arg(QString::fromUtf8(document.toJson()))); return; } @@ -58,9 +58,8 @@ void QdbMessageTracker::handleWatchMessage(const QJsonDocument &document) } m_messageCache.append(message); - showMessage(tr("QDB message: %1").arg(message), true); + showMessage(Tr::tr("QDB message: %1").arg(message), true); } } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/device-detection/qdbmessagetracker.h b/src/plugins/boot2qt/device-detection/qdbmessagetracker.h index d037c99de07..d2feac39392 100644 --- a/src/plugins/boot2qt/device-detection/qdbmessagetracker.h +++ b/src/plugins/boot2qt/device-detection/qdbmessagetracker.h @@ -2,11 +2,11 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once + #include #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbWatcher; @@ -29,5 +29,4 @@ private: QContiguousCache m_messageCache = QContiguousCache(10); }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/device-detection/qdbwatcher.cpp b/src/plugins/boot2qt/device-detection/qdbwatcher.cpp index 53081d9864a..3375e10e026 100644 --- a/src/plugins/boot2qt/device-detection/qdbwatcher.cpp +++ b/src/plugins/boot2qt/device-detection/qdbwatcher.cpp @@ -3,17 +3,17 @@ #include "qdbwatcher.h" -#include "../qdbutils.h" #include "hostmessages.h" +#include "../qdbtr.h" +#include "../qdbutils.h" -#include +#include #include #include #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { const int startupDelay = 500; // time in ms to wait for host server startup before retrying const QString qdbSocketName = "qdb.socket"; @@ -79,14 +79,14 @@ void QdbWatcher::handleWatchError(QLocalSocket::LocalSocketError error) if (error != QLocalSocket::ServerNotFoundError && error != QLocalSocket::ConnectionRefusedError) { stop(); - emit watcherError(tr("Unexpected QLocalSocket error: %1") + emit watcherError(Tr::tr("Unexpected QLocalSocket error: %1") .arg(m_socket->errorString())); return; } if (m_retried) { stop(); - emit watcherError(tr("Could not connect to QDB host server even after trying to start it.")); + emit watcherError(Tr::tr("Could not connect to QDB host server even after trying to start it.")); return; } retry(); @@ -99,7 +99,7 @@ void QdbWatcher::handleWatchMessage() const auto document = QJsonDocument::fromJson(responseBytes); if (document.isNull()) { const QString message = - tr("Invalid JSON response received from QDB server: %1"); + Tr::tr("Invalid JSON response received from QDB server: %1"); emit watcherError(message.arg(QString::fromUtf8(responseBytes))); return; } @@ -112,16 +112,16 @@ void QdbWatcher::forkHostServer() Utils::FilePath qdbFilePath = findTool(QdbTool::Qdb); QFile executable(qdbFilePath.toString()); if (!executable.exists()) { - const QString message = tr("Could not find QDB host server executable. " + const QString message = Tr::tr("Could not find QDB host server executable. " "You can set the location with environment variable %1.") .arg(overridingEnvironmentVariable(QdbTool::Qdb)); showMessage(message, true); return; } if (Utils::QtcProcess::startDetached({qdbFilePath, {"server"}})) - showMessage(tr("QDB host server started."), false); + showMessage(Tr::tr("QDB host server started."), false); else - showMessage(tr("Could not start QDB host server in %1").arg(qdbFilePath.toString()), true); + showMessage(Tr::tr("Could not start QDB host server in %1").arg(qdbFilePath.toString()), true); } void QdbWatcher::retry() @@ -130,7 +130,7 @@ void QdbWatcher::retry() { QMutexLocker lock(&s_startMutex); if (!s_startedServer) { - showMessage(tr("Starting QDB host server."), false); + showMessage(Tr::tr("Starting QDB host server."), false); forkHostServer(); s_startedServer = true; } @@ -138,5 +138,4 @@ void QdbWatcher::retry() QTimer::singleShot(startupDelay, this, &QdbWatcher::startPrivate); } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/device-detection/qdbwatcher.h b/src/plugins/boot2qt/device-detection/qdbwatcher.h index 46f9080711a..c609627d7d5 100644 --- a/src/plugins/boot2qt/device-detection/qdbwatcher.h +++ b/src/plugins/boot2qt/device-detection/qdbwatcher.h @@ -14,12 +14,12 @@ QT_BEGIN_NAMESPACE class QJsonDocument; QT_END_NAMESPACE -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbWatcher : public QObject { Q_OBJECT + public: QdbWatcher(QObject *parent = nullptr); virtual ~QdbWatcher(); @@ -49,6 +49,5 @@ private: RequestType m_requestType; }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbdeployconfigurationfactory.cpp b/src/plugins/boot2qt/qdbdeployconfigurationfactory.cpp index c06299f2e21..f1156857948 100644 --- a/src/plugins/boot2qt/qdbdeployconfigurationfactory.cpp +++ b/src/plugins/boot2qt/qdbdeployconfigurationfactory.cpp @@ -4,6 +4,7 @@ #include "qdbdeployconfigurationfactory.h" #include "qdbconstants.h" +#include "qdbtr.h" #include #include "projectexplorer/devicesupport/idevice.h" @@ -15,15 +16,13 @@ using namespace ProjectExplorer; -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { QdbDeployConfigurationFactory::QdbDeployConfigurationFactory() { setConfigBaseId(Constants::QdbDeployConfigurationId); addSupportedTargetDeviceType(Constants::QdbLinuxOsType); - setDefaultDisplayName(QCoreApplication::translate("Qdb::Internal::QdbDeployConfiguration", - "Deploy to Boot2Qt target")); + setDefaultDisplayName(Tr::tr("Deploy to Boot2Qt target")); setUseDeploymentDataView(); addInitialStep(RemoteLinux::Constants::MakeInstallStepId, [](Target *target) { @@ -59,5 +58,4 @@ QdbDeployConfigurationFactory::QdbDeployConfigurationFactory() }); } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbdeployconfigurationfactory.h b/src/plugins/boot2qt/qdbdeployconfigurationfactory.h index c3188789f89..fa006613979 100644 --- a/src/plugins/boot2qt/qdbdeployconfigurationfactory.h +++ b/src/plugins/boot2qt/qdbdeployconfigurationfactory.h @@ -5,8 +5,7 @@ #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbDeployConfigurationFactory final : public ProjectExplorer::DeployConfigurationFactory { @@ -14,5 +13,4 @@ public: QdbDeployConfigurationFactory(); }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbdevice.cpp b/src/plugins/boot2qt/qdbdevice.cpp index 2c0e8d6903a..90568f42641 100644 --- a/src/plugins/boot2qt/qdbdevice.cpp +++ b/src/plugins/boot2qt/qdbdevice.cpp @@ -3,8 +3,9 @@ #include "qdbdevice.h" -#include "qdbutils.h" #include "qdbconstants.h" +#include "qdbtr.h" +#include "qdbutils.h" #include @@ -27,8 +28,7 @@ using namespace ProjectExplorer; using namespace RemoteLinux; using namespace Utils; -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbProcessImpl : public LinuxProcessInterface { @@ -58,7 +58,7 @@ public: m_appRunner.setCommand(command); m_appRunner.start(); - showMessage(QdbDevice::tr("Starting command \"%1\" on device \"%2\".") + showMessage(Tr::tr("Starting command \"%1\" on device \"%2\".") .arg(command.toUserOutput(), m_deviceName)); } @@ -78,18 +78,18 @@ private: if (failure) { QString errorString; if (!m_appRunner.errorString().isEmpty()) { - errorString = QdbDevice::tr("Command failed on device \"%1\": %2") + errorString = Tr::tr("Command failed on device \"%1\": %2") .arg(m_deviceName, m_appRunner.errorString()); } else { - errorString = QdbDevice::tr("Command failed on device \"%1\".").arg(m_deviceName); + errorString = Tr::tr("Command failed on device \"%1\".").arg(m_deviceName); } showMessage(errorString, true); if (!stdOut.isEmpty()) - showMessage(QdbDevice::tr("stdout was: \"%1\"").arg(stdOut)); + showMessage(Tr::tr("stdout was: \"%1\"").arg(stdOut)); if (!stdErr.isEmpty()) - showMessage(QdbDevice::tr("stderr was: \"%1\"").arg(stdErr)); + showMessage(Tr::tr("stderr was: \"%1\"").arg(stdErr)); } else { - showMessage(QdbDevice::tr("Commands on device \"%1\" finished successfully.") + showMessage(Tr::tr("Commands on device \"%1\" finished successfully.") .arg(m_deviceName)); } deleteLater(); @@ -104,13 +104,13 @@ private: QdbDevice::QdbDevice() { - setDisplayType(tr("Boot2Qt Device")); + setDisplayType(Tr::tr("Boot2Qt Device")); - addDeviceAction({tr("Reboot Device"), [](const IDevice::Ptr &device, QWidget *) { + addDeviceAction({Tr::tr("Reboot Device"), [](const IDevice::Ptr &device, QWidget *) { (void) new DeviceApplicationObserver(device, {device->filePath("reboot"), {}}); }}); - addDeviceAction({tr("Restore Default App"), [](const IDevice::Ptr &device, QWidget *) { + addDeviceAction({Tr::tr("Restore Default App"), [](const IDevice::Ptr &device, QWidget *) { (void) new DeviceApplicationObserver(device, {device->filePath("appcontroller"), {"--remove-default"}}); }}); } @@ -170,14 +170,14 @@ class QdbSettingsPage : public QWizardPage public: QdbSettingsPage() { - setWindowTitle(QdbDevice::tr("WizardPage")); - setTitle(QdbDevice::tr("Device Settings")); + setWindowTitle(Tr::tr("WizardPage")); + setTitle(Tr::tr("Device Settings")); nameLineEdit = new QLineEdit(this); - nameLineEdit->setPlaceholderText(QdbDevice::tr("A short, free-text description")); + nameLineEdit->setPlaceholderText(Tr::tr("A short, free-text description")); addressLineEdit = new QLineEdit(this); - addressLineEdit->setPlaceholderText(QdbDevice::tr("Host name or IP address")); + addressLineEdit->setPlaceholderText(Tr::tr("Host name or IP address")); auto usbWarningLabel = new QLabel(this); usbWarningLabel->setText(QString("%1

%2

") @@ -187,8 +187,8 @@ public: "

The connectivity to the device is tested after finishing.")); auto formLayout = new QFormLayout(this); - formLayout->addRow(QdbDevice::tr("Device name:"), nameLineEdit); - formLayout->addRow(QdbDevice::tr("Device address:"), addressLineEdit); + formLayout->addRow(Tr::tr("Device name:"), nameLineEdit); + formLayout->addRow(Tr::tr("Device address:"), addressLineEdit); formLayout->addRow(usbWarningLabel); connect(nameLineEdit, &QLineEdit::textChanged, this, &QWizardPage::completeChanged); @@ -214,7 +214,7 @@ public: QdbDeviceWizard(QWidget *parent) : QWizard(parent) { - setWindowTitle(QdbDevice::tr("Boot2Qt Network Device Setup")); + setWindowTitle(Tr::tr("Boot2Qt Network Device Setup")); settingsPage.setCommitPage(true); enum { SettingsPageId }; @@ -246,7 +246,7 @@ private: QdbLinuxDeviceFactory::QdbLinuxDeviceFactory() : IDeviceFactory(Constants::QdbLinuxOsType) { - setDisplayName(QdbDevice::tr("Boot2Qt Device")); + setDisplayName(Tr::tr("Boot2Qt Device")); setCombinedIcon(":/qdb/images/qdbdevicesmall.png", ":/qdb/images/qdbdevice.png"); setConstructionFunction(&QdbDevice::create); setCreator([] { @@ -259,5 +259,4 @@ QdbLinuxDeviceFactory::QdbLinuxDeviceFactory() }); } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbdevice.h b/src/plugins/boot2qt/qdbdevice.h index eb2e63d97ac..300fe826329 100644 --- a/src/plugins/boot2qt/qdbdevice.h +++ b/src/plugins/boot2qt/qdbdevice.h @@ -3,17 +3,13 @@ #pragma once -#include "qdbconstants.h" #include #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbDevice final : public RemoteLinux::LinuxDevice { - Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbDevice) - public: typedef QSharedPointer Ptr; typedef QSharedPointer ConstPtr; @@ -45,5 +41,4 @@ public: QdbLinuxDeviceFactory(); }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp index cb95edcf765..97529dfa9fb 100644 --- a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp +++ b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp @@ -4,9 +4,8 @@ #include "qdbdevicedebugsupport.h" #include "qdbconstants.h" -#include "qdbdevice.h" -#include "qdbrunconfiguration.h" +#include #include #include diff --git a/src/plugins/boot2qt/qdbmakedefaultappstep.cpp b/src/plugins/boot2qt/qdbmakedefaultappstep.cpp index e364f8c94e6..f8b50b22e32 100644 --- a/src/plugins/boot2qt/qdbmakedefaultappstep.cpp +++ b/src/plugins/boot2qt/qdbmakedefaultappstep.cpp @@ -4,6 +4,7 @@ #include "qdbmakedefaultappstep.h" #include "qdbconstants.h" +#include "qdbtr.h" #include #include @@ -20,14 +21,12 @@ using namespace ProjectExplorer; using namespace Utils; using namespace Utils::Tasking; -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { // QdbMakeDefaultAppService class QdbMakeDefaultAppService : public RemoteLinux::AbstractRemoteLinuxDeployService { - Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbMakeDefaultAppService) public: void setMakeDefault(bool makeDefault) { m_makeDefault = makeDefault; } @@ -55,12 +54,12 @@ private: }; const auto doneHandler = [this](const QtcProcess &) { if (m_makeDefault) - emit progressMessage(tr("Application set as the default one.")); + emit progressMessage(Tr::tr("Application set as the default one.")); else - emit progressMessage(tr("Reset the default application.")); + emit progressMessage(Tr::tr("Reset the default application.")); }; const auto errorHandler = [this](const QtcProcess &process) { - emit errorMessage(tr("Remote process failed: %1").arg(process.errorString())); + emit errorMessage(Tr::tr("Remote process failed: %1").arg(process.errorString())); }; return Group { Process(setupHandler, doneHandler, errorHandler) }; } @@ -72,8 +71,6 @@ private: class QdbMakeDefaultAppStep final : public RemoteLinux::AbstractRemoteLinuxDeployStep { - Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbMakeDefaultAppStep) - public: QdbMakeDefaultAppStep(BuildStepList *bsl, Id id) : AbstractRemoteLinuxDeployStep(bsl, id) @@ -83,8 +80,8 @@ public: auto selection = addAspect(); selection->setSettingsKey("QdbMakeDefaultDeployStep.MakeDefault"); - selection->addOption(tr("Set this application to start by default")); - selection->addOption(tr("Reset default application")); + selection->addOption(Tr::tr("Set this application to start by default")); + selection->addOption(Tr::tr("Reset default application")); setInternalInitializer([service, selection] { service->setMakeDefault(selection->value() == 0); @@ -99,10 +96,9 @@ public: QdbMakeDefaultAppStepFactory::QdbMakeDefaultAppStepFactory() { registerStep(Constants::QdbMakeDefaultAppStepId); - setDisplayName(QdbMakeDefaultAppStep::tr("Change default application")); + setDisplayName(Tr::tr("Change default application")); setSupportedDeviceType(Qdb::Constants::QdbLinuxOsType); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbmakedefaultappstep.h b/src/plugins/boot2qt/qdbmakedefaultappstep.h index 5f66e5c546e..ff0d8bdf778 100644 --- a/src/plugins/boot2qt/qdbmakedefaultappstep.h +++ b/src/plugins/boot2qt/qdbmakedefaultappstep.h @@ -5,8 +5,7 @@ #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbMakeDefaultAppStepFactory final : public ProjectExplorer::BuildStepFactory { @@ -14,5 +13,4 @@ public: QdbMakeDefaultAppStepFactory(); }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp index 834ddb23c0e..7e1882c1679 100644 --- a/src/plugins/boot2qt/qdbplugin.cpp +++ b/src/plugins/boot2qt/qdbplugin.cpp @@ -4,13 +4,16 @@ #include "qdbplugin.h" #include "device-detection/devicedetector.h" +#include "qdbconstants.h" #include "qdbdeployconfigurationfactory.h" +#include "qdbdevice.h" #include "qdbstopapplicationstep.h" #include "qdbmakedefaultappstep.h" #include "qdbdevicedebugsupport.h" #include "qdbqtversion.h" #include "qdbrunconfiguration.h" #include "qdbutils.h" +#include "qdbtr.h" #include #include @@ -34,7 +37,6 @@ #include #include -#include using namespace ProjectExplorer; using namespace Utils; @@ -56,8 +58,7 @@ static void startFlashingWizard() } else if (QtcProcess::startDetached({filePath, {}})) { return; } - const QString message = - QCoreApplication::translate("Qdb", "Flash wizard \"%1\" failed to start."); + const QString message = Tr::tr("Flash wizard \"%1\" failed to start."); showMessage(message.arg(filePath.toUserOutput()), true); } @@ -76,9 +77,8 @@ void registerFlashAction(QObject *parentForAction) return; const FilePath fileName = flashWizardFilePath(); if (!fileName.exists()) { - const QString message = - QCoreApplication::translate("Qdb", "Flash wizard executable \"%1\" not found."); - showMessage(message.arg(fileName.toString())); + const QString message = Tr::tr("Flash wizard executable \"%1\" not found."); + showMessage(message.arg(fileName.toUserOutput())); return; } @@ -92,8 +92,7 @@ void registerFlashAction(QObject *parentForAction) Core::Context globalContext(Core::Constants::C_GLOBAL); - const QString actionText = QCoreApplication::translate("Qdb", "Flash Boot to Qt Device"); - QAction *flashAction = new QAction(actionText, parentForAction); + QAction *flashAction = new QAction(Tr::tr("Flash Boot to Qt Device"), parentForAction); Core::Command *flashCommand = Core::ActionManager::registerAction(flashAction, flashActionId, globalContext); diff --git a/src/plugins/boot2qt/qdbplugin.h b/src/plugins/boot2qt/qdbplugin.h index 5d0c17b264b..ff0b6de5224 100644 --- a/src/plugins/boot2qt/qdbplugin.h +++ b/src/plugins/boot2qt/qdbplugin.h @@ -5,8 +5,7 @@ #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbPlugin final : public ExtensionSystem::IPlugin { @@ -25,5 +24,4 @@ private: class QdbPluginPrivate *d = nullptr; }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbqtversion.cpp b/src/plugins/boot2qt/qdbqtversion.cpp index 36b0819fb0b..7f15b32348b 100644 --- a/src/plugins/boot2qt/qdbqtversion.cpp +++ b/src/plugins/boot2qt/qdbqtversion.cpp @@ -4,13 +4,13 @@ #include "qdbqtversion.h" #include "qdbconstants.h" +#include "qdbtr.h" -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { QString QdbQtVersion::description() const { - return QCoreApplication::translate("QtVersion", "Boot2Qt", "Qt version is used for Boot2Qt development"); + return Tr::tr("Boot2Qt", "Qt version is used for Boot2Qt development"); } QSet QdbQtVersion::targetDeviceTypes() const @@ -19,5 +19,4 @@ QSet QdbQtVersion::targetDeviceTypes() const } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbqtversion.h b/src/plugins/boot2qt/qdbqtversion.h index 3bb4f0074e4..3488324074b 100644 --- a/src/plugins/boot2qt/qdbqtversion.h +++ b/src/plugins/boot2qt/qdbqtversion.h @@ -5,8 +5,7 @@ #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbQtVersion : public QtSupport::QtVersion { @@ -18,5 +17,4 @@ public: QSet targetDeviceTypes() const final; }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbrunconfiguration.cpp b/src/plugins/boot2qt/qdbrunconfiguration.cpp index d505bba08c9..d288289dfa7 100644 --- a/src/plugins/boot2qt/qdbrunconfiguration.cpp +++ b/src/plugins/boot2qt/qdbrunconfiguration.cpp @@ -4,6 +4,7 @@ #include "qdbrunconfiguration.h" #include "qdbconstants.h" +#include "qdbtr.h" #include #include @@ -22,19 +23,16 @@ using namespace ProjectExplorer; using namespace Utils; -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { // FullCommandLineAspect class FullCommandLineAspect : public StringAspect { - Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbRunConfiguration); - public: explicit FullCommandLineAspect(RunConfiguration *rc) { - setLabelText(tr("Full command line:")); + setLabelText(Tr::tr("Full command line:")); auto exeAspect = rc->aspect(); auto argumentsAspect = rc->aspect(); @@ -58,8 +56,6 @@ public: class QdbRunConfiguration : public RunConfiguration { - Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbRunConfiguration); - public: QdbRunConfiguration(Target *target, Utils::Id id); @@ -73,14 +69,14 @@ QdbRunConfiguration::QdbRunConfiguration(Target *target, Id id) { auto exeAspect = addAspect(target, ExecutableAspect::RunDevice); exeAspect->setSettingsKey("QdbRunConfig.RemoteExecutable"); - exeAspect->setLabelText(tr("Executable on device:")); - exeAspect->setPlaceHolderText(tr("Remote path not set")); + exeAspect->setLabelText(Tr::tr("Executable on device:")); + exeAspect->setPlaceHolderText(Tr::tr("Remote path not set")); exeAspect->makeOverridable("QdbRunConfig.AlternateRemoteExecutable", "QdbRunCofig.UseAlternateRemoteExecutable"); auto symbolsAspect = addAspect(); symbolsAspect->setSettingsKey("QdbRunConfig.LocalExecutable"); - symbolsAspect->setLabelText(tr("Executable on host:")); + symbolsAspect->setLabelText(Tr::tr("Executable on host:")); symbolsAspect->setDisplayStyle(SymbolFileAspect::LabelDisplay); auto envAspect = addAspect(target); @@ -103,15 +99,15 @@ QdbRunConfiguration::QdbRunConfiguration(Target *target, Id id) connect(target, &Target::deploymentDataChanged, this, &RunConfiguration::update); connect(target, &Target::kitChanged, this, &RunConfiguration::update); - setDefaultDisplayName(tr("Run on Boot2Qt Device")); + setDefaultDisplayName(Tr::tr("Run on Boot2Qt Device")); } Tasks QdbRunConfiguration::checkForIssues() const { Tasks tasks; if (aspect()->executable().toString().isEmpty()) { - tasks << BuildSystemTask(Task::Warning, tr("The remote executable must be set " - "in order to run on a Boot2Qt device.")); + tasks << BuildSystemTask(Task::Warning, Tr::tr("The remote executable must be set " + "in order to run on a Boot2Qt device.")); } return tasks; } @@ -129,5 +125,4 @@ QdbRunConfigurationFactory::QdbRunConfigurationFactory() addSupportedTargetDeviceType(Constants::QdbLinuxOsType); } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbrunconfiguration.h b/src/plugins/boot2qt/qdbrunconfiguration.h index 1e73cf283fd..6559daf5586 100644 --- a/src/plugins/boot2qt/qdbrunconfiguration.h +++ b/src/plugins/boot2qt/qdbrunconfiguration.h @@ -5,8 +5,7 @@ #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory { @@ -14,5 +13,4 @@ public: QdbRunConfigurationFactory(); }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbstopapplicationstep.cpp b/src/plugins/boot2qt/qdbstopapplicationstep.cpp index 5c71768774a..f41877f7869 100644 --- a/src/plugins/boot2qt/qdbstopapplicationstep.cpp +++ b/src/plugins/boot2qt/qdbstopapplicationstep.cpp @@ -4,6 +4,7 @@ #include "qdbstopapplicationstep.h" #include "qdbconstants.h" +#include "qdbtr.h" #include #include @@ -19,15 +20,12 @@ using namespace ProjectExplorer; using namespace Utils; using namespace Utils::Tasking; -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { // QdbStopApplicationService class QdbStopApplicationService : public RemoteLinux::AbstractRemoteLinuxDeployService { - Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbStopApplicationService) - private: bool isDeploymentNecessary() const final { return true; } Group deployRecipe() final; @@ -46,17 +44,17 @@ Group QdbStopApplicationService::deployRecipe() }); }; const auto doneHandler = [this](const QtcProcess &) { - emit progressMessage(tr("Stopped the running application.")); + emit progressMessage(Tr::tr("Stopped the running application.")); }; const auto errorHandler = [this](const QtcProcess &process) { const QString errorOutput = process.cleanedStdErr(); - const QString failureMessage = tr("Could not check and possibly stop running application."); + const QString failureMessage = Tr::tr("Could not check and possibly stop running application."); if (process.exitStatus() == QProcess::CrashExit) { emit errorMessage(failureMessage); } else if (process.result() != ProcessResult::FinishedWithSuccess) { emit stdErrData(process.errorString()); } else if (errorOutput.contains("Could not connect: Connection refused")) { - emit progressMessage(tr("Checked that there is no running application.")); + emit progressMessage(Tr::tr("Checked that there is no running application.")); } else if (!errorOutput.isEmpty()) { emit stdErrData(errorOutput); emit errorMessage(failureMessage); @@ -65,7 +63,7 @@ Group QdbStopApplicationService::deployRecipe() const auto rootSetupHandler = [this] { const auto device = DeviceKitAspect::device(target()->kit()); if (!device) { - emit errorMessage(tr("No device to stop the application on.")); + emit errorMessage(Tr::tr("No device to stop the application on.")); return GroupConfig{GroupAction::StopWithError}; } return GroupConfig(); @@ -81,8 +79,6 @@ Group QdbStopApplicationService::deployRecipe() class QdbStopApplicationStep final : public RemoteLinux::AbstractRemoteLinuxDeployStep { - Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbStopApplicationStep) - public: QdbStopApplicationStep(BuildStepList *bsl, Id id) : AbstractRemoteLinuxDeployStep(bsl, id) @@ -102,10 +98,9 @@ public: QdbStopApplicationStepFactory::QdbStopApplicationStepFactory() { registerStep(Constants::QdbStopApplicationStepId); - setDisplayName(QdbStopApplicationStep::tr("Stop already running application")); + setDisplayName(Tr::tr("Stop already running application")); setSupportedDeviceType(Constants::QdbLinuxOsType); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbstopapplicationstep.h b/src/plugins/boot2qt/qdbstopapplicationstep.h index d84a520b6ee..bd726575106 100644 --- a/src/plugins/boot2qt/qdbstopapplicationstep.h +++ b/src/plugins/boot2qt/qdbstopapplicationstep.h @@ -5,8 +5,7 @@ #include -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { class QdbStopApplicationStepFactory final : public ProjectExplorer::BuildStepFactory { @@ -14,5 +13,4 @@ public: QdbStopApplicationStepFactory(); }; -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/boot2qttr.h b/src/plugins/boot2qt/qdbtr.h similarity index 70% rename from src/plugins/boot2qt/boot2qttr.h rename to src/plugins/boot2qt/qdbtr.h index cff48d4e8e5..b0bc7232f9b 100644 --- a/src/plugins/boot2qt/boot2qttr.h +++ b/src/plugins/boot2qt/qdbtr.h @@ -5,11 +5,11 @@ #include -namespace Boot2Qt { +namespace Qdb { struct Tr { - Q_DECLARE_TR_FUNCTIONS(::Boot2Qt) + Q_DECLARE_TR_FUNCTIONS(::Qdb) }; -} // namespace Boot2Qt +} // namespace Qdb diff --git a/src/plugins/boot2qt/qdbutils.cpp b/src/plugins/boot2qt/qdbutils.cpp index 6eef6191998..fcc6e38da29 100644 --- a/src/plugins/boot2qt/qdbutils.cpp +++ b/src/plugins/boot2qt/qdbutils.cpp @@ -3,8 +3,11 @@ #include "qdbutils.h" +#include "qdbtr.h" + #include #include + #include #include #include @@ -12,8 +15,7 @@ using namespace Utils; -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { static QString executableBaseName(QdbTool tool) { @@ -63,7 +65,7 @@ QString overridingEnvironmentVariable(QdbTool tool) void showMessage(const QString &message, bool important) { - const QString fullMessage = QCoreApplication::translate("::Boot2Qt", "Boot2Qt: %1").arg(message); + const QString fullMessage = Tr::tr("Boot2Qt: %1").arg(message); if (important) Core::MessageManager::writeFlashing(fullMessage); else @@ -86,5 +88,4 @@ QString settingsKey(QdbTool tool) QTC_ASSERT(false, return QString()); } -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal diff --git a/src/plugins/boot2qt/qdbutils.h b/src/plugins/boot2qt/qdbutils.h index 59768359ff5..1a04007218a 100644 --- a/src/plugins/boot2qt/qdbutils.h +++ b/src/plugins/boot2qt/qdbutils.h @@ -3,12 +3,9 @@ #pragma once -#include +#include -#include - -namespace Qdb { -namespace Internal { +namespace Qdb::Internal { enum class QdbTool { FlashingWizard, @@ -21,5 +18,4 @@ void showMessage(const QString &message, bool important = false); QString settingsGroupKey(); QString settingsKey(QdbTool tool); -} // namespace Internal -} // namespace Qdb +} // Qdb::Internal