| 288 | } |
| 289 | |
| 290 | void cacheDocument(const QWidget *widget) |
| 291 | { |
| 292 | if(!ctxptr) |
| 293 | ctxptr = getCaptureContext(widget); |
| 294 | |
| 295 | if(!ctxptr) |
| 296 | return; |
| 297 | |
| 298 | ICaptureContext &ctx = *(ICaptureContext *)ctxptr; |
| 299 | |
| 300 | int refCache = ctx.ResourceNameCacheID(); |
| 301 | |
| 302 | if(cacheId == refCache && textCacheId == refCache) |
| 303 | return; |
| 304 | |
| 305 | cacheId = refCache; |
| 306 | textCacheId = refCache; |
| 307 | |
| 308 | // use a table to ensure images don't screw up the baseline for text. DON'T JUDGE ME. |
| 309 | QString html = lit("<table><tr>"); |
| 310 | |
| 311 | int i = 0; |
| 312 | |
| 313 | bool highdpi = widget && widget->devicePixelRatioF() > 1.0; |
| 314 | |
| 315 | QVector<int> fragmentIndexFromBlockIndex; |
| 316 | |
| 317 | // there's an empty block at the start. |
| 318 | fragmentIndexFromBlockIndex.push_back(-1); |
| 319 | |
| 320 | text.clear(); |
| 321 | |
| 322 | numLines = 1; |
| 323 | |
| 324 | for(const QVariant &v : fragments) |
| 325 | { |
| 326 | if(v.userType() == qMetaTypeId<ResourceId>()) |
| 327 | { |
| 328 | QString resname = GetTruncatedResourceName(ctx, v.value<ResourceId>()).toHtmlEscaped(); |
| 329 | html += lit("<td valign=\"middle\" style=\"line-height: 14px\"><b>%1</b></td>" |
| 330 | "<td valign=\"middle\" style=\"line-height: 14px\">" |
| 331 | "<img width=\"16\" src=':/link%3.png'></td>") |
| 332 | .arg(resname) |
| 333 | .arg(highdpi ? lit("@2x") : QString()); |
| 334 | text += resname; |
| 335 | |
| 336 | // these generate two blocks (one for each cell) |
| 337 | fragmentIndexFromBlockIndex.push_back(i); |
| 338 | fragmentIndexFromBlockIndex.push_back(i); |
| 339 | } |
| 340 | else if(v.userType() == qMetaTypeId<ShaderMessageLink>()) |
| 341 | { |
| 342 | ShaderMessageLink link = v.value<ShaderMessageLink>(); |
| 343 | |
| 344 | QString msgstr = |
| 345 | QApplication::translate("qrenderdoc", "%n msg(s)", "Shader messages", link.numMessages); |
| 346 | |
| 347 | html += lit("<td valign=\"middle\" style=\"line-height: 14px\">" |
no test coverage detected