From 57afbae5438d15741e29c8a0ffc19276a420478a Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 7 Feb 2022 17:21:02 +0100 Subject: [PATCH] CMakeProjectManager: Move some markup out of translated strings Eases the pain of translators. Change-Id: I7327958ee0628698ab326b3c8d6518d3330b83dd Reviewed-by: Eike Ziller Reviewed-by: --- .../cmakeprojectmanager/configmodel.cpp | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/configmodel.cpp b/src/plugins/cmakeprojectmanager/configmodel.cpp index 0e680ad56e3..73f6f1e2280 100644 --- a/src/plugins/cmakeprojectmanager/configmodel.cpp +++ b/src/plugins/cmakeprojectmanager/configmodel.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include @@ -602,7 +601,7 @@ QVariant ConfigModelTreeItem::data(int column, int role) const case Qt::DisplayRole: if (column == 0) return dataItem->key.isEmpty() - ? QCoreApplication::translate("CMakeProjectManager::ConfigModel", "") + ? ConfigModel::tr("") : dataItem->key; return value; case Qt::EditRole: @@ -688,33 +687,28 @@ QString ConfigModelTreeItem::toolTip() const if (!dataItem->description.isEmpty()) tooltip << dataItem->description; + const QString pattern = "

%1 %2

"; if (dataItem->isInitial) { if (!dataItem->kitValue.isEmpty()) - tooltip << QCoreApplication::translate("CMakeProjectManager", "

Kit: %1

") - .arg(dataItem->kitValue); + tooltip << pattern.arg(ConfigModel::tr("Kit:")).arg(dataItem->kitValue); - tooltip << QCoreApplication::translate("CMakeProjectManager", - "

Initial Configuration: %1

") - .arg(dataItem->currentValue()); + tooltip << pattern.arg(ConfigModel::tr("Initial Configuration:")).arg(dataItem->currentValue()); } else { - if (!dataItem->initialValue.isEmpty()) - tooltip << QCoreApplication::translate("CMakeProjectManager", - "

Initial Configuration: %1

") - .arg(dataItem->initialValue); + if (!dataItem->initialValue.isEmpty()) { + tooltip << pattern.arg(ConfigModel::tr("Initial Configuration:")) + .arg(dataItem->initialValue); + } if (dataItem->inCMakeCache) { - tooltip << QCoreApplication::translate("CMakeProjectManager", - "

Current Configuration: %1

") - .arg(dataItem->currentValue()); + tooltip << pattern.arg(ConfigModel::tr("Current Configuration:")) + .arg(dataItem->currentValue()); } else { - tooltip << QCoreApplication::translate("CMakeProjectManager", - "

Not in CMakeCache.txt

"); + tooltip << pattern.arg(ConfigModel::tr("Not in CMakeCache.txt")).arg(QString()); } } - tooltip << QCoreApplication::translate("CMakeProjectManager", - "

Type: %1

") - .arg(dataItem->typeDisplay()); - return tooltip.join(""); + tooltip << pattern.arg(ConfigModel::tr("Type:")).arg(dataItem->typeDisplay()); + + return tooltip.join(QString()); } QString ConfigModelTreeItem::currentValue() const