Fix lupdate issues

- missing Q_DECLARE_TR_FUNCTIONS
- some full qualifications needed for confused lupdate
- avoid breaking some translations from former TaskListPlugin,
  VcsCommand and highlighter settings refactoring

Change-Id: Ia3b34095512a7bad6903f0aff6095313ee39e3e4
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2022-10-14 14:52:54 +02:00
parent ec430787e5
commit 8db0d3b0ff
11 changed files with 17 additions and 10 deletions

View File

@@ -5,6 +5,7 @@
#include "utils_global.h" #include "utils_global.h"
#include <QCoreApplication>
#include <QToolButton> #include <QToolButton>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@@ -44,6 +45,7 @@ public:
class QTCREATOR_UTILS_EXPORT DetailsButton : public ExpandButton class QTCREATOR_UTILS_EXPORT DetailsButton : public ExpandButton
{ {
Q_DECLARE_TR_FUNCTIONS(Utils::DetailsButton);
public: public:
DetailsButton(QWidget *parent = nullptr); DetailsButton(QWidget *parent = nullptr);
QSize sizeHint() const override; QSize sizeHint() const override;

View File

@@ -161,7 +161,8 @@ private:
QAction *m_clear = nullptr; QAction *m_clear = nullptr;
QAction *m_expandCollapse = nullptr; QAction *m_expandCollapse = nullptr;
Utils::Perspective m_perspective{ClangTidyClazyPerspectiveId, tr("Clang-Tidy and Clazy")}; Utils::Perspective m_perspective{ClangTidyClazyPerspectiveId,
::ClangTools::Internal::ClangTool::tr("Clang-Tidy and Clazy")};
private: private:
const QString m_name; const QString m_name;

View File

@@ -39,7 +39,8 @@ public:
CppcheckOptionsPage options; CppcheckOptionsPage options;
DiagnosticsModel manualRunModel; DiagnosticsModel manualRunModel;
CppcheckTool manualRunTool; CppcheckTool manualRunTool;
Utils::Perspective perspective{Constants::PERSPECTIVE_ID, CppcheckPlugin::tr("Cppcheck")}; Utils::Perspective perspective{Constants::PERSPECTIVE_ID,
::Cppcheck::Internal::CppcheckPlugin::tr("Cppcheck")};
QAction *manualRunAction; QAction *manualRunAction;
void startManualRun(); void startManualRun();

View File

@@ -46,7 +46,7 @@ private:
void toggleThreadRestriction(QAction *action); void toggleThreadRestriction(QAction *action);
Utils::Perspective m_perspective{Constants::CtfVisualizerPerspectiveId, Utils::Perspective m_perspective{Constants::CtfVisualizerPerspectiveId,
Tr::tr("Chrome Trace Format Visualizer")}; ::CtfVisualizer::Tr::tr("Chrome Trace Format Visualizer")};
bool m_isLoading; bool m_isLoading;
QScopedPointer<QAction> m_loadJson; QScopedPointer<QAction> m_loadJson;

View File

@@ -14,7 +14,8 @@ class MesonActionsManager : public QObject
{ {
Q_OBJECT Q_OBJECT
Utils::ParameterAction buildTargetContextAction{ Utils::ParameterAction buildTargetContextAction{
Tr::tr("Build"), Tr::tr("Build \"%1\""), ::MesonProjectManager::Tr::tr("Build"),
::MesonProjectManager::Tr::tr("Build \"%1\""),
Utils::ParameterAction::AlwaysEnabled /*handled manually*/ Utils::ParameterAction::AlwaysEnabled /*handled manually*/
}; };
QAction configureActionMenu; QAction configureActionMenu;

View File

@@ -79,7 +79,7 @@ private:
void finalize(); void finalize();
Utils::Perspective m_perspective{Constants::PerfProfilerPerspectiveId, Utils::Perspective m_perspective{Constants::PerfProfilerPerspectiveId,
Tr::tr("Performance Analyzer")}; ::PerfProfiler::Tr::tr("Performance Analyzer")};
QAction *m_startAction = nullptr; QAction *m_startAction = nullptr;
QAction *m_stopAction = nullptr; QAction *m_stopAction = nullptr;

View File

@@ -2239,7 +2239,7 @@ void ProjectExplorerPlugin::extensionsInitialized()
BuildManager::extensionsInitialized(); BuildManager::extensionsInitialized();
TaskHub::addCategory(Constants::TASK_CATEGORY_SANITIZER, TaskHub::addCategory(Constants::TASK_CATEGORY_SANITIZER,
tr("Sanitizer", "Category for sanitizer issues listed under 'Issues'")); tr("Sanitizer", "Category for sanitizer issues listed under 'Issues'"));
TaskHub::addCategory(Constants::TASK_CATEGORY_TASKLIST_ID, tr("My Tasks")); TaskHub::addCategory(Constants::TASK_CATEGORY_TASKLIST_ID, TaskFile::tr("My Tasks"));
SshSettings::loadSettings(Core::ICore::settings()); SshSettings::loadSettings(Core::ICore::settings());
const auto searchPathRetriever = [] { const auto searchPathRetriever = [] {

View File

@@ -104,8 +104,8 @@ static bool parseTaskFile(QString *errorString, const FilePath &name)
{ {
QFile tf(name.toString()); QFile tf(name.toString());
if (!tf.open(QIODevice::ReadOnly)) { if (!tf.open(QIODevice::ReadOnly)) {
*errorString = ProjectExplorerPlugin::tr("Cannot open task file %1: %2").arg( *errorString = TaskFile::tr("Cannot open task file %1: %2")
name.toUserOutput(), tf.errorString()); .arg(name.toUserOutput(), tf.errorString());
return false; return false;
} }

View File

@@ -20,6 +20,7 @@ public:
class TaskFile : public Core::IDocument class TaskFile : public Core::IDocument
{ {
Q_DECLARE_TR_FUNCTIONS(TaskList::Internal::TaskListPlugin)
public: public:
TaskFile(QObject *parent); TaskFile(QObject *parent);

View File

@@ -28,6 +28,7 @@ namespace Internal {
class HighlighterSettingsPageWidget : public QWidget class HighlighterSettingsPageWidget : public QWidget
{ {
Q_DECLARE_TR_FUNCTIONS(TextEditor::Internal::HighlighterSettingsPage)
public: public:
QLabel *definitionsInfolabel; QLabel *definitionsInfolabel;
QPushButton *downloadDefinitions; QPushButton *downloadDefinitions;

View File

@@ -94,13 +94,13 @@ QString VcsCommandPrivate::displayName() const
if (!m_displayName.isEmpty()) if (!m_displayName.isEmpty())
return m_displayName; return m_displayName;
if (m_jobs.isEmpty()) if (m_jobs.isEmpty())
return tr("Unknown"); return VcsCommand::tr("UNKNOWN");
const Job &job = m_jobs.at(0); const Job &job = m_jobs.at(0);
QString result = job.command.executable().baseName(); QString result = job.command.executable().baseName();
if (!result.isEmpty()) if (!result.isEmpty())
result[0] = result.at(0).toTitleCase(); result[0] = result.at(0).toTitleCase();
else else
result = tr("UNKNOWN"); result = VcsCommand::tr("UNKNOWN");
if (!job.command.arguments().isEmpty()) if (!job.command.arguments().isEmpty())
result += ' ' + job.command.splitArguments().at(0); result += ' ' + job.command.splitArguments().at(0);
return result; return result;