Stringify ResourceIds consistently as "ResourceId::12345"

* This means even strings generated in the core code will become
  richtext in the UI.
This commit is contained in:
baldurk
2018-02-13 21:10:01 +00:00
parent cdf72a8963
commit 8368f9b8be
4 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -1001,9 +1001,9 @@ void CaptureContext::LoadRenames(const QString &data)
{
ResourceId id;
if(str.startsWith(lit("resourceid::")))
if(str.startsWith(lit("ResourceId::")))
{
qulonglong num = str.mid(sizeof("resourceid::") - 1).toULongLong();
qulonglong num = str.mid(sizeof("ResourceId::") - 1).toULongLong();
memcpy(&id, &num, sizeof(num));
}
else
+2 -2
View File
@@ -64,7 +64,7 @@ std::string DoStringise(const ResourceId &el)
{
uint64_t num;
memcpy(&num, &el, sizeof(num));
return lit("resourceid::%1").arg(num).toStdString();
return lit("ResourceId::%1").arg(num).toStdString();
}
struct RichResourceText
@@ -180,7 +180,7 @@ void RegisterMetatypeConversions()
void RichResourceTextInitialise(QVariant &var)
{
static QRegularExpression re(lit("(resourceid::)([0-9]*)"));
static QRegularExpression re(lit("(ResourceId::)([0-9]*)"));
if(var.userType() == qMetaTypeId<ResourceId>() || re.match(var.toString()).hasMatch())
{
+1 -1
View File
@@ -45,7 +45,7 @@ std::string DoStringise(const ResourceId &el)
{
RDCCOMPILE_ASSERT(sizeof(el) == sizeof(uint64_t), "ResourceId is no longer 1:1 with uint64_t");
return StringFormat::Fmt("ResourceId(%llu)", el);
return StringFormat::Fmt("ResourceId::%llu", el);
}
BASIC_TYPE_SERIALISE_STRINGIFY(ResourceId, (uint64_t &)el, SDBasic::UnsignedInteger, 8);
@@ -3762,7 +3762,7 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in
buf->AddChild(makeSDObject("Offset", offs));
buf->data.children[0]->type.flags |= SDTypeFlags::HasCustomString;
buf->data.children[0]->data.str = ToStr(id);
buf->data.children[0]->data.str = ToStr(GetResourceManager()->GetOriginalID(id));
command->AddChild(buf);
}
@@ -3811,7 +3811,7 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in
buf->AddChild(makeSDObject("Offset", offs));
buf->data.children[0]->type.flags |= SDTypeFlags::HasCustomString;
buf->data.children[0]->data.str = ToStr(id);
buf->data.children[0]->data.str = ToStr(GetResourceManager()->GetOriginalID(id));
command->AddChild(buf);
}
@@ -3867,7 +3867,7 @@ void WrappedID3D12GraphicsCommandList::PatchExecuteIndirect(BakedCmdListInfo &in
buf->AddChild(makeSDObject("Offset", offs));
buf->data.children[0]->type.flags |= SDTypeFlags::HasCustomString;
buf->data.children[0]->data.str = ToStr(id);
buf->data.children[0]->data.str = ToStr(GetResourceManager()->GetOriginalID(id));
fakeChunk->AddChild(buf);
}