forked from qt-creator/qt-creator
Use QString::toHtmlEscaped() for GUI text
Otherwise diagnostics mentioning the '<<' operator might be interpreted strangely. Task-number: QCE-21 Change-Id: Ifc55335a6639020c143edd5f8b02158f8c8ab651 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -58,19 +58,20 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic)
|
|||||||
if (!diagnostic.category.isEmpty()) {
|
if (!diagnostic.category.isEmpty()) {
|
||||||
lines << qMakePair(
|
lines << qMakePair(
|
||||||
QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Category:"),
|
QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Category:"),
|
||||||
diagnostic.category);
|
diagnostic.category.toHtmlEscaped());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!diagnostic.type.isEmpty()) {
|
if (!diagnostic.type.isEmpty()) {
|
||||||
lines << qMakePair(
|
lines << qMakePair(
|
||||||
QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Type:"),
|
QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Type:"),
|
||||||
diagnostic.type);
|
diagnostic.type.toHtmlEscaped());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!diagnostic.issueContext.isEmpty() && !diagnostic.issueContextKind.isEmpty()) {
|
if (!diagnostic.issueContext.isEmpty() && !diagnostic.issueContextKind.isEmpty()) {
|
||||||
lines << qMakePair(
|
lines << qMakePair(
|
||||||
QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Context:"),
|
QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Context:"),
|
||||||
diagnostic.issueContextKind + QLatin1Char(' ') + diagnostic.issueContext);
|
diagnostic.issueContextKind.toHtmlEscaped() + QLatin1Char(' ')
|
||||||
|
+ diagnostic.issueContext.toHtmlEscaped());
|
||||||
}
|
}
|
||||||
|
|
||||||
lines << qMakePair(
|
lines << qMakePair(
|
||||||
|
@@ -63,7 +63,9 @@ QString createSummaryText(const ClangStaticAnalyzer::Internal::Diagnostic &diagn
|
|||||||
const QString location = fileName + QLatin1Char(' ')
|
const QString location = fileName + QLatin1Char(' ')
|
||||||
+ QString::number(diagnostic.location.line);
|
+ QString::number(diagnostic.location.line);
|
||||||
return QString::fromLatin1("%1 <span %3>%2</span>")
|
return QString::fromLatin1("%1 <span %3>%2</span>")
|
||||||
.arg(diagnostic.description, location, linkStyle);
|
.arg(diagnostic.description.toHtmlEscaped(),
|
||||||
|
location,
|
||||||
|
linkStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
QLabel *createSummaryLabel(const ClangStaticAnalyzer::Internal::Diagnostic &diagnostic)
|
QLabel *createSummaryLabel(const ClangStaticAnalyzer::Internal::Diagnostic &diagnostic)
|
||||||
@@ -136,12 +138,12 @@ QString createExplainingStepToolTipString(const ClangStaticAnalyzer::Internal::E
|
|||||||
if (!step.message.isEmpty()) {
|
if (!step.message.isEmpty()) {
|
||||||
lines << qMakePair(
|
lines << qMakePair(
|
||||||
QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Message:"),
|
QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Message:"),
|
||||||
step.message);
|
step.message.toHtmlEscaped());
|
||||||
}
|
}
|
||||||
if (!step.extendedMessage.isEmpty()) {
|
if (!step.extendedMessage.isEmpty()) {
|
||||||
lines << qMakePair(
|
lines << qMakePair(
|
||||||
QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Extended Message:"),
|
QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Extended Message:"),
|
||||||
step.extendedMessage);
|
step.extendedMessage.toHtmlEscaped());
|
||||||
}
|
}
|
||||||
|
|
||||||
lines << qMakePair(
|
lines << qMakePair(
|
||||||
@@ -170,7 +172,9 @@ QString createExplainingStepString(
|
|||||||
{
|
{
|
||||||
return createExplainingStepNumberString(number, withMarkup)
|
return createExplainingStepNumberString(number, withMarkup)
|
||||||
+ QLatin1Char(' ')
|
+ QLatin1Char(' ')
|
||||||
+ explainingStep.extendedMessage
|
+ (withMarkup
|
||||||
|
? explainingStep.extendedMessage.toHtmlEscaped()
|
||||||
|
: explainingStep.extendedMessage)
|
||||||
+ QLatin1Char(' ')
|
+ QLatin1Char(' ')
|
||||||
+ createLocationString(explainingStep.location, withMarkup, withAbsolutePath);
|
+ createLocationString(explainingStep.location, withMarkup, withAbsolutePath);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user