MCPcopy Create free account
hub / github.com/baldurk/renderdoc / ImportCapture

Method ImportCapture

qrenderdoc/Code/CaptureContext.cpp:1479–1529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1477}
1478
1479bool CaptureContext::ImportCapture(const CaptureFileFormat &fmt, const rdcstr &importfile,
1480 const rdcstr &rdcfile)
1481{
1482 CloseCapture();
1483
1484 QString ext = fmt.extension;
1485
1486 ResultDetails result;
1487
1488 // shorten the filename after here for error messages
1489 QString filename = QFileInfo(importfile).fileName();
1490
1491 float progress = 0.0f;
1492
1493 LambdaThread *th = new LambdaThread([rdcfile, importfile, ext, &progress, &result]() {
1494 ICaptureFile *file = RENDERDOC_OpenCaptureFile();
1495
1496 result = file->OpenFile(importfile, ext.toUtf8().data(),
1497 [&progress](float p) { progress = p * 0.5f; });
1498
1499 if(result.code != ResultCode::Succeeded)
1500 {
1501 file->Shutdown();
1502 return;
1503 }
1504
1505 result =
1506 file->Convert(rdcfile, "rdc", NULL, [&progress](float p) { progress = 0.5f + p * 0.5f; });
1507 file->Shutdown();
1508 });
1509 th->setName(lit("ImportCapture"));
1510 th->start();
1511 // wait a few ms before popping up a progress bar
1512 th->wait(500);
1513 if(th->isRunning())
1514 {
1515 ShowProgressDialog(
1516 m_MainWindow, tr("Importing from %1, please wait...").arg(filename),
1517 [th]() { return !th->isRunning(); }, [&progress]() { return progress; });
1518 }
1519 th->deleteLater();
1520
1521 if(!result.OK())
1522 {
1523 RDDialog::critical(m_MainWindow, tr("Error converting capture"),
1524 tr("Couldn't convert file '%1'\n%2").arg(filename).arg(result.Message()));
1525 return false;
1526 }
1527
1528 return true;
1529}
1530
1531void CaptureContext::ExportCapture(const CaptureFileFormat &fmt, const rdcstr &exportfile)
1532{

Callers

nothing calls this directly

Calls 15

ShowProgressDialogFunction · 0.85
criticalFunction · 0.85
fileNameMethod · 0.80
OpenFileMethod · 0.80
toUtf8Method · 0.80
ConvertMethod · 0.80
trFunction · 0.70
QFileInfoClass · 0.50
dataMethod · 0.45
ShutdownMethod · 0.45
setNameMethod · 0.45

Tested by

no test coverage detected