mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-22 21:55:52 +00:00
Ensure formatting tags aren't exported/put on the clipboard. Refs #2382
* When we're formatting text we want just the plain text version to be used.
This commit is contained in:
@@ -189,6 +189,8 @@ struct ShaderMessageLink
|
||||
|
||||
Q_DECLARE_METATYPE(ShaderMessageLink);
|
||||
|
||||
static QRegularExpression htmlRE(lit("<[^>]*>"));
|
||||
|
||||
// this is an opaque struct that contains the data to render, hit-test, etc for some text that
|
||||
// contains links to resources. It will update and cache the names of the resources.
|
||||
struct RichResourceText
|
||||
@@ -242,9 +244,24 @@ struct RichResourceText
|
||||
{
|
||||
text += lit("EID @%1").arg(v.toUInt());
|
||||
}
|
||||
else if(v.userType() == qMetaTypeId<ShaderMessageLink>())
|
||||
{
|
||||
ShaderMessageLink link = v.value<ShaderMessageLink>();
|
||||
|
||||
text +=
|
||||
QApplication::translate("qrenderdoc", "%n msg(s)", "Shader messages", link.numMessages);
|
||||
}
|
||||
else
|
||||
{
|
||||
text += v.toString();
|
||||
if(forcehtml)
|
||||
{
|
||||
// strip html tags and convert any html entities
|
||||
text += QUrl::fromPercentEncoding(v.toString().replace(htmlRE, QString()).toLatin1());
|
||||
}
|
||||
else
|
||||
{
|
||||
text += v.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -340,7 +357,15 @@ struct RichResourceText
|
||||
lit("\n"),
|
||||
lit("</td></tr></table><table><tr><td valign=\"middle\" style=\"line-height: 14px\">"));
|
||||
|
||||
text += v.toString();
|
||||
if(forcehtml)
|
||||
{
|
||||
text += QUrl::fromPercentEncoding(v.toString().replace(htmlRE, QString()).toLatin1());
|
||||
}
|
||||
else
|
||||
{
|
||||
text += v.toString();
|
||||
}
|
||||
|
||||
html += lit("<td valign=\"middle\" style=\"line-height: 14px\">%1</td>").arg(htmlfrag);
|
||||
|
||||
numLines += newlines;
|
||||
|
||||
@@ -1162,6 +1162,8 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
bool forceHTML = false;
|
||||
|
||||
if(name.isEmpty())
|
||||
{
|
||||
for(const APIEvent &e : action->events)
|
||||
@@ -1218,10 +1220,7 @@ private:
|
||||
if(name.isEmpty())
|
||||
qCritical() << "Couldn't find APIEvent for" << eid;
|
||||
|
||||
// force html even for events that don't reference resources etc, to get the italics for
|
||||
// parameters
|
||||
if(m_ShowParameterNames)
|
||||
name = lit("<rdhtml>") + name + lit("</rdhtml>");
|
||||
forceHTML = m_ShowParameterNames;
|
||||
}
|
||||
|
||||
if(m_MessageCounts.contains(eid))
|
||||
@@ -1231,6 +1230,11 @@ private:
|
||||
name += lit(" __rd_msgs::%1:%2").arg(eid).arg(count);
|
||||
}
|
||||
|
||||
// force html even for events that don't reference resources etc, to get the italics for
|
||||
// parameters
|
||||
if(forceHTML)
|
||||
name = lit("<rdhtml>") + name + lit("</rdhtml>");
|
||||
|
||||
QVariant v = name;
|
||||
|
||||
RichResourceTextInitialise(v, &m_Ctx);
|
||||
|
||||
Reference in New Issue
Block a user