diff --git a/share/qtcreator/translations/qtcreator_cs.ts b/share/qtcreator/translations/qtcreator_cs.ts index 8ba3dd26030..22178204de1 100644 --- a/share/qtcreator/translations/qtcreator_cs.ts +++ b/share/qtcreator/translations/qtcreator_cs.ts @@ -56017,7 +56017,7 @@ For example, "Revision: 15" will leave the branch at revision 15. - ClangCodeModel::Internal::ClangProjectSettingsPropertiesPage + ::ClangCodeModel Pre-compiled headers: Předpřeložené hlavičky: @@ -56427,30 +56427,21 @@ Vytvořte, prosím, aplikaci qmldump na stránce pro nastavení verze Qt. - ClangCodeModel::Internal::ClangCompletionAssistProcessor + ::ClangCodeModel Location: %1 Parent folder for proposed #include completion Umístění: %1 - - - ClangCodeModel::Internal::ClangIndexer C++ Indexing Indexování C++ - - - ClangCodeModel::Internal::ModelManagerSupport Clang Display name Clang - - - ClangCodeModel::Internal::ClangProjectSettingsWidget Clang Settings Nastavení pro Clang @@ -56463,9 +56454,6 @@ Vytvořte, prosím, aplikaci qmldump na stránce pro nastavení verze Qt.All Files (*) Všechny soubory (*) - - - ClangCodeModel::CompletionProposalsBuilder Is deprecated deprecated C++ symbol @@ -56479,9 +56467,6 @@ Vytvořte, prosím, aplikaci qmldump na stránce pro nastavení verze Qt.Signal of %1, returns %2 Signál: %1, vrací %2 - - - ClangCodeModel::Diagnostic ignored Přehlíženo @@ -56502,9 +56487,6 @@ Vytvořte, prosím, aplikaci qmldump na stránce pro nastavení verze Qt.fatal Selhání - - - ClangCodeModel::Internal::PchManager Successfully generated PCH file "%1". Soubor PCH "%1" byl úspěšně vytvořen. diff --git a/share/qtcreator/translations/qtcreator_da.ts b/share/qtcreator/translations/qtcreator_da.ts index 35c86e3268c..e6d794eeb18 100644 --- a/share/qtcreator/translations/qtcreator_da.ts +++ b/share/qtcreator/translations/qtcreator_da.ts @@ -4589,7 +4589,7 @@ F.eks., vil "Revision: 15" efterlade grenen ved revision 15. - Clang Code Model Marks + ::ClangCodeModel Code Model Warning Kodemodel advarsel @@ -4598,9 +4598,6 @@ F.eks., vil "Revision: 15" efterlade grenen ved revision 15.Code Model Error Kodemodel fejl - - - ClangCodeModel::Internal::BackendCommunicator Clang Code Model: Error: The clangbackend executable "%1" does not exist. Clang-kodemodel: Fejl: clangbackend-eksekverbaren "%1" findes ikke. @@ -4613,24 +4610,15 @@ F.eks., vil "Revision: 15" efterlade grenen ved revision 15.Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted. Clang-kodemodel: Fejl: clangbackend-processen har afsluttet uventet og blev genstartet. - - - ClangCodeModel::Internal::ClangCompletionAssistProcessor Location: %1 Parent folder for proposed #include completion Placering: %1 - - - ClangCodeModel::Internal::ClangDiagnosticManager Inspect available fixits Inspicer tilgængelige fixits - - - ClangCodeModel::Internal::ClangProjectSettingsWidget Clang Code Model Clang-kodemodel @@ -4653,9 +4641,6 @@ Men brug af de afslappede og udvidet regler betyder også at der ikke kan levere Enable MSVC-compliant template parsing Aktivér MSVC-kompatibel skabelon-parsing - - - ClangCodeModel::Internal::ModelManagerSupport Clang Display name @@ -40296,14 +40281,7 @@ Spordataene er tabt. - ClangCodeModel::Internal::ClangCodeModelPlugin - - Clang Code Model - Clang-kodemodel - - - - ClangDiagnosticWidget + ::ClangCodeModel Clazy Issue Clazy-problemstilling diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 1ad645c7267..aa6a7169fb0 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -41357,7 +41357,7 @@ Are you sure? - ClangCodeModel::Internal::ClangCodeModelPlugin + ::ClangCodeModel Generating Compilation DB Erzeuge Kompilierungsdatenbank @@ -41382,9 +41382,6 @@ Are you sure? Generating Clang compilation database failed: %1 Erzeugen der Clang-Kompilierungsdatenbank fehlgeschlagen: %1 - - - ClangDiagnosticWidget Clazy Issue Clang-Problem @@ -41397,9 +41394,6 @@ Are you sure? [Source: %1] [Quelle: %1] - - - ::ClangCodeModel Component Komponente @@ -50904,7 +50898,7 @@ in "%2" aus. - ClangCodeModel::Internal::ClangdClient + ::ClangCodeModel clangd clangd @@ -50934,9 +50928,6 @@ in "%2" aus. <base declaration> <Basisdeklaration> - - - ClangCodeModel::Internal::ClangdFindReferences C++ Usages: C++ Referenzen: @@ -50954,9 +50945,6 @@ in "%2" aus. Dateien: %1 - - - ClangCodeModel::Internal::ClangModelManagerSupport The use of clangd for the C/C++ code model was disabled, because it is likely that its memory requirements would be higher than what your system can handle. Clangd wurde für das C/C++-Codemodell deaktiviert, da dessen Speicheranforderung wahrscheinlich die Leistungsfähigkeit Ihres Systems übersteigt. @@ -50975,9 +50963,6 @@ in "%2" aus. Kann Clangd nicht nutzen: Erstellen der Kompilierungsdatenbank fehlgeschlagen: %1 - - - ClangdTextMark Code Model Error Codemodell-Fehler diff --git a/share/qtcreator/translations/qtcreator_hr.ts b/share/qtcreator/translations/qtcreator_hr.ts index fdc5b41a3d6..c1660000aad 100644 --- a/share/qtcreator/translations/qtcreator_hr.ts +++ b/share/qtcreator/translations/qtcreator_hr.ts @@ -1718,7 +1718,7 @@ Na primjer, „Revizija: 15” će ostaviti granu na reviziji 15. - ClangCodeModel::Internal::ClangProjectSettingsWidget + ::ClangCodeModel Global Globalno @@ -15934,14 +15934,11 @@ Check the test environment. - ClangCodeModel::ClangAssistProposalItem + ::ClangCodeModel Requires changing "%1" to "%2" Zahtijeva mijenjanje "%1" u "%2" - - - ClangCodeModel::Internal::BackendCommunicator Clang Code Model: Error: The clangbackend executable "%1" does not exist. @@ -15954,13 +15951,6 @@ Check the test environment. Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted. - - - ClangCodeModel::Internal::ClangCodeModelPlugin - - Clang Code Model - - Generate Compilation Database @@ -15969,17 +15959,11 @@ Check the test environment. Generate Compilation Database for "%1" - - - ClangCodeModel::Internal::ClangCompletionAssistProcessor Location: %1 Parent folder for proposed #include completion Mjesto: %1 - - - ClangCodeModel::Internal::ClangDiagnosticManager Inspect available fixits @@ -15993,15 +15977,12 @@ Check the test environment. - ClangCodeModel::Internal::ModelManagerSupport + ::ClangCodeModel Clang Display name Clang - - - ::ClangCodeModel <No Symbols> <Bez simbola> @@ -16023,7 +16004,7 @@ Check the test environment. - Clang Code Model Marks + ::ClangCodeModel Code Model Warning Code Model upozorenje @@ -16032,9 +16013,6 @@ Check the test environment. Code Model Error Code Model greška - - - ClangDiagnosticWidget Clazy Issue Clazy problem diff --git a/share/qtcreator/translations/qtcreator_ja.ts b/share/qtcreator/translations/qtcreator_ja.ts index 1c84aa50809..aef4a159dd4 100644 --- a/share/qtcreator/translations/qtcreator_ja.ts +++ b/share/qtcreator/translations/qtcreator_ja.ts @@ -32208,15 +32208,12 @@ Qt バージョンオプションページで qmldump アプリケーション - ClangCodeModel::Internal::ClangCompletionAssistProcessor + ::ClangCodeModel Location: %1 Parent folder for proposed #include completion パス: %1 - - - ClangCodeModel::Internal::ModelManagerSupport Clang Display name @@ -34094,7 +34091,7 @@ Android 5 ではローカルの Qt ライブラリをデプロイできません - ClangCodeModel::Internal::ClangProjectSettingsWidget + ::ClangCodeModel Warnings 警告 @@ -42276,7 +42273,7 @@ Android パッケージソースディレクトリのファイルはビルドデ - ClangCodeModel::Internal::ClangDiagnosticManager + ::ClangCodeModel Inspect available fixits 利用可能な修正の確認 @@ -45186,14 +45183,11 @@ The name of the release build configuration created by default for a qmake proje - ClangCodeModel::ClangAssistProposalItem + ::ClangCodeModel Requires changing "%1" to "%2" "%1"を"%2 "に変更する必要があります - - - ClangCodeModel::Internal::BackendCommunicator Clang Code Model: Error: The clangbackend executable "%1" does not exist. Clang コードモデル: エラー: clangbackend の実行ファイル "%1" が存在しません。 @@ -45206,17 +45200,10 @@ The name of the release build configuration created by default for a qmake proje Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted. Clang コードモデル: エラー: clangbackend プロセスが予期せず終了し、再起動されました。 - - - ClangCodeModel::Internal::ClangCodeModelPlugin Generating Compilation DB コンパイル DB の生成 - - Clang Code Model - Clang コードモデル - Generate Compilation Database コンパイル DB の生成 @@ -45268,7 +45255,7 @@ The name of the release build configuration created by default for a qmake proje - Clang Code Model Marks + ::ClangCodeModel Code Model Warning コードモデルの警告 @@ -45298,7 +45285,7 @@ The name of the release build configuration created by default for a qmake proje - ClangDiagnosticWidget + ::ClangCodeModel Clazy Issue Clazy の問題 diff --git a/share/qtcreator/translations/qtcreator_pl.ts b/share/qtcreator/translations/qtcreator_pl.ts index ba269890a45..2a4689ab9d7 100644 --- a/share/qtcreator/translations/qtcreator_pl.ts +++ b/share/qtcreator/translations/qtcreator_pl.ts @@ -27356,23 +27356,17 @@ Zbuduj aplikację qmldump na stronie z opcjami wersji Qt. - ClangCodeModel::Internal::ClangCompletionAssistProcessor + ::ClangCodeModel Location: %1 Parent folder for proposed #include completion Położenie: %1 - - - ClangCodeModel::Internal::ModelManagerSupport Clang Display name Clang - - - ClangCodeModel::Internal::ClangProjectSettingsWidget Warnings Ostrzeżenia @@ -36832,7 +36826,7 @@ po naciśnięciu klawisza backspace - ClangCodeModel::Internal::ClangDiagnosticManager + ::ClangCodeModel Inspect available fixits @@ -37869,7 +37863,7 @@ Uwaga: podczas używania zwykłego formatu tekstowego może brakować niektóryc - ClangCodeModel::Internal::IpcCommunicator + ::ClangCodeModel Clang Code Model: Error: The clangbackend executable "%1" does not exist. Model kodu Clang: Błąd: Plik wykonywalny "%1" clangbackendu nie istnieje. @@ -37882,9 +37876,6 @@ Uwaga: podczas używania zwykłego formatu tekstowego może brakować niektóryc Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted. Model kodu Clang: Błąd: Proces clangbackend nieoczekiwanie zakończony i zrestartowany. - - - Clang Code Model Marks Code Model Warning Ostrzeżenie modelu kodu diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts index 56b735bf3f2..80a3db030eb 100644 --- a/share/qtcreator/translations/qtcreator_ru.ts +++ b/share/qtcreator/translations/qtcreator_ru.ts @@ -6318,7 +6318,7 @@ For example, "Revision: 15" will leave the branch at revision 15. - Clang Code Model Marks + ::ClangCodeModel Code Model Warning Предупреждение модели кода @@ -6327,9 +6327,6 @@ For example, "Revision: 15" will leave the branch at revision 15.Code Model Error Ошибка модели кода - - - ::ClangCodeModel <No Symbols> <Нет символов> @@ -6338,16 +6335,10 @@ For example, "Revision: 15" will leave the branch at revision 15.<Select Symbol> <Выберите символ> - - - ClangCodeModel::ClangAssistProposalItem Requires changing "%1" to "%2" Требует изменить «%1» на «%2» - - - ClangCodeModel::Internal::BackendCommunicator Clang Code Model: Error: The clangbackend executable "%1" does not exist. Модель кода Clang: Ошибка: Программа clangbackend «%1» отсутствует. @@ -6360,9 +6351,6 @@ For example, "Revision: 15" will leave the branch at revision 15.Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted. Модель кода Clang: Ошибка: Программа clangbackend неожиданно завершилась и была перезапущена. - - - ClangCodeModel::Internal::ClangCodeModelPlugin Generating Compilation DB Создание БД компиляции @@ -6387,28 +6375,15 @@ For example, "Revision: 15" will leave the branch at revision 15.Generating Clang compilation database failed: %1 Clang: не удалось создать БД компиляции: %1 - - - ClangCodeModel::Internal::ClangCompletionAssistProcessor Location: %1 Parent folder for proposed #include completion Находится в %1 - - - ClangCodeModel::Internal::ClangDiagnosticManager Inspect available fixits Проверить доступные запросы на исправление - - - ClangCodeModel::Internal::ClangProjectSettingsWidget - - Clang Code Model - Модель кода Clang - Parse templates in a MSVC-compliant way. This helps to parse headers for example from Active Template Library (ATL) or Windows Runtime Library (WRL). However, using the relaxed and extended rules means also that no highlighting/completion can be provided within template functions. @@ -6431,9 +6406,6 @@ However, using the relaxed and extended rules means also that no highlighting/co <a href="target">Open Global Settings</a> <a href="target">Открыть глобальные настройки</a> - - - ClangCodeModel::Internal::ModelManagerSupport Clang Display name @@ -6475,7 +6447,7 @@ However, using the relaxed and extended rules means also that no highlighting/co - ClangDiagnosticWidget + ::ClangCodeModel Clazy Issue Проблема Clazy diff --git a/share/qtcreator/translations/qtcreator_uk.ts b/share/qtcreator/translations/qtcreator_uk.ts index 3e569406bc6..3929cd8873b 100644 --- a/share/qtcreator/translations/qtcreator_uk.ts +++ b/share/qtcreator/translations/qtcreator_uk.ts @@ -35284,7 +35284,7 @@ For example, "Revision: 15" will leave the branch at revision 15. - ClangCodeModel::Internal::ClangProjectSettingsPropertiesPage + ::ClangCodeModel Pre-compiled headers: Попередньо скомпільовані заголовки: @@ -35721,15 +35721,12 @@ Please build the qmldump application on the Qt version options page. - ClangCodeModel::Internal::ClangCompletionAssistProcessor + ::ClangCodeModel Location: %1 Parent folder for proposed #include completion Розташування: %1 - - - ClangCodeModel::Internal::ClangIndexer C++ Indexing Індексування C++ @@ -35738,17 +35735,11 @@ Please build the qmldump application on the Qt version options page. Parsing C/C++/ObjC Files Розбір файлів C/C++/ObjC - - - ClangCodeModel::Internal::ModelManagerSupport Clang Display name Clang - - - ClangCodeModel::Internal::ClangProjectSettingsWidget Clang Settings Налаштування Clang @@ -35773,9 +35764,6 @@ Please build the qmldump application on the Qt version options page. Global setting (%1) Глобальні налаштування (%1) - - - ClangCodeModel::CompletionProposalsBuilder Is deprecated deprecated C++ symbol @@ -35789,9 +35777,6 @@ Please build the qmldump application on the Qt version options page. Signal of %1, returns %2 Сигнал %1, повертає %2 - - - ClangCodeModel::Diagnostic ignored проігноровано @@ -35812,9 +35797,6 @@ Please build the qmldump application on the Qt version options page. fatal фатальне - - - ClangCodeModel::Internal::PchManager Successfully generated PCH file "%1". Файл PCH "%1" було успішно створено. diff --git a/share/qtcreator/translations/qtcreator_zh_CN.ts b/share/qtcreator/translations/qtcreator_zh_CN.ts index e287cb18785..b61df2459c2 100644 --- a/share/qtcreator/translations/qtcreator_zh_CN.ts +++ b/share/qtcreator/translations/qtcreator_zh_CN.ts @@ -6829,9 +6829,6 @@ Make sure that CMAKE_BUILD_TYPE variable matches the "Build type" fiel Update 更新 - - - ClangCodeModel::Internal::ClangCodeModelPlugin Generating Compilation DB @@ -6856,9 +6853,6 @@ Make sure that CMAKE_BUILD_TYPE variable matches the "Build type" fiel Generating Clang compilation database failed: %1 - - - ClangCodeModel::Internal::ClangModelManagerSupport The use of clangd for the C/C++ code model was disabled, because it is likely that its memory requirements would be higher than what your system can handle. @@ -6876,9 +6870,6 @@ Make sure that CMAKE_BUILD_TYPE variable matches the "Build type" fiel %1 - - - ClangCodeModel::Internal::ClangProjectSettingsWidget Parse templates in a MSVC-compliant way. This helps to parse headers for example from Active Template Library (ATL) or Windows Runtime Library (WRL). However, using the relaxed and extended rules means also that no highlighting/completion can be provided within template functions. @@ -6888,9 +6879,6 @@ However, using the relaxed and extended rules means also that no highlighting/co Enable MSVC-compliant template parsing - - - ClangCodeModel::Internal::ClangdClient clangd @@ -6920,9 +6908,6 @@ However, using the relaxed and extended rules means also that no highlighting/co <base declaration> - - - ClangCodeModel::Internal::ClangdFindReferences C++ Usages: C++ 使用: @@ -6966,7 +6951,7 @@ However, using the relaxed and extended rules means also that no highlighting/co - ClangDiagnosticWidget + ::ClangCodeModel [Source: %1] @@ -7739,7 +7724,7 @@ Set a valid executable first. - ClangdTextMark + ::ClangCodeModel Code Model Error diff --git a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp index d55572f3b11..3bec0cd7494 100644 --- a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp +++ b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp @@ -3,6 +3,7 @@ #include "clangcodemodelplugin.h" +#include "clangcodemodeltr.h" #include "clangconstants.h" #include "clangmodelmanagersupport.h" #include "clangutils.h" @@ -38,6 +39,8 @@ #include #include +using namespace Core; +using namespace ProjectExplorer; using namespace Utils; namespace ClangCodeModel { @@ -47,7 +50,7 @@ void ClangCodeModelPlugin::generateCompilationDB() { using namespace CppEditor; - ProjectExplorer::Target *target = ProjectExplorer::SessionManager::startupTarget(); + Target *target = SessionManager::startupTarget(); if (!target) return; @@ -64,7 +67,7 @@ void ClangCodeModelPlugin::generateCompilationDB() warningsConfigForProject(target->project()), globalClangOptions(), FilePath()); - Core::ProgressManager::addTask(task, tr("Generating Compilation DB"), "generate compilation db"); + ProgressManager::addTask(task, Tr::tr("Generating Compilation DB"), "generate compilation db"); m_generatorWatcher.setFuture(task); } @@ -78,11 +81,11 @@ bool ClangCodeModelPlugin::initialize(const QStringList &arguments, QString *err Q_UNUSED(arguments) Q_UNUSED(errorMessage) - ProjectExplorer::TaskHub::addCategory(Constants::TASK_CATEGORY_DIAGNOSTICS, - tr("Clang Code Model")); + TaskHub::addCategory(Constants::TASK_CATEGORY_DIAGNOSTICS, + Tr::tr("Clang Code Model")); - connect(ProjectExplorer::ProjectExplorerPlugin::instance(), - &ProjectExplorer::ProjectExplorerPlugin::finishedInitialization, + connect(ProjectExplorerPlugin::instance(), + &ProjectExplorerPlugin::finishedInitialization, this, &ClangCodeModelPlugin::maybeHandleBatchFileAndExit); @@ -98,15 +101,15 @@ void ClangCodeModelPlugin::createCompilationDBAction() { // generate compile_commands.json m_generateCompilationDBAction = new ParameterAction( - tr("Generate Compilation Database"), - tr("Generate Compilation Database for \"%1\""), + Tr::tr("Generate Compilation Database"), + Tr::tr("Generate Compilation Database for \"%1\""), ParameterAction::AlwaysEnabled, this); - ProjectExplorer::Project *startupProject = ProjectExplorer::SessionManager::startupProject(); + Project *startupProject = SessionManager::startupProject(); if (startupProject) m_generateCompilationDBAction->setParameter(startupProject->displayName()); - Core::Command *command = Core::ActionManager::registerAction(m_generateCompilationDBAction, - Constants::GENERATE_COMPILATION_DB); - command->setAttribute(Core::Command::CA_UpdateText); + Command *command = ActionManager::registerAction(m_generateCompilationDBAction, + Constants::GENERATE_COMPILATION_DB); + command->setAttribute(Command::CA_UpdateText); command->setDescription(m_generateCompilationDBAction->text()); connect(&m_generatorWatcher, &QFutureWatcher::finished, @@ -114,60 +117,54 @@ void ClangCodeModelPlugin::createCompilationDBAction() const GenerateCompilationDbResult result = m_generatorWatcher.result(); QString message; if (result.error.isEmpty()) { - message = tr("Clang compilation database generated at \"%1\".") + message = Tr::tr("Clang compilation database generated at \"%1\".") .arg(QDir::toNativeSeparators(result.filePath)); } else { - message = tr("Generating Clang compilation database failed: %1").arg(result.error); + message = Tr::tr("Generating Clang compilation database failed: %1").arg(result.error); } - Core::MessageManager::writeFlashing(message); + MessageManager::writeFlashing(message); m_generateCompilationDBAction->setEnabled(true); }); connect(m_generateCompilationDBAction, &QAction::triggered, this, [this] { if (!m_generateCompilationDBAction->isEnabled()) { - Core::MessageManager::writeDisrupting("Cannot generate compilation database: " - "Generator is already running."); + MessageManager::writeDisrupting("Cannot generate compilation database: " + "Generator is already running."); return; } - ProjectExplorer::Project * const project - = ProjectExplorer::SessionManager::startupProject(); + Project * const project = SessionManager::startupProject(); if (!project) { - Core::MessageManager::writeDisrupting("Cannot generate compilation database: " - "No active project."); + MessageManager::writeDisrupting("Cannot generate compilation database: " + "No active project."); return; } const CppEditor::ProjectInfo::ConstPtr projectInfo = CppEditor::CppModelManager::instance() ->projectInfo(project); if (!projectInfo || projectInfo->projectParts().isEmpty()) { - Core::MessageManager::writeDisrupting("Cannot generate compilation database: " - "Project has no C/C++ project parts."); + MessageManager::writeDisrupting("Cannot generate compilation database: " + "Project has no C/C++ project parts."); return; } m_generateCompilationDBAction->setEnabled(false); generateCompilationDB(); }); connect(CppEditor::CppModelManager::instance(), &CppEditor::CppModelManager::projectPartsUpdated, - this, [this](ProjectExplorer::Project *project) { - if (project != ProjectExplorer::SessionManager::startupProject()) + this, [this](Project *project) { + if (project != SessionManager::startupProject()) return; m_generateCompilationDBAction->setParameter(project->displayName()); }); - connect(ProjectExplorer::SessionManager::instance(), - &ProjectExplorer::SessionManager::startupProjectChanged, - this, - [this](ProjectExplorer::Project *project) { + connect(SessionManager::instance(), &SessionManager::startupProjectChanged, + this, [this](Project *project) { m_generateCompilationDBAction->setParameter(project ? project->displayName() : ""); }); - connect(ProjectExplorer::SessionManager::instance(), - &ProjectExplorer::SessionManager::projectDisplayNameChanged, - this, - [this](ProjectExplorer::Project *project) { - if (project != ProjectExplorer::SessionManager::startupProject()) + connect(SessionManager::instance(), &SessionManager::projectDisplayNameChanged, + this, [this](Project *project) { + if (project != SessionManager::startupProject()) return; m_generateCompilationDBAction->setParameter(project->displayName()); }); - connect(ProjectExplorer::SessionManager::instance(), - &ProjectExplorer::SessionManager::projectAdded, this, - [this](ProjectExplorer::Project *project) { + connect(SessionManager::instance(), &SessionManager::projectAdded, + this, [this](Project *project) { project->registerGenerator(Constants::GENERATE_COMPILATION_DB, m_generateCompilationDBAction->text(), [this] { m_generateCompilationDBAction->trigger(); }); diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 886bd434366..4129a8ac30e 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -3,6 +3,7 @@ #include "clangdclient.h" +#include "clangcodemodeltr.h" #include "clangconstants.h" #include "clangdast.h" #include "clangdcompletion.h" @@ -359,7 +360,7 @@ static void addCompilationDb(QJsonObject &parentObject, const QJsonObject &cdb) ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir, const Id &id) : Client(clientInterface(project, jsonDbDir), id), d(new Private(this, project)) { - setName(tr("clangd")); + setName(Tr::tr("clangd")); LanguageFilter langFilter; langFilter.mimeTypes = QStringList{"text/x-chdr", "text/x-csrc", "text/x-c++hdr", "text/x-c++src", "text/x-objc++src", "text/x-objcsrc"}; @@ -415,8 +416,8 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir, c setLocatorsEnabled(false); setAutoRequestCodeActions(false); // clangd sends code actions inside diagnostics progressManager()->setTitleForToken(indexingToken(), - project ? tr("Indexing %1 with clangd").arg(project->displayName()) - : tr("Indexing session with clangd")); + project ? Tr::tr("Indexing %1 with clangd").arg(project->displayName()) + : Tr::tr("Indexing session with clangd")); progressManager()->setClickHandlerForToken(indexingToken(), [] { // don't directly open modal dialog from click handler, because that would mess // up the stack @@ -602,7 +603,7 @@ QTextCursor ClangdClient::adjustedCursorForHighlighting(const QTextCursor &curso const LanguageClient::Client::CustomInspectorTabs ClangdClient::createCustomInspectorTabs() { - return {{new ClangdMemoryUsageWidget(this), tr("Memory Usage")}}; + return {{new ClangdMemoryUsageWidget(this), Tr::tr("Memory Usage")}}; } class ClangdDiagnosticManager : public LanguageClient::DiagnosticManager diff --git a/src/plugins/clangcodemodel/clangdcompletion.cpp b/src/plugins/clangcodemodel/clangdcompletion.cpp index f5ae84c72dd..50a78c657d2 100644 --- a/src/plugins/clangcodemodel/clangdcompletion.cpp +++ b/src/plugins/clangcodemodel/clangdcompletion.cpp @@ -3,6 +3,7 @@ #include "clangdcompletion.h" +#include "clangcodemodeltr.h" #include "clangcompletioncontextanalyzer.h" #include "clangdclient.h" #include "clangpreprocessorassistproposalitem.h" @@ -18,12 +19,16 @@ #include #include #include + #include + #include + #include #include #include #include + #include using namespace CppEditor; @@ -35,10 +40,12 @@ using namespace TextEditor; using namespace Utils; namespace ClangCodeModel::Internal { + static Q_LOGGING_CATEGORY(clangdLogCompletion, "qtc.clangcodemodel.clangd.completion", QtWarningMsg); enum class CustomAssistMode { Doxygen, Preprocessor, IncludePath }; + class CustomAssistProcessor : public IAssistProcessor { public: @@ -532,7 +539,7 @@ QList CustomAssistProcessor::completeIncludePath( QList completions; QDirIterator i(realPath, QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); //: Parent folder for proposed #include completion - const QString hint = ClangdClient::tr("Location: %1") + const QString hint = Tr::tr("Location: %1") .arg(QDir::toNativeSeparators(QDir::cleanPath(realPath))); while (i.hasNext()) { const QString fileName = i.next(); diff --git a/src/plugins/clangcodemodel/clangdfindreferences.cpp b/src/plugins/clangcodemodel/clangdfindreferences.cpp index 707bfc8ad78..2458183164b 100644 --- a/src/plugins/clangcodemodel/clangdfindreferences.cpp +++ b/src/plugins/clangcodemodel/clangdfindreferences.cpp @@ -3,24 +3,29 @@ #include "clangdfindreferences.h" +#include "clangcodemodeltr.h" #include "clangdast.h" #include "clangdclient.h" #include #include #include + #include + #include #include #include + #include #include + #include #include #include #include + #include -#include #include #include @@ -119,7 +124,7 @@ ClangdFindReferences::ClangdFindReferences(ClangdClient *client, TextDocument *d } d->search = SearchResultWindow::instance()->startNewSearch( - tr("C++ Usages:"), + Tr::tr("C++ Usages:"), {}, searchTerm, replacement ? SearchResultWindow::SearchAndReplace : SearchResultWindow::SearchOnly, @@ -354,10 +359,10 @@ void ClangdFindReferences::Private::finishSearch() search->additionalReplaceWidget()); QTC_CHECK(renameCheckBox); const QSet files = replacementData->fileRenameCandidates; - renameCheckBox->setText(tr("Re&name %n files", nullptr, files.size())); + renameCheckBox->setText(Tr::tr("Re&name %n files", nullptr, files.size())); const QStringList filesForUser = Utils::transform(files, [](const Utils::FilePath &fp) { return fp.toUserOutput(); }); - renameCheckBox->setToolTip(tr("Files:\n%1").arg(filesForUser.join('\n'))); + renameCheckBox->setToolTip(Tr::tr("Files:\n%1").arg(filesForUser.join('\n'))); renameCheckBox->setVisible(true); search->setUserData(QVariant::fromValue(*replacementData)); } diff --git a/src/plugins/clangcodemodel/clangdfollowsymbol.cpp b/src/plugins/clangcodemodel/clangdfollowsymbol.cpp index 2d9c5578ab8..a34d02df21c 100644 --- a/src/plugins/clangcodemodel/clangdfollowsymbol.cpp +++ b/src/plugins/clangcodemodel/clangdfollowsymbol.cpp @@ -3,15 +3,18 @@ #include "clangdfollowsymbol.h" +#include "clangcodemodeltr.h" #include "clangdast.h" #include "clangdclient.h" #include #include #include + #include #include #include + #include #include #include @@ -26,6 +29,7 @@ using namespace TextEditor; using namespace Utils; namespace ClangCodeModel::Internal { + using SymbolData = QPair; using SymbolDataList = QList; @@ -318,7 +322,7 @@ ClangdFollowSymbol::VirtualFunctionAssistProcessor::createProposal(bool final) c items << createEntry({}, m_followSymbol->d->defLink); if (!final) { const auto infoItem = new VirtualFunctionProposalItem({}, false); - infoItem->setText(ClangdClient::tr("collecting overrides ...")); + infoItem->setText(Tr::tr("collecting overrides ...")); infoItem->setOrder(-1); items << infoItem; } @@ -336,7 +340,7 @@ ClangdFollowSymbol::VirtualFunctionAssistProcessor::createEntry(const QString &n if (link == m_followSymbol->d->defLink) { item->setOrder(1000); // Ensure base declaration is on top. if (text.isEmpty()) { - text = ClangdClient::tr(""); + text = Tr::tr(""); } else if (m_followSymbol->d->defLinkNode.isPureVirtualDeclaration() || m_followSymbol->d->defLinkNode.isPureVirtualDefinition()) { text += " = 0"; diff --git a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp index 659fb62fee6..b415eb23ef6 100644 --- a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp +++ b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp @@ -3,6 +3,7 @@ #include "clangdiagnostictooltipwidget.h" +#include "clangcodemodeltr.h" #include "clangfixitoperation.h" #include "clangutils.h" @@ -132,8 +133,7 @@ public: if (!source.isEmpty()) { text.append(QString::fromUtf8("" "%1") - .arg(QCoreApplication::translate("ClangDiagnosticWidget", - "[Source: %1]").arg(source))); + .arg(Tr::tr("[Source: %1]").arg(source))); } text.append(""); diff --git a/src/plugins/clangcodemodel/clangdlocatorfilters.cpp b/src/plugins/clangcodemodel/clangdlocatorfilters.cpp index ccebcee7275..d06920acc6a 100644 --- a/src/plugins/clangcodemodel/clangdlocatorfilters.cpp +++ b/src/plugins/clangcodemodel/clangdlocatorfilters.cpp @@ -199,7 +199,7 @@ ClangFunctionsFilter::ClangFunctionsFilter() : ClangGlobalSymbolFilter(new CppFunctionsFilter, new LspFunctionsFilter) { setId(CppEditor::Constants::FUNCTIONS_FILTER_ID); - setDisplayName(QCoreApplication::translate(":CppEditor", + setDisplayName(QCoreApplication::translate("::CppEditor", CppEditor::Constants::FUNCTIONS_FILTER_DISPLAY_NAME)); setDefaultShortcutString("m"); setDefaultIncludedByDefault(false); diff --git a/src/plugins/clangcodemodel/clangdmemoryusagewidget.cpp b/src/plugins/clangcodemodel/clangdmemoryusagewidget.cpp index 988b3bc8bdf..58c8c9e4056 100644 --- a/src/plugins/clangcodemodel/clangdmemoryusagewidget.cpp +++ b/src/plugins/clangcodemodel/clangdmemoryusagewidget.cpp @@ -3,9 +3,11 @@ #include "clangdmemoryusagewidget.h" +#include "clangcodemodeltr.h" #include "clangdclient.h" #include + #include #include @@ -52,7 +54,6 @@ private: class MemoryTreeItem : public TreeItem { - Q_DECLARE_TR_FUNCTIONS(ClangCodeModel) public: MemoryTreeItem(const QString &displayName, const MemoryTree &tree) : m_displayName(displayName), m_bytesUsed(tree.total()) @@ -102,8 +103,7 @@ class MemoryTreeModel : public BaseTreeModel public: MemoryTreeModel() { - setHeader({ClangdMemoryUsageWidget::tr("Component"), - ClangdMemoryUsageWidget::tr("Total Memory")}); + setHeader({Tr::tr("Component"), Tr::tr("Total Memory")}); } void update(const MemoryTree &tree) @@ -154,7 +154,7 @@ void ClangdMemoryUsageWidget::Private::setupUi() layout->addWidget(&view); QObject::connect(&view, &QWidget::customContextMenuRequested, q, [this](const QPoint &pos) { QMenu menu; - menu.addAction(tr("Update"), [this] { getMemoryTree(); }); + menu.addAction(Tr::tr("Update"), [this] { getMemoryTree(); }); menu.exec(view.mapToGlobal(pos)); }); } diff --git a/src/plugins/clangcodemodel/clangdmemoryusagewidget.h b/src/plugins/clangcodemodel/clangdmemoryusagewidget.h index a9a6bb9922b..cd0e93e8f50 100644 --- a/src/plugins/clangcodemodel/clangdmemoryusagewidget.h +++ b/src/plugins/clangcodemodel/clangdmemoryusagewidget.h @@ -3,15 +3,14 @@ #pragma once -#include #include namespace ClangCodeModel::Internal { + class ClangdClient; class ClangdMemoryUsageWidget : public QWidget { - Q_DECLARE_TR_FUNCTIONS(::ClangCodeModel) public: explicit ClangdMemoryUsageWidget(ClangdClient *client); ~ClangdMemoryUsageWidget(); @@ -20,5 +19,5 @@ public: Private * const d; }; -} // namespace ClangCodeModel::Internal +} // ClangCodeModel::Internal diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp index d916f7592b1..e9742195f8e 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp @@ -3,6 +3,7 @@ #include "clangmodelmanagersupport.h" +#include "clangcodemodeltr.h" #include "clangconstants.h" #include "clangdclient.h" #include "clangdquickfixes.h" @@ -54,8 +55,7 @@ using namespace CppEditor; using namespace LanguageClient; using namespace Utils; -namespace ClangCodeModel { -namespace Internal { +namespace ClangCodeModel::Internal { static CppEditor::CppModelManager *cppModelManager() { @@ -97,7 +97,7 @@ static const QList projectsForClient(const Client *c return projects; } -static bool fileIsProjectBuildArtifact(const Client *client, const Utils::FilePath &filePath) +static bool fileIsProjectBuildArtifact(const Client *client, const FilePath &filePath) { for (const ProjectExplorer::Project * const p : projectsForClient(client)) { if (const auto t = p->activeTarget()) { @@ -110,7 +110,7 @@ static bool fileIsProjectBuildArtifact(const Client *client, const Utils::FilePa return false; } -static Client *clientForGeneratedFile(const Utils::FilePath &filePath) +static Client *clientForGeneratedFile(const FilePath &filePath) { for (Client * const client : LanguageClientManager::clients()) { if (qobject_cast(client) && client->reachable() @@ -129,13 +129,13 @@ static void checkSystemForClangdSuitability() return; ClangdSettings::setUseClangdAndSave(false); - const QString warnStr = ClangModelManagerSupport::tr("The use of clangd for the C/C++ " + const QString warnStr = Tr::tr("The use of clangd for the C/C++ " "code model was disabled, because it is likely that its memory requirements " "would be higher than what your system can handle."); - const Utils::Id clangdWarningSetting("WarnAboutClangd"); - Utils::InfoBarEntry info(clangdWarningSetting, warnStr); + const Id clangdWarningSetting("WarnAboutClangd"); + InfoBarEntry info(clangdWarningSetting, warnStr); info.setDetailsWidgetCreator([] { - const auto label = new QLabel(ClangModelManagerSupport::tr( + const auto label = new QLabel(Tr::tr( "With clangd enabled, Qt Creator fully supports modern C++ " "when highlighting code, completing symbols and so on.
" "This comes at a higher cost in terms of CPU load and memory usage compared " @@ -148,7 +148,7 @@ static void checkSystemForClangdSuitability() }); return label; }); - info.addCustomButton(ClangModelManagerSupport::tr("Enable Anyway"), [clangdWarningSetting] { + info.addCustomButton(Tr::tr("Enable Anyway"), [clangdWarningSetting] { ClangdSettings::setUseClangdAndSave(true); Core::ICore::infoBar()->removeInfo(clangdWarningSetting); }); @@ -162,7 +162,7 @@ static void updateParserConfig(ClangdClient *client) if (const auto editor = TextEditor::BaseTextEditor::currentTextEditor()) { if (!client->documentOpen(editor->textDocument())) return; - const Utils::FilePath filePath = editor->textDocument()->filePath(); + const FilePath filePath = editor->textDocument()->filePath(); if (const auto processor = ClangEditorDocumentProcessor::get(filePath)) client->updateParserConfig(filePath, processor->parserConfig()); } @@ -257,7 +257,7 @@ ClangModelManagerSupport::~ClangModelManagerSupport() } void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &data, - const Utils::LinkHandler &processLinkCallback, bool resolveTarget, + const LinkHandler &processLinkCallback, bool resolveTarget, bool inNextSplit) { if (ClangdClient * const client = clientForFile(data.filePath()); @@ -272,7 +272,7 @@ void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &dat } void ClangModelManagerSupport::followSymbolToType(const CppEditor::CursorInEditor &data, - const Utils::LinkHandler &processLinkCallback, + const LinkHandler &processLinkCallback, bool inNextSplit) { if (ClangdClient * const client = clientForFile(data.filePath())) { @@ -285,7 +285,7 @@ void ClangModelManagerSupport::followSymbolToType(const CppEditor::CursorInEdito } void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &data, - const Utils::LinkHandler &processLinkCallback) + const LinkHandler &processLinkCallback) { if (ClangdClient * const client = clientForFile(data.filePath()); client && client->isFullyIndexed()) { @@ -352,8 +352,8 @@ void ClangModelManagerSupport::switchHeaderSource(const FilePath &filePath, bool CppModelManager::switchHeaderSource(inNextSplit, CppModelManager::Backend::Builtin); } -void ClangModelManagerSupport::checkUnused(const Utils::Link &link, Core::SearchResult *search, - const Utils::LinkHandler &callback) +void ClangModelManagerSupport::checkUnused(const Link &link, Core::SearchResult *search, + const LinkHandler &callback) { if (const ProjectExplorer::Project * const project = ProjectExplorer::SessionManager::projectForFile(link.targetFilePath)) { @@ -377,7 +377,7 @@ CppEditor::BaseEditorDocumentProcessor *ClangModelManagerSupport::createEditorDo TextEditor::TextDocument *baseTextDocument) { const auto processor = new ClangEditorDocumentProcessor(baseTextDocument); - const auto handleConfigChange = [](const Utils::FilePath &fp, + const auto handleConfigChange = [](const FilePath &fp, const BaseEditorDocumentParser::Configuration &config) { if (const auto client = clientForFile(fp)) client->updateParserConfig(fp, config); @@ -394,7 +394,7 @@ void ClangModelManagerSupport::onCurrentEditorChanged(Core::IEditor *editor) if (!editor || !editor->document() || !cppModelManager()->isCppEditor(editor)) return; - const ::Utils::FilePath filePath = editor->document()->filePath(); + const FilePath filePath = editor->document()->filePath(); if (auto processor = ClangEditorDocumentProcessor::get(filePath)) { processor->semanticRehighlight(); if (const auto client = clientForFile(filePath)) { @@ -413,11 +413,11 @@ void ClangModelManagerSupport::connectToWidgetsMarkContextMenuRequested(QWidget } } -static Utils::FilePath getJsonDbDir(const ProjectExplorer::Project *project) +static FilePath getJsonDbDir(const ProjectExplorer::Project *project) { static const QString dirName(".qtc_clangd"); if (!project) { - const QString sessionDirName = Utils::FileUtils::fileSystemFriendlyName( + const QString sessionDirName = FileUtils::fileSystemFriendlyName( ProjectExplorer::SessionManager::activeSession()); return Core::ICore::userResourcePath() / dirName / sessionDirName; // TODO: Make configurable? } @@ -427,12 +427,12 @@ static Utils::FilePath getJsonDbDir(const ProjectExplorer::Project *project) return bc->buildDirectory() / dirName; } } - return Utils::FilePath(); + return {}; } static bool isProjectDataUpToDate( ProjectExplorer::Project *project, ProjectInfoList projectInfo, - const Utils::FilePath &jsonDbDir) + const FilePath &jsonDbDir) { if (project && !ProjectExplorer::SessionManager::hasProject(project)) return false; @@ -478,7 +478,7 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr return; } - const Utils::FilePath jsonDbDir = getJsonDbDir(project); + const FilePath jsonDbDir = getJsonDbDir(project); if (jsonDbDir.isEmpty()) return; const auto generatorWatcher = new QFutureWatcher; @@ -490,7 +490,7 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr const GenerateCompilationDbResult result = generatorWatcher->result(); if (!result.error.isEmpty()) { Core::MessageManager::writeDisrupting( - tr("Cannot use clangd: Failed to generate compilation database:\n%1") + Tr::tr("Cannot use clangd: Failed to generate compilation database:\n%1") .arg(result.error)); return; } @@ -500,7 +500,7 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr LanguageClientManager::shutdownClient(oldClient); } ClangdClient * const client = new ClangdClient(project, jsonDbDir, previousId); - connect(client, &Client::shadowDocumentSwitched, this, [](const Utils::FilePath &fp) { + connect(client, &Client::shadowDocumentSwitched, this, [](const FilePath &fp) { ClangdClient::handleUiHeaderChange(fp.fileName()); }); connect(CppModelManager::instance(), @@ -588,7 +588,7 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr }); }); - const Utils::FilePath includeDir = settings.clangdIncludePath(); + const FilePath includeDir = settings.clangdIncludePath(); auto future = Utils::runAsync(&Internal::generateCompilationDB, projectInfo, jsonDbDir, CompilationDbPurpose::CodeModel, warningsConfigForProject(project), @@ -629,7 +629,7 @@ ClangdClient *ClangModelManagerSupport::clientWithProject(const ProjectExplorer: return clients.empty() ? nullptr : qobject_cast(clients.first()); } -ClangdClient *ClangModelManagerSupport::clientForFile(const Utils::FilePath &file) +ClangdClient *ClangModelManagerSupport::clientForFile(const FilePath &file) { return qobject_cast(LanguageClientManager::clientForFilePath(file)); } @@ -663,10 +663,10 @@ void ClangModelManagerSupport::claimNonProjectSources(ClangdClient *client) void ClangModelManagerSupport::watchForExternalChanges() { connect(Core::DocumentManager::instance(), &Core::DocumentManager::filesChangedExternally, - this, [this](const QSet &files) { + this, [this](const QSet &files) { if (!LanguageClientManager::hasClients()) return; - for (const Utils::FilePath &file : files) { + for (const FilePath &file : files) { const ProjectFile::Kind kind = ProjectFile::classify(file.toString()); if (!ProjectFile::isSource(kind) && !ProjectFile::isHeader(kind)) continue; @@ -691,8 +691,8 @@ void ClangModelManagerSupport::watchForExternalChanges() void ClangModelManagerSupport::watchForInternalChanges() { connect(Core::DocumentManager::instance(), &Core::DocumentManager::filesChangedInternally, - this, [this](const Utils::FilePaths &filePaths) { - for (const Utils::FilePath &fp : filePaths) { + this, [this](const FilePaths &filePaths) { + for (const FilePath &fp : filePaths) { const ProjectFile::Kind kind = ProjectFile::classify(fp.toString()); if (!ProjectFile::isSource(kind) && !ProjectFile::isHeader(kind)) continue; @@ -755,7 +755,7 @@ void ClangModelManagerSupport::onAbstractEditorSupportContentsUpdated(const QStr if (content.size() == 0) return; // Generation not yet finished. - const auto fp = Utils::FilePath::fromString(filePath); + const auto fp = FilePath::fromString(filePath); const QString stringContent = QString::fromUtf8(content); if (Client * const client = clientForGeneratedFile(fp)) { client->setShadowDocument(fp, stringContent); @@ -770,7 +770,7 @@ void ClangModelManagerSupport::onAbstractEditorSupportRemoved(const QString &fil { QTC_ASSERT(!filePath.isEmpty(), return); - const auto fp = Utils::FilePath::fromString(filePath); + const auto fp = FilePath::fromString(filePath); if (Client * const client = clientForGeneratedFile(fp)) { client->removeShadowDocument(fp); ClangdClient::handleUiHeaderChange(fp.fileName()); @@ -809,7 +809,7 @@ void ClangModelManagerSupport::onTextMarkContextMenuRequested(TextEditor::TextEd QTC_ASSERT(lineNumber >= 1, return); QTC_ASSERT(menu, return); - const Utils::FilePath filePath = widget->textDocument()->filePath(); + const FilePath filePath = widget->textDocument()->filePath(); ClangEditorDocumentProcessor *processor = ClangEditorDocumentProcessor::get(filePath); if (processor) { const auto assistInterface = createAssistInterface(widget, lineNumber); @@ -916,5 +916,4 @@ void ClangModelManagerSupport::reinitializeBackendDocuments(const QStringList &p } } -} // Internal -} // ClangCodeModel +} // ClangCodeModel::Internal diff --git a/src/plugins/clangcodemodel/clangtextmark.cpp b/src/plugins/clangcodemodel/clangtextmark.cpp index db653711af3..a8608458797 100644 --- a/src/plugins/clangcodemodel/clangtextmark.cpp +++ b/src/plugins/clangcodemodel/clangtextmark.cpp @@ -3,6 +3,7 @@ #include "clangtextmark.h" +#include "clangcodemodeltr.h" #include "clangconstants.h" #include "clangdclient.h" #include "clangdiagnostictooltipwidget.h" @@ -10,6 +11,7 @@ #include "clangutils.h" #include + #include #include #include @@ -283,7 +285,7 @@ ClangdTextMark::ClangdTextMark(const FilePath &filePath, const bool isError = diagnostic.severity() && *diagnostic.severity() == DiagnosticSeverity::Error; - setDefaultToolTip(isError ? tr("Code Model Error") : tr("Code Model Warning")); + setDefaultToolTip(isError ? Tr::tr("Code Model Error") : Tr::tr("Code Model Warning")); setPriority(isError ? TextEditor::TextMark::HighPriority : TextEditor::TextMark::NormalPriority); setIcon(isError ? Icons::CODEMODEL_ERROR.icon() : Icons::CODEMODEL_WARNING.icon()); @@ -299,7 +301,7 @@ ClangdTextMark::ClangdTextMark(const FilePath &filePath, QList actions; QAction *action = new QAction(); action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon())); - action->setToolTip(tr("Copy to Clipboard", "Clang Code Model Marks")); + action->setToolTip(Tr::tr("Copy to Clipboard", "Clang Code Model Marks")); QObject::connect(action, &QAction::triggered, [diag] { const QString text = ClangDiagnosticWidget::createText({diag}, ClangDiagnosticWidget::InfoBar); @@ -312,7 +314,7 @@ ClangdTextMark::ClangdTextMark(const FilePath &filePath, if (project && isDiagnosticConfigChangable(project, diag)) { action = new QAction(); action->setIcon(Icons::BROKEN.icon()); - action->setToolTip(tr("Disable Diagnostic in Current Project")); + action->setToolTip(Tr::tr("Disable Diagnostic in Current Project")); QObject::connect(action, &QAction::triggered, [diag] { disableDiagnosticInCurrentProjectConfig(diag); }); diff --git a/src/plugins/clangcodemodel/clangtextmark.h b/src/plugins/clangcodemodel/clangtextmark.h index 7d7f2ea3bb1..3f254789607 100644 --- a/src/plugins/clangcodemodel/clangtextmark.h +++ b/src/plugins/clangcodemodel/clangtextmark.h @@ -22,7 +22,6 @@ class ClangdClient; class ClangdTextMark : public TextEditor::TextMark { - Q_DECLARE_TR_FUNCTIONS(ClangdTextMark) public: ClangdTextMark(const ::Utils::FilePath &filePath, const LanguageServerProtocol::Diagnostic &diagnostic, diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp index 4f73c7b5524..f577cbed4b7 100644 --- a/src/plugins/clangcodemodel/clangutils.cpp +++ b/src/plugins/clangcodemodel/clangutils.cpp @@ -3,6 +3,8 @@ #include "clangutils.h" +#include "clangcodemodeltr.h" + #include #include #include @@ -239,9 +241,9 @@ QString DiagnosticTextInfo::category() const const int index = m_squareBracketStartIndex + 1; if (isClazyOption(m_text.mid(index))) - return QCoreApplication::translate("ClangDiagnosticWidget", "Clazy Issue"); + return Tr::tr("Clazy Issue"); else - return QCoreApplication::translate("ClangDiagnosticWidget", "Clang-Tidy Issue"); + return Tr::tr("Clang-Tidy Issue"); } bool DiagnosticTextInfo::isClazyOption(const QString &option)